| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | #ifndef _POLY_HEADER_H_ | 
					
						
							|  |  |  |  | #define _POLY_HEADER_H_
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace New3D { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /*
 | 
					
						
							|  |  |  |  | Polygon Data | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 0x00: | 
					
						
							| 
									
										
										
										
											2016-05-06 15:00:12 +00:00
										 |  |  |  | xxxxxx-- -------- -------- --------		Specular | 
					
						
							|  |  |  |  | ------x- -------- -------- --------		Clockwise winding | 
					
						
							|  |  |  |  | -------x xxxxxxxx xxxxxx-- --------		Polygon number (not always present) | 
					
						
							|  |  |  |  | -------- -------- ------xx --------		Discard polys | 
					
						
							|  |  |  |  | -------- -------- -------- x-------		Enable specular | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- -------- -------- -x------		0 = Triangle, 1 = Quad | 
					
						
							| 
									
										
										
										
											2016-05-06 15:00:12 +00:00
										 |  |  |  | -------- -------- -------- --x-----		Poly is points | 
					
						
							|  |  |  |  | -------- -------- -------- ---x----		Smoothing ? | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- -------- -------- ----x---		Vertex 3 shared from previous polygon | 
					
						
							|  |  |  |  | -------- -------- -------- -----x--		Vertex 2 shared from previous polygon | 
					
						
							|  |  |  |  | -------- -------- -------- ------x-		Vertex 1 shared from previous polygon | 
					
						
							|  |  |  |  | -------- -------- -------- -------x		Vertex 0 shared from previous polygon | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 0x01:  | 
					
						
							|  |  |  |  | xxxxxxxx xxxxxxxx xxxxxxxx--------		Polygon normal X coordinate(2.22 fixed point) | 
					
						
							| 
									
										
										
										
											2016-05-06 15:00:12 +00:00
										 |  |  |  | -------- -------- -------- x-------		Edge on translucency (i guess anti-aliasing)  | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- -------- -------- -x------		UV scale (0 = 13.3, 1 = 16.0) | 
					
						
							| 
									
										
										
										
											2016-04-29 23:03:46 +00:00
										 |  |  |  | -------- -------- -------- --x-----		Fixed shading (seems to only be enabled if lighting is enabled) | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- -------- -------- ---x----		1 = Double-sided polygon | 
					
						
							| 
									
										
										
										
											2016-05-05 00:01:17 +00:00
										 |  |  |  | -------- -------- -------- ----x---		1 = smooth shading, 0 = flat shading | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- -------- -------- -----x--		If set, this is the last polygon | 
					
						
							|  |  |  |  | -------- -------- -------- ------x-		Poly color, 1 = RGB, 0 = color table | 
					
						
							| 
									
										
										
										
											2016-05-06 15:00:12 +00:00
										 |  |  |  | -------- -------- -------- -------x		No los return ? | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 0x02:  | 
					
						
							|  |  |  |  | xxxxxxxx xxxxxxxx xxxxxxxx --------		Polygon normal Y coordinate(2.22 fixed point) | 
					
						
							| 
									
										
										
										
											2016-05-06 15:00:12 +00:00
										 |  |  |  | -------- -------- -------- xxx-----		Microtexture texture number 0-7 | 
					
						
							|  |  |  |  | -------- -------- -------- ---x----		Microtexture enabled | 
					
						
							|  |  |  |  | -------- -------- -------- ----xx--		Microtexture min lod | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- -------- -------- ------x-		Texture U mirror enable | 
					
						
							|  |  |  |  | -------- -------- -------- -------x		Texture V mirror enable | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 0x03:  | 
					
						
							|  |  |  |  | xxxxxxxx xxxxxxxx xxxxxxxx --------		Polygon normal Z coordinate(2.22 fixed point) | 
					
						
							| 
									
										
										
										
											2016-05-06 15:00:12 +00:00
										 |  |  |  | -------- -------- -------- x-------		X wrap smoothing | 
					
						
							|  |  |  |  | -------- -------- -------- -x------		Y wrap smoothing | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- -------- -------- --xxx---		Texture width(in 8 - pixel tiles) | 
					
						
							| 
									
										
										
										
											2016-04-02 22:13:59 +00:00
										 |  |  |  | -------- -------- -------- -----xxx		Texture height(in 8 - pixel tiles) | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 0x04:  | 
					
						
							|  |  |  |  | xxxxxxxx xxxxxxxx xxxxxxxx --------		Color(RGB888) | 
					
						
							| 
									
										
										
										
											2016-04-27 16:42:31 +00:00
										 |  |  |  | -------- -------- -------- x-------		Color disabled | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- -------- -------- -x------		Texture page | 
					
						
							| 
									
										
										
										
											2016-04-27 16:42:31 +00:00
										 |  |  |  | -------- -------- -------- ---xxxxx		Upper 5 bits of texture U coordinate | 
					
						
							| 
									
										
										
										
											2016-04-29 23:03:46 +00:00
										 |  |  |  | -------- -------- -------- --x-----		? | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 0x05 :  | 
					
						
							|  |  |  |  | xxxxxxxx xxxxxxxx xxxxxxxx --------		Specular color ? | 
					
						
							|  |  |  |  | -------- -------- -------- x-------		Low bit of texture U coordinate | 
					
						
							|  |  |  |  | -------- -------- -------- ---xxxxx		Low 5 bits of texture V coordinate | 
					
						
							|  |  |  |  | -------- -------- -------- -xx-----		? | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 0x06:  | 
					
						
							|  |  |  |  | x------- -------- -------- --------		Alpha testing / contour | 
					
						
							| 
									
										
										
										
											2016-05-06 15:00:12 +00:00
										 |  |  |  | -xxxxxxx -------- -------- --------		Translator map offset? | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- x------- -------- --------		1 = disable transparency ? | 
					
						
							|  |  |  |  | -------- -xxxxx-- -------- --------		Polygon translucency(0 = fully transparent) | 
					
						
							|  |  |  |  | -------- -------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.) | 
					
						
							|  |  |  |  | -------- -------- -----x-- --------		Texture enable | 
					
						
							|  |  |  |  | -------- -------- ------xx x-------		Texture format | 
					
						
							|  |  |  |  | -------- -------- -------- -------x		Alpha enable ? | 
					
						
							| 
									
										
										
										
											2016-04-02 12:23:46 +00:00
										 |  |  |  | -------- ------x- -------- --------		Never seen set ? | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | -------- -------- -------- -----xx-		Always set ? | 
					
						
							|  |  |  |  | -------- -------- -------- -xxxx---		? | 
					
						
							|  |  |  |  | */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class PolyHeader | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  | 	PolyHeader(); | 
					
						
							|  |  |  |  | 	PolyHeader(UINT32* h); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	void operator =(const UINT32* h); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	UINT32*	StartOfData(); | 
					
						
							|  |  |  |  | 	bool	NextPoly(); | 
					
						
							|  |  |  |  | 	int		NumPolysTotal();		// could be quads or triangles
 | 
					
						
							|  |  |  |  | 	int		NumTrianglesTotal(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//header 0
 | 
					
						
							| 
									
										
										
										
											2016-05-06 15:00:12 +00:00
										 |  |  |  | 	bool	SpecularEnabled(); | 
					
						
							|  |  |  |  | 	float	SpecularValue(); | 
					
						
							|  |  |  |  | 	bool	Clockwise(); | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 	int		PolyNumber(); | 
					
						
							|  |  |  |  | 	bool	Disabled();		// z & colour disabled
 | 
					
						
							|  |  |  |  | 	int		NumVerts(); | 
					
						
							|  |  |  |  | 	int		NumSharedVerts(); | 
					
						
							|  |  |  |  | 	bool	SharedVertex(int vertex); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//header 1
 | 
					
						
							|  |  |  |  | 	void	FaceNormal(float n[3]); | 
					
						
							|  |  |  |  | 	float	UVScale(); | 
					
						
							|  |  |  |  | 	bool	DoubleSided(); | 
					
						
							|  |  |  |  | 	bool	LastPoly(); | 
					
						
							|  |  |  |  | 	bool	PolyColor();	// if false uses LUT from ram
 | 
					
						
							| 
									
										
										
										
											2016-04-29 23:03:46 +00:00
										 |  |  |  | 	bool	FixedShading(); | 
					
						
							| 
									
										
										
										
											2016-05-05 00:01:17 +00:00
										 |  |  |  | 	bool	SmoothShading(); | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//header 2
 | 
					
						
							|  |  |  |  | 	bool	TexUMirror(); | 
					
						
							|  |  |  |  | 	bool	TexVMirror(); | 
					
						
							| 
									
										
										
										
											2016-05-04 00:35:07 +00:00
										 |  |  |  | 	bool	MicroTexture(); | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// header 3
 | 
					
						
							|  |  |  |  | 	int		TexWidth(); | 
					
						
							|  |  |  |  | 	int		TexHeight(); | 
					
						
							| 
									
										
										
										
											2016-05-07 18:57:06 +00:00
										 |  |  |  | 	bool	TexSmoothU(); | 
					
						
							|  |  |  |  | 	bool	TexSmoothV(); | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//header 4
 | 
					
						
							|  |  |  |  | 	void	Color(UINT8& r, UINT8& g, UINT8& b); | 
					
						
							| 
									
										
										
										
											2016-04-27 16:42:31 +00:00
										 |  |  |  | 	bool	ColorDisabled(); | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 	int		Page(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// header 5
 | 
					
						
							| 
									
										
										
										
											2016-03-26 22:44:26 +00:00
										 |  |  |  | 	int		X(); | 
					
						
							|  |  |  |  | 	int		Y(); | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//header 6
 | 
					
						
							|  |  |  |  | 	int		TexFormat(); | 
					
						
							|  |  |  |  | 	bool	TexEnabled(); | 
					
						
							|  |  |  |  | 	bool	LightEnabled(); | 
					
						
							|  |  |  |  | 	bool	AlphaTest(); | 
					
						
							|  |  |  |  | 	UINT8	Transparency();			// 0-255
 | 
					
						
							|  |  |  |  | 	bool	PolyAlpha(); | 
					
						
							|  |  |  |  | 	bool	TextureAlpha(); | 
					
						
							|  |  |  |  | 	bool	StencilPoly(); | 
					
						
							|  |  |  |  | 	bool	Luminous(); | 
					
						
							|  |  |  |  | 	float	LightModifier(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// misc
 | 
					
						
							| 
									
										
										
										
											2016-03-26 22:44:26 +00:00
										 |  |  |  | 	UINT64	Hash();		// make a unique hash for sorting by state
 | 
					
						
							| 
									
										
										
										
											2016-03-21 04:10:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//=============
 | 
					
						
							|  |  |  |  | 	UINT32* header; | 
					
						
							|  |  |  |  | 	//=============
 | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } // New3D
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #endif
 |