update poly header class

This commit is contained in:
Ian Curtis 2016-05-06 15:00:12 +00:00
parent fee1cfb126
commit 05e1e4de37
2 changed files with 30 additions and 14 deletions

View file

@ -71,9 +71,19 @@ int PolyHeader::NumTrianglesTotal()
// header 0 // header 0
// //
bool PolyHeader::Specular() bool PolyHeader::SpecularEnabled()
{ {
return (header[0] & 0x800000000) > 0; return (header[0] & 0x80) > 0;
}
float PolyHeader::SpecularValue()
{
return (header[0] >> 26) / 64.f;
}
bool PolyHeader::Clockwise()
{
return (header[0] & 0x2000000) > 0;
} }
int PolyHeader::PolyNumber() int PolyHeader::PolyNumber()

View file

@ -7,36 +7,42 @@ namespace New3D {
Polygon Data Polygon Data
0x00: 0x00:
x------- -------- -------- -------- Specular enable xxxxxx-- -------- -------- -------- Specular
-xxxxx-- -------- -------- -------- ? ------x- -------- -------- -------- Clockwise winding
------xx xxxxxxxx xxxxxx-- -------- Polygon number (not always present) -------x xxxxxxxx xxxxxx-- -------- Polygon number (not always present)
-------- -------- ------xx -------- Possibly disable z and colour writing -------- -------- ------xx -------- Discard polys
-------- -------- -------- x------- Enable specular
-------- -------- -------- -x------ 0 = Triangle, 1 = Quad -------- -------- -------- -x------ 0 = Triangle, 1 = Quad
-------- -------- -------- --x----- Poly is points
-------- -------- -------- ---x---- Smoothing ?
-------- -------- -------- ----x--- Vertex 3 shared from previous polygon -------- -------- -------- ----x--- Vertex 3 shared from previous polygon
-------- -------- -------- -----x-- Vertex 2 shared from previous polygon -------- -------- -------- -----x-- Vertex 2 shared from previous polygon
-------- -------- -------- ------x- Vertex 1 shared from previous polygon -------- -------- -------- ------x- Vertex 1 shared from previous polygon
-------- -------- -------- -------x Vertex 0 shared from previous polygon -------- -------- -------- -------x Vertex 0 shared from previous polygon
-------- -------- -------- x-xx---- ?
0x01: 0x01:
xxxxxxxx xxxxxxxx xxxxxxxx-------- Polygon normal X coordinate(2.22 fixed point) xxxxxxxx xxxxxxxx xxxxxxxx-------- Polygon normal X coordinate(2.22 fixed point)
-------- -------- -------- x------- Edge on translucency (i guess anti-aliasing)
-------- -------- -------- -x------ UV scale (0 = 13.3, 1 = 16.0) -------- -------- -------- -x------ UV scale (0 = 13.3, 1 = 16.0)
-------- -------- -------- --x----- Fixed shading (seems to only be enabled if lighting is enabled) -------- -------- -------- --x----- Fixed shading (seems to only be enabled if lighting is enabled)
-------- -------- -------- ---x---- 1 = Double-sided polygon -------- -------- -------- ---x---- 1 = Double-sided polygon
-------- -------- -------- ----x--- 1 = smooth shading, 0 = flat shading -------- -------- -------- ----x--- 1 = smooth shading, 0 = flat shading
-------- -------- -------- -----x-- If set, this is the last polygon -------- -------- -------- -----x-- If set, this is the last polygon
-------- -------- -------- ------x- Poly color, 1 = RGB, 0 = color table -------- -------- -------- ------x- Poly color, 1 = RGB, 0 = color table
-------- -------- -------- x------x ? -------- -------- -------- -------x No los return ?
0x02: 0x02:
xxxxxxxx xxxxxxxx xxxxxxxx -------- Polygon normal Y coordinate(2.22 fixed point) xxxxxxxx xxxxxxxx xxxxxxxx -------- Polygon normal Y coordinate(2.22 fixed point)
-------- -------- -------- ---x---- Microtexture (aka multitexture) -------- -------- -------- xxx----- Microtexture texture number 0-7
-------- -------- -------- ---x---- Microtexture enabled
-------- -------- -------- ----xx-- Microtexture min lod
-------- -------- -------- ------x- Texture U mirror enable -------- -------- -------- ------x- Texture U mirror enable
-------- -------- -------- -------x Texture V mirror enable -------- -------- -------- -------x Texture V mirror enable
-------- -------- -------- xxx-xx-- ?
0x03: 0x03:
xxxxxxxx xxxxxxxx xxxxxxxx -------- Polygon normal Z coordinate(2.22 fixed point) xxxxxxxx xxxxxxxx xxxxxxxx -------- Polygon normal Z coordinate(2.22 fixed point)
-------- -------- -------- x------- X wrap smoothing
-------- -------- -------- -x------ Y wrap smoothing
-------- -------- -------- --xxx--- Texture width(in 8 - pixel tiles) -------- -------- -------- --xxx--- Texture width(in 8 - pixel tiles)
-------- -------- -------- -----xxx Texture height(in 8 - pixel tiles) -------- -------- -------- -----xxx Texture height(in 8 - pixel tiles)
@ -55,9 +61,7 @@ xxxxxxxx xxxxxxxx xxxxxxxx -------- Specular color ?
0x06: 0x06:
x------- -------- -------- -------- Alpha testing / contour x------- -------- -------- -------- Alpha testing / contour
-xxxxx-- -------- -------- -------- Fixed shading ? -xxxxxxx -------- -------- -------- Translator map offset?
------x- -------- -------- -------- Enable fixed shading ?
-------x -------- -------- -------- Possible stencil
-------- x------- -------- -------- 1 = disable transparency ? -------- x------- -------- -------- 1 = disable transparency ?
-------- -xxxxx-- -------- -------- Polygon translucency(0 = fully transparent) -------- -xxxxx-- -------- -------- Polygon translucency(0 = fully transparent)
-------- -------x -------- -------- 1 = disable lighting -------- -------x -------- -------- 1 = disable lighting
@ -84,7 +88,9 @@ public:
int NumTrianglesTotal(); int NumTrianglesTotal();
//header 0 //header 0
bool Specular(); bool SpecularEnabled();
float SpecularValue();
bool Clockwise();
int PolyNumber(); int PolyNumber();
bool Disabled(); // z & colour disabled bool Disabled(); // z & colour disabled
int NumVerts(); int NumVerts();