fix transparency values, values are from 0-32, not 0-16 where the top bit disables

This commit is contained in:
Ian Curtis 2016-05-27 22:20:57 +00:00
parent 2086b1c9af
commit 661f19be19
3 changed files with 4 additions and 10 deletions

View file

@ -961,13 +961,8 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data)
}
}
if ((ph.header[6] & 0x00800000)) { // if set, polygon is opaque
p.faceColour[3] = 1.0f;
}
else {
p.faceColour[3] = ph.Transparency() / 255.f;
}
p.faceColour[3] = ph.Transparency() / 255.f;
// 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];

View file

@ -310,7 +310,7 @@ bool PolyHeader::AlphaTest()
UINT8 PolyHeader::Transparency()
{
return (UINT8)(((header[6] >> 18) & 0x1F) * 255.f / 0x1F);
return (UINT8)((((header[6] >> 18) & 0x3F) * 255) / 32.f);
}
bool PolyHeader::PolyAlpha()

View file

@ -60,8 +60,7 @@ xxxxxxxx xxxxxxxx xxxxxxxx -------- Specular color ?
0x06:
x------- -------- -------- -------- Alpha testing / contour
-xxxxxxx -------- -------- -------- Translator map offset?
-------- x------- -------- -------- 1 = disable transparency
-------- -xxxxx-- -------- -------- Polygon translucency (0 = fully transparent)
-------- xxxxxx-- -------- -------- Polygon transparency 0-32
-------- ------x- -------- -------- Translucency pattern select (stipple alpha) - not sure if used?
-------- -------x -------- -------- 1 = disable lighting
-------- -------- xxxxx--- -------- Polygon light modifier(Amount that a luminous polygon will burn through fog. Valid range is 0.0 to 1.0. 0.0 is completely fogged; 1.0 has no fog.)