mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-02-16 17:35:39 +00:00
Flat shaded polys can't share vertex normals with adjacent connected polys. Fixes some bad lighting in Harley on pavements
This commit is contained in:
parent
b2da849d90
commit
da4bab5f9b
|
@ -899,6 +899,13 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
|
|||
}
|
||||
}
|
||||
|
||||
// if we have flat shading, we can't re-use normals from shared vertices
|
||||
for (i = 0; i < p.number && !ph.SmoothShading(); i++) {
|
||||
p.v[i].normal[0] = p.faceNormal[0];
|
||||
p.v[i].normal[1] = p.faceNormal[1];
|
||||
p.v[i].normal[2] = p.faceNormal[2];
|
||||
}
|
||||
|
||||
for (; j < p.number; j++) // remaining vertices are new and defined here
|
||||
{
|
||||
// Fetch vertices
|
||||
|
@ -912,16 +919,12 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
|
|||
p.v[j].pos[1] = (GLfloat)(((INT32)iy) >> 8) * m_vertexFactor;
|
||||
p.v[j].pos[2] = (GLfloat)(((INT32)iz) >> 8) * m_vertexFactor;
|
||||
|
||||
// Per vertex normals
|
||||
if (ph.SmoothShading()) {
|
||||
p.v[j].normal[0] = (INT8)(ix & 0xFF) / 128.f;
|
||||
p.v[j].normal[1] = (INT8)(iy & 0xFF) / 128.f;
|
||||
p.v[j].normal[2] = (INT8)(iz & 0xFF) / 128.f;
|
||||
}
|
||||
else {
|
||||
p.v[j].normal[0] = p.faceNormal[0];
|
||||
p.v[j].normal[1] = p.faceNormal[1];
|
||||
p.v[j].normal[2] = p.faceNormal[2];
|
||||
}
|
||||
|
||||
if ((ph.header[1] & 2) == 0) {
|
||||
UINT32 colorIdx = ((ph.header[4] >> 8) & 0x7FF);
|
||||
|
|
Loading…
Reference in a new issue