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 #if NORMALMAP == 0
float3 worldPosToLightVector = texCUBE( NormalizingCubemapSampler, i.worldPosToLightVector ) * 2.0f - 1.0f; float3 worldPosToLightVector = texCUBE( NormalizingCubemapSampler, i.worldPosToLightVector ) * 2.0f - 1.0f;
float nDotL = dot( worldPosToLightVector, vNormal.xyz ); float nDotL = 0.577350f;
#endif #endif
#if NORMALMAP == 1 #if NORMALMAP == 1
// flashlightfixme: wrap this! // flashlightfixme: wrap this!
float3 tangentPosToLightVector = texCUBE( NormalizingCubemapSampler, i.tangentPosToLightVector ) * 2.0f - 1.0f; float nDotL = 0.577350f;
float nDotL = dot( tangentPosToLightVector, vNormal.xyz );
#endif #endif
#if NORMALMAP == 2 #if NORMALMAP == 2
float3 tangentPosToLightVector = normalize( i.tangentPosToLightVector ); float nDotL = 0.577350f;
float nDotL =
vNormal.x*dot( tangentPosToLightVector, bumpBasis[0]) +
vNormal.y*dot( tangentPosToLightVector, bumpBasis[1]) +
vNormal.z*dot( tangentPosToLightVector, bumpBasis[2]);
#endif #endif
float3 outColor; float3 outColor;

View File

@ -102,9 +102,7 @@ struct VS_OUTPUT
#endif #endif
float4 color : TEXCOORD2; // Vertex color (from lighting or unlit) float4 color : TEXCOORD2; // Vertex color (from lighting or unlit)
#if CUBEMAP || _X360
float3 worldVertToEyeVector : TEXCOORD3; // Necessary for cubemaps float3 worldVertToEyeVector : TEXCOORD3; // Necessary for cubemaps
#endif
float3 worldSpaceNormal : TEXCOORD4; // Necessary for cubemaps and flashlight 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 // Creates a normalization cubemap texture
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class CNormalizationCubemap : public ITextureRegenerator class CNormalizationCubemap : public ITextureRegenerator
{ {
public: public:
// TODO(nillerusr): broken here with togl /= (maybe here)
virtual void RegenerateTextureBits( ITexture *pTexture, IVTFTexture *pVTFTexture, Rect_t *pSubRect ) virtual void RegenerateTextureBits( ITexture *pTexture, IVTFTexture *pVTFTexture, Rect_t *pSubRect )
{ {
// Normalization cubemap doesn't make sense on low-end hardware // Normalization cubemap doesn't make sense on low-end hardware

View File

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