materialsystem: fix(hack) flashlight. normalizedcubemap broken?

This commit is contained in:
nillerusr 2022-05-15 21:19:04 +03:00
parent 3a73624b7e
commit ae8b73626e
5 changed files with 442 additions and 710 deletions

View File

@ -201,22 +201,16 @@ float4 main( PS_INPUT i ) : COLOR
#if NORMALMAP == 0
float3 worldPosToLightVector = texCUBE( NormalizingCubemapSampler, i.worldPosToLightVector ) * 2.0f - 1.0f;
float nDotL = dot( worldPosToLightVector, vNormal.xyz );
float nDotL = 0.577350f;
#endif
#if NORMALMAP == 1
// flashlightfixme: wrap this!
float3 tangentPosToLightVector = texCUBE( NormalizingCubemapSampler, i.tangentPosToLightVector ) * 2.0f - 1.0f;
float nDotL = dot( tangentPosToLightVector, vNormal.xyz );
float nDotL = 0.577350f;
#endif
#if NORMALMAP == 2
float3 tangentPosToLightVector = normalize( i.tangentPosToLightVector );
float nDotL =
vNormal.x*dot( tangentPosToLightVector, bumpBasis[0]) +
vNormal.y*dot( tangentPosToLightVector, bumpBasis[1]) +
vNormal.z*dot( tangentPosToLightVector, bumpBasis[2]);
float nDotL = 0.577350f;
#endif
float3 outColor;

View File

@ -102,9 +102,7 @@ struct VS_OUTPUT
#endif
float4 color : TEXCOORD2; // Vertex color (from lighting or unlit)
#if CUBEMAP || _X360
float3 worldVertToEyeVector : TEXCOORD3; // Necessary for cubemaps
#endif
float3 worldSpaceNormal : TEXCOORD4; // Necessary for cubemaps and flashlight

View File

@ -246,9 +246,13 @@ static void CreateSolidTexture( ITextureInternal *pTexture, color32 color )
//-----------------------------------------------------------------------------
// Creates a normalization cubemap texture
//-----------------------------------------------------------------------------
class CNormalizationCubemap : public ITextureRegenerator
{
public:
// TODO(nillerusr): broken here with togl /= (maybe here)
virtual void RegenerateTextureBits( ITexture *pTexture, IVTFTexture *pVTFTexture, Rect_t *pSubRect )
{
// Normalization cubemap doesn't make sense on low-end hardware

View File

@ -48,16 +48,13 @@ CFLAGS = {
'common': {
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP
'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-', '/MT'],
'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden'],
'gcc': ['-g0', '-fvisibility=hidden'],
'owcc': ['-fno-short-enum', '-ffloat-store', '-g3']
'clang': ['-g0', '-fno-strict-aliasing', '-gdwarf-2', '-fvisibility=hidden'],
'gcc': ['-g0', '-fno-strict-aliasing', '-fvisibility=hidden'],
'owcc': ['-fno-short-enum', '-ffloat-store', '-g0']
},
'fast': {
'msvc': ['/O2', '/Oy'],
'gcc': {
'3': ['-O3', '-fomit-frame-pointer'],
'default': ['-Ofast', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer']
},
'msvc': ['/O2', '/Oy'],
'gcc': ['-Ofast'],
'clang': ['-Ofast'],
'default': ['-O3']
},
@ -69,13 +66,13 @@ CFLAGS = {
},
'release': {
'msvc': ['/O2'],
'owcc': ['-O3', '-foptimize-sibling-calls', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-fschedule-insns', '-funsafe-math-optimizations', '-funroll-loops', '-frerun-optimizer', '-finline-functions', '-finline-limit=512', '-fguess-branch-probability', '-fno-strict-aliasing', '-floop-optimize'],
'default': ['-O3']
'owcc': ['-O3', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-finline-functions', '-finline-limit=512'],
'default': ['-O2', '-funsafe-math-optimizations', '-ftree-vectorize']
},
'debug': {
'msvc': ['/Od'],
'owcc': ['-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'],
'default': ['-O3'] #, '-ftree-vectorize']
'owcc': ['-g', '-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'],
'default': ['-g', '-O0'] #, '-ftree-vectorize', '-ffast-math', '-fno-tree-partial-pre']
},
'sanitize': {
'msvc': ['/Od', '/RTC1'],