ScummVM API documentation
psx_pchmd.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_PSX_PCHMD_H
28 #define ICB_PSX_PCHMD_H
29 
30 #include "engines/icb/gfx/psx_pcdefines.h"
31 
32 namespace ICB {
33 
34 const int32 HMD_FUS3 = 0x00000048; // Flat, Un-textured, Self-Luminous Triangle
35 const int32 HMD_FTS3 = 0x00000049; // Flat, Textured, Self-Luminous Triangle
36 const int32 HMD_GUS3 = 0x0000004c; // Gouraud, Un-textured, Self-Luminous Triangle
37 const int32 HMD_GTS3 = 0x0000004d; // Gouraud, Textured, Self-Luminous Triangle
38 
39 const int32 HMD_FUL3 = 0x00000008; // Flat, Un-textured, Lit Triangle
40 const int32 HMD_FTL3 = 0x00000009; // Flat, Textured, Lit Triangle
41 const int32 HMD_GUL3 = 0x0000000c; // Gouraud, Un-textured, Lit Triangle
42 const int32 HMD_GTL3 = 0x0000000d; // Gouraud, Textured, Lit Triangle
43 
44 const int32 TRIANGLE = 0x00000666; // Just 3 vertices for shadow polygon
45 
46 const int32 HMD_FUS3_SIZE = 3;
47 const int32 HMD_GUS3_SIZE = 5;
48 const int32 HMD_FTS3_SIZE = 5;
49 const int32 HMD_GTS3_SIZE = 7;
50 const int32 HMD_FUL3_SIZE = 3;
51 const int32 HMD_GUL3_SIZE = 4;
52 const int32 HMD_FTL3_SIZE = 5;
53 const int32 HMD_GTL3_SIZE = 6;
54 const int32 TRIANGLE_SIZE = 2;
55 
56 int32 decodeHMDpolygon(uint32 primType, uint32 pcplatform, uint32 *&pp, uint32 &code0, uint32 &r0, uint32 &g0, uint32 &b0, uint32 &code1, uint32 &r1, uint32 &g1, uint32 &b1, uint32 &code2, uint32 &r2,
57  uint32 &g2, uint32 &b2, uint32 &u0, uint32 &v0, uint32 &u1, uint32 &v1, uint32 &u2, uint32 &v2, uint32 &cba, uint32 &cx, uint32 &cy, uint32 &tsb, uint32 &tp, uint32 &n0, uint32 &vert0,
58  uint32 &n1, uint32 &vert1, uint32 &n2, uint32 &vert2, uint32 dump);
59 
60 // Handy structures for decoding polygon information
61 
62 // Flat, Un-textured, Self-Luminous Triangle
63 // Each polygon is 3 32-bit WORDS
64 // Bit 31 ----> Bit 0
65 //
66 // 8-bits | 8-bits | 8-bits | 8-bits
67 // 0x20 | Blue | Green | Red
68 // 16-bits | 8-bits | 8-bits
69 // --------------------------
70 // vp1 | vp0
71 // pad | vp2
72 typedef struct PolyFUS3 {
73  uint8 r0, g0, b0, code0;
74  uint16 vp0, vp1;
75  uint16 vp2, pad;
76 } PolyFUS3;
77 
78 // Gouraud, Un-textured, Self-Luminous Triangle
79 // Each polygon is 5 32-bit WORDS
80 // Bit 31 ----> Bit 0
81 //
82 // 8-bits | 8-bits | 8-bits | 8-bits
83 // 0x30 | Blue0 | Green0 | Red0
84 // 0x30 | Blue1 | Green1 | Red1
85 // 0x30 | Blue2 | Green2 | Red2
86 // 16-bits | 8-bits | 8-bits
87 // --------------------------
88 // vp1 | vp0
89 // pad | vp2
90 typedef struct PolyGUS3 {
91  uint8 r0, g0, b0, code0;
92  uint8 r1, g1, b1, code1;
93  uint8 r2, g2, b2, code2;
94  uint16 vp0, vp1;
95  uint16 vp2, pad;
96 } PolyGUS3;
97 
98 // Flat, Textured, Self-Luminous Triangle
99 // Each polygon is 5 32-bit WORDS
100 // Structure is :
101 // Bit 31 ----> Bit 0
102 //
103 // 8-bits | 8-bits | 8-bits | 8-bits
104 // 0x24 | Blue | Green | Red
105 // 16-bits | 8-bits | 8-bits
106 // --------------------------
107 // cba | v0 | u0
108 // tsb | v1 | u1
109 // vp0 | v2 | u2
110 // --------------------------
111 // vp2 | vp1
112 typedef struct PolyFTS3 {
113  uint8 r0, g0, b0, code0;
114  uint8 u0, v0;
115  uint16 cba;
116  uint8 u1, v1;
117  uint16 tsb;
118  uint8 u2, v2;
119  uint16 vp0;
120  uint16 vp1, vp2;
121 } PolyFTS3;
122 
123 // Gouraud, Textured, Self-Luminous Triangle
124 // Each polygon is 7 32-bit WORDS
125 // Structure is :
126 // Bit 31 ----> Bit 0
127 //
128 // 8-bits | 8-bits | 8-bits | 8-bits
129 // 0x34 | Blue0 | Green0 | Red0
130 // 0x34 | Blue1 | Green1 | Red1
131 // 0x34 | Blue2 | Green2 | Red2
132 // 16-bits | 8-bits | 8-bits
133 // --------------------------
134 // cba | v0 | u0
135 // tsb | v1 | u1
136 // vp0 | v2 | u2
137 // --------------------------
138 // vp2 | vp2
139 typedef struct PolyGTS3 {
140  uint8 r0, g0, b0, code0;
141  uint8 r1, g1, b1, code1;
142  uint8 r2, g2, b2, code2;
143  uint8 u0, v0;
144  uint16 cba;
145  uint8 u1, v1;
146  uint16 tsb;
147  uint8 u2, v2;
148  uint16 vp0;
149  uint16 vp1, vp2;
150 } PolyGTS3;
151 
152 // Flat, Un-textured, Lit Triangle
153 // Each polygon is 3 32-bit WORDS
154 // Bit 31 ----> Bit 0
155 //
156 // 8-bits | 8-bits | 8-bits | 8-bits
157 // 0x20 | Blue | Green | Red
158 // 16-bits | 16-bits
159 // ------------------
160 // vp0 | np0
161 // vp2 | vp1
162 typedef struct PolyFUL3 {
163  uint8 r0, g0, b0, code0;
164  uint16 np0, vp0;
165  uint16 vp1, vp2;
166 } PolyFUL3;
167 
168 // Gouraud, Un-textured, Lit Triangle
169 // Each polygon is 4 32-bit WORDS
170 // Bit 31 ----> Bit 0
171 //
172 // 8-bits | 8-bits | 8-bits | 8-bits
173 // 0x20 | Blue | Green | Red
174 // 16-bits | 8-bits | 8-bits
175 // --------------------------
176 // vp0 | np0
177 // vp1 | np1
178 // vp2 | np2
179 typedef struct PolyGUL3 {
180  uint8 r0, g0, b0, code0;
181  uint16 np0, vp0;
182  uint16 np1, vp1;
183  uint16 np2, vp2;
184 } PolyGUL3;
185 
186 // Flat, Textured, Lit Triangle
187 // Each polygon is 5 32-bit WORDS
188 // Structure is :
189 // Bit 31 ----> Bit 0
190 //
191 // 16-bits | 8-bits | 8-bits
192 // --------------------------
193 // cba | v0 | u0
194 // tsb | v1 | u1
195 // pad | v2 | u2
196 // --------------------------
197 // vp0 | np0
198 // vp2 | vp1
199 typedef struct PolyFTL3 {
200  uint8 u0, v0;
201  uint16 cba;
202  uint8 u1, v1;
203  uint16 tsb;
204  uint8 u2, v2;
205  uint16 pad;
206  uint16 np0, vp0;
207  uint16 vp1, vp2;
208 } PolyFTL3;
209 
210 // Gouraud, Textured, Lit Triangle
211 // Each polygon is 6 32-bit WORDS
212 // Structure is :
213 // Bit 31 ----> Bit 0
214 //
215 // 16-bits | 8-bits | 8-bits
216 // --------------------------
217 // cba | v0 | u0
218 // tsb | v1 | u1
219 // pad | v2 | u2
220 // --------------------------
221 // vp0 | np0
222 // vp1 | np1
223 // vp2 | np2
224 //
225 typedef struct PolyGTL3 {
226  uint8 u0, v0;
227  uint16 cba;
228  uint8 u1, v1;
229  uint16 tsb;
230  uint8 u2, v2;
231  uint16 pad;
232  uint16 np0, vp0;
233  uint16 np1, vp1;
234  uint16 np2, vp2;
235 } PolyGTL3;
236 
237 #if (_PSX == 0) || (_PSX_ON_PC == 1)
238 
239 void MatrixToAngles(MATRIX *A, SVECTOR *rotvec);
240 
241 #endif // #if (_PSX==0) || (_PSX_ON_PC==1)
242 
243 } // End of namespace ICB
244 
245 #endif // #ifndef PSX_PCHMD_H
Definition: px_capri_maths.h:53
Definition: actor.h:32
Definition: psx_pchmd.h:199
Definition: psx_pchmd.h:162
Definition: psx_pchmd.h:112
Definition: psx_pchmd.h:72
Definition: psx_pchmd.h:225
Definition: psx_pchmd.h:179
Definition: psx_pchmd.h:139
Definition: psx_pchmd.h:90
Definition: px_capri_maths.h:38