When the translator map?? bit is enabled the colour format seems to be 4-5bit. Max observed value is 16. Scaling these values up seems to produce the correct colours in harley and dirt devils.

This commit is contained in:
Ian Curtis 2017-02-16 17:20:42 +00:00
parent 7407d03036
commit 4a116190b5
3 changed files with 12 additions and 13 deletions

View file

@ -419,7 +419,6 @@ void CNew3D::DescendCullingNode(UINT32 addr)
{ {
tx = 32 * ((node[0x02] >> 7) & 0x3F); tx = 32 * ((node[0x02] >> 7) & 0x3F);
ty = 32 * (node[0x02] & 0x1F); ty = 32 * (node[0x02] & 0x1F);
// apply texture offsets, else retain current ones // apply texture offsets, else retain current ones
if ((node[0x02] & 0x8000)) { if ((node[0x02] & 0x8000)) {
m_nodeAttribs.currentTexOffsetX = tx; m_nodeAttribs.currentTexOffsetX = tx;
@ -1066,15 +1065,15 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
p.faceColour[0] = ((m_polyRAM[m_colorTableAddr + colorIdx] >> 16) & 0xFF) / 255.f; p.faceColour[0] = ((m_polyRAM[m_colorTableAddr + colorIdx] >> 16) & 0xFF) / 255.f;
} }
else { else {
if (ph.ColorDisabled()) { // no colours were set
p.faceColour[0] = 1.0f; p.faceColour[0] = ((ph.header[4] >> 24)) / 255.f;
p.faceColour[1] = 1.0f; p.faceColour[1] = ((ph.header[4] >> 16) & 0xFF) / 255.f;
p.faceColour[2] = 1.0f; p.faceColour[2] = ((ph.header[4] >> 8) & 0xFF) / 255.f;
}
else { if (ph.TranslatorMap()) {
p.faceColour[0] = ((ph.header[4] >> 24)) / 255.f; p.faceColour[0] *= 15.9375f; // not using 16, as 16x16=256 not 255 and that would overflow (potentially)
p.faceColour[1] = ((ph.header[4] >> 16) & 0xFF) / 255.f; p.faceColour[1] *= 15.9375f;
p.faceColour[2] = ((ph.header[4] >> 8) & 0xFF) / 255.f; p.faceColour[2] *= 15.9375f;
} }
} }

View file

@ -249,7 +249,7 @@ int PolyHeader::SensorColorIndex()
return (header[4] >> 20) & 0xFFF; return (header[4] >> 20) & 0xFFF;
} }
bool PolyHeader::ColorDisabled() bool PolyHeader::TranslatorMap()
{ {
return (header[4] & 0x80) > 0; return (header[4] & 0x80) > 0;
} }

View file

@ -48,7 +48,7 @@ xxxxxxxx xxxxxxxx xxxxxxxx -------- Polygon normal Z coordinate(2.22 fixed poin
0x04: 0x04:
xxxxxxxx xxxxxxxx xxxxxxxx -------- Color (RGB888 or two 12-bit indexes, sensor color and color) xxxxxxxx xxxxxxxx xxxxxxxx -------- Color (RGB888 or two 12-bit indexes, sensor color and color)
-------- -------- -------- x------- Translator map enable ? (treated as color modulation disabled) -------- -------- -------- x------- Translator map enable ? (Seems to be some 4/5bit colour format. Max observed value=16)
-------- -------- -------- -x------ Texture page -------- -------- -------- -x------ Texture page
-------- -------- -------- ---xxxxx Upper 5 bits of texture U coordinate -------- -------- -------- ---xxxxx Upper 5 bits of texture U coordinate
@ -121,7 +121,7 @@ public:
void Color(UINT8& r, UINT8& g, UINT8& b); void Color(UINT8& r, UINT8& g, UINT8& b);
int ColorIndex(); int ColorIndex();
int SensorColorIndex(); int SensorColorIndex();
bool ColorDisabled(); bool TranslatorMap();
int Page(); int Page();
// header 5 // header 5