mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-04-10 19:15:14 +00:00
There are 2 bits in the polyheader labelled discard. When both are set ie in sega rally, the polygons are totally discarded. Scud seems to set bit 1 which seems halve the opacity.
This commit is contained in:
parent
21836c088c
commit
3c78571615
|
@ -1118,6 +1118,10 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
p.faceColour[3] = ph.Transparency() / 255.f;
|
p.faceColour[3] = ph.Transparency() / 255.f;
|
||||||
|
|
||||||
|
if (ph.Discard1() && !ph.Discard2()) {
|
||||||
|
p.faceColour[3] *= 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
// if we have flat shading, we can't re-use normals from shared vertices
|
// if we have flat shading, we can't re-use normals from shared vertices
|
||||||
for (i = 0; i < p.number && !ph.SmoothShading(); i++) {
|
for (i = 0; i < p.number && !ph.SmoothShading(); i++) {
|
||||||
|
@ -1200,7 +1204,7 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we need double up vertices for two sided lighting
|
// check if we need double up vertices for two sided lighting
|
||||||
if (ph.DoubleSided() && !ph.Disabled()) {
|
if (ph.DoubleSided() && !ph.Discard()) {
|
||||||
|
|
||||||
R3DPoly tempP = p;
|
R3DPoly tempP = p;
|
||||||
|
|
||||||
|
@ -1215,7 +1219,7 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy this polygon into the model buffer
|
// Copy this polygon into the model buffer
|
||||||
if (!ph.Disabled()) {
|
if (!ph.Discard()) {
|
||||||
CopyVertexData(p, currentMesh->polys);
|
CopyVertexData(p, currentMesh->polys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ int PolyHeader::PolyNumber()
|
||||||
return (header[0] & 0x000FFFC00) >> 10; // not all programs pass this, instead they are set to 0
|
return (header[0] & 0x000FFFC00) >> 10; // not all programs pass this, instead they are set to 0
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PolyHeader::Disabled()
|
bool PolyHeader::Discard()
|
||||||
{
|
{
|
||||||
if ((header[0] & 0x100) && (header[0] & 0x200)) {
|
if ((header[0] & 0x100) && (header[0] & 0x200)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -100,6 +100,16 @@ bool PolyHeader::Disabled()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PolyHeader::Discard1()
|
||||||
|
{
|
||||||
|
return (header[0] & 0x200) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PolyHeader::Discard2()
|
||||||
|
{
|
||||||
|
return (header[0] & 0x100) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
int PolyHeader::NumVerts()
|
int PolyHeader::NumVerts()
|
||||||
{
|
{
|
||||||
return (header[0] & 0x40) ? 4 : 3;
|
return (header[0] & 0x40) ? 4 : 3;
|
||||||
|
|
|
@ -10,7 +10,7 @@ Polygon Data
|
||||||
xxxxxx-- -------- -------- -------- Specular
|
xxxxxx-- -------- -------- -------- Specular
|
||||||
------x- -------- -------- -------- Clockwise winding
|
------x- -------- -------- -------- Clockwise winding
|
||||||
-------x xxxxxxxx xxxxxx-- -------- Polygon number (not always present)
|
-------x xxxxxxxx xxxxxx-- -------- Polygon number (not always present)
|
||||||
-------- -------- ------xx -------- Discard polys
|
-------- -------- ------xx -------- Discard
|
||||||
-------- -------- -------- x------- Enable specular
|
-------- -------- -------- x------- Enable specular
|
||||||
-------- -------- -------- -x------ 0 = Triangle, 1 = Quad
|
-------- -------- -------- -x------ 0 = Triangle, 1 = Quad
|
||||||
-------- -------- -------- --x----- Poly is points
|
-------- -------- -------- --x----- Poly is points
|
||||||
|
@ -90,7 +90,9 @@ public:
|
||||||
float SpecularValue();
|
float SpecularValue();
|
||||||
bool Clockwise();
|
bool Clockwise();
|
||||||
int PolyNumber();
|
int PolyNumber();
|
||||||
bool Disabled();
|
bool Discard(); // both bits
|
||||||
|
bool Discard1(); // bit 1 only
|
||||||
|
bool Discard2(); // bit 2 only
|
||||||
int NumVerts();
|
int NumVerts();
|
||||||
int NumSharedVerts();
|
int NumSharedVerts();
|
||||||
bool SharedVertex(int vertex);
|
bool SharedVertex(int vertex);
|
||||||
|
@ -100,7 +102,7 @@ public:
|
||||||
float UVScale();
|
float UVScale();
|
||||||
bool DoubleSided();
|
bool DoubleSided();
|
||||||
bool LastPoly();
|
bool LastPoly();
|
||||||
bool PolyColor(); // if false uses LUT from ram
|
bool PolyColor(); // if false uses LUT from ram
|
||||||
bool FixedShading();
|
bool FixedShading();
|
||||||
bool SmoothShading();
|
bool SmoothShading();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue