Generate sensible normals for textures with them

Using (0,0,0) violates normalisation assumptions, which shifts the weight
between landscape and texture normals quite massively. The new normal
code should represent a "flat" texture properly.
shapetextures
Peter Wortmann 2015-10-17 09:30:36 +01:00
parent a5d7f08e16
commit f0561cc150
1 changed files with 9 additions and 1 deletions

View File

@ -262,7 +262,15 @@ bool C4LandscapeRenderGL::InitMaterialTexture(C4TextureMap *pTexs)
}
// If we didn't "continue" yet, we haven't written the texture yet.
// Make color texture transparent, and normal texture flat.
memset(p, fNormal ? 127 : 0, iTexSize);
if (fNormal)
{
DWORD *texdata = reinterpret_cast<DWORD *>(p);
for (int y = 0; y < iTexHgt; ++y)
for (int x = 0; x < iTexWdt; ++x)
*texdata++ = RGBA(127, 127, 255, 255);
}
else
memset(p, 0, iTexSize);
}
// Clear error error(s?)