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
@@ -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;
File diff suppressed because it is too large Load Diff
@@ -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
+4
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