diff --git a/asm/MetroidPrime/CParticleDatabase.s b/asm/MetroidPrime/CParticleDatabase.s index b45be99c..e7c2a203 100644 --- a/asm/MetroidPrime/CParticleDatabase.s +++ b/asm/MetroidPrime/CParticleDatabase.s @@ -1311,7 +1311,7 @@ GetParticleSystem__23CParticleGenInfoGenericCFv: /* 800B8B8C 000B5AEC 80 81 00 08 */ lwz r4, 8(r1) /* 800B8B90 000B5AF0 38 61 00 08 */ addi r3, r1, 8 /* 800B8B94 000B5AF4 83 E4 00 00 */ lwz r31, 0(r4) -/* 800B8B98 000B5AF8 4B FF EE 69 */ bl sub_800b7a00 +/* 800B8B98 000B5AF8 4B FF EE 69 */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" /* 800B8B9C 000B5AFC FC 20 F8 90 */ fmr f1, f31 /* 800B8BA0 000B5B00 7F E3 FB 78 */ mr r3, r31 /* 800B8BA4 000B5B04 7F C4 F3 78 */ mr r4, r30 @@ -1780,7 +1780,7 @@ lbl_800B9140: /* 800B91FC 000B615C 91 61 00 0C */ stw r11, 0xc(r1) /* 800B9200 000B6160 92 E1 00 10 */ stw r23, 0x10(r1) /* 800B9204 000B6164 90 01 00 14 */ stw r0, 0x14(r1) -/* 800B9208 000B6168 4B FF E4 59 */ bl "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManageri" +/* 800B9208 000B6168 4B FF E4 59 */ bl "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManager7TAreaIdi16EParticleGenType" /* 800B920C 000B616C 7C 78 1B 78 */ mr r24, r3 lbl_800B9210: /* 800B9210 000B6170 7C 18 00 D0 */ neg r0, r24 @@ -1826,7 +1826,7 @@ lbl_800B92A4: /* 800B92A4 000B6204 7E A0 07 75 */ extsb. r0, r21 /* 800B92A8 000B6208 41 82 00 0C */ beq lbl_800B92B4 /* 800B92AC 000B620C 38 61 00 1C */ addi r3, r1, 0x1c -/* 800B92B0 000B6210 4B FF E7 51 */ bl sub_800b7a00 +/* 800B92B0 000B6210 4B FF E7 51 */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" lbl_800B92B4: /* 800B92B4 000B6214 7E C0 07 75 */ extsb. r0, r22 /* 800B92B8 000B6218 41 82 00 0C */ beq lbl_800B92C4 @@ -1850,7 +1850,7 @@ lbl_800B92C4: /* 800B92FC 000B625C 38 80 00 00 */ li r4, 0 /* 800B9300 000B6260 48 00 09 75 */ bl "InsertParticleGen__17CParticleDatabaseFbiRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RCQ24rstl28auto_ptr<16CParticleGenInfo>" /* 800B9304 000B6264 38 61 00 24 */ addi r3, r1, 0x24 -/* 800B9308 000B6268 4B FF E6 F9 */ bl sub_800b7a00 +/* 800B9308 000B6268 4B FF E6 F9 */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" /* 800B930C 000B626C 48 00 00 08 */ b lbl_800B9314 lbl_800B9310: /* 800B9310 000B6270 48 28 7C F5 */ bl Type2Text__10SObjectTagFUi @@ -2066,7 +2066,7 @@ lbl_800B9578: /* 800B960C 000B656C 91 61 00 0C */ stw r11, 0xc(r1) /* 800B9610 000B6570 92 61 00 10 */ stw r19, 0x10(r1) /* 800B9614 000B6574 90 01 00 14 */ stw r0, 0x14(r1) -/* 800B9618 000B6578 4B FF E0 49 */ bl "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManageri" +/* 800B9618 000B6578 4B FF E0 49 */ bl "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManager7TAreaIdi16EParticleGenType" /* 800B961C 000B657C 7C 65 1B 78 */ mr r5, r3 lbl_800B9620: /* 800B9620 000B6580 7C 05 00 D0 */ neg r0, r5 @@ -2112,10 +2112,10 @@ lbl_800B96B4: /* 800B96B4 000B6614 7E A0 07 75 */ extsb. r0, r21 /* 800B96B8 000B6618 41 82 00 0C */ beq lbl_800B96C4 /* 800B96BC 000B661C 38 61 00 28 */ addi r3, r1, 0x28 -/* 800B96C0 000B6620 4B FF E3 41 */ bl sub_800b7a00 +/* 800B96C0 000B6620 4B FF E3 41 */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" lbl_800B96C4: /* 800B96C4 000B6624 38 61 00 38 */ addi r3, r1, 0x38 -/* 800B96C8 000B6628 4B FF E3 39 */ bl sub_800b7a00 +/* 800B96C8 000B6628 4B FF E3 39 */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" /* 800B96CC 000B662C 48 00 04 D4 */ b lbl_800B9BA0 lbl_800B96D0: /* 800B96D0 000B6630 3C 03 AC A9 */ addis r0, r3, 0xaca9 @@ -2236,7 +2236,7 @@ lbl_800B97EC: /* 800B9870 000B67D0 91 81 00 0C */ stw r12, 0xc(r1) /* 800B9874 000B67D4 91 61 00 10 */ stw r11, 0x10(r1) /* 800B9878 000B67D8 90 01 00 14 */ stw r0, 0x14(r1) -/* 800B987C 000B67DC 4B FF DD E5 */ bl "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManageri" +/* 800B987C 000B67DC 4B FF DD E5 */ bl "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManager7TAreaIdi16EParticleGenType" /* 800B9880 000B67E0 7C 65 1B 78 */ mr r5, r3 lbl_800B9884: /* 800B9884 000B67E4 7C 05 00 D0 */ neg r0, r5 @@ -2282,10 +2282,10 @@ lbl_800B9918: /* 800B9918 000B6878 7E 60 07 75 */ extsb. r0, r19 /* 800B991C 000B687C 41 82 00 0C */ beq lbl_800B9928 /* 800B9920 000B6880 38 61 00 20 */ addi r3, r1, 0x20 -/* 800B9924 000B6884 4B FF E0 DD */ bl sub_800b7a00 +/* 800B9924 000B6884 4B FF E0 DD */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" lbl_800B9928: /* 800B9928 000B6888 38 61 00 34 */ addi r3, r1, 0x34 -/* 800B992C 000B688C 4B FF E0 D5 */ bl sub_800b7a00 +/* 800B992C 000B688C 4B FF E0 D5 */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" /* 800B9930 000B6890 48 00 02 70 */ b lbl_800B9BA0 lbl_800B9934: /* 800B9934 000B6894 3C 03 BA B4 */ addis r0, r3, 0xbab4 @@ -2409,7 +2409,7 @@ lbl_800B9A4C: /* 800B9AE0 000B6A40 91 61 00 0C */ stw r11, 0xc(r1) /* 800B9AE4 000B6A44 92 61 00 10 */ stw r19, 0x10(r1) /* 800B9AE8 000B6A48 90 01 00 14 */ stw r0, 0x14(r1) -/* 800B9AEC 000B6A4C 4B FF DB 75 */ bl "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManageri" +/* 800B9AEC 000B6A4C 4B FF DB 75 */ bl "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManager7TAreaIdi16EParticleGenType" /* 800B9AF0 000B6A50 7C 65 1B 78 */ mr r5, r3 lbl_800B9AF4: /* 800B9AF4 000B6A54 7C 05 00 D0 */ neg r0, r5 @@ -2455,10 +2455,10 @@ lbl_800B9B88: /* 800B9B88 000B6AE8 7E A0 07 75 */ extsb. r0, r21 /* 800B9B8C 000B6AEC 41 82 00 0C */ beq lbl_800B9B98 /* 800B9B90 000B6AF0 38 61 00 18 */ addi r3, r1, 0x18 -/* 800B9B94 000B6AF4 4B FF DE 6D */ bl sub_800b7a00 +/* 800B9B94 000B6AF4 4B FF DE 6D */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" lbl_800B9B98: /* 800B9B98 000B6AF8 38 61 00 30 */ addi r3, r1, 0x30 -/* 800B9B9C 000B6AFC 4B FF DE 65 */ bl sub_800b7a00 +/* 800B9B9C 000B6AFC 4B FF DE 65 */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" lbl_800B9BA0: /* 800B9BA0 000B6B00 80 61 00 88 */ lwz r3, 0x88(r1) /* 800B9BA4 000B6B04 28 03 00 00 */ cmplwi r3, 0 diff --git a/asm/MetroidPrime/CParticleGenInfo.s b/asm/MetroidPrime/CParticleGenInfo.s index a3dc5e72..04dac9ae 100644 --- a/asm/MetroidPrime/CParticleGenInfo.s +++ b/asm/MetroidPrime/CParticleGenInfo.s @@ -3,8 +3,8 @@ .section .data .balign 8 -.global lbl_803DF498 -lbl_803DF498: +.global __vt__16CParticleGenInfo +__vt__16CParticleGenInfo: # ROM: 0x3DC498 .4byte 0 .4byte 0 @@ -57,9 +57,9 @@ __dt__16CParticleGenInfoFv: /* 800B7734 000B4694 93 C1 00 08 */ stw r30, 8(r1) /* 800B7738 000B4698 7C 7E 1B 79 */ or. r30, r3, r3 /* 800B773C 000B469C 41 82 00 30 */ beq lbl_800B776C -/* 800B7740 000B46A0 3C 60 80 3E */ lis r3, lbl_803DF498@ha +/* 800B7740 000B46A0 3C 60 80 3E */ lis r3, __vt__16CParticleGenInfo@ha /* 800B7744 000B46A4 34 1E 00 10 */ addic. r0, r30, 0x10 -/* 800B7748 000B46A8 38 03 F4 98 */ addi r0, r3, lbl_803DF498@l +/* 800B7748 000B46A8 38 03 F4 98 */ addi r0, r3, __vt__16CParticleGenInfo@l /* 800B774C 000B46AC 90 1E 00 00 */ stw r0, 0(r30) /* 800B7750 000B46B0 41 82 00 0C */ beq lbl_800B775C /* 800B7754 000B46B4 38 7E 00 10 */ addi r3, r30, 0x10 @@ -78,8 +78,8 @@ lbl_800B776C: /* 800B7780 000B46E0 38 21 00 10 */ addi r1, r1, 0x10 /* 800B7784 000B46E4 4E 80 00 20 */ blr -.global "_initializeLight__FRCQ24rstl24ncrc_ptr<12CParticleGen>R13CStateManageri" -"_initializeLight__FRCQ24rstl24ncrc_ptr<12CParticleGen>R13CStateManageri": +.global "_initializeLight__FRCQ24rstl24ncrc_ptr<12CParticleGen>R13CStateManager7TAreaIdi" +"_initializeLight__FRCQ24rstl24ncrc_ptr<12CParticleGen>R13CStateManager7TAreaIdi": /* 800B7788 000B46E8 94 21 FF 00 */ stwu r1, -0x100(r1) /* 800B778C 000B46EC 7C 08 02 A6 */ mflr r0 /* 800B7790 000B46F0 90 01 01 04 */ stw r0, 0x104(r1) @@ -185,15 +185,15 @@ lbl_800B7904: /* 800B7910 000B4870 38 21 01 00 */ addi r1, r1, 0x100 /* 800B7914 000B4874 4E 80 00 20 */ blr -.global "__ct__16CParticleGenInfoFRC10SObjectTagiRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC9CVector3fQ213CParticleData13EParentedModei" -"__ct__16CParticleGenInfoFRC10SObjectTagiRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC9CVector3fQ213CParticleData13EParentedModei": +.global "__ct__16CParticleGenInfoFRC10SObjectTagiRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC9CVector3fQ213CParticleData13EParentedModei16EParticleGenType" +"__ct__16CParticleGenInfoFRC10SObjectTagiRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC9CVector3fQ213CParticleData13EParentedModei16EParticleGenType": /* 800B7918 000B4878 94 21 FF D0 */ stwu r1, -0x30(r1) /* 800B791C 000B487C 7C 08 02 A6 */ mflr r0 -/* 800B7920 000B4880 3D 60 80 3E */ lis r11, lbl_803DF498@ha +/* 800B7920 000B4880 3D 60 80 3E */ lis r11, __vt__16CParticleGenInfo@ha /* 800B7924 000B4884 C8 22 8D 18 */ lfd f1, lbl_805AAA38@sda21(r2) /* 800B7928 000B4888 90 01 00 34 */ stw r0, 0x34(r1) /* 800B792C 000B488C 3C 00 43 30 */ lis r0, 0x4330 -/* 800B7930 000B4890 39 6B F4 98 */ addi r11, r11, lbl_803DF498@l +/* 800B7930 000B4890 39 6B F4 98 */ addi r11, r11, __vt__16CParticleGenInfo@l /* 800B7934 000B4894 C0 42 8D 14 */ lfs f2, lbl_805AAA34@sda21(r2) /* 800B7938 000B4898 BF 61 00 1C */ stmw r27, 0x1c(r1) /* 800B793C 000B489C 7C 7B 1B 78 */ mr r27, r3 @@ -246,8 +246,8 @@ lbl_800B7904: /* 800B79F8 000B4958 38 21 00 30 */ addi r1, r1, 0x30 /* 800B79FC 000B495C 4E 80 00 20 */ blr -.global sub_800b7a00 -sub_800b7a00: +.global "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" +"ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv": /* 800B7A00 000B4960 94 21 FF F0 */ stwu r1, -0x10(r1) /* 800B7A04 000B4964 7C 08 02 A6 */ mflr r0 /* 800B7A08 000B4968 90 01 00 14 */ stw r0, 0x14(r1) diff --git a/asm/MetroidPrime/CParticleGenInfoGeneric.s b/asm/MetroidPrime/CParticleGenInfoGeneric.s index dfcaf61b..954bc615 100644 --- a/asm/MetroidPrime/CParticleGenInfoGeneric.s +++ b/asm/MetroidPrime/CParticleGenInfoGeneric.s @@ -3,8 +3,8 @@ .section .data .balign 8 -.global lbl_803DF448 -lbl_803DF448: +.global __vt__23CParticleGenInfoGeneric +__vt__23CParticleGenInfoGeneric: # ROM: 0x3DC448 .4byte 0 .4byte 0 @@ -545,21 +545,21 @@ __dt__23CParticleGenInfoGenericFv: /* 800B75E0 000B4540 93 C1 00 08 */ stw r30, 8(r1) /* 800B75E4 000B4544 7C 7E 1B 79 */ or. r30, r3, r3 /* 800B75E8 000B4548 41 82 00 5C */ beq lbl_800B7644 -/* 800B75EC 000B454C 3C 60 80 3E */ lis r3, lbl_803DF448@ha +/* 800B75EC 000B454C 3C 60 80 3E */ lis r3, __vt__23CParticleGenInfoGeneric@ha /* 800B75F0 000B4550 34 1E 00 84 */ addic. r0, r30, 0x84 -/* 800B75F4 000B4554 38 03 F4 48 */ addi r0, r3, lbl_803DF448@l +/* 800B75F4 000B4554 38 03 F4 48 */ addi r0, r3, __vt__23CParticleGenInfoGeneric@l /* 800B75F8 000B4558 90 1E 00 00 */ stw r0, 0(r30) /* 800B75FC 000B455C 41 82 00 14 */ beq lbl_800B7610 /* 800B7600 000B4560 34 1E 00 84 */ addic. r0, r30, 0x84 /* 800B7604 000B4564 41 82 00 0C */ beq lbl_800B7610 /* 800B7608 000B4568 38 7E 00 84 */ addi r3, r30, 0x84 -/* 800B760C 000B456C 48 00 03 F5 */ bl sub_800b7a00 +/* 800B760C 000B456C 48 00 03 F5 */ bl "ReleaseData__Q24rstl22rc_ptr<12CParticleGen>Fv" lbl_800B7610: /* 800B7610 000B4570 28 1E 00 00 */ cmplwi r30, 0 /* 800B7614 000B4574 41 82 00 20 */ beq lbl_800B7634 -/* 800B7618 000B4578 3C 60 80 3E */ lis r3, lbl_803DF498@ha +/* 800B7618 000B4578 3C 60 80 3E */ lis r3, __vt__16CParticleGenInfo@ha /* 800B761C 000B457C 34 1E 00 10 */ addic. r0, r30, 0x10 -/* 800B7620 000B4580 38 03 F4 98 */ addi r0, r3, lbl_803DF498@l +/* 800B7620 000B4580 38 03 F4 98 */ addi r0, r3, __vt__16CParticleGenInfo@l /* 800B7624 000B4584 90 1E 00 00 */ stw r0, 0(r30) /* 800B7628 000B4588 41 82 00 0C */ beq lbl_800B7634 /* 800B762C 000B458C 38 7E 00 10 */ addi r3, r30, 0x10 @@ -578,8 +578,8 @@ lbl_800B7644: /* 800B7658 000B45B8 38 21 00 10 */ addi r1, r1, 0x10 /* 800B765C 000B45BC 4E 80 00 20 */ blr -.global "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManageri" -"__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManageri": +.global "__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManager7TAreaIdi16EParticleGenType" +"__ct__23CParticleGenInfoGenericFRC10SObjectTagQ24rstl24ncrc_ptr<12CParticleGen>iRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>9CVector3fQ213CParticleData13EParentedModeiR13CStateManager7TAreaIdi16EParticleGenType": /* 800B7660 000B45C0 94 21 FF D0 */ stwu r1, -0x30(r1) /* 800B7664 000B45C4 7C 08 02 A6 */ mflr r0 /* 800B7668 000B45C8 90 01 00 34 */ stw r0, 0x34(r1) @@ -596,10 +596,10 @@ lbl_800B7644: /* 800B7694 000B45F4 7C 7B 1B 78 */ mr r27, r3 /* 800B7698 000B45F8 83 E1 00 40 */ lwz r31, 0x40(r1) /* 800B769C 000B45FC 7C 0A 03 78 */ mr r10, r0 -/* 800B76A0 000B4600 48 00 02 79 */ bl "__ct__16CParticleGenInfoFRC10SObjectTagiRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC9CVector3fQ213CParticleData13EParentedModei" -/* 800B76A4 000B4604 3C 60 80 3E */ lis r3, lbl_803DF448@ha +/* 800B76A0 000B4600 48 00 02 79 */ bl "__ct__16CParticleGenInfoFRC10SObjectTagiRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC9CVector3fQ213CParticleData13EParentedModei16EParticleGenType" +/* 800B76A4 000B4604 3C 60 80 3E */ lis r3, __vt__23CParticleGenInfoGeneric@ha /* 800B76A8 000B4608 3C 1F 00 01 */ addis r0, r31, 1 -/* 800B76AC 000B460C 38 63 F4 48 */ addi r3, r3, lbl_803DF448@l +/* 800B76AC 000B460C 38 63 F4 48 */ addi r3, r3, __vt__23CParticleGenInfoGeneric@l /* 800B76B0 000B4610 90 7B 00 00 */ stw r3, 0(r27) /* 800B76B4 000B4614 28 00 FF FF */ cmplwi r0, 0xffff /* 800B76B8 000B4618 80 1C 00 00 */ lwz r0, 0(r28) @@ -619,7 +619,7 @@ lbl_800B76DC: /* 800B76EC 000B464C 90 01 00 0C */ stw r0, 0xc(r1) /* 800B76F0 000B4650 38 61 00 08 */ addi r3, r1, 8 /* 800B76F4 000B4654 38 C1 00 0C */ addi r6, r1, 0xc -/* 800B76F8 000B4658 48 00 00 91 */ bl "_initializeLight__FRCQ24rstl24ncrc_ptr<12CParticleGen>R13CStateManageri" +/* 800B76F8 000B4658 48 00 00 91 */ bl "_initializeLight__FRCQ24rstl24ncrc_ptr<12CParticleGen>R13CStateManager7TAreaIdi" /* 800B76FC 000B465C 38 61 00 08 */ addi r3, r1, 8 lbl_800B7700: /* 800B7700 000B4660 A0 03 00 00 */ lhz r0, 0(r3) diff --git a/include/Kyoto/Math/CMatrix3f.hpp b/include/Kyoto/Math/CMatrix3f.hpp index 9269e377..6287de63 100644 --- a/include/Kyoto/Math/CMatrix3f.hpp +++ b/include/Kyoto/Math/CMatrix3f.hpp @@ -14,6 +14,8 @@ public: static const CMatrix3f& Identity() { return sIdentity; } + CMatrix3f Orthonormalized() const; + private: // TODO maybe individual floats CVector3f m0; diff --git a/include/MetaRender/CCubeRenderer.hpp b/include/MetaRender/CCubeRenderer.hpp index d9a47721..f5f0fb17 100644 --- a/include/MetaRender/CCubeRenderer.hpp +++ b/include/MetaRender/CCubeRenderer.hpp @@ -34,7 +34,7 @@ public: virtual void DrawAreaGeometry(); virtual void PostRenderFogs(); virtual void SetModelMatrix(const CTransform4f& xf); - virtual void AddParticleGen1(); + virtual void AddParticleGen(const CParticleGen& gen); virtual void AddParticleGen2(); virtual void AddPlaneObject(); virtual void AddDrawable(const void* obj, const CVector3f& pos, const CAABox& bounds, int mode, diff --git a/include/MetaRender/IRenderer.hpp b/include/MetaRender/IRenderer.hpp index ffc7eef7..b83e620a 100644 --- a/include/MetaRender/IRenderer.hpp +++ b/include/MetaRender/IRenderer.hpp @@ -12,6 +12,18 @@ public: virtual ~IRenderer(); // TODO vtable + + virtual void AddStaticGeometry(); + virtual void EnablePVS(); + virtual void DisablePVS(); + virtual void RemoveStaticGeometry(); + virtual void DrawUnsortedGeometry(); + virtual void DrawSortedGeometry(); + virtual void DrawStaticGeometry(); + virtual void DrawAreaGeometry(); + virtual void PostRenderFogs(); + virtual void SetModelMatrix(const CTransform4f& xf); + virtual void AddParticleGen(const CParticleGen& gen); }; class IObjectStore; diff --git a/include/MetroidPrime/CGameLight.hpp b/include/MetroidPrime/CGameLight.hpp new file mode 100644 index 00000000..c493e2f7 --- /dev/null +++ b/include/MetroidPrime/CGameLight.hpp @@ -0,0 +1,29 @@ +#ifndef _CGAMELIGHT +#define _CGAMELIGHT + +#include "MetroidPrime/CActor.hpp" + +#include "Kyoto/Graphics/CLight.hpp" + +class CGameLight : public CActor { +public: + CGameLight(TUniqueId uid, TAreaId aid, bool active, const rstl::string& name, + const CTransform4f& xf, TUniqueId parentId, const CLight& light, uint sourceId, + uint priority, float lifeTime); + + void Accept(IVisitor& visitor) override; + void Think(float dt, CStateManager& mgr) override; + void SetLightPriorityAndId(); + void SetLight(const CLight& light); + CLight GetLight() const; + +private: + TUniqueId xe8_parentId; + CLight xec_light; + uint x13c_lightId; + uint x140_priority; + float x144_lifeTime; +}; +CHECK_SIZEOF(CGameLight, 0x148) + +#endif // _CGAMELIGHT diff --git a/include/MetroidPrime/CModelData.hpp b/include/MetroidPrime/CModelData.hpp index 1f50d992..c44098de 100644 --- a/include/MetroidPrime/CModelData.hpp +++ b/include/MetroidPrime/CModelData.hpp @@ -39,6 +39,14 @@ private: }; CHECK_SIZEOF(CAdvancementDeltas, 0x1c) +class CStaticRes { + CAssetId x0_cmdlId; + CVector3f x4_scale; + +public: + CStaticRes(CAssetId id, const CVector3f& scale) : x0_cmdlId(id), x4_scale(scale) {} +}; + class CModelData { public: enum EWhichModel { diff --git a/include/MetroidPrime/CParticleGenInfo.hpp b/include/MetroidPrime/CParticleGenInfo.hpp new file mode 100644 index 00000000..058c01b1 --- /dev/null +++ b/include/MetroidPrime/CParticleGenInfo.hpp @@ -0,0 +1,67 @@ +#ifndef _CPARTICLEGENINFO +#define _CPARTICLEGENINFO + +#include "MetroidPrime/CParticleData.hpp" + +#include "MetroidPrime/TGameTypes.hpp" + +#include "Kyoto/Math/CTransform4f.hpp" +#include "Kyoto/SObjectTag.hpp" + +#include "rstl/optional_object.hpp" +#include "rstl/rc_ptr.hpp" +#include "rstl/string.hpp" + + +enum EParticleGenType { kPGT_Normal, kPGT_Auxiliary }; + +class CStateManager; +class CColor; +class CAABox; +class CParticleGen; + +class CParticleGenInfo { +public: + CParticleGenInfo(const SObjectTag& part, int frameCount, const rstl::string& boneName, + const CVector3f& scale, CParticleData::EParentedMode parentMode, int flags, + EParticleGenType type); + virtual ~CParticleGenInfo() {} + + virtual void AddToRenderer() = 0; + virtual void Render() = 0; + virtual void Update(float dt, CStateManager& stateMgr) = 0; + virtual void SetOrientation(const CTransform4f& xf, CStateManager& stateMgr) = 0; + virtual void SetTranslation(const CVector3f& trans, CStateManager& stateMgr) = 0; + virtual void SetGlobalOrientation(const CTransform4f& xf, CStateManager& stateMgr) = 0; + virtual void SetGlobalTranslation(const CVector3f& trans, CStateManager& stateMgr) = 0; + virtual void SetGlobalScale(const CVector3f& scale) = 0; + virtual void SetParticleEmission(bool isActive, CStateManager& stateMgr) = 0; + virtual bool IsSystemDeletable() const = 0; + virtual CAABox GetBounds() const = 0; // This should match CParticleGen::GetBounds result + virtual bool HasActiveParticles() const = 0; + virtual void DestroyParticles() = 0; + virtual bool HasLight() const = 0; + virtual TUniqueId GetLightId() const = 0; + virtual void DeleteLight(CStateManager& stateMgr) = 0; + virtual void SetModulationColor(const CColor& color) = 0; + +private: + SObjectTag x4_part; + float xc_seconds; + rstl::string x10_boneName; + float x20_curTime; + bool x24_active; + CParticleData::EParentedMode x28_parentMode; + s32 x2c_flags; + CVector3f x30_particleScale; + float x3c_finishTime; + bool x40_grabInitialData; + CTransform4f x44_transform; + CVector3f x74_offset; + EParticleGenType x80_type; +}; + +TUniqueId _initializeLight(const rstl::ncrc_ptr< CParticleGen >&, CStateManager&, TAreaId, + int lightId); + +#endif // _CPARTICLEGENINFO diff --git a/include/MetroidPrime/CParticleGenInfoGeneric.hpp b/include/MetroidPrime/CParticleGenInfoGeneric.hpp new file mode 100644 index 00000000..4ec0dfee --- /dev/null +++ b/include/MetroidPrime/CParticleGenInfoGeneric.hpp @@ -0,0 +1,42 @@ +#ifndef _CPARTICLEGENINFOGENERIC +#define _CPARTICLEGENINFOGENERIC + +#include "MetroidPrime/CParticleGenInfo.hpp" + +class CParticleGen; + +class CParticleGenInfoGeneric : public CParticleGenInfo { +public: + CParticleGenInfoGeneric(const SObjectTag& part, rstl::ncrc_ptr< CParticleGen > system, int frames, + const rstl::string& boneName, CVector3f scale, + CParticleData::EParentedMode parentMode, int flags, + CStateManager& stateMgr, TAreaId areaId, int lightId, + EParticleGenType state); + ~CParticleGenInfoGeneric(); + + virtual void AddToRenderer() override; + virtual void Render() override; + virtual void Update(float dt, CStateManager& stateMgr) override; + virtual void SetOrientation(const CTransform4f& xf, CStateManager& stateMgr) override; + virtual void SetTranslation(const CVector3f& trans, CStateManager& stateMgr) override; + virtual void SetGlobalOrientation(const CTransform4f& xf, CStateManager& stateMgr) override; + virtual void SetGlobalTranslation(const CVector3f& trans, CStateManager& stateMgr) override; + virtual void SetGlobalScale(const CVector3f& scale) override; + virtual void SetParticleEmission(bool isActive, CStateManager& stateMgr) override; + virtual bool IsSystemDeletable() const override; + virtual CAABox GetBounds() const override; + virtual bool HasActiveParticles() const override; + virtual void DestroyParticles() override; + virtual bool HasLight() const override; + virtual TUniqueId GetLightId() const override; + virtual void DeleteLight(CStateManager& stateMgr) override; + virtual void SetModulationColor(const CColor& color) override; + + const rstl::rc_ptr< CParticleGen >& GetParticleSystem() const { return x84_system; } + +private: + rstl::ncrc_ptr< CParticleGen > x84_system; + TUniqueId x88_lightId; +}; + +#endif // _CPARTICLEGENINFOGENERIC diff --git a/src/MetroidPrime/CParticleGenInfo.cpp b/src/MetroidPrime/CParticleGenInfo.cpp new file mode 100644 index 00000000..9ccb12a1 --- /dev/null +++ b/src/MetroidPrime/CParticleGenInfo.cpp @@ -0,0 +1,39 @@ +#include "MetroidPrime/CParticleGenInfo.hpp" + +#include "MetroidPrime/CGameLight.hpp" +#include "MetroidPrime/CStateManager.hpp" + +#include "Kyoto/Particles/CParticleGen.hpp" + +CParticleGenInfo::CParticleGenInfo(const SObjectTag& part, int frameCount, + const rstl::string& boneName, const CVector3f& scale, + CParticleData::EParentedMode parentMode, int flags, + EParticleGenType type) +: x4_part(part) +, xc_seconds(frameCount * (1.0f / 60.f)) +, x10_boneName(boneName) +, x20_curTime(0.f) +, x24_active(false) +, x28_parentMode(parentMode) +, x2c_flags(flags) +, x30_particleScale(scale) +, x3c_finishTime(0.f) +, x40_grabInitialData(false) +, x44_transform(CTransform4f::Identity()) +, x74_offset(0.f, 0.f, 0.f) +, x80_type(type) {} + +TUniqueId _initializeLight(const rstl::ncrc_ptr< CParticleGen >& system, CStateManager& stateMgr, + TAreaId areaId, int lightId) { + if (system->SystemHasLight()) { + TUniqueId ret = stateMgr.AllocateUniqueId(); + stateMgr.AddObject(new CGameLight( + ret, areaId, false, rstl::string_l("ParticleLight"), + CTransform4f(system->GetOrientation().BuildMatrix3f(), system->GetTranslation()), + kInvalidUniqueId, system->GetLight(), lightId, 0, 0.f)); + + return ret; + } else { + return kInvalidUniqueId; + } +} diff --git a/src/MetroidPrime/CParticleGenInfoGeneric.cpp b/src/MetroidPrime/CParticleGenInfoGeneric.cpp new file mode 100644 index 00000000..7d52475e --- /dev/null +++ b/src/MetroidPrime/CParticleGenInfoGeneric.cpp @@ -0,0 +1,140 @@ +#include "MetroidPrime/CParticleGenInfoGeneric.hpp" + +#include "MetroidPrime/CGameLight.hpp" +#include "MetroidPrime/CStateManager.hpp" + +#include "Kyoto/Math/CQuaternion.hpp" +#include "MetaRender/CCubeRenderer.hpp" + +CParticleGenInfoGeneric::CParticleGenInfoGeneric(const SObjectTag& part, + rstl::ncrc_ptr< CParticleGen > system, int frames, + const rstl::string& boneName, CVector3f scale, + CParticleData::EParentedMode parentMode, int flags, + CStateManager& stateMgr, TAreaId areaId, + int lightId, EParticleGenType state) + +: CParticleGenInfo(part, frames, boneName, scale, parentMode, flags, state) +, x84_system(system) +, x88_lightId(lightId == 0xffff ? kInvalidUniqueId + : _initializeLight(system, stateMgr, areaId, lightId)) {} + +CParticleGenInfoGeneric::~CParticleGenInfoGeneric() {} + +void CParticleGenInfoGeneric::AddToRenderer() { gpRender->AddParticleGen(*x84_system.GetPtr()); } + +void CParticleGenInfoGeneric::Render() { x84_system->Render(); } + +void CParticleGenInfoGeneric::Update(float dt, CStateManager& stateMgr) { + x84_system->Update(dt); + + if (x88_lightId == kInvalidUniqueId) { + return; + } + + if (CGameLight* gl = TCastToPtr< CGameLight >(stateMgr.ObjectById(x88_lightId))) { + gl->SetLight(x84_system->GetLight()); + } +} + +void CParticleGenInfoGeneric::SetOrientation(const CTransform4f& xf, CStateManager& stateMgr) { + x84_system->SetOrientation(xf); + + if (x88_lightId == kInvalidUniqueId) { + return; + } + + if (CGameLight* gl = TCastToPtr< CGameLight >(stateMgr.ObjectById(x88_lightId))) { + CMatrix3f m1 = xf.BuildMatrix3f(); + gl->SetRotation(CQuaternion::FromMatrix(m1.Orthonormalized())); + } +} + +void CParticleGenInfoGeneric::SetTranslation(const CVector3f& vec, CStateManager& stateMgr) { + x84_system->SetTranslation(vec); + + if (x88_lightId == kInvalidUniqueId) { + return; + } + + if (CGameLight* gl = TCastToPtr< CGameLight >(stateMgr.ObjectById(x88_lightId))) { + gl->SetTranslation(vec); + } +} + +void CParticleGenInfoGeneric::SetGlobalOrientation(const CTransform4f& xf, + CStateManager& stateMgr) { + x84_system->SetGlobalOrientation(xf); + + if (x88_lightId == kInvalidUniqueId) { + return; + } + + if (CGameLight* gl = TCastToPtr< CGameLight >(stateMgr.ObjectById(x88_lightId))) { + gl->SetRotation(CQuaternion::FromMatrix(xf)); + } +} + +void CParticleGenInfoGeneric::SetGlobalTranslation(const CVector3f& vec, CStateManager& stateMgr) { + x84_system->SetGlobalTranslation(vec); + + if (x88_lightId == kInvalidUniqueId) { + return; + } + + if (CGameLight* gl = TCastToPtr< CGameLight >(stateMgr.ObjectById(x88_lightId))) { + gl->SetTranslation(vec); + } +} + +void CParticleGenInfoGeneric::SetGlobalScale(const CVector3f& vec) { + x84_system->SetGlobalScale(vec); +} + +void CParticleGenInfoGeneric::SetParticleEmission(bool isActive, CStateManager& stateMgr) { + x84_system->SetParticleEmission(isActive); + + if (x88_lightId == kInvalidUniqueId) { + return; + } + + if (CGameLight* gl = TCastToPtr< CGameLight >(stateMgr.ObjectById(x88_lightId))) { + gl->SetActive(isActive); + } +} + +void CParticleGenInfoGeneric::DeleteLight(CStateManager& stateMgr) { + if (x88_lightId == kInvalidUniqueId) { + return; + } + + stateMgr.FreeScriptObject(x88_lightId); + x88_lightId = kInvalidUniqueId; +} + +TUniqueId CParticleGenInfoGeneric::GetLightId() const { + return x88_lightId; +} + +void CParticleGenInfoGeneric::SetModulationColor(const CColor& color) { + x84_system->SetModulationColor(color); +} + +bool CParticleGenInfoGeneric::HasLight() const { + return x84_system->SystemHasLight(); +} + +void CParticleGenInfoGeneric::DestroyParticles() { + x84_system->DestroyParticles(); +} + +bool CParticleGenInfoGeneric::HasActiveParticles() const { + return x84_system->GetParticleCount() > 0; +} + +CAABox CParticleGenInfoGeneric::GetBounds() const { + return x84_system->GetBounds(); +} + +bool CParticleGenInfoGeneric::IsSystemDeletable() const { + return x84_system->IsSystemDeletable(); +}