mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-04-10 19:15:14 +00:00
Legacy engine: extracting fixed shading component (but still can't use it because unsure of how to activate)
This commit is contained in:
parent
0ae9e8013b
commit
34e8f00382
|
@ -50,9 +50,10 @@ enum POLY_STATE
|
||||||
|
|
||||||
struct Vertex
|
struct Vertex
|
||||||
{
|
{
|
||||||
GLfloat x,y,z; // vertex
|
GLfloat x,y,z; // vertex
|
||||||
GLfloat n[3]; // normal X, Y, Z
|
GLfloat n[3]; // normal X, Y, Z
|
||||||
GLfloat u,v; // texture U, V coordinates (in texels, relative to selected texture)
|
GLfloat u,v; // texture U, V coordinates (in texels, relative to selected texture)
|
||||||
|
GLfloat intensity; // shading intensity (if using per-vertex fixed shading)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Poly
|
struct Poly
|
||||||
|
|
|
@ -535,6 +535,7 @@ void CLegacy3D::InsertVertex(ModelCache *Cache, const Vertex *V, const Poly *P,
|
||||||
* - Fighting Vipers 2 shadows are not black anymore.
|
* - Fighting Vipers 2 shadows are not black anymore.
|
||||||
* - More to follow...
|
* - More to follow...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned modulate = (step >= 0x20) ? !(P->header[4]&0x80) : (P->header[3]&0x80 && lightEnable);
|
unsigned modulate = (step >= 0x20) ? !(P->header[4]&0x80) : (P->header[3]&0x80 && lightEnable);
|
||||||
if (texEnable)
|
if (texEnable)
|
||||||
{
|
{
|
||||||
|
@ -543,6 +544,23 @@ void CLegacy3D::InsertVertex(ModelCache *Cache, const Vertex *V, const Poly *P,
|
||||||
r = g = b = 1.0f;
|
r = g = b = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
int modulate = 0;//((P->header[5]>>22) & 1);
|
||||||
|
int fixedShading = ((P->header[5]>>23) & 1);
|
||||||
|
if (texEnable)
|
||||||
|
{
|
||||||
|
if (!modulate)
|
||||||
|
r = g = b = 1.0f;
|
||||||
|
}
|
||||||
|
if (fixedShading)
|
||||||
|
{
|
||||||
|
lightEnable = 0;
|
||||||
|
r = V->intensity;
|
||||||
|
g = V->intensity;
|
||||||
|
b = V->intensity;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Specular shininess
|
// Specular shininess
|
||||||
int shininess = (P->header[0]>>26)&0x3F;
|
int shininess = (P->header[0]>>26)&0x3F;
|
||||||
//shininess = (P->header[0]>>28)&0xF;
|
//shininess = (P->header[0]>>28)&0xF;
|
||||||
|
@ -928,6 +946,7 @@ struct VBORef *CLegacy3D::CacheModel(ModelCache *Cache, int lutIdx, UINT16 texOf
|
||||||
P.Vert[j].n[2] = (GLfloat)(INT8)(iz&0xFF);
|
P.Vert[j].n[2] = (GLfloat)(INT8)(iz&0xFF);
|
||||||
P.Vert[j].u = (GLfloat) ((UINT16)(it>>16)) * uvScale; // TO-DO: might these be signed?
|
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].v = (GLfloat) ((UINT16)(it&0xFFFF)) * uvScale;
|
||||||
|
P.Vert[j].intensity = GLfloat((255 - (ix & 0xFF))) / 255.0;
|
||||||
data += 4;
|
data += 4;
|
||||||
|
|
||||||
// Normalize the vertex normal
|
// Normalize the vertex normal
|
||||||
|
|
Loading…
Reference in a new issue