| 3 | #include "dxRenderDeviceRender.h" |
| 4 | |
| 5 | void uber_deffer(CBlender_Compile& C, bool hq, LPCSTR _vspec, LPCSTR _pspec, BOOL _aref, LPCSTR _detail_replace, bool DO_NOT_FINISH) |
| 6 | { |
| 7 | // Uber-parse |
| 8 | string256 fname, fnameA, fnameB; |
| 9 | xr_strcpy(fname, *C.L_textures[0]); //. andy if (strext(fname)) *strext(fname)=0; |
| 10 | fix_texture_name(fname); |
| 11 | ref_texture _t; |
| 12 | _t.create(fname); |
| 13 | const bool bump = _t.bump_exist(); |
| 14 | |
| 15 | // detect lmap |
| 16 | bool lmap = true; |
| 17 | if (C.L_textures.size() < 3) |
| 18 | lmap = false; |
| 19 | else |
| 20 | { |
| 21 | const pcstr tex = C.L_textures[2].c_str(); |
| 22 | if (tex[0] == 'l' && tex[1] == 'm' && tex[2] == 'a' && tex[3] == 'p') |
| 23 | lmap = true; |
| 24 | else |
| 25 | lmap = false; |
| 26 | } |
| 27 | |
| 28 | string256 ps, vs, dt; |
| 29 | strconcat(sizeof(vs), vs, "deffer_", _vspec, lmap ? "_lmh" : ""); |
| 30 | strconcat(sizeof(ps), ps, "deffer_", _pspec, lmap ? "_lmh" : ""); |
| 31 | xr_strcpy(dt, sizeof(dt), _detail_replace ? _detail_replace : (C.detail_texture ? C.detail_texture : "")); |
| 32 | |
| 33 | // detect detail bump |
| 34 | string256 texDetailBump{}, texDetailBumpX{}; |
| 35 | bool bHasDetailBump = false; |
| 36 | if (C.bDetail_Bump) |
| 37 | { |
| 38 | LPCSTR detail_bump_texture = DEV->m_textures_description.GetBumpName(dt).c_str(); |
| 39 | // Detect and use detail bump |
| 40 | if (detail_bump_texture && strlen(detail_bump_texture)) |
| 41 | { |
| 42 | bHasDetailBump = true; |
| 43 | xr_strcpy(texDetailBump, sizeof(texDetailBump), detail_bump_texture); |
| 44 | xr_strcpy(texDetailBumpX, sizeof(texDetailBumpX), detail_bump_texture); |
| 45 | xr_strcat(texDetailBumpX, "#"); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | if (_aref) |
| 50 | { |
| 51 | xr_strcat(ps, "_aref"); |
| 52 | } |
| 53 | |
| 54 | if (!bump) |
| 55 | { |
| 56 | fnameA[0] = fnameB[0] = 0; |
| 57 | xr_strcat(vs, "_flat"); |
| 58 | xr_strcat(ps, "_flat"); |
| 59 | if (hq && (C.bDetail_Diffuse || C.bDetail_Bump)) |
| 60 | { |
| 61 | xr_strcat(vs, "_d"); |
| 62 | xr_strcat(ps, "_d"); |
no test coverage detected