mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-02-17 01:45:41 +00:00
Legacy engine: preliminary per-vertex fixed shading. Only limited testing with LA Machineguns (appears to work), Sega Rally 2 (appears okay), and Scud Race (fixes expert course bridge but not other mis-colored polygons).
This commit is contained in:
parent
2785ecd25f
commit
57d5bc8367
|
@ -535,7 +535,7 @@ void CLegacy3D::InsertVertex(ModelCache *Cache, const Vertex *V, const Poly *P,
|
|||
* - Fighting Vipers 2 shadows are not black anymore.
|
||||
* - More to follow...
|
||||
*/
|
||||
|
||||
/*
|
||||
unsigned modulate = (step >= 0x20) ? !(P->header[4]&0x80) : (P->header[3]&0x80 && lightEnable);
|
||||
if (texEnable)
|
||||
{
|
||||
|
@ -543,10 +543,25 @@ void CLegacy3D::InsertVertex(ModelCache *Cache, const Vertex *V, const Poly *P,
|
|||
if (!modulate)
|
||||
r = g = b = 1.0f;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
int modulate = 0;//((P->header[5]>>22) & 1);
|
||||
int fixedShading = ((P->header[5]>>23) & 1);
|
||||
/*
|
||||
* Fixed per-vertex shading appears to only be active in LA Machineguns for
|
||||
* polygons where bits 0x20 and 0x08 of word 1 are set to 1 and 0,
|
||||
* respectively. Confirmed in both Scud Race and LA Machineguns that such
|
||||
* polygons contain 0's in normal Y and Z component.
|
||||
*
|
||||
* Fixed shading appears to multiply the polygon color, else LA Machineguns
|
||||
* enemy target reticles and Sega Rally 2 dust trails are mis-colored.
|
||||
*
|
||||
* This code is still not correct for Scud Race, although it illuminates the
|
||||
* expert stage bridge battlements.
|
||||
*
|
||||
* To-do: What is the significance of the two fixed shading bits? What are
|
||||
* other possible settings for them? What if lighting already disabled?
|
||||
*/
|
||||
int modulate = !(P->header[4] & 0x80);
|
||||
int fixedShading = (P->header[1] & 0x20) && !(P->header[1] & 0x08);
|
||||
if (texEnable)
|
||||
{
|
||||
if (!modulate)
|
||||
|
@ -555,11 +570,10 @@ void CLegacy3D::InsertVertex(ModelCache *Cache, const Vertex *V, const Poly *P,
|
|||
if (fixedShading)
|
||||
{
|
||||
lightEnable = 0;
|
||||
r = V->intensity;
|
||||
g = V->intensity;
|
||||
b = V->intensity;
|
||||
r *= V->intensity;
|
||||
g *= V->intensity;
|
||||
b *= V->intensity;
|
||||
}
|
||||
*/
|
||||
|
||||
// Specular shininess
|
||||
int shininess = (P->header[0]>>26)&0x3F;
|
||||
|
@ -947,6 +961,8 @@ struct VBORef *CLegacy3D::CacheModel(ModelCache *Cache, int lutIdx, UINT16 texOf
|
|||
P.Vert[j].u = (GLfloat) ((UINT16)(it>>16)) * uvScale; // TO-DO: might these be signed?
|
||||
P.Vert[j].v = (GLfloat) ((UINT16)(it&0xFFFF)) * uvScale;
|
||||
P.Vert[j].intensity = GLfloat((255 - (ix & 0xFF))) / 255.0;
|
||||
//if ((P.header[1] & 0x20) && !(P.header[1] & 0x08))
|
||||
// printf("%02x %02x %02x\n", ix&0xff, iy&0xff, iz&0xff);
|
||||
data += 4;
|
||||
|
||||
// Normalize the vertex normal
|
||||
|
|
Loading…
Reference in a new issue