DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
frame.cpp
1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#pragma name_counter 548
4
5#include "frame.hpp"
6
7#include <libdma.h>
8#include <libgraph.h>
9#include <libpkt.h>
10#include <libvu0.h>
11
12#include <cstring>
13
14#include "collision.hpp"
15#include "framevu1.hpp"
16#include "mathutil.hpp"
17#include "mglib.hpp"
18#include "renderinfo.hpp"
19#include "visualvu1.hpp"
20
21void *operator new(size_t size, u_long128 *block) {
22 return block;
23}
24
25void *operator new[](size_t size, u_long128 *block) {
26 return block;
27}
28
29void DevInit() {
30 sceDmaEnv env;
31
32 sceDmaReset(1);
33 sceDmaGetEnv(&env);
34 env.notify = 0x100;
35 sceDmaPutEnv(&env);
36 sceGsResetPath();
37}
38#ifndef PORT
39/* The two matrix operations the frame does often enough to spell out. Both exist in the vector
40 library as calls; done inline the arithmetic costs less than the call around it would, and the
41 unit's accumulator does a whole row of a multiply in one pass. The pointers are register
42 variables because that is how an assembly block reaches a value the compiler is holding. */
43static inline void MulFrameMatrix(sceVu0FMATRIX m0, sceVu0FMATRIX m1, sceVu0FMATRIX m2) {
44 register float *out = &m0[0][0];
45 register float *left = &m1[0][0];
46 register float *right = &m2[0][0];
47
48 asm {
49 lqc2 vf5, 0(right)
50 lqc2 vf1, 0(left)
51 lqc2 vf2, 16(left)
52 lqc2 vf3, 32(left)
53 lqc2 vf4, 48(left)
54 vmulax ACC, vf1, vf5
55 vmadday ACC, vf2, vf5
56 vmaddaz ACC, vf3, vf5
57 vmaddw vf20, vf4, vf5
58 lqc2 vf6, 16(right)
59 lqc2 vf7, 32(right)
60 lqc2 vf8, 48(right)
61 vmulax ACC, vf1, vf6
62 vmadday ACC, vf2, vf6
63 vmaddaz ACC, vf3, vf6
64 vmaddw vf21, vf4, vf6
65 vmulax ACC, vf1, vf7
66 vmadday ACC, vf2, vf7
67 vmaddaz ACC, vf3, vf7
68 vmaddw vf22, vf4, vf7
69 vmulax ACC, vf1, vf8
70 vmadday ACC, vf2, vf8
71 vmaddaz ACC, vf3, vf8
72 vmaddw vf23, vf4, vf8
73 sqc2 vf20, 0(out)
74 sqc2 vf21, 16(out)
75 sqc2 vf22, 32(out)
76 sqc2 vf23, 48(out)
77 }
78}
79
80/* vf0's w is the constant one, which is what lets the row that carries the translation go through
81 the same multiply as the three the scale applies to. */
82static inline void ScaleMatrix(sceVu0FMATRIX m0, sceVu0FMATRIX m1, sceVu0FVECTOR scale) {
83 register float *out = &m0[0][0];
84 register float *in = &m1[0][0];
85 register float *by = &scale[0];
86
87 asm {
88 lqc2 vf10, 0(by)
89 lqc2 vf1, 0(in)
90 lqc2 vf2, 16(in)
91 lqc2 vf3, 32(in)
92 lqc2 vf4, 48(in)
93 vmulx vf1, vf1, vf10
94 vmuly vf2, vf2, vf10
95 vmulz vf3, vf3, vf10
96 vmulw vf4, vf4, vf0
97 sqc2 vf1, 0(out)
98 sqc2 vf2, 16(out)
99 sqc2 vf3, 32(out)
100 sqc2 vf4, 48(out)
101 }
102}
103
104/* A whole matrix in four quadwords, held in four registers so that none of the loads waits on a
105 store. Written out because the same copy spelled in C costs a fresh address for every row: the
106 compiler pairs each load with its store and recomputes the source, which is three instructions
107 more and no faster. */
108static inline void CopyMatrix(sceVu0FMATRIX m0, sceVu0FMATRIX m1) {
109 register float *in = &m1[0][0];
110 register float *out = &m0[0][0];
111
112 asm {
113 lq $6, 0(in)
114 lq $7, 16(in)
115 lq $8, 32(in)
116 lq $9, 48(in)
117 sq $6, 0(out)
118 sq $7, 16(out)
119 sq $8, 32(out)
120 sq $9, 48(out)
121 }
122}
123
124/* vf15 minus itself is the zero the unit already has, so wiping a matrix costs one arithmetic
125 instruction and four stores rather than a constant to load. */
126static inline void ZeroMatrix(sceVu0FMATRIX m0) {
127 register float *out = &m0[0][0];
128
129 asm {
130 vsub vf15, vf15, vf15
131 sqc2 vf15, 0(out)
132 sqc2 vf15, 16(out)
133 sqc2 vf15, 32(out)
134 sqc2 vf15, 48(out)
135 }
136}
137
138/* The screen extent of eight already-transformed corners. Each is divided through by the magnitude
139 of its own depth, so a corner behind the camera folds onto the side it came from instead of
140 changing sign, and the eight results are reduced to one pair of extremes. It is written as one
141 block because the divider is what costs: every division is issued a whole quadword of work
142 before its result is waited on, which is what the interleaving here is for. */
143static inline void ScreenBound(sceVu0FVECTOR *screen, sceVu0FVECTOR max, sceVu0FVECTOR min) {
144 register float *in = &screen[0][0];
145 register float *hi = &max[0];
146 register float *lo = &min[0];
147
148 asm {
149 lqc2 vf10, 0(in)
150 lqc2 vf11, 16(in)
151 lqc2 vf12, 32(in)
152 lqc2 vf13, 48(in)
153 vabs.z vf20, vf10
154 vabs.z vf21, vf11
155 vabs.z vf22, vf12
156 vabs.z vf23, vf13
157 vdiv Q, vf0w, vf20z
158 lqc2 vf14, 64(in)
159 lqc2 vf15, 80(in)
160 lqc2 vf16, 96(in)
161 lqc2 vf17, 112(in)
162 vwaitq
163 vmulq.xy vf10, vf10, Q
164 vdiv Q, vf0w, vf21z
165 vabs.z vf24, vf14
166 vabs.z vf25, vf15
167 vabs.z vf26, vf16
168 vabs.z vf27, vf17
169 vwaitq
170 vmulq.xy vf11, vf11, Q
171 vdiv Q, vf0w, vf22z
172 vwaitq
173 vmulq.xy vf12, vf12, Q
174 vdiv Q, vf0w, vf23z
175 vmax vf30, vf10, vf11
176 vmini vf31, vf10, vf11
177 vwaitq
178 vmulq.xy vf13, vf13, Q
179 vmax vf30, vf30, vf12
180 vmini vf31, vf31, vf12
181 vdiv Q, vf0w, vf24z
182 vwaitq
183 vmulq.xy vf14, vf14, Q
184 vdiv Q, vf0w, vf25z
185 vmax vf30, vf30, vf13
186 vmini vf31, vf31, vf13
187 vwaitq
188 vmulq.xy vf15, vf15, Q
189 vdiv Q, vf0w, vf26z
190 vmax vf30, vf30, vf14
191 vmini vf31, vf31, vf14
192 vwaitq
193 vmulq.xy vf16, vf16, Q
194 vdiv Q, vf0w, vf27z
195 vmax vf30, vf30, vf15
196 vmini vf31, vf31, vf15
197 vmax vf30, vf30, vf16
198 vmini vf31, vf31, vf16
199 vwaitq
200 vmulq.xy vf17, vf17, Q
201 vnop
202 vnop
203 vmax vf30, vf30, vf17
204 vmini vf31, vf31, vf17
205 sqc2 vf30, 0(hi)
206 sqc2 vf31, 0(lo)
207 }
208}
209#endif
210/* The rotation a frame carries is stored as a quaternion whose scalar part comes first, so the
211 caller's four floats are w, x, y, z in that order. */
212static void QuatToMat(float *quaternion, sceVu0FMATRIX matrix) {
213 float wx;
214 float wy;
215 float wz;
216 float xx;
217 float yy;
218 float yz;
219 float xy;
220 float xz;
221 float zz;
222 float x2;
223 float y2;
224 float z2;
225
226 x2 = quaternion[1] + quaternion[1];
227 y2 = quaternion[2] + quaternion[2];
228 z2 = quaternion[3] + quaternion[3];
229
230 xx = quaternion[1] * x2;
231 xy = quaternion[1] * y2;
232 xz = quaternion[1] * z2;
233 yy = quaternion[2] * y2;
234 yz = quaternion[2] * z2;
235 zz = quaternion[3] * z2;
236 wx = quaternion[0] * x2;
237 wy = quaternion[0] * y2;
238 wz = quaternion[0] * z2;
239
240 matrix[0][0] = 1.0f - (yy + zz);
241 matrix[1][0] = xy - wz;
242 matrix[2][0] = xz + wy;
243 matrix[3][0] = 0.0f;
244
245 matrix[0][1] = xy + wz;
246 matrix[1][1] = 1.0f - (xx + zz);
247 matrix[2][1] = yz - wx;
248 matrix[3][1] = 0.0f;
249
250 matrix[0][2] = xz - wy;
251 matrix[1][2] = yz + wx;
252 matrix[2][2] = 1.0f - (xx + yy);
253 matrix[3][2] = 0.0f;
254
255 matrix[0][3] = 0.0f;
256 matrix[1][3] = 0.0f;
257 matrix[2][3] = 0.0f;
258 matrix[3][3] = 1.0f;
259}
260
261void CFrameAttr::Initialize() {
262 clip_depth = 0.0f;
264 far_clip = 0.0f;
265 use_color = false;
266 color[0] = color[1] = color[2] = color[3] = 128.0f;
267 alpha_ref = -1;
268 draw_on = 1;
269 depth_write = true;
270 ignore_depth = false;
271 eye_relative = false;
272 billboard = 0;
273 blend_mode = 0;
274 cull_enable = true;
275 ambient_boost = false;
276 unk_40[0] = unk_40[2] = unk_40[3] = 0.0f;
277 unk_40[1] = 1.0f;
278}
279
280CFrameAttr::CFrameAttr() {
281 Initialize();
282}
283
284void CFrame::Initialize() {
285 int i;
286
287 world_valid = false;
288 no_rotation = true;
289
290 parent = child = brother = elder = 0;
291
292 scale[0] = scale[1] = scale[2] = scale[3] = 1.0f;
293 position[0] = position[1] = position[2] = position[3] = 0.0f;
294 rotation[0] = rotation[1] = rotation[2] = rotation[3] = 0.0f;
295
296 max[0] = max[1] = max[2] = 0.0f;
297 min[0] = min[1] = min[2] = 0.0f;
298
299 sceVu0UnitMatrix(world);
300 sceVu0UnitMatrix(inverse);
301 sceVu0UnitMatrix(local);
302
303 for (i = 0; i < 8; i++) {
304 corner[i][0] = 0.0f;
305 corner[i][1] = 0.0f;
306 corner[i][2] = 0.0f;
307 corner[i][3] = 1.0f;
308 }
309
310 attr.Initialize();
311
312 flags = 1;
313 collision = 0;
314 name[0] = '\0';
315 rot_type = 0;
316 srt = false;
317 reference = false;
318}
319
320void CFrame::SetPosition(float x, float y, float z) {
321 srt = true;
322
323 if (position[0] == x && position[1] == y && position[2] == z) {
324 return;
325 }
326
327 position[0] = x;
328 position[1] = y;
329 position[2] = z;
330 world_valid = false;
331}
332
333void CFrame::SetPosition(float *position) {
334 srt = true;
335
336 if (this->position[0] == position[0] && this->position[1] == position[1] && this->position[2] == position[2]) {
337 return;
338 }
339
340 this->position[0] = position[0];
341 this->position[1] = position[1];
342 this->position[2] = position[2];
343 world_valid = false;
344}
345
346void CFrame::SetScale(float x, float y, float z) {
347 if (scale[0] == x && scale[1] == y && scale[2] == z) {
348 return;
349 }
350
351 scale[0] = x;
352 scale[1] = y;
353 scale[2] = z;
354 world_valid = false;
355}
356
357void CFrame::SetScale(float *scale) {
358 if (this->scale[0] == scale[0] && this->scale[1] == scale[1] && this->scale[2] == scale[2]) {
359 return;
360 }
361
362 this->scale[0] = scale[0];
363 this->scale[1] = scale[1];
364 this->scale[2] = scale[2];
365 world_valid = false;
366}
367
368int CFrame::GetFrameNum() {
369 int num;
370 CFrame *frame;
371
372 num = 1;
373
374 for (frame = child; frame != 0; frame = frame->brother) {
375 num += frame->GetFrameNum();
376 }
377
378 return num;
379}
380
381void CFrame::SetParent(CFrame *parent) {
382 if (this->parent != 0) {
383 return;
384 }
385
386 this->parent = parent;
387
388 if (parent == 0) {
389 return;
390 }
391
392 parent->SetChild(this);
393}
394
395void CFrame::SetBrother(CFrame *brother) {
396 if (brother == 0) {
397 return;
398 }
399
400 if (this->brother != 0) {
401 this->brother->SetBrother(brother);
402 return;
403 }
404
405 this->brother = brother;
406 this->brother->elder = this;
407}
408
409void CFrame::SetChild(CFrame *child) {
410 if (child == 0) {
411 this->child = 0;
412 return;
413 }
414
415 if (this->child != 0) {
416 this->child->SetBrother(child);
417 return;
418 }
419
420 this->child = child;
421 this->child->parent = this;
422}
423
424void CFrame::SetReference(CFrame *reference) {
425 if (reference == 0) {
426 return;
427 }
428
430 this->reference = true;
431}
432
433void CFrame::DeleteReference() {
434 parent = 0;
435 reference = false;
436}
437
438/* The frame's world matrix, rebuilt unless the cache and every cache above it in the chain are
439 still current. Rebuilding one invalidates the caches of the frame's children, since their
440 world matrices were composed with the matrix that just changed. */
441void CFrame::GetLWMatrix(sceVu0FMATRIX matrix) {
442 sceVu0FMATRIX parent_world;
443 sceVu0FMATRIX local_matrix;
444 sceVu0FVECTOR translation;
445 CFrame *frame;
446 CFrame *sibling;
447
448 /* A referenced frame follows a frame that is not its parent, so nothing on that frame's side
449 clears this cache when it moves and it can never be trusted. */
450 if (reference) {
451 world_valid = false;
452 }
453
454 if (world_valid) {
455 if (!parent) {
456 sceVu0CopyMatrix(matrix, world);
457 return;
458 }
459
460 frame = parent;
461
462 while (frame) {
463 if (!frame->world_valid) {
464 break;
465 }
466
467 frame = frame->parent;
468
469 if (!frame) {
470 sceVu0CopyMatrix(matrix, world);
471 return;
472 }
473 }
474 }
475
476 if (this->child) {
477 this->child->world_valid = false;
478 sibling = this->child;
479
480 if (sibling->brother) {
481 while (sibling->brother) {
482 sibling->brother->world_valid = false;
483 sibling = sibling->brother;
484 }
485 }
486 }
487
488 if (srt) {
489 ScaleMatrix(local_matrix, this->local, scale);
490
491 /* Rotation type 2 turns about the frame's own origin rather than the parent's, so the
492 translation is taken out before the rotation and added back after it. */
493 if (rot_type & 2) {
494 sceVu0CopyVector(translation, local_matrix[3]);
495 local_matrix[3][0] = local_matrix[3][1] = local_matrix[3][2] = 0.0f;
496 }
497
498 if (rot_type & 1) {
499 if (rotation[0] != 0.0f) {
500 sceVu0RotMatrixX(local_matrix, local_matrix, rotation[0]);
501 }
502
503 if (rotation[1] != 0.0f) {
504 sceVu0RotMatrixY(local_matrix, local_matrix, rotation[1]);
505 }
506
507 if (rotation[2] != 0.0f) {
508 sceVu0RotMatrixZ(local_matrix, local_matrix, rotation[2]);
509 }
510 }
511
512 if (rot_type & 2) {
513 sceVu0AddVector(local_matrix[3], translation, position);
514 } else {
515 sceVu0AddVector(local_matrix[3], local_matrix[3], position);
516 }
517 } else {
518 sceVu0CopyMatrix(local_matrix, this->local);
519 }
520
521 frame = parent;
522
523 if (!frame) {
524 sceVu0CopyMatrix(world, local_matrix);
525 sceVu0CopyMatrix(matrix, world);
526 world_valid = true;
527 return;
528 }
529
530 if (frame->attr.billboard) {
531 sceVu0CopyMatrix(parent_world, frame->world);
532 } else {
533 frame->GetLWMatrix(parent_world);
534 }
535
536 MulFrameMatrix(world, parent_world, local_matrix);
537 sceVu0CopyMatrix(matrix, world);
538 world_valid = true;
539}
540
541float (*CFrame::GetInverseMatrix())[4] {
542 sceVu0FMATRIX world_matrix;
543
544 GetLWMatrix(world_matrix);
545 sceVu0InversMatrix(inverse, world_matrix);
546
547 return inverse;
548}
549
550void CFrame::SetTransMatrix(sceVu0FMATRIX matrix) {
551 sceVu0CopyMatrix(local, matrix);
552 world_valid = false;
553}
554
555/* A quaternion says nothing about where the frame is, so the translation row of the local matrix
556 has to survive being overwritten by the rotation it produces. */
557void CFrame::SetTransMatrix(float *quaternion) {
558 sceVu0FVECTOR translation;
559
560 world_valid = false;
561 *(u_long128 *) translation = *(u_long128 *) local[3];
562 QuatToMat(quaternion, local);
563 *(u_long128 *) local[3] = *(u_long128 *) translation;
564}
565
566/* Only the stem before a "__" identifies a frame, so both sides are measured to it first and a
567 difference in stem length settles the answer without comparing a character. */
568static int StrCmp(char *left, char *right) {
569 char *left_cursor;
570 char *right_cursor;
571 char ch;
572 int left_length;
573 int right_length;
574 int i;
575
576 left_cursor = left;
577 right_cursor = right;
578 left_length = 0;
579 right_length = 0;
580
581 while ((ch = *left_cursor) != '\0') {
582 if (ch == '_' && left_cursor[1] == '_') {
583 break;
584 }
585
586 left_length++;
587 left_cursor++;
588 }
589
590 while ((ch = *right_cursor) != '\0') {
591 if (ch == '_' && right_cursor[1] == '_') {
592 break;
593 }
594
595 right_length++;
596 right_cursor++;
597 }
598
599 if (left_length != right_length) {
600 return 0;
601 }
602
603 for (i = 0; i < left_length; i++) {
604 if (*left != *right) {
605 return 0;
606 }
607
608 left++;
609 right++;
610 }
611
612 return 1;
613}
614
615int FrameNameComp(char *left, char *right) {
616 return StrCmp(left, right);
617}
618
619CFrame *CFrame::SearchFrame(char *name) {
620 CFrame *frame;
621 CFrame *found;
622
623 if (StrCmp(this->name, name)) {
624 return this;
625 }
626
627 for (frame = child; frame != 0; frame = frame->brother) {
628 found = frame->SearchFrame(name);
629
630 if (found != 0) {
631 return found;
632 }
633 }
634
635 return 0;
636}
637
638/* Without a parent the frame's own extent is already in the space the caller wants; with one it is
639 the eight corners run through the local transform, which is why the corners are kept at all. */
640void CFrame::GetBoundBox(CBoxVu0 *box, int children) {
641 sceVu0FVECTOR low;
642 sceVu0FVECTOR high;
643 sceVu0FVECTOR point;
644 CBoxVu0 child_box;
645 CFrame *frame;
646 int i;
647
648 low[0] = min[0];
649 low[1] = min[1];
650 low[2] = min[2];
651 low[3] = 1.0f;
652
653 high[0] = max[0];
654 high[1] = max[1];
655 high[2] = max[2];
656 high[3] = 1.0f;
657
658 if (parent == 0) {
659 sceVu0CopyVector(box->min, low);
660 sceVu0CopyVector(box->max, high);
661 } else {
662 sceVu0ApplyMatrix(box->max, local, corner[0]);
663 sceVu0CopyVector(box->min, box->max);
664
665 for (i = 1; i < 8; i++) {
666 sceVu0ApplyMatrix(point, local, corner[i]);
667 VectorMaxMin(box->max, box->min, point, box->max, box->min);
668 }
669 }
670
671 if (children == 0) {
672 return;
673 }
674
675 for (frame = child; frame != 0; frame = frame->brother) {
676 frame->GetBoundBox(&child_box, 1);
677 VectorMaxMin(box->max, box->min, box->max, box->min, child_box.max, child_box.min);
678 }
679}
680
681/* Scaling about the centre rather than the origin, so a bound stays where the frame is. */
682void CFrame::ScaleBoundBox(float *scale) {
683 sceVu0FVECTOR center;
684 sceVu0FVECTOR dmax;
685 sceVu0FVECTOR dmin;
686 sceVu0FVECTOR new_max;
687 sceVu0FVECTOR new_min;
688 float *bound[2];
689 int i;
690
691 new_max[0] = this->max[0];
692 new_max[1] = this->max[1];
693 new_max[2] = this->max[2];
694
695 new_min[0] = this->min[0];
696 new_min[1] = this->min[1];
697 new_min[2] = this->min[2];
698
699 sceVu0AddVector(center, new_max, new_min);
700 sceVu0ScaleVector(center, center, 0.5f);
701 sceVu0SubVector(dmax, new_max, center);
702 sceVu0SubVector(dmin, new_min, center);
703
704 dmax[0] *= scale[0];
705 dmax[1] *= scale[1];
706 dmax[2] *= scale[2];
707
708 dmin[0] *= scale[0];
709 dmin[1] *= scale[1];
710 dmin[2] *= scale[2];
711
712 sceVu0AddVector(new_max, dmax, center);
713 sceVu0AddVector(new_min, dmin, center);
714
715 this->max[0] = new_max[0];
716 this->max[1] = new_max[1];
717 this->max[2] = new_max[2];
718
719 this->min[0] = new_min[0];
720 this->min[1] = new_min[1];
721 this->min[2] = new_min[2];
722
723 bound[0] = this->min;
724 bound[1] = this->max;
725
726 for (i = 0; i < 8; i++) {
727 this->corner[i][3] = 1.0f;
728 this->corner[i][0] = bound[(i & 1) != 0][0];
729 this->corner[i][1] = bound[(i & 2) != 0][1];
730 this->corner[i][2] = bound[(i & 4) != 0][2];
731 }
732}
733
734void CFrame::SetAttr(CFrameAttr &attr, int children, int mask) {
735 CFrame *frame;
736
737 if (mask == 0) {
738 this->attr = attr;
739 } else {
740 if (mask & 0x1) {
741 this->attr.draw_on = attr.draw_on;
742 }
743
744 if (mask & 0x2) {
745 this->attr.clip_depth = attr.clip_depth;
746 }
747
748 if (mask & 0x4) {
749 this->attr.clip_enable = attr.clip_enable;
750 }
751
752 if (mask & 0x8) {
753 this->attr.unk_09 = attr.unk_09;
754 }
755
756 if (mask & 0x10) {
758 }
759
760 if (mask & 0x20) {
762 }
763
764 if (mask & 0x40) {
765 this->attr.fog_enable = attr.fog_enable;
766 }
767
768 if (mask & 0x80) {
770 }
771
772 if (mask & 0x100) {
773 this->attr.far_clip = attr.far_clip;
774 }
775
776 if (mask & 0x200) {
777 this->attr.use_color = attr.use_color;
778 }
779
780 if (mask & 0x400) {
781 *(u_long128 *) this->attr.color = *(u_long128 *) attr.color;
782 }
783
784 if (mask & 0x800) {
785 this->attr.alpha_ref = attr.alpha_ref;
786 }
787
788 if (mask & 0x1000) {
789 this->attr.depth_write = attr.depth_write;
790 }
791
792 if (mask & 0x2000) {
793 this->attr.eye_relative = attr.eye_relative;
794 }
795
796 if (mask & 0x4000) {
797 this->attr.billboard = attr.billboard;
798 }
799
800 if (mask & 0x8000) {
801 this->attr.blend_mode = attr.blend_mode;
802 }
803
804 if (mask & 0x10000) {
805 this->attr.ignore_depth = attr.ignore_depth;
806 }
807 }
808
809 if (children == 0) {
810 return;
811 }
812
813 for (frame = child; frame != 0; frame = frame->brother) {
814 frame->SetAttr(attr, 1, mask);
815 }
816}
817
818void CFrame::GetWorldPosition(float *world_point, float *local_point) {
819 sceVu0FMATRIX matrix;
820
821 local_point[3] = 1.0f;
822 GetLWMatrix(matrix);
823 sceVu0ApplyMatrix(world_point, matrix, local_point);
824}
825
826void CFrame::SetRotation(float x, float y, float z) {
827 srt = true;
828 no_rotation = false;
829 rotation[3] = 0.0f;
830
831 if (rotation[0] == x && rotation[1] == y && rotation[2] == z) {
832 return;
833 }
834
835 world_valid = false;
836 rot_type |= 1;
837 rotation[0] = x;
838 rotation[1] = y;
839 rotation[2] = z;
840}
841
842void CFrame::GetRotation(float *rotation) {
843 if (no_rotation != 0) {
844 rotation[0] = rotation[1] = rotation[2] = rotation[3] = 0.0f;
845 return;
846 }
847
848 sceVu0CopyVector(rotation, this->rotation);
849}
850
851void CFrame::SetRotType(int type) {
852 rot_type = type;
853
854 if (type & 0x2) {
855 rot_type |= 1;
856 }
857}
858
859/* A copied frame is a frame of its own: it keeps the transform and the attributes and none of the
860 place in the hierarchy the original held. */
861CFrame &CFrame::operator=(CFrame &other) {
862 memcpy(this, &other, sizeof(CFrame));
863
864 parent = child = brother = 0;
865 world_valid = false;
866 no_rotation = false;
867
868 return *this;
869}
870
871/* The shadow the frame casts is a plane projection, and the plane is carried as a point and a
872 normal rather than as four coefficients. Both are turned into one vector d with x.d == 1 over the
873 plane, which is what lets the projection be written without a division per point. A plane through
874 the origin has no such vector, so a point that lands there is pushed a tenth of a unit back along
875 the normal instead of failing. */
876static void ShadowMatrix(sceVu0FMATRIX matrix, sceVu0FMATRIX light, float *point, float *normal) {
877 sceVu0FVECTOR direction;
878 sceVu0FVECTOR plane;
879 sceVu0FVECTOR axis;
880 float dx;
881 float dy;
882 float dz;
883 float nx;
884 float ny;
885 float nz;
886 float depth;
887 float scale;
888 float t;
889
890 direction[0] = light[0][0];
891 direction[1] = light[1][0];
892 direction[2] = light[2][0];
893 direction[3] = 0.0f;
894
895 sceVu0CopyVector(plane, point);
896 sceVu0CopyVector(axis, normal);
897
898 t = sceVu0InnerProduct(axis, plane);
899
900 if (t == 0.0f) {
901 plane[0] -= 0.1f * axis[0];
902 plane[1] -= 0.1f * axis[1];
903 plane[2] -= 0.1f * axis[2];
904 t = sceVu0InnerProduct(axis, plane);
905 }
906
907 t = 1.0f / t;
908 dx = axis[0] * t;
909 dy = axis[1] * t;
910 dz = axis[2] * t;
911
912 sceVu0Normalize(direction, direction);
913
914 nx = direction[0];
915 ny = direction[1];
916 nz = direction[2];
917
918 depth = dx * nx + dy * ny + dz * nz;
919 scale = -1.0f / depth;
920
921 matrix[0][0] = scale * (dx * nx - depth);
922 matrix[1][0] = scale * (dy * nx);
923 matrix[2][0] = scale * (dz * nx);
924 matrix[3][0] = scale * -nx;
925 matrix[0][1] = scale * (dx * ny);
926 matrix[1][1] = scale * (dy * ny - depth);
927 matrix[2][1] = scale * (dz * ny);
928 matrix[3][1] = scale * -ny;
929 matrix[0][2] = scale * (dx * nz);
930 matrix[1][2] = scale * (dy * nz);
931 matrix[2][2] = scale * (dz * nz - depth);
932 matrix[3][2] = scale * -nz;
933 matrix[0][3] = 0.0f;
934 matrix[1][3] = 0.0f;
935 matrix[2][3] = 0.0f;
936 matrix[3][3] = scale * -depth;
937}
938
939/* The shadow doubles the volume a frame has to be clipped against: what is drawn is the box that
940 holds both the frame's own corners and the same corners flattened onto the plane, so the two
941 sets are reduced to one bound and that bound's own corners go to the screen. */
942static void ShadowClipBox(sceVu0FVECTOR *screen, sceVu0FVECTOR *corner, sceVu0FMATRIX matrix, RenderInfo *info) {
943 sceVu0FMATRIX shadow;
944 sceVu0FVECTOR flat[8];
945 sceVu0FVECTOR world[8];
946 /* Only two of these are ever filled. The frame reserves 64 bytes for the array, which is
947 what rules two out, and nothing addresses the pair beyond. */
948 sceVu0FVECTOR extent[4];
949 sceVu0FVECTOR max[4];
950 sceVu0FVECTOR min[4];
951 int i;
952
953 ApplyMatrixN(world, matrix, corner, 8);
954 MulFrameMatrix(shadow, info->shadow, matrix);
955 ApplyMatrixN(flat, shadow, corner, 8);
956
957 VectorMaxMin(max[0], min[0], world[0], world[1], world[2], world[3]);
958 VectorMaxMin(max[1], min[1], world[4], world[5], world[6], world[7]);
959 VectorMaxMin(max[2], min[2], flat[0], flat[1], flat[2], flat[3]);
960 VectorMaxMin(max[3], min[3], flat[4], flat[5], flat[6], flat[7]);
961 VectorMax(extent[0], max[0], max[1], max[2], max[3]);
962 VectorMin(extent[1], min[0], min[1], min[2], min[3]);
963
964 for (i = 0; i < 8; i++) {
965 world[i][3] = 1.0f;
966 world[i][0] = extent[(i & 1) != 0][0];
967 world[i][1] = extent[(i & 2) != 0][1];
968 world[i][2] = extent[(i & 4) != 0][2];
969 }
970
971 ApplyMatrixN(screen, info->view_scaled, world, 8);
972}
973
974/* The three registers a frame is drawn under, written straight into a word cursor the caller
975 already holds rather than through a packet: one counted DMA tag, a DIRECT code, and a GIF tag of
976 three A+D pairs. The answer is the number of words written, not quadwords. */
977static int SetGsReg3(u_int *p, u_long *test, u_long *zbuf, u_long *alpha) {
978 p[0] = 0x10000005;
979 p[1] = 0;
980 p[2] = 0;
981 p[3] = 0;
982 p[4] = 0;
983 p[5] = 0;
984 p[6] = 0;
985 p[7] = 0x50000004;
986 p[8] = 0x00008001;
987 p[9] = 0x30000000;
988 p[10] = 0x00000eee;
989 p[11] = 0;
990 *(u_long *) (p + 12) = *test;
991 p[14] = SCE_GS_TEST_1;
992 p[15] = 0;
993 *(u_long *) (p + 16) = *zbuf;
994 p[18] = SCE_GS_ZBUF_1;
995 p[19] = 0;
996 *(u_long *) (p + 20) = *alpha;
997 p[22] = SCE_GS_ALPHA_1;
998 p[23] = 0;
999
1000 return 24;
1001}
1002
1003/* A frame draws its own visual and then its children's, into a cursor the caller owns rather than
1004 into a packet, and answers how many words it spent - which is what lets a whole hierarchy go into
1005 one packet without anybody counting for it.
1006
1007 Four things happen in order. The world matrix is either asked for or, for a frame the attributes
1008 turn towards the camera, built here from the camera's position and the axis lengths of the one
1009 the hierarchy would have given. The bound's eight corners go to the screen and decide whether
1010 anything is drawn at all. The GS registers the attributes ask for go down the packet and are put
1011 back after. And the light the frame supplies itself, where it does, replaces the scene's for the
1012 length of its own draw and no longer.
1013
1014 A frame turned towards the camera cannot take its transform from the hierarchy, so it writes its
1015 own into the cache and invalidates its children's - which is the one place a draw moves anything.
1016 Its children then take the cached matrix as it stands, because the attribute that turns the
1017 frame is also what GetLWMatrix reads on a parent to mean exactly that. */
1018int CFrameVu1::DrawVu1(unsigned int *packet, RenderInfo *info) {
1019 u_int *start = packet;
1020 sceVu0FMATRIX matrix;
1021 sceVu0FMATRIX screen_matrix;
1022 sceVu0FMATRIX turn;
1023 sceVu0FMATRIX light;
1024 sceVu0FVECTOR ambient;
1025 sceVu0FVECTOR direction;
1026 sceVu0FVECTOR world_position;
1027 sceVu0FVECTOR origin = {0.0f, 0.0f, 0.0f, 1.0f};
1028 sceVu0FVECTOR screen_corner[8];
1029 sceVu0FMATRIX world_matrix;
1030 sceVu0FVECTOR screen_max;
1031 sceVu0FVECTOR screen_min;
1032 sceVu0FVECTOR color;
1033 int near_clip = 0;
1034 int far_clip = 0;
1035 int visible = true;
1036 sceGsTest test = mgPixelTest;
1037 sceGsZbuf zbuf = mgZBuffer;
1038 sceGsAlpha alpha;
1039 CFrame *sibling;
1040 CFrame *frame;
1041 float height;
1042 float axis_x;
1043 float axis_y;
1044 float axis_z;
1045 float inv_scale;
1046 float flat;
1047 float half_width;
1048 float half_height;
1049 float near_z;
1050 float far_z;
1051 float depth;
1052 int done;
1053
1054 if (attr.billboard) {
1055 world_valid = false;
1056 GetWorldPosition(world_position, origin);
1057 GetLWMatrix(world_matrix);
1058 axis_x = DistVector(world_matrix[0]);
1059 axis_y = DistVector(world_matrix[1]);
1060 axis_z = DistVector(world_matrix[2]);
1061
1062 if ((attr.billboard & 2) && !(attr.billboard & 1)) {
1063 sceVu0CopyMatrix(matrix, mgUnitMatrix);
1064 sceVu0SubVector(matrix[2], info->view_position, world_position);
1065 matrix[2][1] = 0.0f;
1066 matrix[2][3] = 0.0f;
1067 sceVu0Normalize(matrix[2], matrix[2]);
1068 matrix[0][0] = matrix[2][2];
1069 matrix[0][2] = -matrix[2][0];
1070 }
1071
1072 if ((attr.billboard & 2) && (attr.billboard & 1)) {
1073 sceVu0UnitMatrix(turn);
1074 sceVu0SubVector(direction, info->view_position, world_position);
1075 sceVu0Normalize(direction, direction);
1076 height = direction[1];
1077 direction[1] = 0.0f;
1078 direction[3] = 0.0f;
1079 flat = DistVector(direction);
1080 turn[1][1] = flat;
1081 turn[1][2] = -height;
1082 turn[2][1] = height;
1083 turn[2][2] = flat;
1084
1085 sceVu0CopyMatrix(matrix, mgUnitMatrix);
1086 sceVu0SubVector(matrix[2], info->view_position, world_position);
1087 matrix[2][1] = 0.0f;
1088 matrix[2][3] = 0.0f;
1089 sceVu0Normalize(matrix[2], matrix[2]);
1090 matrix[0][0] = matrix[2][2];
1091 matrix[0][2] = -matrix[2][0];
1092
1093 MulFrameMatrix(matrix, matrix, turn);
1094 }
1095
1096 sceVu0ScaleVector(matrix[0], matrix[0], axis_x);
1097 sceVu0ScaleVector(matrix[1], matrix[1], axis_y);
1098 sceVu0ScaleVector(matrix[2], matrix[2], axis_z);
1099 matrix[3][0] = world_position[0];
1100 matrix[3][1] = world_position[1];
1101 matrix[3][2] = world_position[2];
1102 CopyMatrix(this->world, matrix);
1103
1104 if (this->child) {
1105 this->child->world_valid = false;
1106 sibling = this->child;
1107
1108 if (sibling->brother) {
1109 while (sibling->brother) {
1110 sibling->brother->world_valid = false;
1111 sibling = sibling->brother;
1112 }
1113 }
1114 }
1115
1116 world_valid = true;
1117 } else {
1118 GetLWMatrix(matrix);
1119 }
1120
1121 if (!(attr.draw_on & 1) && (attr.draw_on & 2)) {
1122 return 0;
1123 }
1124
1125 if (info->shadow_pass) {
1126 ShadowMatrix(info->shadow, info->light_direction, info->shadow_point, info->shadow_normal);
1127 }
1128
1129 if (visual && attr.draw_on && attr.cull_enable) {
1130 MulFrameMatrix(screen_matrix, info->view_scaled, matrix);
1131 inv_scale = 1.0f / info->scale[0];
1132 done = 0;
1133
1134 if (info->shadow_pass) {
1135 ShadowClipBox(screen_corner, this->corner, matrix, info);
1136 ScreenBound(screen_corner, screen_max, screen_min);
1137 } else {
1138 ApplyMatrixN(screen_corner, screen_matrix, this->corner, 8);
1139 ScreenBound(screen_corner, screen_max, screen_min);
1140 }
1141
1142 near_z = info->near[2];
1143 far_z = info->frame_far_z;
1144
1145 while (done == 0) {
1146 visible = false;
1147
1148 if (attr.remake_pending) {
1149 half_width = 2.0f * (320.0f * inv_scale);
1150 half_height = 2.0f * (SCREEN_QUARTER_HEIGHT_F * inv_scale);
1151 } else {
1152 half_width = 320.0f * inv_scale;
1153 half_height = SCREEN_QUARTER_HEIGHT_F * inv_scale;
1154 }
1155
1156 if (screen_min[0] > half_width) {
1157 break;
1158 }
1159
1160 if (screen_max[0] < -half_width) {
1161 break;
1162 }
1163
1164 if (screen_min[1] > half_height) {
1165 break;
1166 }
1167
1168 if (screen_max[1] < -half_height) {
1169 break;
1170 }
1171
1172 if (screen_max[2] < near_z) {
1173 break;
1174 }
1175
1176 if (screen_min[2] < far_z) {
1177 near_clip = 8;
1178 }
1179
1180 depth = 0.96f * (2048.0f * inv_scale);
1181
1182 if (screen_min[2] > near_z && screen_max[0] < depth && screen_min[0] > -depth && screen_max[1] < depth && screen_min[1] > -depth) {
1183 far_clip = 8;
1184 }
1185
1186 visible = true;
1187 break;
1188 }
1189 }
1190
1191 info->frame_far_z = attr.clip_depth;
1192 info->scissor = (near_clip && far_clip < 8) && (attr.clip_enable || info->scissoring);
1193 info->fog_enabled = attr.fog_enable;
1195 info->clip_flags = 0;
1196
1197 if (far_clip < 8 || attr.remake_pending) {
1198 info->clip_flags |= 1;
1199 }
1200
1201 if (attr.remake_pending) {
1202 visible = true;
1203 }
1204
1205 if (info->scissor) {
1206 info->clip_flags |= 2;
1207 }
1208
1209 if (attr.program_option) {
1210 info->clip_flags |= 4;
1211 }
1212
1213 if (visual && visible && attr.draw_on) {
1214 if (!info->shadow_pass) {
1215 if (attr.alpha_ref >= 0) {
1216 test.bits.aref = attr.alpha_ref;
1217 }
1218
1219 if (attr.ignore_depth) {
1220 test.bits.zte = 1;
1221 test.bits.ztst = 1;
1222 }
1223
1224 zbuf.bits.zmsk = !attr.depth_write;
1225
1226 alpha = mgAlpha;
1227
1228 if (attr.blend_mode != 0) {
1229 if (attr.blend_mode > 0) {
1230 alpha.bits.a = 0;
1231 alpha.bits.b = 2;
1232 alpha.bits.c = 0;
1233 alpha.bits.d = 1;
1234 }
1235
1236 if (attr.blend_mode < 0) {
1237 alpha.bits.a = 2;
1238 alpha.bits.b = 0;
1239 alpha.bits.c = 0;
1240 alpha.bits.d = 1;
1241 }
1242 }
1243
1244 packet += SetGsReg3(packet, (u_long *) &test, (u_long *) &zbuf, (u_long *) &alpha);
1245 }
1246
1248 if (attr.ambient_boost) {
1249 color[0] = info->light_color[0][0];
1250 color[1] = info->light_color[0][1];
1251 color[2] = info->light_color[0][2];
1252 sceVu0CopyMatrix(light, info->light_direction);
1253 ZeroMatrix(info->light_direction);
1254 *(u_long128 *) ambient = *(u_long128 *) info->ambient;
1255 info->ambient[0] += 0.3f * color[0];
1256 info->ambient[1] += 0.3f * color[1];
1257 info->ambient[2] += 0.3f * color[2];
1258 } else {
1259 sceVu0CopyMatrix(light, info->light_direction);
1260 ZeroMatrix(info->light_direction);
1261 *(u_long128 *) ambient = *(u_long128 *) info->ambient;
1262 info->ambient[0] = attr.color[0];
1263 info->ambient[1] = attr.color[1];
1264 info->ambient[2] = attr.color[2];
1265 }
1266 }
1267
1268 if (attr.remake_pending) {
1269 visual->RemakeData(0);
1270 }
1271
1272 attr.remake_pending = 0;
1273
1274 packet += visual->DrawVu1(packet, matrix, info, VU1_PROGRAM_UNKNOWN6, 0, 0, 0);
1275
1277 sceVu0CopyMatrix(info->light_direction, light);
1278 *(u_long128 *) info->ambient = *(u_long128 *) ambient;
1279 }
1280
1281 if (!info->shadow_pass) {
1282 packet += SetGsReg3(packet, (u_long *) &mgPixelTest, (u_long *) &mgZBuffer, (u_long *) &mgAlpha);
1283 }
1284 }
1285
1286 if (!(attr.draw_on & 2)) {
1287 for (frame = this->child; frame; frame = frame->brother) {
1288 if (frame->attr.draw_on & 4) {
1289 continue;
1290 }
1291
1292 packet += frame->DrawVu1(packet, info);
1293 }
1294 }
1295
1296 return packet - start;
1297}
1298
1299/* The same draw against a packet the SDK is tracking rather than a bare cursor: the packet is
1300 closed so that its current word is a legal place to write, the draw is handed that word, and the
1301 packet is told afterwards how much of it went.
1302
1303 The word buffer is reserved and never reached, and the cursor is what reserves it: a local
1304 whose address nothing takes costs no stack at all. */
1306 int count;
1307 u_int work[128];
1308 u_int *current = work;
1309
1310 sceVif1PkTerminate(packet);
1311 count = DrawVu1(packet->pCurrent, info);
1312 sceVif1PkReserve(packet, count);
1313
1314 return count;
1315}
1316
1317void CFrame::SetCollision(CCollision *collision) {
1318 this->collision = collision;
1319}
1320
1321int CFrame::DrawVu1(unsigned int *packet, RenderInfo *info) {
1322 return 0;
1323}
1324
1325int CFrame::DrawVu1(sceVif1Packet *packet, RenderInfo *info) {
1326 return 0;
1327}
1328
1329CFrame::CFrame() {
1330 CFrame::Initialize();
1331}
1332
1334 this->visual = visual;
1335}
1336
1340
1342 CFrame::Initialize();
1343 visual = 0;
1344}
1345
1349
1350/* Exactly what the compiler would have generated, and declared all the same - which is what makes
1351 assigning one of these a call at every use instead of the base call and one word copied in
1352 line. */
1354 CFrame::operator=(other);
1355 visual = other.visual;
1356
1357 return *this;
1358}
1359#ifndef PORT
1360/* The matrix every polygon of one pick-up is transformed by, parked in the unit's registers once
1361 instead of being reloaded per triangle. */
1362static void pre_trance_normal(sceVu0FMATRIX matrix) {
1363 register float *m = &matrix[0][0];
1364
1365 asm {
1366 lqc2 vf10, 0(m)
1367 lqc2 vf11, 16(m)
1368 lqc2 vf12, 32(m)
1369 lqc2 vf13, 48(m)
1370 }
1371}
1372
1373/* A triangle through that matrix, and its plane normal rebuilt afterwards rather than transformed:
1374 the collision answers in its own space and a normal does not survive a transform the way a point
1375 does. */
1376static void trance_normal(float *p0, float *p1, float *p2, float *plane) {
1377 register float *a = p0;
1378 register float *b = p1;
1379 register float *c = p2;
1380 register float *normal = plane;
1381
1382 asm {
1383 lqc2 vf16, 0(a)
1384 lqc2 vf17, 16(a)
1385 lqc2 vf18, 32(a)
1386 vmulax ACC, vf10, vf16
1387 vmadday ACC, vf11, vf16
1388 vmaddaz ACC, vf12, vf16
1389 vmaddw vf16, vf13, vf16
1390 vmulax ACC, vf10, vf17
1391 vmadday ACC, vf11, vf17
1392 vmaddaz ACC, vf12, vf17
1393 vmaddw vf17, vf13, vf17
1394 vmulax ACC, vf10, vf18
1395 vmadday ACC, vf11, vf18
1396 vmaddaz ACC, vf12, vf18
1397 vmaddw vf18, vf13, vf18
1398 vsub vf20, vf17, vf16
1399 vsub vf21, vf18, vf16
1400 sqc2 vf16, 0(a)
1401 sqc2 vf17, 0(b)
1402 sqc2 vf18, 0(c)
1403 vnop
1404 vopmula ACC, vf20, vf21
1405 vopmsub vf22, vf21, vf20
1406 sqc2 vf22, 0(normal)
1407 }
1408}
1409#endif
1410/* The polygons of this frame's collision, and of every frame under it, that reach into a bound the
1411 caller gives in world space. The bound is carried the other way instead of the geometry: it is
1412 eight corners through the inverse of this frame's transform and then their extent, so the
1413 collision is searched in its own space and only what comes back is transformed. */
1414int CFrame::PickUpNearPoly(CCPoly *poly, const CBoxVu0 &box) {
1415 sceVu0FVECTOR box_corner[8];
1416 sceVu0FVECTOR local_corner[8];
1417 sceVu0FVECTOR max0;
1418 sceVu0FVECTOR min0;
1419 sceVu0FVECTOR max1;
1420 sceVu0FVECTOR min1;
1421 sceVu0FVECTOR extent[2];
1422 sceVu0FMATRIX world_matrix;
1423 CBoxVu0 bound;
1424 CCPoly *found;
1425 float (*inverse_matrix)[4];
1426 int num;
1427 CFrame *frame;
1428 int i;
1429
1430 found = poly;
1431 num = 0;
1432
1433 if (flags == 4) {
1434 return 0;
1435 }
1436
1437 if (collision != 0 && (flags & 1)) {
1438 GetLWMatrix(world_matrix);
1439 inverse_matrix = GetInverseMatrix();
1440
1441 *(u_long128 *) extent[0] = *(u_long128 *) box.min;
1442 *(u_long128 *) extent[1] = *(u_long128 *) box.max;
1443
1444 for (i = 0; i < 8; i++) {
1445 box_corner[i][3] = 1.0f;
1446 box_corner[i][0] = extent[(i & 1) != 0][0];
1447 box_corner[i][1] = extent[(i & 2) != 0][1];
1448 box_corner[i][2] = extent[(i & 4) != 0][2];
1449 }
1450
1451 ApplyMatrixN(local_corner, inverse_matrix, box_corner, 8);
1452 VectorMaxMin(max0, min0, local_corner[0], local_corner[1], local_corner[2], local_corner[3]);
1453 VectorMaxMin(max1, min1, local_corner[4], local_corner[5], local_corner[6], local_corner[7]);
1454 VectorMaxMin(bound.max, bound.min, max0, max1, min0, min1);
1455
1456 num = collision->PickUpNearPoly(poly, bound);
1457
1458 found = poly;
1459 pre_trance_normal(world_matrix);
1460
1461 for (i = 0; i < num; i++, found++) {
1462 trance_normal(found->vertex[0], found->vertex[1], found->vertex[2], found->normal);
1463 }
1464 }
1465
1466 if ((flags & 2) == 0) {
1467 for (frame = child; frame != 0; frame = frame->brother) {
1468 if (flags & 4) {
1469 continue;
1470 }
1471
1472 num += frame->PickUpNearPoly(found, box);
1473 found = poly + num;
1474 }
1475 }
1476
1477 return num;
1478}
sceVu0FVECTOR min
Definition collision.hpp:29
sceVu0FVECTOR max
Definition collision.hpp:28
sceVu0FVECTOR normal
Definition collision.hpp:49
sceVu0FVECTOR vertex[3]
Definition collision.hpp:48
short draw_on
Definition frame.hpp:27
char clip_enable
Definition frame.hpp:29
short alpha_ref
Definition frame.hpp:43
char remake_pending
Definition frame.hpp:31
sceVu0FVECTOR color
Definition frame.hpp:39
char cull_enable
Definition frame.hpp:40
char ignore_depth
Definition frame.hpp:46
char ambient_boost
Definition frame.hpp:41
short billboard
Definition frame.hpp:48
float clip_depth
Definition frame.hpp:28
char program_option
Definition frame.hpp:32
float far_clip
Definition frame.hpp:37
char use_color
Definition frame.hpp:38
short eye_relative
Definition frame.hpp:47
char depth_write
Definition frame.hpp:45
char fog_enable
Definition frame.hpp:33
char far_clip_enable
Definition frame.hpp:34
short blend_mode
Definition frame.hpp:44
CFrameVu1 & operator=(CFrameVu1 &other)
Definition frame.cpp:1353
CVisualVu1 * visual
Definition framevu1.hpp:17
virtual void Initialize()
Definition frame.cpp:1341
void SetVisual(CVisualVu1 *visual)
Definition frame.cpp:1333
CVisualVu1 * GetVisual()
Definition frame.cpp:1337
virtual int DrawVu1(unsigned int *packet, RenderInfo *info)
Definition frame.cpp:1018
int flags
Definition frame.hpp:60
sceVu0FVECTOR corner[8]
Definition frame.hpp:64
char name[32]
Definition frame.hpp:68
int rot_type
Definition frame.hpp:80
sceVu0FMATRIX local
Definition frame.hpp:74
CFrame * elder
Definition frame.hpp:71
int no_rotation
Definition frame.hpp:79
CFrameAttr attr
Definition frame.hpp:65
sceVu0FVECTOR min
Definition frame.hpp:63
sceVu0FVECTOR scale
Definition frame.hpp:75
sceVu0FVECTOR position
Definition frame.hpp:76
int reference
Definition frame.hpp:67
sceVu0FMATRIX world
Definition frame.hpp:72
sceVu0FMATRIX inverse
Definition frame.hpp:73
sceVu0FVECTOR max
Definition frame.hpp:62
CCollision * collision
Definition frame.hpp:61
int world_valid
Definition frame.hpp:78
CFrame * child
Definition frame.hpp:69
int srt
Definition frame.hpp:81
CFrame * parent
Definition frame.hpp:66
sceVu0FVECTOR rotation
Definition frame.hpp:77
CFrame * brother
Definition frame.hpp:70
virtual int RemakeData(u_int *data)
virtual int DrawVu1(u_int *packet, float(*matrix)[4], RenderInfo *info, VU1_PROGRAM program, u_long128 *draw_state, int unknown1, int unknown2)
sceVu0FMATRIX light_color
sceVu0FVECTOR scale
sceVu0FMATRIX light_direction
sceVu0FVECTOR near
float frame_far_z
sceVu0FVECTOR view_position
sceVu0FVECTOR shadow_point
sceVu0FMATRIX shadow
sceVu0FMATRIX view_scaled
sceVu0FVECTOR ambient
sceVu0FVECTOR shadow_normal
u_short notify
Definition libdma.h:36