Debian Codegraph @

renderer/HardwareDraw.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "3d.h"cxx . . $ `<file>/lib/3d.h`/
20 #include "HardwareInternal.h"cxx . . $ `<file>/renderer/HardwareInternal.h`/
21 #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/
22
23 #define roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(v) ((int)(((v) + 0.5f)))
24
25 // draws a line. takes two points. returns true if drew
26 void g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(ddgr_colorcxx . . $ ddgr_color# color, g3Pointcxx . . $ g3Point# *p0, g3Pointcxx . . $ g3Point# *p1) {
27 uint8_tcxx . . $ uint8_t# codes_or;
28 bool was_clipped = 0;
29
30 if (p0->p3_codescxx . . $ g3Point#p3_codes. & p1->p3_codescxx . . $ g3Point#p3_codes.)
31 return;
32
33 codes_or = p0->p3_codescxx . . $ g3Point#p3_codes. | p1->p3_codescxx . . $ g3Point#p3_codes.;
34
35 if (codes_or) {
36 ClipLinecxx . . $ ClipLine(c1cfda758dd1a0e3).(&p0, &p1, codes_or);
37 was_clipped = 1;
38 }
39
40 if (!(p0->p3_flagscxx . . $ g3Point#p3_flags. & PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!)) {
41 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(p0);
42 }
43
44 if (!(p1->p3_flagscxx . . $ g3Point#p3_flags. & PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!)) {
45 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(p1);
46 }
47
48 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(color);
49 rend_DrawLinecxx . . $ rend_DrawLine(748afa4755bc9595).(roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(p0->p3_sx), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(p0->p3_sy), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(p1->p3_sx), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(p1->p3_sy));
50
51 // If was clipped, free temp points
52 if (was_clipped) {
53 if (p0->p3_flagscxx . . $ g3Point#p3_flags. & PF_TEMP_POINTcxx . . $ `lib/3d.h:216:9`!) {
54 FreeTempPointcxx . . $ FreeTempPoint(4c7ad40c64d4fb9c).(p0);
55 }
56
57 if (p1->p3_flagscxx . . $ g3Point#p3_flags. & PF_TEMP_POINTcxx . . $ `lib/3d.h:216:9`!) {
58 FreeTempPointcxx . . $ FreeTempPoint(4c7ad40c64d4fb9c).(p1);
59 }
60
61 // Make sure all temp points have been freed
62 CheckTempPointscxx . . $ CheckTempPoints(49f6e7a06ebc5aa8).();
63 }
64 }
65
66 // draws a line based on the current setting of render states. takes two points. returns true if drew
67 void g3_DrawSpecialLinecxx . . $ g3_DrawSpecialLine(1b637e6b3e24914d).(g3Pointcxx . . $ g3Point# *p0, g3Pointcxx . . $ g3Point# *p1) {
68 uint8_tcxx . . $ uint8_t# codes_or;
69 bool was_clipped = 0;
70
71 if (p0->p3_codescxx . . $ g3Point#p3_codes. & p1->p3_codescxx . . $ g3Point#p3_codes.)
72 return;
73
74 codes_or = p0->p3_codescxx . . $ g3Point#p3_codes. | p1->p3_codescxx . . $ g3Point#p3_codes.;
75
76 if (codes_or) {
77
78 ClipLinecxx . . $ ClipLine(c1cfda758dd1a0e3).(&p0, &p1, codes_or);
79
80 was_clipped = 1;
81 }
82
83 if (!(p0->p3_flagscxx . . $ g3Point#p3_flags. & PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!))
84 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(p0);
85
86 if (!(p1->p3_flagscxx . . $ g3Point#p3_flags. & PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!))
87 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(p1);
88
89 rend_DrawSpecialLinecxx . . $ rend_DrawSpecialLine(1b637e6b3e24914d).(p0, p1);
90
91 // If was clipped, free temp points
92 if (was_clipped) {
93 if (p0->p3_flagscxx . . $ g3Point#p3_flags. & PF_TEMP_POINTcxx . . $ `lib/3d.h:216:9`!)
94 FreeTempPointcxx . . $ FreeTempPoint(4c7ad40c64d4fb9c).(p0);
95
96 if (p1->p3_flagscxx . . $ g3Point#p3_flags. & PF_TEMP_POINTcxx . . $ `lib/3d.h:216:9`!)
97 FreeTempPointcxx . . $ FreeTempPoint(4c7ad40c64d4fb9c).(p1);
98
99 // Make sure all temp points have been freed
100 CheckTempPointscxx . . $ CheckTempPoints(49f6e7a06ebc5aa8).();
101 }
102 }
103
104 // returns true if a plane is facing the viewer. takes the unrotated surface
105 // normal of the plane, and a point on it. The normal need not be normalized
106 bool g3_CheckNormalFacingcxx . . $ g3_CheckNormalFacing(73e76fc48bf5de61).(vectorcxx . . $ vector# *v, vectorcxx . . $ vector# *norm) {
107 vectorcxx . . $ vector# tempv;
108
109 tempv =cxx . . $ vector#`operator=`(c0842353a20857d). View_positioncxx . . $ View_position. -cxx . . $ operator-(b77b703cd1e43e33). *v;
110
111 return ((tempv *cxx . . $ `operator*`(4a721543d64e126a). *norm) > 0);
112 }
113
114 bool DoFacingCheckcxx . . $ DoFacingCheck(810f215e03522c56).(vectorcxx . . $ vector# *norm, g3Pointcxx . . $ g3Point# **vertlist, vectorcxx . . $ vector# *p) {
115 if (norm) {
116 // have normal
117 ASSERTcxx . . $ `misc/pserror.h:246:9`!(norm->x || norm->y || norm->z);
118 return g3_CheckNormalFacingcxx . . $ g3_CheckNormalFacing(73e76fc48bf5de61).(p, norm);
119 } else {
120 // normal not specified, so must compute
121 vectorcxx . . $ vector# tempv;
122 // get three points (rotated) and compute normal
123 vm_GetPerpcxx . . $ vm_GetPerp(f7eb4a62c434525d).(&tempv, &vertlist[0]->p3_veccxx . . $ g3Point#p3_vec., &vertlist[1]->p3_veccxx . . $ g3Point#p3_vec., &vertlist[2]->p3_veccxx . . $ g3Point#p3_vec.);
124 return ((tempv *cxx . . $ `operator*`(4a721543d64e126a). vertlist[1]->p3_veccxx . . $ g3Point#p3_vec.) < 0);
125 }
126 }
127
128 // like g3_DrawPoly(), but checks to see if facing. If surface normal is
129 // NULL, this routine must compute it, which will be slow. It is better to
130 // pre-compute the normal, and pass it to this function. When the normal
131 // is passed, this function works like g3_CheckNormalFacing() plus
132 // g3_DrawPoly().
133 void g3_CheckAndDrawPolycxx . . $ g3_CheckAndDrawPoly(685a53fd3174869).(int nv, g3Pointcxx . . $ g3Point# **pointlist, int bm, vectorcxx . . $ vector# *norm, vectorcxx . . $ vector# *pnt) {
134 if (DoFacingCheckcxx . . $ DoFacingCheck(810f215e03522c56).(norm, pointlist, pnt))
135 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(nv, pointlist, bm);
136 }
137
138 int Triangulate_testcxx . . $ Triangulate_test. = 0;
139
140 // draw a polygon
141 // Parameters: nv - the number of verts in the poly
142 // pointlist - a pointer to a list of pointers to points
143 // bm - the bitmap handle if texturing. ignored if flat shading
144 // Returns 0 if clipped away
145 int g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(int nv, g3Pointcxx . . $ g3Point# **pointlist, int bm, int map_type, g3Codescxx . . $ g3Codes# *clip_codes) {
146 rend_DrawPolygon3Dcxx . . $ rend_DrawPolygon3D(3928f75259b907be).(bm, pointlist, nv, map_type);
147 return 1;
148
149 /*
150 int i;
151 g3Codes cc;
152 bool was_clipped=0;
153
154 if( Triangulate_test && (nv > 3) )
155 {
156 g3Point *tripoints[3];
157 int sum=0;
158
159 for (i=0;i<nv-2;i++)
160 {
161 tripoints[0] = pointlist[0];
162 tripoints[1] = pointlist[i+1];
163 tripoints[2] = pointlist[i+2];
164 sum += g3_DrawPoly( 3, tripoints, bm, map_type );
165 }
166
167 return sum;
168 }
169
170 //Initialize or just used the ones passed in
171 if( clip_codes )
172 {
173 cc = *clip_codes;
174 }
175 else
176 {
177 cc.cc_or = 0;
178 cc.cc_and = 0xff;
179
180 //Get codes for this polygon, and copy uvls into points
181 for( i = 0; i < nv; ++i )
182 {
183 uint8_t c = pointlist[i]->p3_codes;
184 cc.cc_and &= c;
185 cc.cc_or |= c;
186 }
187 }
188
189 //All points off screen?
190 if( cc.cc_and )
191 return 0;
192
193 //One or more point off screen, so clip
194 if( cc.cc_or )
195 {
196 //Clip the polygon, getting pointer to new buffer
197 pointlist = g3_ClipPolygon( pointlist, &nv, &cc );
198
199 //Flag as clipped so temp points will be freed
200 was_clipped = 1;
201
202 //Check for polygon clipped away, or clip otherwise failed
203 if( (nv==0) || (cc.cc_or&CC_BEHIND) || cc.cc_and )
204 goto free_points;
205 }
206
207 //Make list of 2d coords (& check for overflow)
208 for( i = 0; i < nv; ++i )
209 {
210 g3Point *p = pointlist[i];
211
212 //Project if needed
213 if( !(p->p3_flags&PF_PROJECTED) )
214 {
215 g3_ProjectPoint(p);
216 }
217 }
218
219 //Draw!
220 rend_DrawPolygon3D( bm, pointlist, nv, map_type );
221
222 free_points:;
223
224 //If was clipped, free temp points
225 if( was_clipped )
226 {
227 g3_FreeTempPoints( pointlist, nv );
228 }
229
230 return 1;
231 */
232 }
233
234 // draw a sortof sphere - i.e., the 2d radius is proportional to the 3d
235 // radius, but not to the distance from the eye
236 void g3_DrawSpherecxx . . $ g3_DrawSphere(d67578e9a982745b).(ddgr_colorcxx . . $ ddgr_color# color, g3Pointcxx . . $ g3Point# *pnt, float rad) {
237 if (!(pnt->p3_codescxx . . $ g3Point#p3_codes. & CC_BEHINDcxx . . $ `lib/3d.h:230:9`!)) {
238 if (!(pnt->p3_flagscxx . . $ g3Point#p3_flags. & PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!))
239 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(pnt);
240
241 rend_FillCirclecxx . . $ rend_FillCircle(10de3014ec658f6e).(color, pnt->p3_sxcxx . . $ g3Point#p3_sx., pnt->p3_sycxx . . $ g3Point#p3_sy., (rad * Matrix_scalecxx . . $ Matrix_scale..xcxx . . $ vector#x. * Window_w2cxx . . $ Window_w2. / pnt->p3_zcxx . . $ `lib/3d.h:247:9`!));
242 }
243 }
244
245 // draws a bitmap with the specified 3d width & height
246 // If offsets are not -1, then the blitter draws not from the upper left hand
247 // corner of the bitmap, but from size*offsetx,size*offsety
248 // See Jason for explaination
249 void g3_DrawBitmapcxx . . $ g3_DrawBitmap(8d67c7afa700cf9).(vectorcxx . . $ vector# *pos, float width, float height, int bm, int color) {
250 // get the view orientation
251 matrixcxx . . $ matrix# viewOrient;
252 g3_GetUnscaledMatrixcxx . . $ g3_GetUnscaledMatrix(dca75c48c9ab5b54).(&viewOrient);
253
254 // break down the color into components
255 float r, g, b;
256 if (color != -1) {
257 float scale = 1.0f / 255.0f;
258 r = GR_COLOR_REDcxx . . $ GR_COLOR_RED(4c679297bf94b9eb).(color) * scale;
259 g = GR_COLOR_GREENcxx . . $ GR_COLOR_GREEN(4c679297bf94b9eb).(color) * scale;
260 b = GR_COLOR_BLUEcxx . . $ GR_COLOR_BLUE(4c679297bf94b9eb).(color) * scale;
261 }
262
263 // calculate the four corners
264 g3Pointcxx . . $ g3Point# corners[4], *pts[4];
265 int i;
266 for (i = 0; i < 4; ++i) {
267 pts[i] = &corners[i];
268
269 // calculate the offset for this corner
270 float cornerScaleU = ((i & 1) ^ ((i & 2) >> 1)) ? 1.0f : -1.0f;
271 float cornerScaleV = (i & 2) ? 1.0f : -1.0f;
272
273 // find the point (parallel to the view frame)
274 vectorcxx . . $ vector# cornerPos = *pos +cxx . . $ operator+(b77b703cd1e43e33). (viewOrient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (height * -cornerScaleV)) +cxx . . $ operator+(b77b703cd1e43e33). (viewOrient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (width * cornerScaleU));
275 corners[i].p3_codescxx . . $ g3Point#p3_codes. = 0;
276 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(pts[i], &cornerPos);
277
278 // setup the flags, UVs and colors
279 corners[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`!;
280 corners[i].p3_uvlcxx . . $ g3Point#p3_uvl..ucxx . . $ g3UVL#u. = (cornerScaleU * 0.5f) + 0.5f;
281 corners[i].p3_uvlcxx . . $ g3Point#p3_uvl..vcxx . . $ g3UVL#v. = (cornerScaleV * 0.5f) + 0.5f;
282 if (color == -1) {
283 corners[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_Lcxx . . $ `lib/3d.h:218:9`!;
284 corners[i].p3_uvlcxx . . $ g3Point#p3_uvl..lcxx . . $ g3UVL#$anonymous_type_0#l. = 1.0f;
285 } else {
286 corners[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!;
287 corners[i].p3_uvlcxx . . $ g3Point#p3_uvl..rcxx . . $ g3UVL#$anonymous_type_0#r. = r;
288 corners[i].p3_uvlcxx . . $ g3Point#p3_uvl..gcxx . . $ g3UVL#g. = g;
289 corners[i].p3_uvlcxx . . $ g3Point#p3_uvl..bcxx . . $ g3UVL#b. = b;
290 }
291 corners[i].p3_uvlcxx . . $ g3Point#p3_uvl..acxx . . $ g3UVL#a. = 1.0f;
292 }
293
294 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
295 rend_DrawPolygon3Dcxx . . $ rend_DrawPolygon3D(3928f75259b907be).(bm, pts, 4);
296 }
297
298 // Draws a bitmap that has been rotated about its center. Angle of rotation is passed as 'rot_angle'
299 void g3_DrawRotatedBitmapcxx . . $ g3_DrawRotatedBitmap(b3c51db2a67f6227).(vectorcxx . . $ vector# *pos, anglecxx . . $ angle# rot_angle, float width, float height, int bm, int color) {
300 // get the view orientation
301 matrixcxx . . $ matrix# viewOrient;
302 g3_GetUnscaledMatrixcxx . . $ g3_GetUnscaledMatrix(dca75c48c9ab5b54).(&viewOrient);
303
304 matrixcxx . . $ matrix# rot_matrix;
305 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&rot_matrix, 0, 0, rot_angle);
306
307 float w = width;
308 float h = height;
309
310 vectorcxx . . $ vector# rot_vectors[4];
311 rot_vectors[0].xcxx . . $ vector#x. = -w;
312 rot_vectors[0].ycxx . . $ vector#y. = h;
313
314 rot_vectors[1].xcxx . . $ vector#x. = w;
315 rot_vectors[1].ycxx . . $ vector#y. = h;
316
317 rot_vectors[2].xcxx . . $ vector#x. = w;
318 rot_vectors[2].ycxx . . $ vector#y. = -h;
319
320 rot_vectors[3].xcxx . . $ vector#x. = -w;
321 rot_vectors[3].ycxx . . $ vector#y. = -h;
322
323 g3Pointcxx . . $ g3Point# rot_points[8], *pntlist[8];
324 int i;
325 for (i = 0; i < 4; ++i) {
326 vectorcxx . . $ vector# offset;
327 rot_vectors[i].zcxx . . $ vector#z. = 0.0f;
328 vm_MatrixMulVectorcxx . . $ vm_MatrixMulVector(76352432a16beb64).(&offset, &rot_vectors[i], &rot_matrix);
329
330 vectorcxx . . $ vector# cornerPos = *pos +cxx . . $ operator+(b77b703cd1e43e33). (viewOrient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). offset.ycxx . . $ vector#y.) +cxx . . $ operator+(b77b703cd1e43e33). (viewOrient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). offset.xcxx . . $ vector#x.);
331 rot_points[i].p3_codescxx . . $ g3Point#p3_codes. = 0;
332 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&rot_points[i], &cornerPos);
333
334 rot_points[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`! | PF_RGBAcxx . . $ `lib/3d.h:219:9`!;
335 rot_points[i].p3_lcxx . . $ `lib/3d.h:252:9`! = 1.0f;
336 rot_points[i].p3_uvlcxx . . $ g3Point#p3_uvl..ucxx . . $ g3UVL#u. = ((i & 1) ^ ((i & 2) >> 1)) ? 1.0f : 0.0f;
337 rot_points[i].p3_uvlcxx . . $ g3Point#p3_uvl..vcxx . . $ g3UVL#v. = (i & 2) ? 1.0f : 0.0f;
338
339 pntlist[i] = &rot_points[i];
340 }
341
342 // And draw!!
343 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
344
345 if (color != -1) {
346 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_FLAT_GOURAUDcxx . . $ LS_FLAT_GOURAUD.);
347 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(color);
348 }
349
350 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm);
351 }
352
353 // Draws a bitmap on a specific plane. Also does rotation. Angle of rotation is passed as 'rot_angle'
354 void g3_DrawPlanarRotatedBitmapcxx . . $ g3_DrawPlanarRotatedBitmap(71c6e0d12bc5318b).(vectorcxx . . $ vector# *pos, vectorcxx . . $ vector# *norm, anglecxx . . $ angle# rot_angle, float width, float height, int bm) {
355 matrixcxx . . $ matrix# rot_matrix;
356 vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&rot_matrix, norm, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
357 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&rot_matrix);
358
359 matrixcxx . . $ matrix# twist_matrix;
360 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&twist_matrix, 0, 0, rot_angle);
361
362 float w = width;
363 float h = height;
364
365 vectorcxx . . $ vector# rot_vectors[4];
366 rot_vectors[0] =cxx . . $ vector#`operator=`(c0842353a20857d). (twist_matrix.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). -w);
367 rot_vectors[0] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (twist_matrix.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). h);
368
369 rot_vectors[1] =cxx . . $ vector#`operator=`(c0842353a20857d). (twist_matrix.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). w);
370 rot_vectors[1] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (twist_matrix.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). h);
371
372 rot_vectors[2] =cxx . . $ vector#`operator=`(c0842353a20857d). (twist_matrix.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). w);
373 rot_vectors[2] -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (twist_matrix.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). h);
374
375 rot_vectors[3] =cxx . . $ vector#`operator=`(c0842353a20857d). (twist_matrix.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). -w);
376 rot_vectors[3] -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (twist_matrix.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). h);
377
378 int i;
379 for (i = 0; i < 4; ++i) {
380 vectorcxx . . $ vector# temp_vec = rot_vectors[i];
381 vm_MatrixMulVectorcxx . . $ vm_MatrixMulVector(76352432a16beb64).(&rot_vectors[i], &temp_vec, &rot_matrix);
382 }
383
384 g3Pointcxx . . $ g3Point# rot_points[8], *pntlist[8];
385 for (i = 0; i < 4; ++i) {
386 rot_vectors[i] +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). *pos;
387
388 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&rot_points[i], &rot_vectors[i]);
389 rot_points[i].p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`! | PF_Lcxx . . $ `lib/3d.h:218:9`!;
390 rot_points[i].p3_lcxx . . $ `lib/3d.h:252:9`! = 1.0f;
391
392 pntlist[i] = &rot_points[i];
393 }
394
395 rot_points[0].p3_ucxx . . $ `lib/3d.h:250:9`! = 0.0f;
396 rot_points[0].p3_vcxx . . $ `lib/3d.h:251:9`! = 0.0f;
397
398 rot_points[1].p3_ucxx . . $ `lib/3d.h:250:9`! = 1.0f;
399 rot_points[1].p3_vcxx . . $ `lib/3d.h:251:9`! = 0.0f;
400
401 rot_points[2].p3_ucxx . . $ `lib/3d.h:250:9`! = 1.0f;
402 rot_points[2].p3_vcxx . . $ `lib/3d.h:251:9`! = 1.0f;
403
404 rot_points[3].p3_ucxx . . $ `lib/3d.h:250:9`! = 0.0f;
405 rot_points[3].p3_vcxx . . $ `lib/3d.h:251:9`! = 1.0f;
406
407 // And draw!!
408 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
409 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(4, pntlist, bm);
410 }
411
412 // Draw a wireframe box aligned with the screen. Used for the editor.
413 // Parameters: color - the color to draw the lines
414 // pnt - the center point
415 // rad - specifies the width/2 & height/2 of the box
416 void g3_DrawBoxcxx . . $ g3_DrawBox(d67578e9a982745b).(ddgr_colorcxx . . $ ddgr_color# color, g3Pointcxx . . $ g3Point# *pnt, float rad) {
417 if (!(pnt->p3_codescxx . . $ g3Point#p3_codes. & CC_BEHINDcxx . . $ `lib/3d.h:230:9`!)) {
418 if (!(pnt->p3_flagscxx . . $ g3Point#p3_flags. & PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!))
419 g3_ProjectPointcxx . . $ g3_ProjectPoint(4c7ad40c64d4fb9c).(pnt);
420
421 float w, h;
422
423 w = rad * Matrix_scalecxx . . $ Matrix_scale..xcxx . . $ vector#x. * Window_w2cxx . . $ Window_w2. / pnt->p3_zcxx . . $ `lib/3d.h:247:9`!;
424 h = rad * Matrix_scalecxx . . $ Matrix_scale..ycxx . . $ vector#y. * Window_h2cxx . . $ Window_h2. / pnt->p3_zcxx . . $ `lib/3d.h:247:9`!;
425
426 rend_DrawLinecxx . . $ rend_DrawLine(748afa4755bc9595).(roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sx - w), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sy - h), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sx + w), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sy - h));
427 rend_DrawLinecxx . . $ rend_DrawLine(748afa4755bc9595).(roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sx + w), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sy - h), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sx + w), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sy + h));
428 rend_DrawLinecxx . . $ rend_DrawLine(748afa4755bc9595).(roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sx + w), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sy + h), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sx - w), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sy + h));
429 rend_DrawLinecxx . . $ rend_DrawLine(748afa4755bc9595).(roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sx - w), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sy + h), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sx - w), roundcxx . . $ `renderer/HardwareDraw.cpp:23:9`!(pnt->p3_sy - h));
430 }
431 }
432
433 // Sets the triangulation test to on or off
434 void g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(int state) { Triangulate_testcxx . . $ Triangulate_test. = state; }