diff --git a/.clang-format b/.clang-format index 105a790f..2bd0e21e 100644 --- a/.clang-format +++ b/.clang-format @@ -24,8 +24,7 @@ AllowShortLoopsOnASingleLine: False AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: True AlwaysBreakTemplateDeclarations: Yes -BinPackArguments: True -BinPackParameters: True +BinPackArguments: True BitFieldColonSpacing: Both BreakBeforeBraces: Custom BraceWrapping: @@ -93,15 +92,15 @@ IncludeCategories: Priority: 0 CaseSensitive: true - - Regex: '' # EGG public headers + - Regex: '"egg\/[[:lower:].]+h"' # EGG public headers Priority: 2 CaseSensitive: true - - Regex: '' # NW4R public headers + - Regex: '"nw4r\/[[:lower:].]+h"' # NW4R public headers Priority: 3 CaseSensitive: true - - Regex: '^' # RVL SDK public headers + - Regex: '^"rvl\/[[:upper:].]+h"' # RVL SDK public headers Priority: 4 CaseSensitive: true diff --git a/config/SOUE01/rels/d_a_e_smNP/symbols.txt b/config/SOUE01/rels/d_a_e_smNP/symbols.txt index 27ea2665..a45034e7 100644 --- a/config/SOUE01/rels/d_a_e_smNP/symbols.txt +++ b/config/SOUE01/rels/d_a_e_smNP/symbols.txt @@ -14,9 +14,9 @@ fn_187_570 = .text:0x00000570; // type:function size:0x5C fn_187_5D0 = .text:0x000005D0; // type:function size:0x70 getStateID__76sStateMgr_c<8dAcEsm_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000640; // type:function size:0x10 fn_187_650 = .text:0x00000650; // type:function size:0x164 -fn_187_7C0 = .text:0x000007C0; // type:function size:0x714 +actorCreate__8dAcEsm_cFv = .text:0x000007C0; // type:function size:0x714 changeState__76sStateMgr_c<8dAcEsm_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x00000EE0; // type:function size:0x10 -fn_187_EF0 = .text:0x00000EF0; // type:function size:0x160 +actorPostCreate__8dAcEsm_cFv = .text:0x00000EF0; // type:function size:0x160 fn_187_1050 = .text:0x00001050; // type:function size:0x34 fn_187_1090 = .text:0x00001090; // type:function size:0x1224 executeState__76sStateMgr_c<8dAcEsm_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000022C0; // type:function size:0x10 @@ -77,7 +77,7 @@ fn_187_5B00 = .text:0x00005B00; // type:function size:0xE8 fn_187_5BF0 = .text:0x00005BF0; // type:function size:0x1A0 fn_187_5D90 = .text:0x00005D90; // type:function size:0x1D8 fn_187_5F70 = .text:0x00005F70; // type:function size:0x1D8 -fn_187_6150 = .text:0x00006150; // type:function size:0x60 +fixBoundingBox__8dAcEsm_cFv = .text:0x00006150; // type:function size:0x60 fn_187_61B0 = .text:0x000061B0; // type:function size:0x958 fn_187_6B10 = .text:0x00006B10; // type:function size:0x10C fn_187_6C20 = .text:0x00006C20; // type:function size:0xEC diff --git a/config/SOUE01/rels/d_a_obj_ivy_ropeNP/symbols.txt b/config/SOUE01/rels/d_a_obj_ivy_ropeNP/symbols.txt index 976e6fe9..d456c122 100644 --- a/config/SOUE01/rels/d_a_obj_ivy_ropeNP/symbols.txt +++ b/config/SOUE01/rels/d_a_obj_ivy_ropeNP/symbols.txt @@ -14,7 +14,7 @@ fn_256_5E0 = .text:0x000005E0; // type:function size:0x4 __dt__13dAcOivyRope_cFv = .text:0x000005F0; // type:function size:0x1F4 AcOivyRope__initTightRope = .text:0x000007F0; // type:function size:0x54C AcOivyRope__handleSubtype1update = .text:0x00000D40; // type:function size:0x37C -fn_256_10C0 = .text:0x000010C0; // type:function size:0xDC +fn_256_10C0__13dAcOivyRope_cFv = .text:0x000010C0; // type:function size:0xDC fn_256_11A0 = .text:0x000011A0; // type:function size:0x94 fn_256_1240 = .text:0x00001240; // type:function size:0x23C fn_256_1480 = .text:0x00001480; // type:function size:0xCD4 @@ -71,7 +71,7 @@ finalizeState_TerryRopePlayerCarry__13dAcOivyRope_cFv = .text:0x00006630; // typ initializeState_TerryRopeWait__13dAcOivyRope_cFv = .text:0x00006640; // type:function size:0x74 executeState_TerryRopeWait__13dAcOivyRope_cFv = .text:0x000066C0; // type:function size:0x5C finalizeState_TerryRopeWait__13dAcOivyRope_cFv = .text:0x00006720; // type:function size:0x4 -AcOivyRope__initModels = .text:0x00006730; // type:function size:0x478 +createHeap__13dAcOivyRope_cFv = .text:0x00006730; // type:function size:0x478 AcOivyRope__init = .text:0x00006BB0; // type:function size:0x748 fn_256_7300 = .text:0x00007300; // type:function size:0x8 fn_256_7310 = .text:0x00007310; // type:function size:0xB8 @@ -99,47 +99,47 @@ fn_256_9120 = .text:0x00009120; // type:function size:0x160 fn_256_9280 = .text:0x00009280; // type:function size:0x1D0 fn_256_9450 = .text:0x00009450; // type:function size:0x82C fn_256_9C80 = .text:0x00009C80; // type:function size:0x3BC -fn_256_A040 = .text:0x0000A040; // type:function size:0x27C -fn_256_A2C0 = .text:0x0000A2C0; // type:function size:0x488 -fn_256_A750 = .text:0x0000A750; // type:function size:0x2E4 -fn_256_AA40 = .text:0x0000AA40; // type:function size:0x64 -fn_256_AAB0 = .text:0x0000AAB0; // type:function size:0x38 -fn_256_AAF0 = .text:0x0000AAF0; // type:function size:0xA8 -fn_256_ABA0 = .text:0x0000ABA0; // type:function size:0x5C -fn_256_AC00 = .text:0x0000AC00; // type:function size:0x1FC -fn_256_AE00 = .text:0x0000AE00; // type:function size:0x4A8 -fn_256_B2B0 = .text:0x0000B2B0; // type:function size:0x7F4 -fn_256_BAB0 = .text:0x0000BAB0; // type:function size:0xB4 -fn_256_BB70 = .text:0x0000BB70; // type:function size:0x304 -fn_256_BE80 = .text:0x0000BE80; // type:function size:0x170 -fn_256_BFF0 = .text:0x0000BFF0; // type:function size:0x204 -fn_256_C200 = .text:0x0000C200; // type:function size:0x210 -fn_256_C410 = .text:0x0000C410; // type:function size:0x2DC -fn_256_C6F0 = .text:0x0000C6F0; // type:function size:0x44 -fn_256_C740 = .text:0x0000C740; // type:function size:0xD0 -fn_256_C810 = .text:0x0000C810; // type:function size:0x144 -fn_256_C960 = .text:0x0000C960; // type:function size:0x14 -fn_256_C980 = .text:0x0000C980; // type:function size:0x30 -fn_256_C9B0 = .text:0x0000C9B0; // type:function size:0x384 -fn_256_CD40 = .text:0x0000CD40; // type:function size:0xDC -fn_256_CE20 = .text:0x0000CE20; // type:function size:0x17C -fn_256_CFA0 = .text:0x0000CFA0; // type:function size:0xAC -fn_256_D050 = .text:0x0000D050; // type:function size:0xB8 -fn_256_D110 = .text:0x0000D110; // type:function size:0x94 -fn_256_D1B0 = .text:0x0000D1B0; // type:function size:0xF8 -fn_256_D2B0 = .text:0x0000D2B0; // type:function size:0x118 -fn_256_D3D0 = .text:0x0000D3D0; // type:function size:0x35C -fn_256_D730 = .text:0x0000D730; // type:function size:0x70 -fn_256_D7A0 = .text:0x0000D7A0; // type:function size:0xA4 -fn_256_D850 = .text:0x0000D850; // type:function size:0x244 -fn_256_DAA0 = .text:0x0000DAA0; // type:function size:0x3D8 -fn_256_DE80 = .text:0x0000DE80; // type:function size:0x58 -fn_256_DEE0 = .text:0x0000DEE0; // type:function size:0x4C -fn_256_DF30 = .text:0x0000DF30; // type:function size:0x4A4 -fn_256_E3E0 = .text:0x0000E3E0; // type:function size:0x3A8 -fn_256_E790 = .text:0x0000E790; // type:function size:0xB4 -fn_256_E850 = .text:0x0000E850; // type:function size:0x68 -fn_256_E8C0 = .text:0x0000E8C0; // type:function size:0x88 +fn_256_A040__13dAcOivyRope_cFv = .text:0x0000A040; // type:function size:0x27C +fn_256_A2C0__13dAcOivyRope_cFb = .text:0x0000A2C0; // type:function size:0x488 +fn_256_A750__13dAcOivyRope_cFbf = .text:0x0000A750; // type:function size:0x2E4 +fn_256_AA40__13dAcOivyRope_cFv = .text:0x0000AA40; // type:function size:0x64 +fn_256_AAB0__13dAcOivyRope_cFff = .text:0x0000AAB0; // type:function size:0x38 +fn_256_AAF0__13dAcOivyRope_cFff = .text:0x0000AAF0; // type:function size:0xA8 +fn_256_ABA0__13dAcOivyRope_cFv = .text:0x0000ABA0; // type:function size:0x5C +fn_256_AC00__13dAcOivyRope_cFv = .text:0x0000AC00; // type:function size:0x1FC +fn_256_AE00__13dAcOivyRope_cFv = .text:0x0000AE00; // type:function size:0x4A8 +fn_256_B2B0__13dAcOivyRope_cFv = .text:0x0000B2B0; // type:function size:0x7F4 +fn_256_BAB0__13dAcOivyRope_cFR7mVec3_ciss = .text:0x0000BAB0; // type:function size:0xB4 +fn_256_BB70__13dAcOivyRope_cFv = .text:0x0000BB70; // type:function size:0x304 +fn_256_BE80__13dAcOivyRope_cFv = .text:0x0000BE80; // type:function size:0x170 +fn_256_BFF0__13dAcOivyRope_cFiff = .text:0x0000BFF0; // type:function size:0x204 +fn_256_C200__13dAcOivyRope_cFi = .text:0x0000C200; // type:function size:0x210 +fn_256_C410__13dAcOivyRope_cFv = .text:0x0000C410; // type:function size:0x2DC +fn_256_C6F0__13dAcOivyRope_cFv = .text:0x0000C6F0; // type:function size:0x44 +fn_256_C740__13dAcOivyRope_cFv = .text:0x0000C740; // type:function size:0xD0 +fn_256_C810__13dAcOivyRope_cFR7mVec3_ci = .text:0x0000C810; // type:function size:0x144 +fn_256_C960__13dAcOivyRope_cFv = .text:0x0000C960; // type:function size:0x14 +fn_256_C980__13dAcOivyRope_cFff = .text:0x0000C980; // type:function size:0x30 +fn_256_C9B0__13dAcOivyRope_cFv = .text:0x0000C9B0; // type:function size:0x384 +fn_256_CD40__13dAcOivyRope_cFv = .text:0x0000CD40; // type:function size:0xDC +fn_256_CE20__13dAcOivyRope_cFPfPfPf = .text:0x0000CE20; // type:function size:0x17C +fn_256_CFA0__13dAcOivyRope_cFb = .text:0x0000CFA0; // type:function size:0xAC +fn_256_D050__13dAcOivyRope_cFv = .text:0x0000D050; // type:function size:0xB8 +fn_256_D110__13dAcOivyRope_cFv = .text:0x0000D110; // type:function size:0x94 +fn_256_D1B0__13dAcOivyRope_cFv = .text:0x0000D1B0; // type:function size:0xF8 +fn_256_D2B0__13dAcOivyRope_cFv = .text:0x0000D2B0; // type:function size:0x118 +fn_256_D3D0__13dAcOivyRope_cFR7mVec3_cR7mVec3_csbf = .text:0x0000D3D0; // type:function size:0x35C +fn_256_D730__13dAcOivyRope_cFl = .text:0x0000D730; // type:function size:0x70 +fn_256_D7A0__13dAcOivyRope_cFlRC7mVec3_c = .text:0x0000D7A0; // type:function size:0xA4 +fn_256_D850__13dAcOivyRope_cFv = .text:0x0000D850; // type:function size:0x244 +fn_256_DAA0__13dAcOivyRope_cFbbff = .text:0x0000DAA0; // type:function size:0x3D8 +fn_256_DE80__13dAcOivyRope_cFv = .text:0x0000DE80; // type:function size:0x58 +fn_256_DEE0__13dAcOivyRope_cFv = .text:0x0000DEE0; // type:function size:0x4C +fn_256_DF30__13dAcOivyRope_cFv = .text:0x0000DF30; // type:function size:0x4A4 +fn_256_E3E0__13dAcOivyRope_cFv = .text:0x0000E3E0; // type:function size:0x3A8 +fn_256_E790__13dAcOivyRope_cFv = .text:0x0000E790; // type:function size:0xB4 +canBeLinkedToWoodTag__13dAcOivyRope_cFv = .text:0x0000E850; // type:function size:0x68 +drop__13dAcOivyRope_cFv = .text:0x0000E8C0; // type:function size:0x88 build__29sFStateFct_c<13dAcOivyRope_c>FRC12sStateIDIf_c = .text:0x0000E950; // type:function size:0x60 dispose__29sFStateFct_c<13dAcOivyRope_c>FRP10sStateIf_c = .text:0x0000E9B0; // type:function size:0xC initialize__26sFState_c<13dAcOivyRope_c>Fv = .text:0x0000E9C0; // type:function size:0x1C diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 5640818f..ed8f7a9f 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -1460,169 +1460,262 @@ nw4r/g3d/res/g3d_resdict.cpp: nw4r/g3d/res/g3d_resfile.cpp: .text start:0x80439420 end:0x80439FC4 + .data start:0x8056D020 end:0x8056D180 nw4r/g3d/res/g3d_resmdl.cpp: .text start:0x80439FD0 end:0x8043B244 + .sdata start:0x80574E30 end:0x80574E38 nw4r/g3d/res/g3d_resshp.cpp: .text start:0x8043B250 end:0x8043BD48 nw4r/g3d/res/g3d_restev.cpp: .text start:0x8043BD50 end:0x8043C2B8 + .rodata start:0x804F6FF0 end:0x804F7050 + .data start:0x8056D180 end:0x8056D190 nw4r/g3d/res/g3d_resmat.cpp: .text start:0x8043C2C0 end:0x8043E17C + .data start:0x8056D190 end:0x8056D1E4 + .sdata2 start:0x8057EC18 end:0x8057EC4C nw4r/g3d/res/g3d_resvtx.cpp: - .text start:0x8043E180 end:0x8043E5B8 + .text start:0x8043E180 end:0x8043E598 nw4r/g3d/res/g3d_restex.cpp: - .text start:0x8043E5C0 end:0x8043E74C + .text start:0x8043E5A0 end:0x8043E74C nw4r/g3d/res/g3d_resnode.cpp: .text start:0x8043E750 end:0x8043EA58 + .sdata2 start:0x8057EC50 end:0x8057EC5C nw4r/g3d/res/g3d_resanm.cpp: .text start:0x8043EA60 end:0x8043ECB8 + .sdata2 start:0x8057EC60 end:0x8057EC74 nw4r/g3d/res/g3d_resanmvis.cpp: .text start:0x8043ECC0 end:0x8043EDE0 + .sdata2 start:0x8057EC78 end:0x8057EC88 nw4r/g3d/res/g3d_resanmclr.cpp: .text start:0x8043EDE0 end:0x8043EF4C + .sdata2 start:0x8057EC88 end:0x8057EC98 nw4r/g3d/res/g3d_resanmtexpat.cpp: .text start:0x8043EF50 end:0x8043F320 nw4r/g3d/res/g3d_resanmtexsrt.cpp: .text start:0x8043F320 end:0x8043F734 + .sdata2 start:0x8057EC98 end:0x8057ECA0 nw4r/g3d/res/g3d_resanmchr.cpp: .text start:0x8043F740 end:0x804419EC + .rodata start:0x804F7050 end:0x804F7070 + .sdata2 start:0x8057ECA0 end:0x8057ECCC nw4r/g3d/res/g3d_reslightset.cpp: .text start:0x804419F0 end:0x80441B5C nw4r/g3d/res/g3d_resanmamblight.cpp: .text start:0x80441B60 end:0x80441C30 + .sdata2 start:0x8057ECD0 end:0x8057ECE0 nw4r/g3d/res/g3d_resanmlight.cpp: .text start:0x80441C30 end:0x80442018 + .sdata2 start:0x8057ECE0 end:0x8057ECF0 nw4r/g3d/res/g3d_resanmcamera.cpp: .text start:0x80442020 end:0x80442330 nw4r/g3d/res/g3d_resanmscn.cpp: .text start:0x80442330 end:0x8044297C + .data start:0x8056D200 end:0x8056D280 nw4r/g3d/res/g3d_resanmshp.cpp: .text start:0x80442980 end:0x80442AE8 + .sdata2 start:0x8057ECF0 end:0x8057ECF4 nw4r/g3d/g3d_transform.cpp: .text start:0x80442AF0 end:0x80442DF4 + .sdata2 start:0x8057ECF8 end:0x8057ECFC nw4r/g3d/g3d_anmvis.cpp: .text start:0x80442E00 end:0x8044358C + .rodata start:0x804F7070 end:0x804F7094 + .data start:0x8056D280 end:0x8056D308 + .sdata start:0x80574E38 end:0x80574E40 + .sdata2 start:0x8057ED00 end:0x8057ED10 nw4r/g3d/g3d_anmclr.cpp: .text start:0x80443590 end:0x80444D5C + .rodata start:0x804F7098 end:0x804F7100 + .data start:0x8056D308 end:0x8056D428 + .sdata2 start:0x8057ED10 end:0x8057ED20 nw4r/g3d/g3d_anmtexpat.cpp: .text start:0x80444D60 end:0x8044635C + .rodata start:0x804F7100 end:0x804F7168 + .data start:0x8056D428 end:0x8056D548 + .sdata2 start:0x8057ED20 end:0x8057ED30 nw4r/g3d/g3d_anmtexsrt.cpp: .text start:0x80446360 end:0x804479AC + .rodata start:0x804F7168 end:0x804F71D0 + .data start:0x8056D548 end:0x8056D668 + .sdata2 start:0x8057ED30 end:0x8057ED50 nw4r/g3d/g3d_anmchr.cpp: .text start:0x804479B0 end:0x804499CC + .rodata start:0x804F71D0 end:0x804F721C + .data start:0x8056D668 end:0x8056D7C8 + .sdata2 start:0x8057ED50 end:0x8057ED68 nw4r/g3d/g3d_anmshp.cpp: .text start:0x804499D0 end:0x8044A3BC + .rodata start:0x804F7220 end:0x804F7244 + .data start:0x8056D7C8 end:0x8056D868 + .sdata2 start:0x8057ED68 end:0x8057ED78 nw4r/g3d/g3d_anmscn.cpp: .text start:0x8044A3C0 end:0x8044A6E8 nw4r/g3d/g3d_obj.cpp: .text start:0x8044A6F0 end:0x8044A85C + .rodata start:0x804F7248 end:0x804F7254 + .data start:0x8056D868 end:0x8056D884 nw4r/g3d/g3d_anmobj.cpp: .text start:0x8044A860 end:0x8044A928 + .rodata start:0x804F7258 end:0x804F7264 + .sdata start:0x80574E40 end:0x80574E44 + .sdata2 start:0x8057ED78 end:0x8057ED7C nw4r/g3d/platform/g3d_gpu.cpp: .text start:0x8044A930 end:0x8044AE50 + .sdata2 start:0x8057ED80 end:0x8057ED98 nw4r/g3d/platform/g3d_tmem.cpp: .text start:0x8044AE50 end:0x8044B1B0 + .rodata start:0x804F7268 end:0x804F79E8 + .sbss start:0x80576618 end:0x80576628 + .bss start:0x8063B560 end:0x8063B9A0 nw4r/g3d/platform/g3d_cpu.cpp: .text start:0x8044B1B0 end:0x8044B35C + .sdata2 start:0x8057ED98 end:0x8057ED9C nw4r/g3d/g3d_state.cpp: .text start:0x8044B360 end:0x8044EAB0 .ctors start:0x804DB954 end:0x804DB958 + .rodata start:0x804F79E8 end:0x804F7A18 + .data start:0x8056D888 end:0x8056D8A0 + .sdata start:0x80574E48 end:0x80574E50 + .sbss start:0x80576628 end:0x80576648 + .sdata2 start:0x8057EDA0 end:0x8057EDC8 + .bss start:0x8063B9A0 end:0x80640F44 nw4r/g3d/g3d_draw1mat1shp.cpp: .text start:0x8044EAB0 end:0x8044F7F4 + .rodata start:0x804F7A18 end:0x804F7A28 + .sdata2 start:0x8057EDC8 end:0x8057EDE8 nw4r/g3d/g3d_calcview.cpp: .text start:0x8044F800 end:0x80451A9C + .rodata start:0x804F7A28 end:0x804F7A44 + .sdata2 start:0x8057EDE8 end:0x8057EDF4 nw4r/g3d/g3d_dcc.cpp: .text start:0x80451AA0 end:0x80451B84 nw4r/g3d/g3d_workmem.cpp: .text start:0x80451B90 end:0x80451BDC + .bss start:0x80640F80 end:0x80658F80 nw4r/g3d/g3d_calcworld.cpp: .text start:0x80451BE0 end:0x8045274C + .data start:0x8056D8A0 end:0x8056D8A9 + .sdata start:0x80574E50 end:0x80574E58 + .sdata2 start:0x8057EDF8 end:0x8057EE00 nw4r/g3d/g3d_draw.cpp: .text start:0x80452750 end:0x804545F0 + .sdata start:0x80574E58 end:0x80574E60 + .sdata2 start:0x8057EE00 end:0x8057EE0C nw4r/g3d/g3d_camera.cpp: .text start:0x804545F0 end:0x804556AC + .sdata2 start:0x8057EE10 end:0x8057EE48 nw4r/g3d/dcc/g3d_basic.cpp: .text start:0x804556B0 end:0x80455978 + .sdata2 start:0x8057EE48 end:0x8057EE54 nw4r/g3d/dcc/g3d_maya.cpp: .text start:0x80455980 end:0x80456684 + .rodata start:0x804F7A48 end:0x804F7A80 + .sdata2 start:0x8057EE58 end:0x8057EE6C nw4r/g3d/dcc/g3d_xsi.cpp: .text start:0x80456690 end:0x804572A4 + .rodata start:0x804F7A80 end:0x804F7AB8 + .sdata2 start:0x8057EE70 end:0x8057EE7C nw4r/g3d/dcc/g3d_3dsmax.cpp: .text start:0x804572B0 end:0x80457DCC + .rodata start:0x804F7AB8 end:0x804F7AF0 + .sdata2 start:0x8057EE80 end:0x8057EE94 nw4r/g3d/g3d_scnobj.cpp: .text start:0x80457DD0 end:0x8045980C + .rodata start:0x804F7AF0 end:0x804F7B20 + .data start:0x8056D8B0 end:0x8056D9A8 + .sbss start:0x80576648 end:0x8057664C + .sdata2 start:0x8057EE98 end:0x8057EEA0 nw4r/g3d/g3d_scnroot.cpp: .text start:0x80459810 end:0x8045B1BC + .rodata start:0x804F7B20 end:0x804F7B30 + .data start:0x8056D9A8 end:0x8056DA18 + .sdata start:0x80574E60 end:0x80574E70 + .sdata2 start:0x8057EEA0 end:0x8057EEA4 nw4r/g3d/g3d_scnmdlsmpl.cpp: .text start:0x8045B1C0 end:0x8045D25C + .rodata start:0x804F7B30 end:0x804F7B48 + .data start:0x8056DA18 end:0x8056DA70 + .sdata start:0x80574E70 end:0x80574E88 + .sdata2 start:0x8057EEA8 end:0x8057EEAC nw4r/g3d/g3d_scnmdl.cpp: .text start:0x8045D260 end:0x8045FDAC + .rodata start:0x804F7B48 end:0x804F7B58 + .data start:0x8056DA70 end:0x8056DAB8 nw4r/g3d/g3d_calcmaterial.cpp: .text start:0x8045FDB0 end:0x8045FFE4 nw4r/g3d/g3d_init.cpp: .text start:0x8045FFF0 end:0x804600E8 + .data start:0x8056DAB8 end:0x8056DAFE + .sdata start:0x80574E88 end:0x80574E8C nw4r/g3d/g3d_scnproc.cpp: .text start:0x804600F0 end:0x804603F0 + .rodata start:0x804F7B70 end:0x804F7B80 + .data start:0x8056DB00 end:0x8056DB34 + .sdata2 start:0x8057EEB0 end:0x8057EEB4 nw4r/g3d/g3d_fog.cpp: .text start:0x804603F0 end:0x80460560 + .sdata2 start:0x8057EEB8 end:0x8057EEBC nw4r/g3d/g3d_light.cpp: .text start:0x80460560 end:0x80460F68 + .sdata2 start:0x8057EEC0 end:0x8057EEEC nw4r/g3d/g3d_calcvtx.cpp: .text start:0x80460F70 end:0x804616F8 + .sdata2 start:0x8057EEF0 end:0x8057EEF4 nw4r/snd/snd_AnimSound.cpp: .text start:0x80461700 end:0x804630D4 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 5aed4c7b..c237a2fc 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -589,7 +589,7 @@ fn_80017CF0 = .text:0x80017CF0; // type:function size:0x230 fn_80017F20 = .text:0x80017F20; // type:function size:0x20C fn_80018130 = .text:0x80018130; // type:function size:0x788 fn_800188C0 = .text:0x800188C0; // type:function size:0x3EC -nw4r__g3d__G3dObj__IsDerivedFrom = .text:0x80018CB0; // type:function size:0x1C +IsDerivedFrom__Q34nw4r3g3d6G3dObjCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80018CB0; // type:function size:0x1C scope:weak fn_80018CD0 = .text:0x80018CD0; // type:function size:0x34 fn_80018D10 = .text:0x80018D10; // type:function size:0x190 fn_80018EA0 = .text:0x80018EA0; // type:function size:0x58 @@ -22421,7 +22421,7 @@ GXGetProjectionv = .text:0x803C2310; // type:function size:0x40 GXLoadPosMtxImm = .text:0x803C2350; // type:function size:0x50 GXLoadPosMtxIndx = .text:0x803C23A0; // type:function size:0x2C GXLoadNrmMtxImm = .text:0x803C23D0; // type:function size:0x58 -GXLoadNormMtxIndx3x3 = .text:0x803C2430; // type:function size:0x34 +GXLoadNrmMtxIndx3x3 = .text:0x803C2430; // type:function size:0x34 GXSetCurrentMtx = .text:0x803C2470; // type:function size:0x20 GXLoadTexMtxImm = .text:0x803C2490; // type:function size:0xB4 __GXSetViewport = .text:0x803C2550; // type:function size:0x90 @@ -24274,13 +24274,13 @@ GetResTexPlttInfoOffsetFromTexNameNumEntries__Q34nw4r3g3d6ResMdlCFv = .text:0x80 Bind__Q34nw4r3g3d6ResMdlFQ34nw4r3g3d7ResFile = .text:0x8043A9B0; // type:function size:0x10C Init__Q34nw4r3g3d6ResMdlFv = .text:0x8043AAC0; // type:function size:0x598 IsOpaque__Q34nw4r3g3d6ResMdlCFUl = .text:0x8043B060; // type:function size:0xA8 -CreateByteCodeIterator = .text:0x8043B110; // type:function size:0x1C -isOk = .text:0x8043B130; // type:function size:0x54 -iterate = .text:0x8043B190; // type:function size:0x40 -getIdIndex = .text:0x8043B1D0; // type:function size:0x34 -getMatIndex = .text:0x8043B210; // type:function size:0x34 -GXGetVtxAttrFmtv__Q34nw4r3g3d6ResShpCFP17_GXVtxAttrFmtList = .text:0x8043B250; // type:function size:0x204 -GXSetVtxAttrFmtv__Q34nw4r3g3d6ResShpFPC17_GXVtxAttrFmtList = .text:0x8043B460; // type:function size:0x26C +__ct__Q44nw4r3g3d6ResMdl14DrawEnumeratorFPCUcPCUc = .text:0x8043B110; // type:function size:0x1C +IsValid__Q44nw4r3g3d6ResMdl14DrawEnumeratorCFv = .text:0x8043B130; // type:function size:0x54 +MoveNext__Q44nw4r3g3d6ResMdl14DrawEnumeratorFv = .text:0x8043B190; // type:function size:0x40 +GetMatID__Q44nw4r3g3d6ResMdl14DrawEnumeratorCFv = .text:0x8043B1D0; // type:function size:0x34 +GetShpID__Q44nw4r3g3d6ResMdl14DrawEnumeratorCFv = .text:0x8043B210; // type:function size:0x34 +GXGetVtxDescv__Q34nw4r3g3d6ResShpCFP14_GXVtxDescList = .text:0x8043B250; // type:function size:0x204 +GXGetVtxAttrFmtv__Q34nw4r3g3d6ResShpCFP17_GXVtxAttrFmtList = .text:0x8043B460; // type:function size:0x26C GetResVtxPos__Q34nw4r3g3d6ResShpCFv = .text:0x8043B6D0; // type:function size:0x48 GetResVtxNrm__Q34nw4r3g3d6ResShpCFv = .text:0x8043B720; // type:function size:0x5C GetResVtxClr__Q34nw4r3g3d6ResShpCFUl = .text:0x8043B780; // type:function size:0x64 @@ -24289,8 +24289,8 @@ Init__Q34nw4r3g3d6ResShpFv = .text:0x8043B850; // type:function size:0x38C CallPrePrimitiveDisplayList__Q34nw4r3g3d6ResShpCFbb = .text:0x8043BBE0; // type:function size:0xD8 CallPrimitiveDisplayList__Q34nw4r3g3d6ResShpCFb = .text:0x8043BCC0; // type:function size:0x64 DCStore__Q34nw4r3g3d6ResShpFb = .text:0x8043BD30; // type:function size:0x18 -GXGetTevAlphaIn__Q34nw4r3g3d6ResTevCF13_GXTevStageIDP14_GXTevAlphaArgP14_GXTevAlphaArgP14_GXTevAlphaArgP14_GXTevAlphaArg = .text:0x8043BD50; // type:function size:0xB0 -GXGetTevAlphaOp__Q34nw4r3g3d6ResTevCF13_GXTevStageIDP8_GXTevOpP10_GXTevBiasP11_GXTevScalePUcP11_GXTevRegID = .text:0x8043BE00; // type:function size:0xCC +GXSetTevSwapModeTable__Q34nw4r3g3d6ResTevF13_GXTevSwapSel15_GXTevColorChan15_GXTevColorChan15_GXTevColorChan15_GXTevColorChan = .text:0x8043BD50; // type:function size:0xB0 +GXGetTevOrder__Q34nw4r3g3d6ResTevCF13_GXTevStageIDP13_GXTexCoordIDP11_GXTexMapIDP12_GXChannelID = .text:0x8043BE00; // type:function size:0xCC GXSetTevOrder__Q34nw4r3g3d6ResTevF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID = .text:0x8043BED0; // type:function size:0x11C GXGetIndTexOrder__Q34nw4r3g3d6ResTevCF16_GXIndTexStageIDP13_GXTexCoordIDP11_GXTexMapID = .text:0x8043BFF0; // type:function size:0x9C GXSetIndTexOrder__Q34nw4r3g3d6ResTevF16_GXIndTexStageID13_GXTexCoordID11_GXTexMapID = .text:0x8043C090; // type:function size:0x138 @@ -24312,7 +24312,7 @@ GetTexObj__Q34nw4r3g3d9ResTexObjCF11_GXTexMapID = .text:0x8043C4C0; // type:func GetTexObj__Q34nw4r3g3d9ResTexObjF11_GXTexMapID = .text:0x8043C4F0; // type:function size:0x2C IsValidTexObj__Q34nw4r3g3d9ResTexObjCF11_GXTexMapID = .text:0x8043C520; // type:function size:0x3C CopyTo__Q34nw4r3g3d9ResTexObjCFPv = .text:0x8043C560; // type:function size:0x88 -GetTlut__Q34nw4r3g3d10ResTlutObjCF7_GXTlut = .text:0x8043C5F0; // type:function size:0x2C +GetTlut__Q34nw4r3g3d10ResTlutObjCF6GXTlut = .text:0x8043C5F0; // type:function size:0x2C GetTlut__Q34nw4r3g3d10ResTlutObjF7_GXTlut = .text:0x8043C620; // type:function size:0x2C IsValidTlut__Q34nw4r3g3d10ResTlutObjCF7_GXTlut = .text:0x8043C650; // type:function size:0x3C CopyTo__Q34nw4r3g3d10ResTlutObjCFPv = .text:0x8043C690; // type:function size:0x88 @@ -24426,10 +24426,10 @@ GetResAnmAmbLight__Q34nw4r3g3d9ResAnmScnCFQ34nw4r3g3d7ResName = .text:0x804423F0 GetResAnmAmbLight__Q34nw4r3g3d9ResAnmScnCFUl = .text:0x80442480; // type:function size:0xAC GetResAnmLight__Q34nw4r3g3d9ResAnmScnCFQ34nw4r3g3d7ResName = .text:0x80442530; // type:function size:0x88 GetResAnmLight__Q34nw4r3g3d9ResAnmScnCFUl = .text:0x804425C0; // type:function size:0xAC -GetResAnmCamera__Q34nw4r3g3d9ResAnmScnCFUl = .text:0x80442670; // type:function size:0xAC -GetResLightSetByRefNumber__Q34nw4r3g3d9ResAnmScnCFi = .text:0x80442720; // type:function size:0x4C +GetResAnmCamera__Q34nw4r3g3d9ResAnmScnCFi = .text:0x80442670; // type:function size:0xAC +GetResLightSetByRefNumber__Q34nw4r3g3d9ResAnmScnCFUl = .text:0x80442720; // type:function size:0x4C GetResAnmAmbLightByRefNumber__Q34nw4r3g3d9ResAnmScnCFUl = .text:0x80442770; // type:function size:0x4C -GetResAnmLightByRefNumber__Q34nw4r3g3d9ResAnmScnCFi = .text:0x804427C0; // type:function size:0x4C +GetResAnmLightByRefNumber__Q34nw4r3g3d9ResAnmScnCFUl = .text:0x804427C0; // type:function size:0x4C Bind__Q34nw4r3g3d9ResAnmScnFQ34nw4r3g3d9ResAnmScn = .text:0x80442810; // type:function size:0x16C GetAnmResult__Q34nw4r3g3d9ResAnmShpCFPQ34nw4r3g3d12ShpAnmResultUlfPCQ34nw4r3g3d12ShpAnmVtxSet = .text:0x80442980; // type:function size:0x168 CalcViewNrmMtx__Q34nw4r3g3d6detailFPQ34nw4r4math5MTX33PCQ34nw4r4math5MTX34 = .text:0x80442AF0; // type:function size:0xE4 @@ -24439,7 +24439,7 @@ Release__Q34nw4r3g3d9AnmObjVisFv = .text:0x80442E00; // type:function size:0x40 Attach__Q34nw4r3g3d9AnmObjVisFiPQ34nw4r3g3d12AnmObjVisRes = .text:0x80442E40; // type:function size:0x8 Detach__Q34nw4r3g3d9AnmObjVisFi = .text:0x80442E50; // type:function size:0x8 G3dProc__Q34nw4r3g3d9AnmObjVisFUlUlPv = .text:0x80442E60; // type:function size:0x40 -__dt__Q34nw4r3g3d6AnmObjFv = .text:0x80442EA0; // type:function size:0x40 +__dt__Q34nw4r3g3d9AnmObjVisFv = .text:0x80442EA0; // type:function size:0x40 Construct__Q34nw4r3g3d12AnmObjVisResFP12MEMAllocatorPUlQ34nw4r3g3d9ResAnmVisQ34nw4r3g3d6ResMdl = .text:0x80442EE0; // type:function size:0x150 SetFrame__Q34nw4r3g3d12AnmObjVisResFf = .text:0x80443030; // type:function size:0x64 GetFrame__Q34nw4r3g3d12AnmObjVisResCFv = .text:0x804430A0; // type:function size:0x8 @@ -24859,7 +24859,7 @@ SetPriorityDrawXlu__Q34nw4r3g3d6ScnObjFi = .text:0x80458410; // type:function si EnableScnObjCallbackTiming__Q34nw4r3g3d6ScnObjFQ44nw4r3g3d6ScnObj6Timing = .text:0x80458440; // type:function size:0x40 DisableScnObjCallbackTiming__Q34nw4r3g3d6ScnObjFQ44nw4r3g3d6ScnObj6Timing = .text:0x80458480; // type:function size:0x40 EnableScnObjCallbackExecOp__Q34nw4r3g3d6ScnObjFQ44nw4r3g3d6ScnObj6ExecOp = .text:0x804584C0; // type:function size:0x14 -SetBoundingVolume__Q34nw4r3g3d6ScnObjFQ44nw4r3g3d6ScnObj24ScnObjBoundingVolumeTypePCQ34nw4r4math4AABB = .text:0x804584E0; // type:function size:0x80 +SetBoundingVolume__Q34nw4r3g3d6ScnObjFQ44nw4r3g3d6ScnObj24ScnObjBoundingVolumeTypePCQ34nw4r4math4AABB = .text:0x804584E0; // type:function size:0x84 GetBoundingVolume__Q34nw4r3g3d6ScnObjCFQ44nw4r3g3d6ScnObj24ScnObjBoundingVolumeTypePQ34nw4r4math4AABB = .text:0x80458570; // type:function size:0x60 ForEach__Q34nw4r3g3d7ScnLeafFPFPQ34nw4r3g3d6ScnObjPv_Q44nw4r3g3d6ScnObj13ForEachResultPvb = .text:0x804585D0; // type:function size:0x38 SetScnObjOption__Q34nw4r3g3d7ScnLeafFUlUl = .text:0x80458610; // type:function size:0x40 @@ -28755,7 +28755,7 @@ lbl_804F0480 = .rodata:0x804F0480; // type:object size:0x60 lbl_804F04E0 = .rodata:0x804F04E0; // type:object size:0x50 lbl_804F0530 = .rodata:0x804F0530; // type:object size:0x40 data:double s_GameHeapNames__5mHeap = .rodata:0x804F0570; // type:object size:0x10 -lbl_804F0580 = .rodata:0x804F0580; // type:object size:0x8 data:float +lbl_804F0580 = .rodata:0x804F0580; // type:object size:0x4 data:float lbl_804F0588 = .rodata:0x804F0588; // type:object size:0x10 data:float lbl_804F0598 = .rodata:0x804F0598; // type:object size:0x4 data:float lbl_804F059C = .rodata:0x804F059C; // type:object size:0x4 data:float @@ -28784,9 +28784,9 @@ lbl_804F09B4 = .rodata:0x804F09B4; // type:object size:0x4 data:float lbl_804F09B8 = .rodata:0x804F09B8; // type:object size:0x4 data:float lbl_804F09BC = .rodata:0x804F09BC; // type:object size:0xC data:float lbl_804F09C8 = .rodata:0x804F09C8; // type:object size:0x8 data:double -lbl_804F09D0 = .rodata:0x804F09D0; // type:object size:0x8 data:float +lbl_804F09D0 = .rodata:0x804F09D0; // type:object size:0x4 data:float lbl_804F09D8 = .rodata:0x804F09D8; // type:object size:0x18 data:float -lbl_804F09F0 = .rodata:0x804F09F0; // type:object size:0x8 data:float +lbl_804F09F0 = .rodata:0x804F09F0; // type:object size:0x4 data:float lbl_804F09F8 = .rodata:0x804F09F8; // type:object size:0x4 data:float lbl_804F0A00 = .rodata:0x804F0A00; // type:object size:0x10 data:double lbl_804F0A10 = .rodata:0x804F0A10; // type:object size:0x4 data:float @@ -28807,7 +28807,7 @@ lbl_804F0A90 = .rodata:0x804F0A90; // type:object size:0x20 data:double lbl_804F0AB0 = .rodata:0x804F0AB0; // type:object size:0x4 data:float lbl_804F0AB4 = .rodata:0x804F0AB4; // type:object size:0x4 data:float lbl_804F0AB8 = .rodata:0x804F0AB8; // type:object size:0x8 data:double -lbl_804F0AC0 = .rodata:0x804F0AC0; // type:object size:0x8 data:float +lbl_804F0AC0 = .rodata:0x804F0AC0; // type:object size:0x4 data:float lbl_804F0AC8 = .rodata:0x804F0AC8; // type:object size:0x28 data:float lbl_804F0AF0 = .rodata:0x804F0AF0; // type:object size:0x80 lbl_804F0B70 = .rodata:0x804F0B70; // type:object size:0x10 @@ -29088,46 +29088,46 @@ nw4r__math__detail__SIN_COS_TABLE = .rodata:0x804F5FE0; // type:object size:0x10 lbl_804F6FF0 = .rodata:0x804F6FF0; // type:object size:0x20 lbl_804F7010 = .rodata:0x804F7010; // type:object size:0x40 lbl_804F7050 = .rodata:0x804F7050; // type:object size:0x20 -AnmObjVis = .rodata:0x804F7070; // type:object size:0x10 -AnmObjVisRes = .rodata:0x804F7080; // type:object size:0x18 -AnmObjMatClr = .rodata:0x804F7098; // type:object size:0x18 -AnmObjMatClrNode = .rodata:0x804F70B0; // type:object size:0x18 -TYPE_NAME__Q34nw4r3g3d20AnmObjMatClrOverride = .rodata:0x804F70C8; // type:object size:0x20 +TYPE_NAME__Q34nw4r3g3d9AnmObjVis = .rodata:0x804F7070; // type:object size:0x10 +TYPE_NAME__Q34nw4r3g3d12AnmObjVisRes = .rodata:0x804F7080; // type:object size:0x14 +TYPE_NAME__Q34nw4r3g3d12AnmObjMatClr = .rodata:0x804F7098; // type:object size:0x14 +TYPE_NAME__Q34nw4r3g3d16AnmObjMatClrNode = .rodata:0x804F70B0; // type:object size:0x18 +TYPE_NAME__Q34nw4r3g3d20AnmObjMatClrOverride = .rodata:0x804F70C8; // type:object size:0x1C TYPE_NAME__Q34nw4r3g3d15AnmObjMatClrRes = .rodata:0x804F70E8; // type:object size:0x18 -AnmObjTexPat = .rodata:0x804F7100; // type:object size:0x18 -AnmObjTexPatNode = .rodata:0x804F7118; // type:object size:0x18 -TYPE_NAME__Q34nw4r3g3d20AnmObjTexPatOverride = .rodata:0x804F7130; // type:object size:0x20 +TYPE_NAME__Q34nw4r3g3d12AnmObjTexPat = .rodata:0x804F7100; // type:object size:0x14 +TYPE_NAME__Q34nw4r3g3d16AnmObjTexPatNode = .rodata:0x804F7118; // type:object size:0x18 +TYPE_NAME__Q34nw4r3g3d20AnmObjTexPatOverride = .rodata:0x804F7130; // type:object size:0x1C TYPE_NAME__Q34nw4r3g3d15AnmObjTexPatRes = .rodata:0x804F7150; // type:object size:0x18 -AnmObjTexSrt = .rodata:0x804F7168; // type:object size:0x18 -AnmObjTexSrtNode = .rodata:0x804F7180; // type:object size:0x18 -TYPE_NAME__Q34nw4r3g3d20AnmObjTexSrtOverride = .rodata:0x804F7198; // type:object size:0x20 +TYPE_NAME__Q34nw4r3g3d12AnmObjTexSrt = .rodata:0x804F7168; // type:object size:0x14 +TYPE_NAME__Q34nw4r3g3d16AnmObjTexSrtNode = .rodata:0x804F7180; // type:object size:0x18 +TYPE_NAME__Q34nw4r3g3d20AnmObjTexSrtOverride = .rodata:0x804F7198; // type:object size:0x1C TYPE_NAME__Q34nw4r3g3d15AnmObjTexSrtRes = .rodata:0x804F71B8; // type:object size:0x18 -AnmObjChr = .rodata:0x804F71D0; // type:object size:0x10 +TYPE_NAME__Q34nw4r3g3d9AnmObjChr = .rodata:0x804F71D0; // type:object size:0x10 TYPE_NAME__Q34nw4r3g3d13AnmObjChrNode = .rodata:0x804F71E0; // type:object size:0x14 TYPE_NAME__Q34nw4r3g3d14AnmObjChrBlend = .rodata:0x804F71F4; // type:object size:0x14 -TYPE_NAME__Q34nw4r3g3d12AnmObjChrRes = .rodata:0x804F7208; // type:object size:0x18 -lbl_804F7220 = .rodata:0x804F7220; // type:object size:0x10 -lbl_804F7230 = .rodata:0x804F7230; // type:object size:0x18 -G3DObj = .rodata:0x804F7248; // type:object size:0x10 -AnmObj = .rodata:0x804F7258; // type:object size:0x10 -lbl_804F7268 = .rodata:0x804F7268; // type:object size:0x3C0 -lbl_804F7628 = .rodata:0x804F7628; // type:object size:0x3C0 -lbl_804F79E8 = .rodata:0x804F79E8; // type:object size:0x30 +TYPE_NAME__Q34nw4r3g3d12AnmObjChrRes = .rodata:0x804F7208; // type:object size:0x14 +TYPE_NAME__Q34nw4r3g3d9AnmObjShp = .rodata:0x804F7220; // type:object size:0x10 +TYPE_NAME__Q34nw4r3g3d12AnmObjShpRes = .rodata:0x804F7230; // type:object size:0x14 +TYPE_NAME__Q34nw4r3g3d6G3dObj = .rodata:0x804F7248; // type:object size:0xC +TYPE_NAME__Q34nw4r3g3d6AnmObj = .rodata:0x804F7258; // type:object size:0xC +scaaaTexRegionAddr = .rodata:0x804F7268; // type:object size:0x3C0 scope:local +scaaaTexRegionSize = .rodata:0x804F7628; // type:object size:0x3C0 scope:local +@LOCAL@EnvironmentMapping__Q44nw4r3g3d6detail19ScnDependentMtxFuncFPQ34nw4r4math5MTX34ScSc@envMtx = .rodata:0x804F79E8; // type:object size:0x30 scope:local lbl_804F7A18 = .rodata:0x804F7A18; // type:object size:0x10 data:4byte -lbl_804F7A28 = .rodata:0x804F7A28; // type:object size:0x20 -lbl_804F7A48 = .rodata:0x804F7A48; // type:object size:0x1C -lbl_804F7A64 = .rodata:0x804F7A64; // type:object size:0x1C -lbl_804F7A80 = .rodata:0x804F7A80; // type:object size:0x1C -lbl_804F7A9C = .rodata:0x804F7A9C; // type:object size:0x1C -lbl_804F7AB8 = .rodata:0x804F7AB8; // type:object size:0x1C -lbl_804F7AD4 = .rodata:0x804F7AD4; // type:object size:0x1C -ScnObj = .rodata:0x804F7AF0; // type:object size:0x10 -ScnLeaf = .rodata:0x804F7B00; // type:object size:0x10 -ScnGroup = .rodata:0x804F7B10; // type:object size:0x10 -ScnRoot = .rodata:0x804F7B20; // type:object size:0x10 -TYPE_NAME__Q34nw4r3g3d12ScnMdlSimple = .rodata:0x804F7B30; // type:object size:0x18 -TYPE_NAME__Q34nw4r3g3d6ScnMdl = .rodata:0x804F7B48; // type:object size:0x10 -ScnMdlMat1Shp = .rodata:0x804F7B58; // type:object size:0x18 +bbFunc__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@ = .rodata:0x804F7A28; // type:object size:0x1C +@LOCAL@CalcTexMtx_Maya__Q44nw4r3g3d6detail3dccFPQ34nw4r4math5MTX34bRCQ34nw4r3g3d6TexSrtQ44nw4r3g3d6TexSrt4Flag@funcTable = .rodata:0x804F7A48; // type:object size:0x1C scope:weak +@LOCAL@CalcTexMtx_Maya__Q44nw4r3g3d6detail3dccFPQ34nw4r4math5MTX34bRCQ34nw4r3g3d6TexSrtQ44nw4r3g3d6TexSrt4Flag@funcTable@0 = .rodata:0x804F7A64; // type:object size:0x1C scope:weak +@LOCAL@CalcTexMtx_Xsi__Q44nw4r3g3d6detail3dccFPQ34nw4r4math5MTX34bRCQ34nw4r3g3d6TexSrtQ44nw4r3g3d6TexSrt4Flag@funcTable = .rodata:0x804F7A80; // type:object size:0x1C scope:weak +@LOCAL@CalcTexMtx_Xsi__Q44nw4r3g3d6detail3dccFPQ34nw4r4math5MTX34bRCQ34nw4r3g3d6TexSrtQ44nw4r3g3d6TexSrt4Flag@funcTable@0 = .rodata:0x804F7A9C; // type:object size:0x1C scope:weak +@LOCAL@CalcTexMtx_3dsmax__Q44nw4r3g3d6detail3dccFPQ34nw4r4math5MTX34bRCQ34nw4r3g3d6TexSrtQ44nw4r3g3d6TexSrt4Flag@funcTable = .rodata:0x804F7AB8; // type:object size:0x1C scope:weak +@LOCAL@CalcTexMtx_3dsmax__Q44nw4r3g3d6detail3dccFPQ34nw4r4math5MTX34bRCQ34nw4r3g3d6TexSrtQ44nw4r3g3d6TexSrt4Flag@funcTable@0 = .rodata:0x804F7AD4; // type:object size:0x1C scope:weak +TYPE_NAME__Q34nw4r3g3d6ScnObj = .rodata:0x804F7AF0; // type:object size:0xC +TYPE_NAME__Q34nw4r3g3d7ScnLeaf = .rodata:0x804F7B00; // type:object size:0x10 +TYPE_NAME__Q34nw4r3g3d8ScnGroup = .rodata:0x804F7B10; // type:object size:0x10 +TYPE_NAME__Q34nw4r3g3d7ScnRoot = .rodata:0x804F7B20; // type:object size:0x10 +TYPE_NAME__Q34nw4r3g3d12ScnMdlSimple = .rodata:0x804F7B30; // type:object size:0x14 +TYPE_NAME__Q34nw4r3g3d6ScnMdl = .rodata:0x804F7B48; // type:object size:0xC +TYPE_NAME__Q34nw4r3g3d13ScnMdlMat1Shp = .rodata:0x804F7B58; // type:object size:0x18 TYPE_NAME__Q34nw4r3g3d7ScnProc = .rodata:0x804F7B70; // type:object size:0x10 lbl_804F7B80 = .rodata:0x804F7B80; // type:object size:0x460 lbl_804F7FE0 = .rodata:0x804F7FE0; // type:object size:0x3CC @@ -37194,58 +37194,58 @@ CPU_EXP_NAME__Q24nw4r2db = .data:0x8056C0F4; // type:object size:0x44 lbl_8056C600 = .data:0x8056C600; // type:object size:0x108 lbl_8056C708 = .data:0x8056C708; // type:object size:0x808 lbl_8056CF10 = .data:0x8056CF10; // type:object size:0x110 -RES_MODELS_FOLDER = .data:0x8056D020; // type:object size:0x20 -PALLETS_FOLDER = .data:0x8056D040; // type:object size:0x20 -TEXTURES_FOLDER = .data:0x8056D060; // type:object size:0x20 -ANM_CHR_FOLDER = .data:0x8056D080; // type:object size:0x20 -ANM_VIS_FOLDER = .data:0x8056D0A0; // type:object size:0x20 -ANM_CLR_FOLDER = .data:0x8056D0C0; // type:object size:0x20 -ANM_TEX_PAT_FOLDER = .data:0x8056D0E0; // type:object size:0x20 -ANM_TEX_SRT_FOLDER = .data:0x8056D100; // type:object size:0x20 -ANM_SHP_FOLDER = .data:0x8056D120; // type:object size:0x20 -ANM_SCN_FOLDER = .data:0x8056D140; // type:object size:0x20 -EXTERNAL_FOLDER = .data:0x8056D160; // type:object size:0x20 +ResNameData_Models__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D020; // type:object size:0x20 +ResNameData_Pltts__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D040; // type:object size:0x20 +ResNameData_Textures__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D060; // type:object size:0x20 +ResNameData_AnmChr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D080; // type:object size:0x20 +ResNameData_AnmVis__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D0A0; // type:object size:0x20 +ResNameData_AnmClr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D0C0; // type:object size:0x20 +ResNameData_AnmTexPat__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D0E0; // type:object size:0x20 +ResNameData_AnmTexSrt__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D100; // type:object size:0x20 +ResNameData_AnmShp__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D120; // type:object size:0x20 +ResNameData_AnmScn__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D140; // type:object size:0x20 +ResNameData_Ext__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x8056D160; // type:object size:0x20 lbl_8056D180 = .data:0x8056D180; // type:object size:0x10 jumptable_8056D190 = .data:0x8056D190; // type:object size:0x54 scope:local -RRES_LIGHTSET_FOLDER = .data:0x8056D200; // type:object size:0x20 -RRES_AMBLIGHTS_FOLDER = .data:0x8056D220; // type:object size:0x20 -RRES_LIGHTS_FOLDER = .data:0x8056D240; // type:object size:0x20 -RRES_CAMERA_FOLDER = .data:0x8056D260; // type:object size:0x20 -nw4r__g3d__AnmObjVisRes__vtable = .data:0x8056D280; // type:object size:0x44 -nw4r__g3d__AnmObjVis__vtable = .data:0x8056D2C4; // type:object size:0x44 -nw4r__g3d__AnmObjMatClrRes__vtable = .data:0x8056D308; // type:object size:0x48 -nw4r__g3d__AnmObjMatClrOverride__vtable = .data:0x8056D350; // type:object size:0x48 -nw4r__g3d__AnmObjMatClrNode__vtable = .data:0x8056D398; // type:object size:0x48 -nw4r__g3d__AnmObjMatClr__vtable = .data:0x8056D3E0; // type:object size:0x48 -nw4r__g3d__AnmObjTexPatRes__vtable = .data:0x8056D428; // type:object size:0x48 -nw4r__g3d__AnmObjTexPatOverride__vtable = .data:0x8056D470; // type:object size:0x48 -nw4r__g3d__AnmObjTexPatNode__vtable = .data:0x8056D4B8; // type:object size:0x48 -nw4r__g3d__AnmObjTexPat__vtable = .data:0x8056D500; // type:object size:0x48 -nw4r__g3d__AnmObjTexSrtRes__vtable = .data:0x8056D548; // type:object size:0x48 -nw4r__g3d__AnmObjTexSrtOverride__vtable = .data:0x8056D590; // type:object size:0x48 -nw4r__g3d__AnmObjTexSrtNode__vtable = .data:0x8056D5D8; // type:object size:0x48 -nw4r__g3d__AnmObjTexSrt__vtable = .data:0x8056D620; // type:object size:0x48 -nw4r__g3d__AnmObjChrRes__vtable = .data:0x8056D668; // type:object size:0x58 -nw4r__g3d__AnmObjChrBlend__vtable = .data:0x8056D6C0; // type:object size:0x58 -nw4r__g3d__AnmObjChrNode__vtable = .data:0x8056D718; // type:object size:0x58 -nw4r__g3d__AnmObjChr__vtable = .data:0x8056D770; // type:object size:0x58 -nw4r__g3d__AnmObjShpRes__vtable = .data:0x8056D7C8; // type:object size:0x50 -nw4r__g3d__AnmObjShp__vtable = .data:0x8056D818; // type:object size:0x50 -lbl_8056D868 = .data:0x8056D868; // type:object size:0x20 -lbl_8056D888 = .data:0x8056D888; // type:object size:0x18 -lbl_8056D8A0 = .data:0x8056D8A0; // type:object size:0x10 +ResNameData_LightSet__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x8056D200; // type:object size:0x20 +ResNameData_AmbLights__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x8056D220; // type:object size:0x20 +ResNameData_Lights__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x8056D240; // type:object size:0x20 +ResNameData_Cameras__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x8056D260; // type:object size:0x20 +__vt__Q34nw4r3g3d12AnmObjVisRes = .data:0x8056D280; // type:object size:0x44 +__vt__Q34nw4r3g3d9AnmObjVis = .data:0x8056D2C4; // type:object size:0x44 +__vt__Q34nw4r3g3d15AnmObjMatClrRes = .data:0x8056D308; // type:object size:0x48 +__vt__Q34nw4r3g3d20AnmObjMatClrOverride = .data:0x8056D350; // type:object size:0x48 +__vt__Q34nw4r3g3d16AnmObjMatClrNode = .data:0x8056D398; // type:object size:0x48 +__vt__Q34nw4r3g3d12AnmObjMatClr = .data:0x8056D3E0; // type:object size:0x48 +__vt__Q34nw4r3g3d15AnmObjTexPatRes = .data:0x8056D428; // type:object size:0x48 +__vt__Q34nw4r3g3d20AnmObjTexPatOverride = .data:0x8056D470; // type:object size:0x48 +__vt__Q34nw4r3g3d16AnmObjTexPatNode = .data:0x8056D4B8; // type:object size:0x48 +__vt__Q34nw4r3g3d12AnmObjTexPat = .data:0x8056D500; // type:object size:0x48 +__vt__Q34nw4r3g3d15AnmObjTexSrtRes = .data:0x8056D548; // type:object size:0x48 +__vt__Q34nw4r3g3d20AnmObjTexSrtOverride = .data:0x8056D590; // type:object size:0x48 +__vt__Q34nw4r3g3d16AnmObjTexSrtNode = .data:0x8056D5D8; // type:object size:0x48 +__vt__Q34nw4r3g3d12AnmObjTexSrt = .data:0x8056D620; // type:object size:0x48 +__vt__Q34nw4r3g3d12AnmObjChrRes = .data:0x8056D668; // type:object size:0x58 +__vt__Q34nw4r3g3d14AnmObjChrBlend = .data:0x8056D6C0; // type:object size:0x58 +__vt__Q34nw4r3g3d13AnmObjChrNode = .data:0x8056D718; // type:object size:0x58 +__vt__Q34nw4r3g3d9AnmObjChr = .data:0x8056D770; // type:object size:0x58 +__vt__Q34nw4r3g3d12AnmObjShpRes = .data:0x8056D7C8; // type:object size:0x50 +__vt__Q34nw4r3g3d9AnmObjShp = .data:0x8056D818; // type:object size:0x50 +__vt__Q34nw4r3g3d6G3dObj = .data:0x8056D868; // type:object size:0x1C +__vt__Q44nw4r3g3d8G3DState11IndMtxOpStd = .data:0x8056D888; // type:object size:0x18 +lbl_8056D8A0 = .data:0x8056D8A0; // type:object size:0x9 data:string jumptable_8056D8B0 = .data:0x8056D8B0; // type:object size:0x28 scope:local jumptable_8056D8D8 = .data:0x8056D8D8; // type:object size:0x28 scope:local -nw4r__g3d__ScnGroup__vtable = .data:0x8056D900; // type:object size:0x40 -nw4r__g3d__ScnLeaf__vtable = .data:0x8056D940; // type:object size:0x34 -nw4r__g3d__ScnObj__vtable = .data:0x8056D974; // type:object size:0x34 -nw4r__g3d__ScnObjGather__vtable = .data:0x8056D9A8; // type:object size:0x30 -nw4r__g3d__ScnRoot__vtable = .data:0x8056D9D8; // type:object size:0x40 -lbl_8056DA18 = .data:0x8056DA18; // type:object size:0x10 -lbl_8056DA28 = .data:0x8056DA28; // type:object size:0x48 -nw4r__g3d__ScnMdl__vtable = .data:0x8056DA70; // type:object size:0x48 -lbl_8056DAB8 = .data:0x8056DAB8; // type:object size:0x48 -nw4r__g3d__ScnProc__vtable = .data:0x8056DB00; // type:object size:0x38 +__vt__Q34nw4r3g3d8ScnGroup = .data:0x8056D900; // type:object size:0x40 +__vt__Q34nw4r3g3d7ScnLeaf = .data:0x8056D940; // type:object size:0x34 +__vt__Q34nw4r3g3d6ScnObj = .data:0x8056D974; // type:object size:0x34 +__vt__Q34nw4r3g3d12ScnObjGather = .data:0x8056D9A8; // type:object size:0x2C +__vt__Q34nw4r3g3d7ScnRoot = .data:0x8056D9D8; // type:object size:0x40 +lbl_8056DA18 = .data:0x8056DA18; // type:object size:0x9 data:string +__vt__Q34nw4r3g3d12ScnMdlSimple = .data:0x8056DA28; // type:object size:0x48 +__vt__Q34nw4r3g3d6ScnMdl = .data:0x8056DA70; // type:object size:0x48 +lbl_8056DAB8 = .data:0x8056DAB8; // type:object size:0x46 scope:local data:string +__vt__Q34nw4r3g3d7ScnProc = .data:0x8056DB00; // type:object size:0x34 lbl_8056DB38 = .data:0x8056DB38; // type:object size:0x28 lbl_8056DB60 = .data:0x8056DB60; // type:object size:0x38 lbl_8056DB98 = .data:0x8056DB98; // type:object size:0x10 @@ -37802,7 +37802,7 @@ lbl_80571C38 = .sdata:0x80571C38; // type:object size:0x8 data:string status_1__4dDyl = .sdata:0x80571C40; // type:object size:0x4 data:4byte status_2__4dDyl = .sdata:0x80571C44; // type:object size:0x4 data:4byte lbl_80571C48 = .sdata:0x80571C48; // type:object size:0x8 -lbl_80571C50 = .sdata:0x80571C50; // type:object size:0x8 data:float +lbl_80571C50 = .sdata:0x80571C50; // type:object size:0x4 data:float lbl_80571C58 = .sdata:0x80571C58; // type:object size:0x8 data:byte lbl_80571C60 = .sdata:0x80571C60; // type:object size:0x8 data:4byte lbl_80571C68 = .sdata:0x80571C68; // type:object size:0x8 @@ -38561,7 +38561,7 @@ lbl_80572FF0 = .sdata:0x80572FF0; // type:object size:0x8 lbl_80572FF8 = .sdata:0x80572FF8; // type:object size:0x8 lbl_80573000 = .sdata:0x80573000; // type:object size:0x8 lbl_80573008 = .sdata:0x80573008; // type:object size:0x8 -lbl_80573010 = .sdata:0x80573010; // type:object size:0x8 data:float +lbl_80573010 = .sdata:0x80573010; // type:object size:0x4 data:float lbl_80573018 = .sdata:0x80573018; // type:object size:0x4 data:float lbl_8057301C = .sdata:0x8057301C; // type:object size:0x4 data:float lbl_80573020 = .sdata:0x80573020; // type:object size:0x4 data:float @@ -39787,15 +39787,15 @@ sMapBufMaxSize__Q24nw4r2db = .sdata:0x80574E10; // type:object size:0x4 scope:lo sDvdBuf__Q24nw4r2db = .sdata:0x80574E14; // type:object size:0x4 scope:local data:4byte sMapBufOffset__Q24nw4r2db = .sdata:0x80574E18; // type:object size:0x4 scope:local data:4byte @1016 = .sdata:0x80574E1C; // type:object size:0x5 scope:local data:string -lbl_80574E28 = .sdata:0x80574E28; // type:object size:0x8 data:float +lbl_80574E28 = .sdata:0x80574E28; // type:object size:0x4 data:float lbl_80574E30 = .sdata:0x80574E30; // type:object size:0x8 data:string -PLAY_ONCE_OR_LOOP = .sdata:0x80574E38; // type:object size:0x8 -lbl_80574E40 = .sdata:0x80574E40; // type:object size:0x8 data:float -lbl_80574E48 = .sdata:0x80574E48; // type:object size:0x4 data:4byte -lbl_80574E4C = .sdata:0x80574E4C; // type:object size:0x4 data:4byte +@LOCAL@GetAnmPlayPolicy__Q24nw4r3g3dFQ34nw4r3g3d9AnmPolicy@policyTable = .sdata:0x80574E38; // type:object size:0x8 +smBaseUpdateRate__Q34nw4r3g3d9FrameCtrl = .sdata:0x80574E40; // type:object size:0x4 data:float +lbl_80574E48 = .sdata:0x80574E48; // type:object size:0x4 scope:local data:4byte +pG3DStateIndMtxOp__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sdata:0x80574E4C; // type:object size:0x4 scope:local data:4byte lbl_80574E50 = .sdata:0x80574E50; // type:object size:0x8 data:string lbl_80574E58 = .sdata:0x80574E58; // type:object size:0x4 data:4byte -lbl_80574E5C = .sdata:0x80574E5C; // type:object size:0x4 data:4byte +@LOCAL@sort__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZRPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v@shuffle@2 = .sdata:0x80574E5C; // type:object size:0x4 scope:local data:4byte lbl_80574E60 = .sdata:0x80574E60; // type:object size:0x4 data:4byte lbl_80574E64 = .sdata:0x80574E64; // type:object size:0x4 data:4byte lbl_80574E68 = .sdata:0x80574E68; // type:object size:0x4 data:4byte @@ -39803,7 +39803,7 @@ lbl_80574E6C = .sdata:0x80574E6C; // type:object size:0x4 data:4byte lbl_80574E70 = .sdata:0x80574E70; // type:object size:0x8 data:string lbl_80574E78 = .sdata:0x80574E78; // type:object size:0x8 data:string lbl_80574E80 = .sdata:0x80574E80; // type:object size:0x8 data:string -lbl_80574E88 = .sdata:0x80574E88; // type:object size:0x8 data:4byte +NW4R_G3D_Version___22@unnamed@g3d_init_cpp@ = .sdata:0x80574E88; // type:object size:0x4 data:4byte lbl_80574E90 = .sdata:0x80574E90; // type:object size:0x4 lbl_80574E94 = .sdata:0x80574E94; // type:object size:0x4 lbl_80574E98 = .sdata:0x80574E98; // type:object size:0x8 @@ -39994,7 +39994,7 @@ dSystem__s_OrgMEM1ArenaHi = .sbss:0x8057523C; // type:object size:0x4 data:4byte dSystem__s_NewMEM1ArenaHi = .sbss:0x80575240; // type:object size:0x8 data:4byte dSystem__myDylinkInitPhase = .sbss:0x80575248; // type:object size:0x8 sInstance__18ArcCallbackHandler = .sbss:0x80575250; // type:object size:0x8 data:4byte -aspectRatio = .sbss:0x80575258; // type:object size:0x8 data:float +aspectRatio = .sbss:0x80575258; // type:object size:0x4 data:float sInstance__Q23d2d15dLytStructDList = .sbss:0x80575260; // type:object size:0x8 data:4byte lbl_80575268 = .sbss:0x80575268; // type:object size:0x8 data:4byte someColor = .sbss:0x80575270; // type:object size:0x1 data:byte @@ -40162,7 +40162,7 @@ TEAR_COUNTER = .sbss:0x80575628; // type:object size:0x8 SLINGSHOT_SEED_COUNTER = .sbss:0x80575630; // type:object size:0x8 KEY_PIECE_COUNTER = .sbss:0x80575638; // type:object size:0x8 EXTRA_WALLET_COUNTER = .sbss:0x80575640; // type:object size:0x8 -lbl_80575648 = .sbss:0x80575648; // type:object size:0x8 data:float +lbl_80575648 = .sbss:0x80575648; // type:object size:0x4 data:float lbl_80575650 = .sbss:0x80575650; // type:object size:0x4 data:4byte REV_INFO = .sbss:0x80575654; // type:object size:0x4 data:4byte lbl_80575658 = .sbss:0x80575658; // type:object size:0x8 data:4byte @@ -40360,7 +40360,7 @@ TREASURE_TEMP_COLLECT = .sbss:0x805758D8; // type:object size:0x4 data:4byte CURRENT_COUNT_VALUE = .sbss:0x805758DC; // type:object size:0x4 data:4byte lbl_805758E0 = .sbss:0x805758E0; // type:object size:0x4 data:float lbl_805758E4 = .sbss:0x805758E4; // type:object size:0x4 data:float -lbl_805758E8 = .sbss:0x805758E8; // type:object size:0x8 data:float +lbl_805758E8 = .sbss:0x805758E8; // type:object size:0x4 data:float lbl_805758F0 = .sbss:0x805758F0; // type:object size:0x2 data:2byte lbl_805758F4 = .sbss:0x805758F4; // type:object size:0x1 data:byte lbl_805758F8 = .sbss:0x805758F8; // type:object size:0x8 data:byte @@ -40507,9 +40507,9 @@ g_PadFrame__4mPad = .sbss:0x80575C60; // type:object size:0x4 scope:local data:4 s_WPADInfoAvailable__4mPad = .sbss:0x80575C64; // type:object size:0x4 scope:local s_GetWPADInfoInterval__4mPad = .sbss:0x80575C68; // type:object size:0x4 scope:local data:4byte s_GetWPADInfoCount__4mPad = .sbss:0x80575C6C; // type:object size:0x4 scope:local data:4byte -mVec2__Zero = .sbss:0x80575C70; // type:object size:0x8 data:float -mVec2__Ex = .sbss:0x80575C78; // type:object size:0x8 data:float -mVec2__Ey = .sbss:0x80575C80; // type:object size:0x8 data:float +mVec2__Zero = .sbss:0x80575C70; // type:object size:0x4 data:float +mVec2__Ex = .sbss:0x80575C78; // type:object size:0x4 data:float +mVec2__Ey = .sbss:0x80575C80; // type:object size:0x4 data:float m_video__6mVideo = .sbss:0x80575C88; // type:object size:0x8 data:4byte MSB_ALLOC_FUNC = .sbss:0x80575C90; // type:object size:0x4 data:4byte MSB_FREE_FUNC = .sbss:0x80575C94; // type:object size:0x4 data:4byte @@ -40994,7 +40994,7 @@ lbl_805764C0 = .sbss:0x805764C0; // type:object size:0x1 data:byte lbl_805764C1 = .sbss:0x805764C1; // type:object size:0x1 data:byte lbl_805764C2 = .sbss:0x805764C2; // type:object size:0x1 data:byte lbl_805764C4 = .sbss:0x805764C4; // type:object size:0x4 data:float -lbl_805764C8 = .sbss:0x805764C8; // type:object size:0x8 data:float +lbl_805764C8 = .sbss:0x805764C8; // type:object size:0x4 data:float lbl_805764D0 = .sbss:0x805764D0; // type:object size:0x8 data:4byte lbl_805764D8 = .sbss:0x805764D8; // type:object size:0x4 data:4byte lbl_805764DC = .sbss:0x805764DC; // type:object size:0x4 data:4byte @@ -41062,17 +41062,17 @@ sFileLength__Q24nw4r2db = .sbss:0x80576600; // type:object size:0x4 scope:local sMapFileList__Q24nw4r2db = .sbss:0x80576604; // type:object size:0x4 scope:local data:4byte GetCharPtr___Q24nw4r2db = .sbss:0x80576608; // type:object size:0x4 scope:local data:4byte sConsoleHandle__Q24nw4r2db = .sbss:0x80576610; // type:object size:0x4 scope:local data:4byte -lbl_80576618 = .sbss:0x80576618; // type:object size:0x4 data:4byte -lbl_8057661C = .sbss:0x8057661C; // type:object size:0x4 data:4byte -lbl_80576620 = .sbss:0x80576620; // type:object size:0x4 data:4byte -lbl_80576624 = .sbss:0x80576624; // type:object size:0x4 data:4byte -sSyncGx = .sbss:0x80576628; // type:object size:0x1 data:byte -sCurrMtx = .sbss:0x8057662C; // type:object size:0x1 data:byte -sPostTexMtxState = .sbss:0x80576630; // type:object size:0x4 data:4byte -sTev = .sbss:0x80576634; // type:object size:0x4 data:4byte -lbl_80576638 = .sbss:0x80576638; // type:object size:0x8 data:byte -lbl_80576640 = .sbss:0x80576640; // type:object size:0x8 data:4byte -SomeFrustum = .sbss:0x80576648; // type:object size:0x8 data:4byte +sTMemCachePlan = .sbss:0x80576618; // type:object size:0x4 data:4byte +sTlutRegionNum = .sbss:0x8057661C; // type:object size:0x4 data:4byte +sfpDefaultTexRegionCallback = .sbss:0x80576620; // type:object size:0x4 data:4byte +sfpDefaultTlutRegionCallback = .sbss:0x80576624; // type:object size:0x4 data:4byte +sSyncGX__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x80576628; // type:object size:0x1 scope:local data:byte +sCurrMtx__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x8057662C; // type:object size:0x1 scope:local data:byte +sPostTexMtx__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x80576630; // type:object size:0x4 scope:local data:4byte +sTev__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x80576634; // type:object size:0x4 scope:local data:4byte +@GUARD@GetViewNrmMtxPtr__Q54nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@19PosNrmMtxArrayStateCFUl@m = .sbss:0x80576638; // type:object size:0x1 scope:weak data:byte +sMisc__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x80576640; // type:object size:0x8 scope:local data:4byte +gpCullingFrustum__Q24nw4r3g3d = .sbss:0x80576648; // type:object size:0x4 data:4byte sBiquadFilterLpf = .sbss:0x80576650; // type:object size:0x4 data:4byte sBiquadFilterHpf = .sbss:0x80576654; // type:object size:0x4 data:4byte sBiquadFilterBpf512 = .sbss:0x80576658; // type:object size:0x4 data:4byte @@ -41134,9 +41134,9 @@ sCoreControllerFactory__Q23EGG17CoreControllerMgr = .sbss:0x805767B0; // type:ob sConnectCallback__Q23EGG17CoreControllerMgr = .sbss:0x805767B4; // type:object size:0x4 data:4byte sUseBuiltinWpadAllocator__Q23EGG17CoreControllerMgr = .sbss:0x805767B8; // type:object size:0x1 data:byte sAllocator__Q23EGG27@unnamed@eggController_cpp@ = .sbss:0x805767BC; // type:object size:0x4 scope:local data:4byte -zero__Q23EGG8Vector2f = .sbss:0x805767C0; // type:object size:0x8 data:float -ex__Q23EGG8Vector2f = .sbss:0x805767C8; // type:object size:0x8 data:float -ey__Q23EGG8Vector2f = .sbss:0x805767D0; // type:object size:0x8 data:float +zero__Q23EGG8Vector2f = .sbss:0x805767C0; // type:object size:0x4 data:float +ex__Q23EGG8Vector2f = .sbss:0x805767C8; // type:object size:0x4 data:float +ey__Q23EGG8Vector2f = .sbss:0x805767D0; // type:object size:0x4 data:float zero__Q23EGG8Vector3s = .sbss:0x805767D8; // type:object size:0x6 data:2byte ex__Q23EGG8Vector3s = .sbss:0x805767E0; // type:object size:0x6 data:2byte ey__Q23EGG8Vector3s = .sbss:0x805767E8; // type:object size:0x6 data:2byte @@ -41148,8 +41148,8 @@ sInstantHalt__Q23EGG6Assert = .sbss:0x80576804; // type:object size:0x1 data:byt sAssertOccurred__Q23EGG6Assert = .sbss:0x80576805; // type:object size:0x1 data:byte lbl_80576808 = .sbss:0x80576808; // type:object size:0x4 data:4byte EGG__DrawGX__sTexMapDefault = .sbss:0x8057680C; // type:object size:0x4 data:4byte -EGG__Frustum__sGlobalScale = .sbss:0x80576810; // type:object size:0x8 data:float -EGG__Frustum__sGlobalOffset = .sbss:0x80576818; // type:object size:0x8 data:float +EGG__Frustum__sGlobalScale = .sbss:0x80576810; // type:object size:0x4 data:float +EGG__Frustum__sGlobalOffset = .sbss:0x80576818; // type:object size:0x4 data:float lbl_80576820 = .sbss:0x80576820; // type:object size:0x1 data:byte lbl_80576824 = .sbss:0x80576824; // type:object size:0x4 data:4byte lbl_80576828 = .sbss:0x80576828; // type:object size:0x4 data:4byte @@ -41170,13 +41170,13 @@ lbl_80576858 = .sbss:0x80576858; // type:object size:0x4 data:4byte lbl_8057685C = .sbss:0x8057685C; // type:object size:0x1 data:byte lbl_80576860 = .sbss:0x80576860; // type:object size:0x1 data:byte lbl_80576861 = .sbss:0x80576861; // type:object size:0x7 data:byte -lbl_80576868 = .sbss:0x80576868; // type:object size:0x8 data:float +lbl_80576868 = .sbss:0x80576868; // type:object size:0x4 data:float sTVMode__Q23EGG6Screen = .sbss:0x80576870; // type:object size:0x4 data:4byte lbl_80576874 = .sbss:0x80576874; // type:object size:0x4 data:4byte lbl_80576878 = .sbss:0x80576878; // type:object size:0x4 data:4byte lbl_8057687C = .sbss:0x8057687C; // type:object size:0x4 data:4byte -lbl_80576880 = .sbss:0x80576880; // type:object size:0x8 data:float -lbl_80576888 = .sbss:0x80576888; // type:object size:0x8 data:float +lbl_80576880 = .sbss:0x80576880; // type:object size:0x4 data:float +lbl_80576888 = .sbss:0x80576888; // type:object size:0x4 data:float lbl_80576890 = .sbss:0x80576890; // type:object size:0x8 data:byte lbl_80576898 = .sbss:0x80576898; // type:object size:0x8 data:4byte lbl_805768A0 = .sbss:0x805768A0; // type:object size:0x2 data:2byte @@ -41211,7 +41211,7 @@ sPreException__Q23EGG9Exception = .sbss:0x80576914; // type:object size:0x4 data sUserCallbackFunc__Q23EGG9Exception = .sbss:0x80576918; // type:object size:0x4 data:4byte sUserCallbackMode__Q23EGG9Exception = .sbss:0x8057691C; // type:object size:0x1 data:byte sExceptionDisplayInfo__Q23EGG9Exception = .sbss:0x8057691E; // type:object size:0x2 data:2byte -lbl_80576920 = .sbss:0x80576920; // type:object size:0x8 data:float +lbl_80576920 = .sbss:0x80576920; // type:object size:0x4 data:float lbl_80576928 = .sbss:0x80576928; // type:object size:0x8 data:4byte __global_destructor_chain = .sbss:0x80576930; // type:object size:0x4 scope:global data:4byte lbl_80576938 = .sbss:0x80576938; // type:object size:0x8 data:byte @@ -41242,7 +41242,7 @@ lbl_805769E8 = .sdata2:0x805769E8; // type:object size:0x4 data:float lbl_805769EC = .sdata2:0x805769EC; // type:object size:0x4 data:float lbl_805769F0 = .sdata2:0x805769F0; // type:object size:0x4 data:float lbl_805769F4 = .sdata2:0x805769F4; // type:object size:0x4 data:float -lbl_805769F8 = .sdata2:0x805769F8; // type:object size:0x8 data:float +lbl_805769F8 = .sdata2:0x805769F8; // type:object size:0x4 data:float lbl_80576A00 = .sdata2:0x80576A00; // type:object size:0x4 data:float lbl_80576A04 = .sdata2:0x80576A04; // type:object size:0x4 data:float lbl_80576A08 = .sdata2:0x80576A08; // type:object size:0x4 data:float @@ -41317,7 +41317,7 @@ lbl_80576B3C = .sdata2:0x80576B3C; // type:object size:0x4 data:float lbl_80576B40 = .sdata2:0x80576B40; // type:object size:0x8 data:double lbl_80576B48 = .sdata2:0x80576B48; // type:object size:0x4 data:float lbl_80576B4C = .sdata2:0x80576B4C; // type:object size:0x4 data:float -lbl_80576B50 = .sdata2:0x80576B50; // type:object size:0x8 data:float +lbl_80576B50 = .sdata2:0x80576B50; // type:object size:0x4 data:float lbl_80576B58 = .sdata2:0x80576B58; // type:object size:0x4 data:float lbl_80576B5C = .sdata2:0x80576B5C; // type:object size:0x4 data:float lbl_80576B60 = .sdata2:0x80576B60; // type:object size:0x4 data:float @@ -41331,8 +41331,8 @@ lbl_80576B80 = .sdata2:0x80576B80; // type:object size:0x4 data:float lbl_80576B84 = .sdata2:0x80576B84; // type:object size:0x4 data:float lbl_80576B88 = .sdata2:0x80576B88; // type:object size:0x4 data:float lbl_80576B8C = .sdata2:0x80576B8C; // type:object size:0x4 data:float -lbl_80576B90 = .sdata2:0x80576B90; // type:object size:0x8 data:float -lbl_80576B98 = .sdata2:0x80576B98; // type:object size:0x8 data:float +lbl_80576B90 = .sdata2:0x80576B90; // type:object size:0x4 data:float +lbl_80576B98 = .sdata2:0x80576B98; // type:object size:0x4 data:float lbl_80576BA0 = .sdata2:0x80576BA0; // type:object size:0x4 data:float lbl_80576BA4 = .sdata2:0x80576BA4; // type:object size:0x4 data:float lbl_80576BA8 = .sdata2:0x80576BA8; // type:object size:0x4 data:float @@ -41377,7 +41377,7 @@ lbl_80576C50 = .sdata2:0x80576C50; // type:object size:0x4 data:float lbl_80576C54 = .sdata2:0x80576C54; // type:object size:0x4 data:float lbl_80576C58 = .sdata2:0x80576C58; // type:object size:0x4 data:float lbl_80576C5C = .sdata2:0x80576C5C; // type:object size:0x4 data:float -lbl_80576C60 = .sdata2:0x80576C60; // type:object size:0x8 data:float +lbl_80576C60 = .sdata2:0x80576C60; // type:object size:0x4 data:float lbl_80576C68 = .sdata2:0x80576C68; // type:object size:0x4 data:float lbl_80576C6C = .sdata2:0x80576C6C; // type:object size:0x4 data:float lbl_80576C70 = .sdata2:0x80576C70; // type:object size:0x4 data:float @@ -41389,7 +41389,7 @@ lbl_80576C88 = .sdata2:0x80576C88; // type:object size:0x4 data:float lbl_80576C8C = .sdata2:0x80576C8C; // type:object size:0x4 data:float lbl_80576C90 = .sdata2:0x80576C90; // type:object size:0x4 data:float lbl_80576C94 = .sdata2:0x80576C94; // type:object size:0x4 data:float -lbl_80576C98 = .sdata2:0x80576C98; // type:object size:0x8 data:float +lbl_80576C98 = .sdata2:0x80576C98; // type:object size:0x4 data:float lbl_80576CA0 = .sdata2:0x80576CA0; // type:object size:0x4 data:float lbl_80576CA4 = .sdata2:0x80576CA4; // type:object size:0x4 data:float lbl_80576CA8 = .sdata2:0x80576CA8; // type:object size:0x4 data:float @@ -41398,7 +41398,7 @@ lbl_80576CB0 = .sdata2:0x80576CB0; // type:object size:0x4 data:float lbl_80576CB4 = .sdata2:0x80576CB4; // type:object size:0x4 data:float lbl_80576CB8 = .sdata2:0x80576CB8; // type:object size:0x4 data:float lbl_80576CBC = .sdata2:0x80576CBC; // type:object size:0x4 data:float -lbl_80576CC0 = .sdata2:0x80576CC0; // type:object size:0x8 data:float +lbl_80576CC0 = .sdata2:0x80576CC0; // type:object size:0x4 data:float lbl_80576CC8 = .sdata2:0x80576CC8; // type:object size:0x8 lbl_80576CD0 = .sdata2:0x80576CD0; // type:object size:0x4 data:float lbl_80576CD4 = .sdata2:0x80576CD4; // type:object size:0x4 data:float @@ -41413,7 +41413,7 @@ lbl_80576CF4 = .sdata2:0x80576CF4; // type:object size:0x4 data:float lbl_80576CF8 = .sdata2:0x80576CF8; // type:object size:0x4 data:float lbl_80576CFC = .sdata2:0x80576CFC; // type:object size:0x4 data:float lbl_80576D00 = .sdata2:0x80576D00; // type:object size:0x8 data:double -lbl_80576D08 = .sdata2:0x80576D08; // type:object size:0x8 data:float +lbl_80576D08 = .sdata2:0x80576D08; // type:object size:0x4 data:float lbl_80576D10 = .sdata2:0x80576D10; // type:object size:0x2 lbl_80576D12 = .sdata2:0x80576D12; // type:object size:0x2 lbl_80576D14 = .sdata2:0x80576D14; // type:object size:0x2 @@ -41450,7 +41450,7 @@ lbl_80576D98 = .sdata2:0x80576D98; // type:object size:0x4 data:float lbl_80576D9C = .sdata2:0x80576D9C; // type:object size:0x4 data:float lbl_80576DA0 = .sdata2:0x80576DA0; // type:object size:0x4 data:float lbl_80576DA4 = .sdata2:0x80576DA4; // type:object size:0x4 data:float -lbl_80576DA8 = .sdata2:0x80576DA8; // type:object size:0x8 data:float +lbl_80576DA8 = .sdata2:0x80576DA8; // type:object size:0x4 data:float lbl_80576DB0 = .sdata2:0x80576DB0; // type:object size:0x4 data:float lbl_80576DB4 = .sdata2:0x80576DB4; // type:object size:0x4 data:float lbl_80576DB8 = .sdata2:0x80576DB8; // type:object size:0x8 data:double @@ -41464,10 +41464,10 @@ lbl_80576DD8 = .sdata2:0x80576DD8; // type:object size:0x4 data:4byte lbl_80576DDC = .sdata2:0x80576DDC; // type:object size:0x4 data:4byte lbl_80576DE0 = .sdata2:0x80576DE0; // type:object size:0x4 data:float lbl_80576DE4 = .sdata2:0x80576DE4; // type:object size:0x4 data:float -lbl_80576DE8 = .sdata2:0x80576DE8; // type:object size:0x8 data:float +lbl_80576DE8 = .sdata2:0x80576DE8; // type:object size:0x4 data:float lbl_80576DF0 = .sdata2:0x80576DF0; // type:object size:0x4 data:float lbl_80576DF4 = .sdata2:0x80576DF4; // type:object size:0x4 data:float -lbl_80576DF8 = .sdata2:0x80576DF8; // type:object size:0x8 data:float +lbl_80576DF8 = .sdata2:0x80576DF8; // type:object size:0x4 data:float lbl_80576E00 = .sdata2:0x80576E00; // type:object size:0x4 data:float lbl_80576E04 = .sdata2:0x80576E04; // type:object size:0x4 data:float lbl_80576E08 = .sdata2:0x80576E08; // type:object size:0x4 data:float @@ -41477,7 +41477,7 @@ lbl_80576E14 = .sdata2:0x80576E14; // type:object size:0x4 data:float lbl_80576E18 = .sdata2:0x80576E18; // type:object size:0x8 data:double lbl_80576E20 = .sdata2:0x80576E20; // type:object size:0x4 data:float lbl_80576E24 = .sdata2:0x80576E24; // type:object size:0x4 data:float -lbl_80576E28 = .sdata2:0x80576E28; // type:object size:0x8 data:float +lbl_80576E28 = .sdata2:0x80576E28; // type:object size:0x4 data:float lbl_80576E30 = .sdata2:0x80576E30; // type:object size:0x4 data:float lbl_80576E34 = .sdata2:0x80576E34; // type:object size:0x4 data:float lbl_80576E38 = .sdata2:0x80576E38; // type:object size:0x4 data:float @@ -41494,7 +41494,7 @@ lbl_80576E68 = .sdata2:0x80576E68; // type:object size:0x4 data:float lbl_80576E6C = .sdata2:0x80576E6C; // type:object size:0x4 data:float lbl_80576E70 = .sdata2:0x80576E70; // type:object size:0x4 data:float lbl_80576E74 = .sdata2:0x80576E74; // type:object size:0x4 data:float -lbl_80576E78 = .sdata2:0x80576E78; // type:object size:0x8 data:float +lbl_80576E78 = .sdata2:0x80576E78; // type:object size:0x4 data:float lbl_80576E80 = .sdata2:0x80576E80; // type:object size:0x4 data:float lbl_80576E84 = .sdata2:0x80576E84; // type:object size:0x4 data:float lbl_80576E88 = .sdata2:0x80576E88; // type:object size:0x4 data:float @@ -41583,10 +41583,10 @@ lbl_80576FF8 = .sdata2:0x80576FF8; // type:object size:0x4 data:float lbl_80576FFC = .sdata2:0x80576FFC; // type:object size:0x4 data:float lbl_80577000 = .sdata2:0x80577000; // type:object size:0x4 data:float lbl_80577004 = .sdata2:0x80577004; // type:object size:0x4 data:float -lbl_80577008 = .sdata2:0x80577008; // type:object size:0x8 data:float +lbl_80577008 = .sdata2:0x80577008; // type:object size:0x4 data:float lbl_80577010 = .sdata2:0x80577010; // type:object size:0x4 data:float lbl_80577014 = .sdata2:0x80577014; // type:object size:0x4 data:float -lbl_80577018 = .sdata2:0x80577018; // type:object size:0x8 data:float +lbl_80577018 = .sdata2:0x80577018; // type:object size:0x4 data:float lbl_80577020 = .sdata2:0x80577020; // type:object size:0x8 data:string lbl_80577028 = .sdata2:0x80577028; // type:object size:0x4 data:string lbl_8057702C = .sdata2:0x8057702C; // type:object size:0x8 @@ -41800,7 +41800,7 @@ lbl_80577668 = .sdata2:0x80577668; // type:object size:0x4 data:float lbl_8057766C = .sdata2:0x8057766C; // type:object size:0x4 data:float lbl_80577670 = .sdata2:0x80577670; // type:object size:0x4 data:float lbl_80577674 = .sdata2:0x80577674; // type:object size:0x4 data:float -lbl_80577678 = .sdata2:0x80577678; // type:object size:0x8 data:float +lbl_80577678 = .sdata2:0x80577678; // type:object size:0x4 data:float lbl_80577680 = .sdata2:0x80577680; // type:object size:0x4 data:float lbl_80577684 = .sdata2:0x80577684; // type:object size:0x4 data:float lbl_80577688 = .sdata2:0x80577688; // type:object size:0x4 data:float @@ -41980,7 +41980,7 @@ lbl_8057790C = .sdata2:0x8057790C; // type:object size:0x2 data:2byte lbl_8057790E = .sdata2:0x8057790E; // type:object size:0x2 data:2byte lbl_80577910 = .sdata2:0x80577910; // type:object size:0x4 data:float lbl_80577914 = .sdata2:0x80577914; // type:object size:0x4 data:float -lbl_80577918 = .sdata2:0x80577918; // type:object size:0x8 data:float +lbl_80577918 = .sdata2:0x80577918; // type:object size:0x4 data:float roomActivateHandlers = .sdata2:0x80577920; // type:object size:0x8 lbl_80577928 = .sdata2:0x80577928; // type:object size:0x4 data:float lbl_8057792C = .sdata2:0x8057792C; // type:object size:0x4 data:float @@ -42005,10 +42005,10 @@ lbl_80577980 = .sdata2:0x80577980; // type:object size:0x4 data:float lbl_80577984 = .sdata2:0x80577984; // type:object size:0x4 data:float lbl_80577988 = .sdata2:0x80577988; // type:object size:0x4 data:float lbl_8057798C = .sdata2:0x8057798C; // type:object size:0x4 data:float -lbl_80577990 = .sdata2:0x80577990; // type:object size:0x8 data:float +lbl_80577990 = .sdata2:0x80577990; // type:object size:0x4 data:float lbl_80577998 = .sdata2:0x80577998; // type:object size:0x4 data:float lbl_8057799C = .sdata2:0x8057799C; // type:object size:0x4 data:float -lbl_805779A0 = .sdata2:0x805779A0; // type:object size:0x8 data:float +lbl_805779A0 = .sdata2:0x805779A0; // type:object size:0x4 data:float lbl_805779A8 = .sdata2:0x805779A8; // type:object size:0x4 data:float lbl_805779AC = .sdata2:0x805779AC; // type:object size:0x4 data:float lbl_805779B0 = .sdata2:0x805779B0; // type:object size:0x4 data:float @@ -42021,7 +42021,7 @@ lbl_805779C8 = .sdata2:0x805779C8; // type:object size:0x4 data:float lbl_805779CC = .sdata2:0x805779CC; // type:object size:0x4 data:float lbl_805779D0 = .sdata2:0x805779D0; // type:object size:0x4 data:float lbl_805779D8 = .sdata2:0x805779D8; // type:object size:0x8 data:double -lbl_805779E0 = .sdata2:0x805779E0; // type:object size:0x8 data:float +lbl_805779E0 = .sdata2:0x805779E0; // type:object size:0x4 data:float lbl_805779E8 = .sdata2:0x805779E8; // type:object size:0x4 data:float lbl_805779F0 = .sdata2:0x805779F0; // type:object size:0x8 data:double lbl_805779F8 = .sdata2:0x805779F8; // type:object size:0x8 @@ -42808,7 +42808,7 @@ lbl_8057921C = .sdata2:0x8057921C; // type:object size:0x4 data:float lbl_80579220 = .sdata2:0x80579220; // type:object size:0x4 data:float lbl_80579224 = .sdata2:0x80579224; // type:object size:0x4 data:float lbl_80579228 = .sdata2:0x80579228; // type:object size:0x8 data:double -lbl_80579230 = .sdata2:0x80579230; // type:object size:0x8 data:float +lbl_80579230 = .sdata2:0x80579230; // type:object size:0x4 data:float lbl_80579238 = .sdata2:0x80579238; // type:object size:0x4 data:float lbl_8057923C = .sdata2:0x8057923C; // type:object size:0x4 data:float lbl_80579240 = .sdata2:0x80579240; // type:object size:0x4 data:float @@ -43038,7 +43038,7 @@ lbl_80579620 = .sdata2:0x80579620; // type:object size:0x4 data:float lbl_80579624 = .sdata2:0x80579624; // type:object size:0x4 data:float lbl_80579628 = .sdata2:0x80579628; // type:object size:0x4 data:float lbl_8057962C = .sdata2:0x8057962C; // type:object size:0x4 data:float -lbl_80579630 = .sdata2:0x80579630; // type:object size:0x8 data:float +lbl_80579630 = .sdata2:0x80579630; // type:object size:0x4 data:float lbl_80579638 = .sdata2:0x80579638; // type:object size:0x4 data:float lbl_8057963C = .sdata2:0x8057963C; // type:object size:0x4 data:float lbl_80579640 = .sdata2:0x80579640; // type:object size:0x4 data:float @@ -43116,14 +43116,14 @@ lbl_80579770 = .sdata2:0x80579770; // type:object size:0x4 data:float lbl_80579774 = .sdata2:0x80579774; // type:object size:0x4 data:float lbl_80579778 = .sdata2:0x80579778; // type:object size:0x4 data:float lbl_8057977C = .sdata2:0x8057977C; // type:object size:0x4 data:float -lbl_80579780 = .sdata2:0x80579780; // type:object size:0x8 data:float +lbl_80579780 = .sdata2:0x80579780; // type:object size:0x4 data:float lbl_80579788 = .sdata2:0x80579788; // type:object size:0x4 data:float lbl_80579790 = .sdata2:0x80579790; // type:object size:0x8 data:double lbl_80579798 = .sdata2:0x80579798; // type:object size:0x4 data:float lbl_8057979C = .sdata2:0x8057979C; // type:object size:0x4 data:float lbl_805797A0 = .sdata2:0x805797A0; // type:object size:0x4 data:float lbl_805797A4 = .sdata2:0x805797A4; // type:object size:0x4 data:float -lbl_805797A8 = .sdata2:0x805797A8; // type:object size:0x8 data:float +lbl_805797A8 = .sdata2:0x805797A8; // type:object size:0x4 data:float lbl_805797B0 = .sdata2:0x805797B0; // type:object size:0x4 data:float lbl_805797B4 = .sdata2:0x805797B4; // type:object size:0x4 data:float lbl_805797B8 = .sdata2:0x805797B8; // type:object size:0x4 data:float @@ -43184,7 +43184,7 @@ lbl_805798B8 = .sdata2:0x805798B8; // type:object size:0x4 data:float lbl_805798BC = .sdata2:0x805798BC; // type:object size:0x4 data:float lbl_805798C0 = .sdata2:0x805798C0; // type:object size:0x4 data:float lbl_805798C4 = .sdata2:0x805798C4; // type:object size:0x4 data:float -lbl_805798C8 = .sdata2:0x805798C8; // type:object size:0x8 data:float +lbl_805798C8 = .sdata2:0x805798C8; // type:object size:0x4 data:float lbl_805798D0 = .sdata2:0x805798D0; // type:object size:0x4 data:float lbl_805798D4 = .sdata2:0x805798D4; // type:object size:0x4 data:float lbl_805798D8 = .sdata2:0x805798D8; // type:object size:0x4 data:float @@ -43201,7 +43201,7 @@ lbl_80579910 = .sdata2:0x80579910; // type:object size:0x4 data:float lbl_80579914 = .sdata2:0x80579914; // type:object size:0x4 data:float lbl_80579918 = .sdata2:0x80579918; // type:object size:0x4 data:float lbl_8057991C = .sdata2:0x8057991C; // type:object size:0x4 data:float -lbl_80579920 = .sdata2:0x80579920; // type:object size:0x8 data:float +lbl_80579920 = .sdata2:0x80579920; // type:object size:0x4 data:float lbl_80579928 = .sdata2:0x80579928; // type:object size:0x4 data:float lbl_8057992C = .sdata2:0x8057992C; // type:object size:0x4 data:float lbl_80579930 = .sdata2:0x80579930; // type:object size:0x4 data:float @@ -43230,7 +43230,7 @@ lbl_805799A0 = .sdata2:0x805799A0; // type:object size:0x4 data:float lbl_805799A4 = .sdata2:0x805799A4; // type:object size:0x4 data:float lbl_805799A8 = .sdata2:0x805799A8; // type:object size:0x4 data:float lbl_805799AC = .sdata2:0x805799AC; // type:object size:0x4 data:float -lbl_805799B0 = .sdata2:0x805799B0; // type:object size:0x8 data:float +lbl_805799B0 = .sdata2:0x805799B0; // type:object size:0x4 data:float lbl_805799B8 = .sdata2:0x805799B8; // type:object size:0x8 lbl_805799C0 = .sdata2:0x805799C0; // type:object size:0x8 lbl_805799C8 = .sdata2:0x805799C8; // type:object size:0x8 @@ -43321,10 +43321,10 @@ lbl_80579B58 = .sdata2:0x80579B58; // type:object size:0x4 data:float lbl_80579B5C = .sdata2:0x80579B5C; // type:object size:0x4 data:float lbl_80579B60 = .sdata2:0x80579B60; // type:object size:0x4 data:float lbl_80579B64 = .sdata2:0x80579B64; // type:object size:0x4 data:float -lbl_80579B68 = .sdata2:0x80579B68; // type:object size:0x8 data:float +lbl_80579B68 = .sdata2:0x80579B68; // type:object size:0x4 data:float lbl_80579B70 = .sdata2:0x80579B70; // type:object size:0x4 data:float lbl_80579B74 = .sdata2:0x80579B74; // type:object size:0x4 data:float -lbl_80579B78 = .sdata2:0x80579B78; // type:object size:0x8 data:float +lbl_80579B78 = .sdata2:0x80579B78; // type:object size:0x4 data:float lbl_80579B80 = .sdata2:0x80579B80; // type:object size:0x4 data:float lbl_80579B84 = .sdata2:0x80579B84; // type:object size:0x4 data:float lbl_80579B88 = .sdata2:0x80579B88; // type:object size:0x4 data:float @@ -43337,10 +43337,10 @@ lbl_80579BA4 = .sdata2:0x80579BA4; // type:object size:0x4 data:float lbl_80579BA8 = .sdata2:0x80579BA8; // type:object size:0x8 data:double lbl_80579BB0 = .sdata2:0x80579BB0; // type:object size:0x4 data:float lbl_80579BB4 = .sdata2:0x80579BB4; // type:object size:0x4 data:float -lbl_80579BB8 = .sdata2:0x80579BB8; // type:object size:0x8 data:float +lbl_80579BB8 = .sdata2:0x80579BB8; // type:object size:0x4 data:float lbl_80579BC0 = .sdata2:0x80579BC0; // type:object size:0x4 data:float lbl_80579BC4 = .sdata2:0x80579BC4; // type:object size:0x4 data:float -lbl_80579BC8 = .sdata2:0x80579BC8; // type:object size:0x8 data:float +lbl_80579BC8 = .sdata2:0x80579BC8; // type:object size:0x4 data:float lbl_80579BD0 = .sdata2:0x80579BD0; // type:object size:0x4 data:float lbl_80579BD4 = .sdata2:0x80579BD4; // type:object size:0x4 data:float lbl_80579BD8 = .sdata2:0x80579BD8; // type:object size:0x4 data:float @@ -43351,20 +43351,20 @@ lbl_80579BE8 = .sdata2:0x80579BE8; // type:object size:0x4 data:float lbl_80579BF0 = .sdata2:0x80579BF0; // type:object size:0x8 data:double lbl_80579BF8 = .sdata2:0x80579BF8; // type:object size:0x4 data:float lbl_80579BFC = .sdata2:0x80579BFC; // type:object size:0x4 data:float -lbl_80579C00 = .sdata2:0x80579C00; // type:object size:0x8 data:float +lbl_80579C00 = .sdata2:0x80579C00; // type:object size:0x4 data:float lbl_80579C08 = .sdata2:0x80579C08; // type:object size:0x4 data:float lbl_80579C0C = .sdata2:0x80579C0C; // type:object size:0x4 data:float -lbl_80579C10 = .sdata2:0x80579C10; // type:object size:0x8 data:float +lbl_80579C10 = .sdata2:0x80579C10; // type:object size:0x4 data:float lbl_80579C18 = .sdata2:0x80579C18; // type:object size:0x4 data:float lbl_80579C1C = .sdata2:0x80579C1C; // type:object size:0x4 data:float lbl_80579C20 = .sdata2:0x80579C20; // type:object size:0x4 data:float lbl_80579C24 = .sdata2:0x80579C24; // type:object size:0x4 data:float lbl_80579C28 = .sdata2:0x80579C28; // type:object size:0x4 data:float lbl_80579C2C = .sdata2:0x80579C2C; // type:object size:0x4 data:float -lbl_80579C30 = .sdata2:0x80579C30; // type:object size:0x8 data:float +lbl_80579C30 = .sdata2:0x80579C30; // type:object size:0x4 data:float lbl_80579C38 = .sdata2:0x80579C38; // type:object size:0x4 data:float lbl_80579C3C = .sdata2:0x80579C3C; // type:object size:0x4 data:float -lbl_80579C40 = .sdata2:0x80579C40; // type:object size:0x8 data:float +lbl_80579C40 = .sdata2:0x80579C40; // type:object size:0x4 data:float lbl_80579C48 = .sdata2:0x80579C48; // type:object size:0x4 data:float lbl_80579C4C = .sdata2:0x80579C4C; // type:object size:0x4 data:float lbl_80579C50 = .sdata2:0x80579C50; // type:object size:0x4 data:float @@ -43372,7 +43372,7 @@ lbl_80579C58 = .sdata2:0x80579C58; // type:object size:0x8 data:double lbl_80579C60 = .sdata2:0x80579C60; // type:object size:0x8 data:double lbl_80579C68 = .sdata2:0x80579C68; // type:object size:0x4 data:float lbl_80579C6C = .sdata2:0x80579C6C; // type:object size:0x4 data:float -lbl_80579C70 = .sdata2:0x80579C70; // type:object size:0x8 data:float +lbl_80579C70 = .sdata2:0x80579C70; // type:object size:0x4 data:float lbl_80579C78 = .sdata2:0x80579C78; // type:object size:0x4 data:float lbl_80579C7C = .sdata2:0x80579C7C; // type:object size:0x4 data:float lbl_80579C80 = .sdata2:0x80579C80; // type:object size:0x4 data:float @@ -43415,7 +43415,7 @@ lbl_80579D18 = .sdata2:0x80579D18; // type:object size:0x4 data:float lbl_80579D1C = .sdata2:0x80579D1C; // type:object size:0x4 data:float lbl_80579D20 = .sdata2:0x80579D20; // type:object size:0x4 data:float lbl_80579D24 = .sdata2:0x80579D24; // type:object size:0x4 data:float -lbl_80579D28 = .sdata2:0x80579D28; // type:object size:0x8 data:float +lbl_80579D28 = .sdata2:0x80579D28; // type:object size:0x4 data:float lbl_80579D30 = .sdata2:0x80579D30; // type:object size:0x4 data:float lbl_80579D34 = .sdata2:0x80579D34; // type:object size:0x4 data:float lbl_80579D38 = .sdata2:0x80579D38; // type:object size:0x4 data:float @@ -43427,24 +43427,24 @@ lbl_80579D50 = .sdata2:0x80579D50; // type:object size:0x4 data:float lbl_80579D58 = .sdata2:0x80579D58; // type:object size:0x8 data:double lbl_80579D60 = .sdata2:0x80579D60; // type:object size:0x4 data:float lbl_80579D64 = .sdata2:0x80579D64; // type:object size:0x4 data:float -lbl_80579D68 = .sdata2:0x80579D68; // type:object size:0x8 data:float +lbl_80579D68 = .sdata2:0x80579D68; // type:object size:0x4 data:float lbl_80579D70 = .sdata2:0x80579D70; // type:object size:0x4 data:float lbl_80579D74 = .sdata2:0x80579D74; // type:object size:0x4 data:float lbl_80579D78 = .sdata2:0x80579D78; // type:object size:0x4 data:float lbl_80579D7C = .sdata2:0x80579D7C; // type:object size:0x4 data:float lbl_80579D80 = .sdata2:0x80579D80; // type:object size:0x4 data:float lbl_80579D88 = .sdata2:0x80579D88; // type:object size:0x8 data:double -lbl_80579D90 = .sdata2:0x80579D90; // type:object size:0x8 data:float +lbl_80579D90 = .sdata2:0x80579D90; // type:object size:0x4 data:float lbl_80579D98 = .sdata2:0x80579D98; // type:object size:0x4 data:float lbl_80579D9C = .sdata2:0x80579D9C; // type:object size:0x4 data:float -lbl_80579DA0 = .sdata2:0x80579DA0; // type:object size:0x8 data:float +lbl_80579DA0 = .sdata2:0x80579DA0; // type:object size:0x4 data:float lbl_80579DA8 = .sdata2:0x80579DA8; // type:object size:0x4 data:float lbl_80579DAC = .sdata2:0x80579DAC; // type:object size:0x4 data:float lbl_80579DB0 = .sdata2:0x80579DB0; // type:object size:0x8 data:double lbl_80579DB8 = .sdata2:0x80579DB8; // type:object size:0x4 data:float lbl_80579DBC = .sdata2:0x80579DBC; // type:object size:0x4 data:float lbl_80579DC0 = .sdata2:0x80579DC0; // type:object size:0x8 data:double -lbl_80579DC8 = .sdata2:0x80579DC8; // type:object size:0x8 data:float +lbl_80579DC8 = .sdata2:0x80579DC8; // type:object size:0x4 data:float lbl_80579DD0 = .sdata2:0x80579DD0; // type:object size:0x4 data:float lbl_80579DD4 = .sdata2:0x80579DD4; // type:object size:0x4 data:float lbl_80579DD8 = .sdata2:0x80579DD8; // type:object size:0x4 data:float @@ -43478,37 +43478,37 @@ lbl_80579E60 = .sdata2:0x80579E60; // type:object size:0x8 data:double lbl_80579E68 = .sdata2:0x80579E68; // type:object size:0x4 data:float lbl_80579E6C = .sdata2:0x80579E6C; // type:object size:0x4 data:float lbl_80579E70 = .sdata2:0x80579E70; // type:object size:0x8 data:double -lbl_80579E78 = .sdata2:0x80579E78; // type:object size:0x8 data:float +lbl_80579E78 = .sdata2:0x80579E78; // type:object size:0x4 data:float lbl_80579E80 = .sdata2:0x80579E80; // type:object size:0x4 data:float lbl_80579E84 = .sdata2:0x80579E84; // type:object size:0x4 data:float lbl_80579E88 = .sdata2:0x80579E88; // type:object size:0x8 data:double -lbl_80579E90 = .sdata2:0x80579E90; // type:object size:0x8 data:float +lbl_80579E90 = .sdata2:0x80579E90; // type:object size:0x4 data:float lbl_80579E98 = .sdata2:0x80579E98; // type:object size:0x4 data:float lbl_80579E9C = .sdata2:0x80579E9C; // type:object size:0x4 data:float -lbl_80579EA0 = .sdata2:0x80579EA0; // type:object size:0x8 data:float +lbl_80579EA0 = .sdata2:0x80579EA0; // type:object size:0x4 data:float lbl_80579EA8 = .sdata2:0x80579EA8; // type:object size:0x4 data:float lbl_80579EAC = .sdata2:0x80579EAC; // type:object size:0x4 data:float lbl_80579EB0 = .sdata2:0x80579EB0; // type:object size:0x8 data:double -lbl_80579EB8 = .sdata2:0x80579EB8; // type:object size:0x8 data:float +lbl_80579EB8 = .sdata2:0x80579EB8; // type:object size:0x4 data:float lbl_80579EC0 = .sdata2:0x80579EC0; // type:object size:0x4 data:float lbl_80579EC4 = .sdata2:0x80579EC4; // type:object size:0x4 data:float lbl_80579EC8 = .sdata2:0x80579EC8; // type:object size:0x4 data:float lbl_80579ECC = .sdata2:0x80579ECC; // type:object size:0x4 data:float lbl_80579ED0 = .sdata2:0x80579ED0; // type:object size:0x4 data:float lbl_80579ED4 = .sdata2:0x80579ED4; // type:object size:0x4 data:float -lbl_80579ED8 = .sdata2:0x80579ED8; // type:object size:0x8 data:float +lbl_80579ED8 = .sdata2:0x80579ED8; // type:object size:0x4 data:float lbl_80579EE0 = .sdata2:0x80579EE0; // type:object size:0x4 data:float lbl_80579EE4 = .sdata2:0x80579EE4; // type:object size:0x4 data:float lbl_80579EE8 = .sdata2:0x80579EE8; // type:object size:0x8 data:double -lbl_80579EF0 = .sdata2:0x80579EF0; // type:object size:0x8 data:float +lbl_80579EF0 = .sdata2:0x80579EF0; // type:object size:0x4 data:float lbl_80579EF8 = .sdata2:0x80579EF8; // type:object size:0x4 data:float lbl_80579EFC = .sdata2:0x80579EFC; // type:object size:0x4 data:float lbl_80579F00 = .sdata2:0x80579F00; // type:object size:0x4 data:float lbl_80579F04 = .sdata2:0x80579F04; // type:object size:0x4 data:float -lbl_80579F08 = .sdata2:0x80579F08; // type:object size:0x8 data:float +lbl_80579F08 = .sdata2:0x80579F08; // type:object size:0x4 data:float lbl_80579F10 = .sdata2:0x80579F10; // type:object size:0x4 data:float lbl_80579F18 = .sdata2:0x80579F18; // type:object size:0x8 data:double -lbl_80579F20 = .sdata2:0x80579F20; // type:object size:0x8 data:float +lbl_80579F20 = .sdata2:0x80579F20; // type:object size:0x4 data:float lbl_80579F28 = .sdata2:0x80579F28; // type:object size:0x4 data:float lbl_80579F2C = .sdata2:0x80579F2C; // type:object size:0x4 data:float lbl_80579F30 = .sdata2:0x80579F30; // type:object size:0x4 data:float @@ -43538,7 +43538,7 @@ lbl_80579FA0 = .sdata2:0x80579FA0; // type:object size:0x4 data:float lbl_80579FA4 = .sdata2:0x80579FA4; // type:object size:0x4 data:float lbl_80579FA8 = .sdata2:0x80579FA8; // type:object size:0x4 data:float lbl_80579FAC = .sdata2:0x80579FAC; // type:object size:0x4 data:float -lbl_80579FB0 = .sdata2:0x80579FB0; // type:object size:0x8 data:float +lbl_80579FB0 = .sdata2:0x80579FB0; // type:object size:0x4 data:float lbl_80579FB8 = .sdata2:0x80579FB8; // type:object size:0x4 data:float lbl_80579FBC = .sdata2:0x80579FBC; // type:object size:0x4 data:float lbl_80579FC0 = .sdata2:0x80579FC0; // type:object size:0x8 data:double @@ -43547,7 +43547,7 @@ lbl_80579FC0 = .sdata2:0x80579FC0; // type:object size:0x8 data:double lbl_80579FD0 = .sdata2:0x80579FD0; // type:object size:0x4 data:float lbl_80579FD4 = .sdata2:0x80579FD4; // type:object size:0x4 data:float lbl_80579FD8 = .sdata2:0x80579FD8; // type:object size:0x8 data:double -lbl_80579FE0 = .sdata2:0x80579FE0; // type:object size:0x8 data:float +lbl_80579FE0 = .sdata2:0x80579FE0; // type:object size:0x4 data:float lbl_80579FE8 = .sdata2:0x80579FE8; // type:object size:0x8 data:4byte lbl_80579FF0 = .sdata2:0x80579FF0; // type:object size:0x4 data:float lbl_80579FF4 = .sdata2:0x80579FF4; // type:object size:0x4 data:float @@ -43563,7 +43563,7 @@ lbl_8057A018 = .sdata2:0x8057A018; // type:object size:0x4 data:float lbl_8057A01C = .sdata2:0x8057A01C; // type:object size:0x4 data:float lbl_8057A020 = .sdata2:0x8057A020; // type:object size:0x4 data:float lbl_8057A028 = .sdata2:0x8057A028; // type:object size:0x8 data:double -lbl_8057A030 = .sdata2:0x8057A030; // type:object size:0x8 data:float +lbl_8057A030 = .sdata2:0x8057A030; // type:object size:0x4 data:float lbl_8057A038 = .sdata2:0x8057A038; // type:object size:0x4 data:float lbl_8057A03C = .sdata2:0x8057A03C; // type:object size:0x4 data:float @7242 = .sdata2:0x8057A040; // type:object size:0x4 scope:local data:float @@ -43590,7 +43590,7 @@ lbl_8057A0A0 = .sdata2:0x8057A0A0; // type:object size:0x4 data:float lbl_8057A0A4 = .sdata2:0x8057A0A4; // type:object size:0x4 data:float lbl_8057A0A8 = .sdata2:0x8057A0A8; // type:object size:0x8 data:double lbl_8057A0B0 = .sdata2:0x8057A0B0; // type:object size:0x8 data:double -lbl_8057A0B8 = .sdata2:0x8057A0B8; // type:object size:0x8 data:float +lbl_8057A0B8 = .sdata2:0x8057A0B8; // type:object size:0x4 data:float lbl_8057A0C0 = .sdata2:0x8057A0C0; // type:object size:0x8 lbl_8057A0C8 = .sdata2:0x8057A0C8; // type:object size:0x4 data:float lbl_8057A0CC = .sdata2:0x8057A0CC; // type:object size:0x4 data:float @@ -43600,7 +43600,7 @@ lbl_8057A0D8 = .sdata2:0x8057A0D8; // type:object size:0x4 data:float lbl_8057A0DC = .sdata2:0x8057A0DC; // type:object size:0x4 data:float lbl_8057A0E0 = .sdata2:0x8057A0E0; // type:object size:0x4 data:float lbl_8057A0E4 = .sdata2:0x8057A0E4; // type:object size:0x4 data:float -lbl_8057A0E8 = .sdata2:0x8057A0E8; // type:object size:0x8 data:float +lbl_8057A0E8 = .sdata2:0x8057A0E8; // type:object size:0x4 data:float lbl_8057A0F0 = .sdata2:0x8057A0F0; // type:object size:0x8 lbl_8057A0F8 = .sdata2:0x8057A0F8; // type:object size:0x4 data:float lbl_8057A0FC = .sdata2:0x8057A0FC; // type:object size:0x4 data:float @@ -43627,7 +43627,7 @@ TRIFORCE_PIECE_ITEM_IDS = .sdata2:0x8057A178; // type:object size:0x8 data:wstri @8161 = .sdata2:0x8057A184; // type:object size:0x4 scope:local data:float lbl_8057A188 = .sdata2:0x8057A188; // type:object size:0x4 data:float lbl_8057A18C = .sdata2:0x8057A18C; // type:object size:0x4 data:float -lbl_8057A190 = .sdata2:0x8057A190; // type:object size:0x8 data:float +lbl_8057A190 = .sdata2:0x8057A190; // type:object size:0x4 data:float lbl_8057A198 = .sdata2:0x8057A198; // type:object size:0x8 data:4byte lbl_8057A1A0 = .sdata2:0x8057A1A0; // type:object size:0x4 data:float lbl_8057A1A4 = .sdata2:0x8057A1A4; // type:object size:0x4 data:float @@ -43641,84 +43641,84 @@ lbl_8057A1C4 = .sdata2:0x8057A1C4; // type:object size:0x4 data:float lbl_8057A1C8 = .sdata2:0x8057A1C8; // type:object size:0x8 data:double lbl_8057A1D0 = .sdata2:0x8057A1D0; // type:object size:0x4 data:float lbl_8057A1D4 = .sdata2:0x8057A1D4; // type:object size:0x4 data:float -lbl_8057A1D8 = .sdata2:0x8057A1D8; // type:object size:0x8 data:float +lbl_8057A1D8 = .sdata2:0x8057A1D8; // type:object size:0x4 data:float lbl_8057A1E0 = .sdata2:0x8057A1E0; // type:object size:0x4 data:float lbl_8057A1E4 = .sdata2:0x8057A1E4; // type:object size:0x4 data:float lbl_8057A1E8 = .sdata2:0x8057A1E8; // type:object size:0x4 data:float lbl_8057A1EC = .sdata2:0x8057A1EC; // type:object size:0x4 data:float -lbl_8057A1F0 = .sdata2:0x8057A1F0; // type:object size:0x8 data:float +lbl_8057A1F0 = .sdata2:0x8057A1F0; // type:object size:0x4 data:float lbl_8057A1F8 = .sdata2:0x8057A1F8; // type:object size:0x4 data:float lbl_8057A1FC = .sdata2:0x8057A1FC; // type:object size:0x4 data:float lbl_8057A200 = .sdata2:0x8057A200; // type:object size:0x4 data:float lbl_8057A204 = .sdata2:0x8057A204; // type:object size:0x4 data:float lbl_8057A208 = .sdata2:0x8057A208; // type:object size:0x4 data:float lbl_8057A20C = .sdata2:0x8057A20C; // type:object size:0x4 data:float -lbl_8057A210 = .sdata2:0x8057A210; // type:object size:0x8 data:float +lbl_8057A210 = .sdata2:0x8057A210; // type:object size:0x4 data:float lbl_8057A218 = .sdata2:0x8057A218; // type:object size:0x4 data:float lbl_8057A21C = .sdata2:0x8057A21C; // type:object size:0x4 data:float lbl_8057A220 = .sdata2:0x8057A220; // type:object size:0x4 data:float lbl_8057A224 = .sdata2:0x8057A224; // type:object size:0x4 data:float lbl_8057A228 = .sdata2:0x8057A228; // type:object size:0x4 data:float lbl_8057A22C = .sdata2:0x8057A22C; // type:object size:0x4 data:float -lbl_8057A230 = .sdata2:0x8057A230; // type:object size:0x8 data:float +lbl_8057A230 = .sdata2:0x8057A230; // type:object size:0x4 data:float lbl_8057A238 = .sdata2:0x8057A238; // type:object size:0x4 data:float lbl_8057A23C = .sdata2:0x8057A23C; // type:object size:0x4 data:float lbl_8057A240 = .sdata2:0x8057A240; // type:object size:0x4 data:float lbl_8057A244 = .sdata2:0x8057A244; // type:object size:0x4 data:float lbl_8057A248 = .sdata2:0x8057A248; // type:object size:0x4 data:float lbl_8057A24C = .sdata2:0x8057A24C; // type:object size:0x4 data:float -lbl_8057A250 = .sdata2:0x8057A250; // type:object size:0x8 data:float +lbl_8057A250 = .sdata2:0x8057A250; // type:object size:0x4 data:float lbl_8057A258 = .sdata2:0x8057A258; // type:object size:0x4 data:float lbl_8057A25C = .sdata2:0x8057A25C; // type:object size:0x4 data:float lbl_8057A260 = .sdata2:0x8057A260; // type:object size:0x4 data:float lbl_8057A264 = .sdata2:0x8057A264; // type:object size:0x4 data:float -lbl_8057A268 = .sdata2:0x8057A268; // type:object size:0x8 data:float +lbl_8057A268 = .sdata2:0x8057A268; // type:object size:0x4 data:float lbl_8057A270 = .sdata2:0x8057A270; // type:object size:0x4 data:float lbl_8057A274 = .sdata2:0x8057A274; // type:object size:0x4 data:float lbl_8057A278 = .sdata2:0x8057A278; // type:object size:0x4 data:float lbl_8057A27C = .sdata2:0x8057A27C; // type:object size:0x4 data:float -lbl_8057A280 = .sdata2:0x8057A280; // type:object size:0x8 data:float +lbl_8057A280 = .sdata2:0x8057A280; // type:object size:0x4 data:float lbl_8057A288 = .sdata2:0x8057A288; // type:object size:0x4 data:float lbl_8057A28C = .sdata2:0x8057A28C; // type:object size:0x4 data:float lbl_8057A290 = .sdata2:0x8057A290; // type:object size:0x4 data:float lbl_8057A294 = .sdata2:0x8057A294; // type:object size:0x4 data:float lbl_8057A298 = .sdata2:0x8057A298; // type:object size:0x4 data:float lbl_8057A29C = .sdata2:0x8057A29C; // type:object size:0x4 data:float -lbl_8057A2A0 = .sdata2:0x8057A2A0; // type:object size:0x8 data:float +lbl_8057A2A0 = .sdata2:0x8057A2A0; // type:object size:0x4 data:float lbl_8057A2A8 = .sdata2:0x8057A2A8; // type:object size:0x4 data:float lbl_8057A2AC = .sdata2:0x8057A2AC; // type:object size:0x4 data:float lbl_8057A2B0 = .sdata2:0x8057A2B0; // type:object size:0x4 data:float lbl_8057A2B4 = .sdata2:0x8057A2B4; // type:object size:0x4 data:float -lbl_8057A2B8 = .sdata2:0x8057A2B8; // type:object size:0x8 data:float +lbl_8057A2B8 = .sdata2:0x8057A2B8; // type:object size:0x4 data:float lbl_8057A2C0 = .sdata2:0x8057A2C0; // type:object size:0x4 data:float lbl_8057A2C4 = .sdata2:0x8057A2C4; // type:object size:0x4 data:float lbl_8057A2C8 = .sdata2:0x8057A2C8; // type:object size:0x4 data:float lbl_8057A2CC = .sdata2:0x8057A2CC; // type:object size:0x4 data:float -lbl_8057A2D0 = .sdata2:0x8057A2D0; // type:object size:0x8 data:float +lbl_8057A2D0 = .sdata2:0x8057A2D0; // type:object size:0x4 data:float lbl_8057A2D8 = .sdata2:0x8057A2D8; // type:object size:0x4 data:float lbl_8057A2DC = .sdata2:0x8057A2DC; // type:object size:0x4 data:float lbl_8057A2E0 = .sdata2:0x8057A2E0; // type:object size:0x4 data:float lbl_8057A2E4 = .sdata2:0x8057A2E4; // type:object size:0x4 data:float -lbl_8057A2E8 = .sdata2:0x8057A2E8; // type:object size:0x8 data:float +lbl_8057A2E8 = .sdata2:0x8057A2E8; // type:object size:0x4 data:float lbl_8057A2F0 = .sdata2:0x8057A2F0; // type:object size:0x4 data:float lbl_8057A2F4 = .sdata2:0x8057A2F4; // type:object size:0x4 data:float lbl_8057A2F8 = .sdata2:0x8057A2F8; // type:object size:0x4 data:float lbl_8057A2FC = .sdata2:0x8057A2FC; // type:object size:0x4 data:float -lbl_8057A300 = .sdata2:0x8057A300; // type:object size:0x8 data:float +lbl_8057A300 = .sdata2:0x8057A300; // type:object size:0x4 data:float lbl_8057A308 = .sdata2:0x8057A308; // type:object size:0x4 data:float lbl_8057A30C = .sdata2:0x8057A30C; // type:object size:0x4 data:float lbl_8057A310 = .sdata2:0x8057A310; // type:object size:0x4 data:float lbl_8057A314 = .sdata2:0x8057A314; // type:object size:0x4 data:float lbl_8057A318 = .sdata2:0x8057A318; // type:object size:0x4 data:float lbl_8057A31C = .sdata2:0x8057A31C; // type:object size:0x4 data:float -lbl_8057A320 = .sdata2:0x8057A320; // type:object size:0x8 data:float +lbl_8057A320 = .sdata2:0x8057A320; // type:object size:0x4 data:float lbl_8057A328 = .sdata2:0x8057A328; // type:object size:0x4 data:float lbl_8057A32C = .sdata2:0x8057A32C; // type:object size:0x4 data:float lbl_8057A330 = .sdata2:0x8057A330; // type:object size:0x4 data:float lbl_8057A334 = .sdata2:0x8057A334; // type:object size:0x4 data:float lbl_8057A338 = .sdata2:0x8057A338; // type:object size:0x4 data:float lbl_8057A33C = .sdata2:0x8057A33C; // type:object size:0x4 data:float -lbl_8057A340 = .sdata2:0x8057A340; // type:object size:0x8 data:float +lbl_8057A340 = .sdata2:0x8057A340; // type:object size:0x4 data:float lbl_8057A348 = .sdata2:0x8057A348; // type:object size:0x4 data:float lbl_8057A34C = .sdata2:0x8057A34C; // type:object size:0x4 data:float lbl_8057A350 = .sdata2:0x8057A350; // type:object size:0x4 data:float @@ -44259,7 +44259,7 @@ lbl_8057AC60 = .sdata2:0x8057AC60; // type:object size:0x4 data:float lbl_8057AC64 = .sdata2:0x8057AC64; // type:object size:0x4 data:float lbl_8057AC68 = .sdata2:0x8057AC68; // type:object size:0x4 data:float lbl_8057AC6C = .sdata2:0x8057AC6C; // type:object size:0x4 data:float -lbl_8057AC70 = .sdata2:0x8057AC70; // type:object size:0x8 data:float +lbl_8057AC70 = .sdata2:0x8057AC70; // type:object size:0x4 data:float lbl_8057AC78 = .sdata2:0x8057AC78; // type:object size:0x4 data:float lbl_8057AC7C = .sdata2:0x8057AC7C; // type:object size:0x4 data:float lbl_8057AC80 = .sdata2:0x8057AC80; // type:object size:0x4 data:float @@ -44299,10 +44299,11 @@ lbl_8057AD10 = .sdata2:0x8057AD10; // type:object size:0x4 data:float lbl_8057AD14 = .sdata2:0x8057AD14; // type:object size:0x4 data:float lbl_8057AD18 = .sdata2:0x8057AD18; // type:object size:0x4 data:float lbl_8057AD1C = .sdata2:0x8057AD1C; // type:object size:0x4 data:float -lbl_8057AD20 = .sdata2:0x8057AD20; // type:object size:0x8 data:float +lbl_8057AD20 = .sdata2:0x8057AD20; // type:object size:0x4 data:float lbl_8057AD28 = .sdata2:0x8057AD28; // type:object size:0x4 data:float lbl_8057AD2C = .sdata2:0x8057AD2C; // type:object size:0x4 data:float -lbl_8057AD30 = .sdata2:0x8057AD30; // type:object size:0x8 data:float +lbl_8057AD30 = .sdata2:0x8057AD30; // type:object size:0x4 data:float +lbl_8057AD34 = .sdata2:0x8057AD34; // type:object size:0x4 lbl_8057AD38 = .sdata2:0x8057AD38; // type:object size:0x4 data:float lbl_8057AD3C = .sdata2:0x8057AD3C; // type:object size:0x4 data:float lbl_8057AD40 = .sdata2:0x8057AD40; // type:object size:0x4 data:float @@ -44336,7 +44337,7 @@ lbl_8057ADB8 = .sdata2:0x8057ADB8; // type:object size:0x4 data:float lbl_8057ADBC = .sdata2:0x8057ADBC; // type:object size:0x4 data:float lbl_8057ADC0 = .sdata2:0x8057ADC0; // type:object size:0x4 data:float lbl_8057ADC8 = .sdata2:0x8057ADC8; // type:object size:0x8 data:double -lbl_8057ADD0 = .sdata2:0x8057ADD0; // type:object size:0x8 data:float +lbl_8057ADD0 = .sdata2:0x8057ADD0; // type:object size:0x4 data:float lbl_8057ADD8 = .sdata2:0x8057ADD8; // type:object size:0x4 data:float lbl_8057ADDC = .sdata2:0x8057ADDC; // type:object size:0x4 data:float lbl_8057ADE0 = .sdata2:0x8057ADE0; // type:object size:0x4 data:float @@ -44356,7 +44357,7 @@ lbl_8057AE14 = .sdata2:0x8057AE14; // type:object size:0x4 data:float lbl_8057AE18 = .sdata2:0x8057AE18; // type:object size:0x8 data:double lbl_8057AE20 = .sdata2:0x8057AE20; // type:object size:0x4 data:float lbl_8057AE24 = .sdata2:0x8057AE24; // type:object size:0x4 data:float -lbl_8057AE28 = .sdata2:0x8057AE28; // type:object size:0x8 data:float +lbl_8057AE28 = .sdata2:0x8057AE28; // type:object size:0x4 data:float lbl_8057AE30 = .sdata2:0x8057AE30; // type:object size:0x4 data:float lbl_8057AE34 = .sdata2:0x8057AE34; // type:object size:0x4 data:float lbl_8057AE38 = .sdata2:0x8057AE38; // type:object size:0x4 data:float @@ -44367,7 +44368,7 @@ lbl_8057AE48 = .sdata2:0x8057AE48; // type:object size:0x4 data:float lbl_8057AE4C = .sdata2:0x8057AE4C; // type:object size:0x4 data:float lbl_8057AE50 = .sdata2:0x8057AE50; // type:object size:0x4 data:float lbl_8057AE54 = .sdata2:0x8057AE54; // type:object size:0x4 data:float -lbl_8057AE58 = .sdata2:0x8057AE58; // type:object size:0x8 data:float +lbl_8057AE58 = .sdata2:0x8057AE58; // type:object size:0x4 data:float lbl_8057AE60 = .sdata2:0x8057AE60; // type:object size:0x4 data:float lbl_8057AE64 = .sdata2:0x8057AE64; // type:object size:0x4 data:float lbl_8057AE68 = .sdata2:0x8057AE68; // type:object size:0x4 data:float @@ -44408,7 +44409,7 @@ lbl_8057AF38 = .sdata2:0x8057AF38; // type:object size:0x4 data:float lbl_8057AF3C = .sdata2:0x8057AF3C; // type:object size:0x4 data:float lbl_8057AF40 = .sdata2:0x8057AF40; // type:object size:0x4 data:float lbl_8057AF44 = .sdata2:0x8057AF44; // type:object size:0x4 data:float -lbl_8057AF48 = .sdata2:0x8057AF48; // type:object size:0x8 data:float +lbl_8057AF48 = .sdata2:0x8057AF48; // type:object size:0x4 data:float lbl_8057AF50 = .sdata2:0x8057AF50; // type:object size:0x4 data:float lbl_8057AF54 = .sdata2:0x8057AF54; // type:object size:0x4 data:float lbl_8057AF58 = .sdata2:0x8057AF58; // type:object size:0x4 data:float @@ -44742,7 +44743,7 @@ lbl_8057B4D0 = .sdata2:0x8057B4D0; // type:object size:0x4 data:float lbl_8057B4D4 = .sdata2:0x8057B4D4; // type:object size:0x4 data:float lbl_8057B4D8 = .sdata2:0x8057B4D8; // type:object size:0x4 data:float lbl_8057B4DC = .sdata2:0x8057B4DC; // type:object size:0x4 data:float -lbl_8057B4E0 = .sdata2:0x8057B4E0; // type:object size:0x8 data:float +lbl_8057B4E0 = .sdata2:0x8057B4E0; // type:object size:0x4 data:float lbl_8057B4E8 = .sdata2:0x8057B4E8; // type:object size:0x4 data:float lbl_8057B4EC = .sdata2:0x8057B4EC; // type:object size:0x4 data:float lbl_8057B4F0 = .sdata2:0x8057B4F0; // type:object size:0x4 data:float @@ -44790,7 +44791,7 @@ lbl_8057B5A8 = .sdata2:0x8057B5A8; // type:object size:0x4 data:float lbl_8057B5AC = .sdata2:0x8057B5AC; // type:object size:0x4 data:float lbl_8057B5B0 = .sdata2:0x8057B5B0; // type:object size:0x4 data:float lbl_8057B5B4 = .sdata2:0x8057B5B4; // type:object size:0x4 data:float -lbl_8057B5B8 = .sdata2:0x8057B5B8; // type:object size:0x8 data:float +lbl_8057B5B8 = .sdata2:0x8057B5B8; // type:object size:0x4 data:float lbl_8057B5C0 = .sdata2:0x8057B5C0; // type:object size:0x4 data:float lbl_8057B5C4 = .sdata2:0x8057B5C4; // type:object size:0x4 data:float lbl_8057B5C8 = .sdata2:0x8057B5C8; // type:object size:0x4 data:float @@ -44822,7 +44823,7 @@ lbl_8057B638 = .sdata2:0x8057B638; // type:object size:0x4 data:float lbl_8057B63C = .sdata2:0x8057B63C; // type:object size:0x4 data:float lbl_8057B640 = .sdata2:0x8057B640; // type:object size:0x4 data:float lbl_8057B644 = .sdata2:0x8057B644; // type:object size:0x4 data:float -lbl_8057B648 = .sdata2:0x8057B648; // type:object size:0x8 data:float +lbl_8057B648 = .sdata2:0x8057B648; // type:object size:0x4 data:float lbl_8057B650 = .sdata2:0x8057B650; // type:object size:0x4 data:float lbl_8057B654 = .sdata2:0x8057B654; // type:object size:0x4 data:float lbl_8057B658 = .sdata2:0x8057B658; // type:object size:0x8 @@ -45034,7 +45035,7 @@ lbl_8057B9A8 = .sdata2:0x8057B9A8; // type:object size:0x4 data:float lbl_8057B9AC = .sdata2:0x8057B9AC; // type:object size:0x4 data:float lbl_8057B9B0 = .sdata2:0x8057B9B0; // type:object size:0x4 data:float lbl_8057B9B4 = .sdata2:0x8057B9B4; // type:object size:0x4 data:float -lbl_8057B9B8 = .sdata2:0x8057B9B8; // type:object size:0x8 data:float +lbl_8057B9B8 = .sdata2:0x8057B9B8; // type:object size:0x4 data:float lbl_8057B9C0 = .sdata2:0x8057B9C0; // type:object size:0x8 B_WHEEL_INDEX_TO_ITEM = .sdata2:0x8057B9C8; // type:object size:0x8 data:byte lbl_8057B9D0 = .sdata2:0x8057B9D0; // type:object size:0x4 data:float @@ -45205,7 +45206,7 @@ lbl_8057BC68 = .sdata2:0x8057BC68; // type:object size:0x4 data:float lbl_8057BC6C = .sdata2:0x8057BC6C; // type:object size:0x4 data:float lbl_8057BC70 = .sdata2:0x8057BC70; // type:object size:0x4 data:float lbl_8057BC74 = .sdata2:0x8057BC74; // type:object size:0x4 data:float -lbl_8057BC78 = .sdata2:0x8057BC78; // type:object size:0x8 data:float +lbl_8057BC78 = .sdata2:0x8057BC78; // type:object size:0x4 data:float lbl_8057BC80 = .sdata2:0x8057BC80; // type:object size:0x8 data:4byte lbl_8057BC88 = .sdata2:0x8057BC88; // type:object size:0x8 data:4byte lbl_8057BC90 = .sdata2:0x8057BC90; // type:object size:0x4 data:float @@ -45268,7 +45269,7 @@ lbl_8057BD70 = .sdata2:0x8057BD70; // type:object size:0x4 data:float lbl_8057BD74 = .sdata2:0x8057BD74; // type:object size:0x4 data:float lbl_8057BD78 = .sdata2:0x8057BD78; // type:object size:0x4 data:float lbl_8057BD7C = .sdata2:0x8057BD7C; // type:object size:0x4 data:float -lbl_8057BD80 = .sdata2:0x8057BD80; // type:object size:0x8 data:float +lbl_8057BD80 = .sdata2:0x8057BD80; // type:object size:0x4 data:float DEFAULT_ITEM_FLAG_STRUCT = .sdata2:0x8057BD88; // type:object size:0x8 lbl_8057BD90 = .sdata2:0x8057BD90; // type:object size:0x4 data:4byte lbl_8057BD94 = .sdata2:0x8057BD94; // type:object size:0x4 data:4byte @@ -45432,7 +45433,7 @@ lbl_8057C040 = .sdata2:0x8057C040; // type:object size:0x4 data:float lbl_8057C044 = .sdata2:0x8057C044; // type:object size:0x4 data:float lbl_8057C048 = .sdata2:0x8057C048; // type:object size:0x4 data:float lbl_8057C04C = .sdata2:0x8057C04C; // type:object size:0x4 data:float -lbl_8057C050 = .sdata2:0x8057C050; // type:object size:0x8 data:float +lbl_8057C050 = .sdata2:0x8057C050; // type:object size:0x4 data:float lbl_8057C058 = .sdata2:0x8057C058; // type:object size:0x4 data:float lbl_8057C05C = .sdata2:0x8057C05C; // type:object size:0x4 data:float lbl_8057C060 = .sdata2:0x8057C060; // type:object size:0x4 data:float @@ -45470,7 +45471,7 @@ lbl_8057C0E0 = .sdata2:0x8057C0E0; // type:object size:0x4 data:float lbl_8057C0E4 = .sdata2:0x8057C0E4; // type:object size:0x4 data:float lbl_8057C0E8 = .sdata2:0x8057C0E8; // type:object size:0x4 data:float lbl_8057C0EC = .sdata2:0x8057C0EC; // type:object size:0x4 data:float -lbl_8057C0F0 = .sdata2:0x8057C0F0; // type:object size:0x8 data:float +lbl_8057C0F0 = .sdata2:0x8057C0F0; // type:object size:0x4 data:float lbl_8057C0F8 = .sdata2:0x8057C0F8; // type:object size:0x4 data:float lbl_8057C0FC = .sdata2:0x8057C0FC; // type:object size:0x4 data:float lbl_8057C100 = .sdata2:0x8057C100; // type:object size:0x4 data:float @@ -45706,10 +45707,10 @@ lbl_8057C4F0 = .sdata2:0x8057C4F0; // type:object size:0x4 data:float lbl_8057C4F4 = .sdata2:0x8057C4F4; // type:object size:0x4 data:float lbl_8057C4F8 = .sdata2:0x8057C4F8; // type:object size:0x4 data:float lbl_8057C4FC = .sdata2:0x8057C4FC; // type:object size:0x4 data:float -lbl_8057C500 = .sdata2:0x8057C500; // type:object size:0x8 data:float +lbl_8057C500 = .sdata2:0x8057C500; // type:object size:0x4 data:float lbl_8057C508 = .sdata2:0x8057C508; // type:object size:0x4 data:float lbl_8057C50C = .sdata2:0x8057C50C; // type:object size:0x4 data:float -lbl_8057C510 = .sdata2:0x8057C510; // type:object size:0x8 data:float +lbl_8057C510 = .sdata2:0x8057C510; // type:object size:0x4 data:float D201_BossKeyPuzzleFlags = .sdata2:0x8057C518; // type:object size:0x4 scope:local data:byte lbl_8057C520 = .sdata2:0x8057C520; // type:object size:0x4 data:float lbl_8057C524 = .sdata2:0x8057C524; // type:object size:0x4 data:float @@ -45777,10 +45778,10 @@ lbl_8057C628 = .sdata2:0x8057C628; // type:object size:0x4 data:float lbl_8057C62C = .sdata2:0x8057C62C; // type:object size:0x4 data:float lbl_8057C630 = .sdata2:0x8057C630; // type:object size:0x4 data:float lbl_8057C634 = .sdata2:0x8057C634; // type:object size:0x4 data:float -lbl_8057C638 = .sdata2:0x8057C638; // type:object size:0x8 data:float -lbl_8057C640 = .sdata2:0x8057C640; // type:object size:0x8 data:float -lbl_8057C648 = .sdata2:0x8057C648; // type:object size:0x8 data:float -lbl_8057C650 = .sdata2:0x8057C650; // type:object size:0x8 data:float +lbl_8057C638 = .sdata2:0x8057C638; // type:object size:0x4 data:float +lbl_8057C640 = .sdata2:0x8057C640; // type:object size:0x4 data:float +lbl_8057C648 = .sdata2:0x8057C648; // type:object size:0x4 data:float +lbl_8057C650 = .sdata2:0x8057C650; // type:object size:0x4 data:float lbl_8057C658 = .sdata2:0x8057C658; // type:object size:0x4 data:float lbl_8057C65C = .sdata2:0x8057C65C; // type:object size:0x4 data:float lbl_8057C660 = .sdata2:0x8057C660; // type:object size:0x4 data:float @@ -45793,14 +45794,14 @@ lbl_8057C680 = .sdata2:0x8057C680; // type:object size:0x4 data:float lbl_8057C684 = .sdata2:0x8057C684; // type:object size:0x4 data:float lbl_8057C688 = .sdata2:0x8057C688; // type:object size:0x4 data:float lbl_8057C690 = .sdata2:0x8057C690; // type:object size:0x8 data:double -lbl_8057C698 = .sdata2:0x8057C698; // type:object size:0x8 data:float +lbl_8057C698 = .sdata2:0x8057C698; // type:object size:0x4 data:float lbl_8057C6A0 = .sdata2:0x8057C6A0; // type:object size:0x4 data:float lbl_8057C6A4 = .sdata2:0x8057C6A4; // type:object size:0x4 data:float -lbl_8057C6A8 = .sdata2:0x8057C6A8; // type:object size:0x8 data:float +lbl_8057C6A8 = .sdata2:0x8057C6A8; // type:object size:0x4 data:float lbl_8057C6B0 = .sdata2:0x8057C6B0; // type:object size:0x4 data:float lbl_8057C6B4 = .sdata2:0x8057C6B4; // type:object size:0x4 data:float lbl_8057C6B8 = .sdata2:0x8057C6B8; // type:object size:0x8 data:double -lbl_8057C6C0 = .sdata2:0x8057C6C0; // type:object size:0x8 data:float +lbl_8057C6C0 = .sdata2:0x8057C6C0; // type:object size:0x4 data:float lbl_8057C6C8 = .sdata2:0x8057C6C8; // type:object size:0x4 data:float lbl_8057C6CC = .sdata2:0x8057C6CC; // type:object size:0x4 data:float lbl_8057C6D0 = .sdata2:0x8057C6D0; // type:object size:0x8 data:double @@ -45832,7 +45833,7 @@ lbl_8057C748 = .sdata2:0x8057C748; // type:object size:0x4 data:float lbl_8057C74C = .sdata2:0x8057C74C; // type:object size:0x4 data:float lbl_8057C750 = .sdata2:0x8057C750; // type:object size:0x4 data:float lbl_8057C754 = .sdata2:0x8057C754; // type:object size:0x4 data:float -lbl_8057C758 = .sdata2:0x8057C758; // type:object size:0x8 data:float +lbl_8057C758 = .sdata2:0x8057C758; // type:object size:0x4 data:float lbl_8057C760 = .sdata2:0x8057C760; // type:object size:0x4 data:float lbl_8057C764 = .sdata2:0x8057C764; // type:object size:0x4 data:float lbl_8057C768 = .sdata2:0x8057C768; // type:object size:0x4 data:float @@ -45864,7 +45865,7 @@ lbl_8057C7E0 = .sdata2:0x8057C7E0; // type:object size:0x4 data:float lbl_8057C7E4 = .sdata2:0x8057C7E4; // type:object size:0x4 data:float lbl_8057C7E8 = .sdata2:0x8057C7E8; // type:object size:0x4 data:float lbl_8057C7F0 = .sdata2:0x8057C7F0; // type:object size:0x8 data:double -lbl_8057C7F8 = .sdata2:0x8057C7F8; // type:object size:0x8 data:float +lbl_8057C7F8 = .sdata2:0x8057C7F8; // type:object size:0x4 data:float lbl_8057C800 = .sdata2:0x8057C800; // type:object size:0x8 data:4byte lbl_8057C808 = .sdata2:0x8057C808; // type:object size:0x4 data:float lbl_8057C810 = .sdata2:0x8057C810; // type:object size:0x8 data:double @@ -45998,14 +45999,14 @@ lbl_8057CA10 = .sdata2:0x8057CA10; // type:object size:0x4 data:float lbl_8057CA14 = .sdata2:0x8057CA14; // type:object size:0x4 data:float lbl_8057CA18 = .sdata2:0x8057CA18; // type:object size:0x4 data:float lbl_8057CA1C = .sdata2:0x8057CA1C; // type:object size:0x4 data:float -lbl_8057CA20 = .sdata2:0x8057CA20; // type:object size:0x8 data:float +lbl_8057CA20 = .sdata2:0x8057CA20; // type:object size:0x4 data:float lbl_8057CA28 = .sdata2:0x8057CA28; // type:object size:0x8 data:4byte lbl_8057CA30 = .sdata2:0x8057CA30; // type:object size:0x8 data:4byte lbl_8057CA38 = .sdata2:0x8057CA38; // type:object size:0x4 data:float lbl_8057CA3C = .sdata2:0x8057CA3C; // type:object size:0x4 data:float lbl_8057CA40 = .sdata2:0x8057CA40; // type:object size:0x4 data:float lbl_8057CA44 = .sdata2:0x8057CA44; // type:object size:0x4 data:float -lbl_8057CA48 = .sdata2:0x8057CA48; // type:object size:0x8 data:float +lbl_8057CA48 = .sdata2:0x8057CA48; // type:object size:0x4 data:float lbl_8057CA50 = .sdata2:0x8057CA50; // type:object size:0x4 data:float lbl_8057CA54 = .sdata2:0x8057CA54; // type:object size:0x4 data:float lbl_8057CA58 = .sdata2:0x8057CA58; // type:object size:0x4 data:float @@ -46117,7 +46118,7 @@ lbl_8057CC20 = .sdata2:0x8057CC20; // type:object size:0x4 data:float lbl_8057CC24 = .sdata2:0x8057CC24; // type:object size:0x4 data:float lbl_8057CC28 = .sdata2:0x8057CC28; // type:object size:0x4 data:float lbl_8057CC2C = .sdata2:0x8057CC2C; // type:object size:0x4 data:float -lbl_8057CC30 = .sdata2:0x8057CC30; // type:object size:0x8 data:float +lbl_8057CC30 = .sdata2:0x8057CC30; // type:object size:0x4 data:float lbl_8057CC38 = .sdata2:0x8057CC38; // type:object size:0x4 data:float lbl_8057CC3C = .sdata2:0x8057CC3C; // type:object size:0x4 data:float lbl_8057CC40 = .sdata2:0x8057CC40; // type:object size:0x4 data:float @@ -46136,7 +46137,7 @@ lbl_8057CC78 = .sdata2:0x8057CC78; // type:object size:0x8 data:double lbl_8057CC80 = .sdata2:0x8057CC80; // type:object size:0x8 data:double lbl_8057CC88 = .sdata2:0x8057CC88; // type:object size:0x4 data:float lbl_8057CC8C = .sdata2:0x8057CC8C; // type:object size:0x4 data:float -lbl_8057CC90 = .sdata2:0x8057CC90; // type:object size:0x8 data:float +lbl_8057CC90 = .sdata2:0x8057CC90; // type:object size:0x4 data:float @6752 = .sdata2:0x8057CC98; // type:object size:0x4 scope:local data:float @6825 = .sdata2:0x8057CC9C; // type:object size:0x4 scope:local data:float @6886 = .sdata2:0x8057CCA0; // type:object size:0x4 scope:local data:float @@ -46167,7 +46168,7 @@ lbl_8057CD2C = .sdata2:0x8057CD2C; // type:object size:0x4 data:float lbl_8057CD30 = .sdata2:0x8057CD30; // type:object size:0x4 data:float lbl_8057CD34 = .sdata2:0x8057CD34; // type:object size:0x4 data:float lbl_8057CD38 = .sdata2:0x8057CD38; // type:object size:0x8 data:double -lbl_8057CD40 = .sdata2:0x8057CD40; // type:object size:0x8 data:float +lbl_8057CD40 = .sdata2:0x8057CD40; // type:object size:0x4 data:float @3688 = .sdata2:0x8057CD48; // type:object size:0x4 scope:local data:float @3689 = .sdata2:0x8057CD4C; // type:object size:0x4 scope:local data:float @4186 = .sdata2:0x8057CD50; // type:object size:0x4 scope:local data:float @@ -46206,16 +46207,16 @@ lbl_8057CDE0 = .sdata2:0x8057CDE0; // type:object size:0x4 data:float lbl_8057CDE4 = .sdata2:0x8057CDE4; // type:object size:0x4 data:float lbl_8057CDE8 = .sdata2:0x8057CDE8; // type:object size:0x4 data:float lbl_8057CDEC = .sdata2:0x8057CDEC; // type:object size:0x4 data:float -lbl_8057CDF0 = .sdata2:0x8057CDF0; // type:object size:0x8 data:float +lbl_8057CDF0 = .sdata2:0x8057CDF0; // type:object size:0x4 data:float @4639 = .sdata2:0x8057CDF8; // type:object size:0x4 scope:local data:float lbl_8057CE00 = .sdata2:0x8057CE00; // type:object size:0x4 data:float lbl_8057CE04 = .sdata2:0x8057CE04; // type:object size:0x4 data:float lbl_8057CE08 = .sdata2:0x8057CE08; // type:object size:0x4 data:float lbl_8057CE0C = .sdata2:0x8057CE0C; // type:object size:0x4 data:float -lbl_8057CE10 = .sdata2:0x8057CE10; // type:object size:0x8 data:float +lbl_8057CE10 = .sdata2:0x8057CE10; // type:object size:0x4 data:float lbl_8057CE18 = .sdata2:0x8057CE18; // type:object size:0x4 data:float lbl_8057CE1C = .sdata2:0x8057CE1C; // type:object size:0x4 data:float -lbl_8057CE20 = .sdata2:0x8057CE20; // type:object size:0x8 data:float +lbl_8057CE20 = .sdata2:0x8057CE20; // type:object size:0x4 data:float lbl_8057CE28 = .sdata2:0x8057CE28; // type:object size:0x4 data:float lbl_8057CE2C = .sdata2:0x8057CE2C; // type:object size:0x4 data:float lbl_8057CE30 = .sdata2:0x8057CE30; // type:object size:0x4 data:float @@ -46234,7 +46235,7 @@ lbl_8057CE6C = .sdata2:0x8057CE6C; // type:object size:0x4 data:float lbl_8057CE70 = .sdata2:0x8057CE70; // type:object size:0x8 data:double lbl_8057CE78 = .sdata2:0x8057CE78; // type:object size:0x4 data:float lbl_8057CE7C = .sdata2:0x8057CE7C; // type:object size:0x4 data:float -lbl_8057CE80 = .sdata2:0x8057CE80; // type:object size:0x8 data:float +lbl_8057CE80 = .sdata2:0x8057CE80; // type:object size:0x4 data:float lbl_8057CE88 = .sdata2:0x8057CE88; // type:object size:0x4 data:float lbl_8057CE90 = .sdata2:0x8057CE90; // type:object size:0x8 data:double lbl_8057CE98 = .sdata2:0x8057CE98; // type:object size:0x4 data:float @@ -46289,7 +46290,7 @@ lbl_8057CF78 = .sdata2:0x8057CF78; // type:object size:0x8 data:double lbl_8057CF80 = .sdata2:0x8057CF80; // type:object size:0x4 data:float lbl_8057CF84 = .sdata2:0x8057CF84; // type:object size:0x4 data:float lbl_8057CF88 = .sdata2:0x8057CF88; // type:object size:0x8 data:double -lbl_8057CF90 = .sdata2:0x8057CF90; // type:object size:0x8 data:float +lbl_8057CF90 = .sdata2:0x8057CF90; // type:object size:0x4 data:float lbl_8057CF98 = .sdata2:0x8057CF98; // type:object size:0x4 data:float lbl_8057CF9C = .sdata2:0x8057CF9C; // type:object size:0x4 data:float lbl_8057CFA0 = .sdata2:0x8057CFA0; // type:object size:0x4 data:float @@ -46301,7 +46302,7 @@ lbl_8057CFB4 = .sdata2:0x8057CFB4; // type:object size:0x4 data:float lbl_8057CFB8 = .sdata2:0x8057CFB8; // type:object size:0x4 data:float lbl_8057CFC0 = .sdata2:0x8057CFC0; // type:object size:0x4 data:float lbl_8057CFC4 = .sdata2:0x8057CFC4; // type:object size:0x4 data:float -lbl_8057CFC8 = .sdata2:0x8057CFC8; // type:object size:0x8 data:float +lbl_8057CFC8 = .sdata2:0x8057CFC8; // type:object size:0x4 data:float G_CM3D_F_ABS_MIN = .sdata2:0x8057CFD0; // type:object size:0x4 data:float lbl_8057CFD4 = .sdata2:0x8057CFD4; // type:object size:0x4 data:float lbl_8057CFD8 = .sdata2:0x8057CFD8; // type:object size:0x4 data:float @@ -46459,7 +46460,7 @@ lbl_8057D2A8 = .sdata2:0x8057D2A8; // type:object size:0x4 data:float lbl_8057D2AC = .sdata2:0x8057D2AC; // type:object size:0x4 data:float lbl_8057D2B0 = .sdata2:0x8057D2B0; // type:object size:0x4 data:float lbl_8057D2B4 = .sdata2:0x8057D2B4; // type:object size:0x4 data:float -lbl_8057D2B8 = .sdata2:0x8057D2B8; // type:object size:0x8 data:float +lbl_8057D2B8 = .sdata2:0x8057D2B8; // type:object size:0x4 data:float lbl_8057D2C0 = .sdata2:0x8057D2C0; // type:object size:0x4 data:float lbl_8057D2C4 = .sdata2:0x8057D2C4; // type:object size:0x4 data:float lbl_8057D2C8 = .sdata2:0x8057D2C8; // type:object size:0x4 data:float @@ -46503,10 +46504,10 @@ lbl_8057D368 = .sdata2:0x8057D368; // type:object size:0x4 data:float lbl_8057D36C = .sdata2:0x8057D36C; // type:object size:0x4 data:float lbl_8057D370 = .sdata2:0x8057D370; // type:object size:0x4 data:float lbl_8057D374 = .sdata2:0x8057D374; // type:object size:0x4 data:float -lbl_8057D378 = .sdata2:0x8057D378; // type:object size:0x8 data:float +lbl_8057D378 = .sdata2:0x8057D378; // type:object size:0x4 data:float lbl_8057D380 = .sdata2:0x8057D380; // type:object size:0x4 data:float lbl_8057D384 = .sdata2:0x8057D384; // type:object size:0x4 data:float -lbl_8057D388 = .sdata2:0x8057D388; // type:object size:0x8 data:float +lbl_8057D388 = .sdata2:0x8057D388; // type:object size:0x4 data:float lbl_8057D390 = .sdata2:0x8057D390; // type:object size:0x4 data:float lbl_8057D394 = .sdata2:0x8057D394; // type:object size:0x4 data:float lbl_8057D398 = .sdata2:0x8057D398; // type:object size:0x4 data:float @@ -46515,7 +46516,7 @@ lbl_8057D3A0 = .sdata2:0x8057D3A0; // type:object size:0x4 data:float lbl_8057D3A4 = .sdata2:0x8057D3A4; // type:object size:0x4 data:float lbl_8057D3A8 = .sdata2:0x8057D3A8; // type:object size:0x4 data:float lbl_8057D3AC = .sdata2:0x8057D3AC; // type:object size:0x4 data:float -lbl_8057D3B0 = .sdata2:0x8057D3B0; // type:object size:0x8 data:float +lbl_8057D3B0 = .sdata2:0x8057D3B0; // type:object size:0x4 data:float lbl_8057D3B8 = .sdata2:0x8057D3B8; // type:object size:0x4 data:float lbl_8057D3BC = .sdata2:0x8057D3BC; // type:object size:0x4 data:float lbl_8057D3C0 = .sdata2:0x8057D3C0; // type:object size:0x4 data:float @@ -46551,7 +46552,7 @@ lbl_8057D438 = .sdata2:0x8057D438; // type:object size:0x4 data:float lbl_8057D43C = .sdata2:0x8057D43C; // type:object size:0x4 data:float lbl_8057D440 = .sdata2:0x8057D440; // type:object size:0x4 data:float lbl_8057D444 = .sdata2:0x8057D444; // type:object size:0x4 data:float -lbl_8057D448 = .sdata2:0x8057D448; // type:object size:0x8 data:float +lbl_8057D448 = .sdata2:0x8057D448; // type:object size:0x4 data:float lbl_8057D450 = .sdata2:0x8057D450; // type:object size:0x4 data:float lbl_8057D454 = .sdata2:0x8057D454; // type:object size:0x4 data:float lbl_8057D458 = .sdata2:0x8057D458; // type:object size:0x4 data:float @@ -46709,7 +46710,7 @@ lbl_8057D890 = .sdata2:0x8057D890; // type:object size:0x8 lbl_8057D898 = .sdata2:0x8057D898; // type:object size:0x8 data:string lbl_8057D8A0 = .sdata2:0x8057D8A0; // type:object size:0x4 data:float lbl_8057D8A4 = .sdata2:0x8057D8A4; // type:object size:0x4 data:float -lbl_8057D8A8 = .sdata2:0x8057D8A8; // type:object size:0x8 data:float +lbl_8057D8A8 = .sdata2:0x8057D8A8; // type:object size:0x4 data:float lbl_8057D8B0 = .sdata2:0x8057D8B0; // type:object size:0x4 data:float lbl_8057D8B4 = .sdata2:0x8057D8B4; // type:object size:0x4 data:float lbl_8057D8B8 = .sdata2:0x8057D8B8; // type:object size:0x4 data:float @@ -46738,7 +46739,7 @@ lbl_8057D918 = .sdata2:0x8057D918; // type:object size:0x4 data:float lbl_8057D920 = .sdata2:0x8057D920; // type:object size:0x8 data:double lbl_8057D928 = .sdata2:0x8057D928; // type:object size:0x4 data:float lbl_8057D92C = .sdata2:0x8057D92C; // type:object size:0x4 data:float -lbl_8057D930 = .sdata2:0x8057D930; // type:object size:0x8 data:float +lbl_8057D930 = .sdata2:0x8057D930; // type:object size:0x4 data:float lbl_8057D938 = .sdata2:0x8057D938; // type:object size:0x4 data:float lbl_8057D93C = .sdata2:0x8057D93C; // type:object size:0x4 data:float lbl_8057D940 = .sdata2:0x8057D940; // type:object size:0x4 data:float @@ -46751,7 +46752,7 @@ lbl_8057D958 = .sdata2:0x8057D958; // type:object size:0x4 data:float lbl_8057D95C = .sdata2:0x8057D95C; // type:object size:0x4 data:float lbl_8057D960 = .sdata2:0x8057D960; // type:object size:0x4 data:float lbl_8057D964 = .sdata2:0x8057D964; // type:object size:0x4 data:float -lbl_8057D968 = .sdata2:0x8057D968; // type:object size:0x8 data:float +lbl_8057D968 = .sdata2:0x8057D968; // type:object size:0x4 data:float lbl_8057D970 = .sdata2:0x8057D970; // type:object size:0x4 data:float lbl_8057D974 = .sdata2:0x8057D974; // type:object size:0x4 data:float lbl_8057D978 = .sdata2:0x8057D978; // type:object size:0x4 data:float @@ -46796,9 +46797,9 @@ lbl_8057DA18 = .sdata2:0x8057DA18; // type:object size:0x4 data:float lbl_8057DA1C = .sdata2:0x8057DA1C; // type:object size:0x4 data:float lbl_8057DA20 = .sdata2:0x8057DA20; // type:object size:0x4 data:float lbl_8057DA24 = .sdata2:0x8057DA24; // type:object size:0x4 data:float -lbl_8057DA28 = .sdata2:0x8057DA28; // type:object size:0x8 data:float +lbl_8057DA28 = .sdata2:0x8057DA28; // type:object size:0x4 data:float lbl_8057DA30 = .sdata2:0x8057DA30; // type:object size:0x8 data:2byte -lbl_8057DA38 = .sdata2:0x8057DA38; // type:object size:0x8 data:float +lbl_8057DA38 = .sdata2:0x8057DA38; // type:object size:0x4 data:float lbl_8057DA40 = .sdata2:0x8057DA40; // type:object size:0x8 data:2byte lbl_8057DA48 = .sdata2:0x8057DA48; // type:object size:0x4 data:float lbl_8057DA4C = .sdata2:0x8057DA4C; // type:object size:0x4 data:float @@ -46812,7 +46813,7 @@ lbl_8057DA68 = .sdata2:0x8057DA68; // type:object size:0x4 data:float lbl_8057DA6C = .sdata2:0x8057DA6C; // type:object size:0x4 data:float lbl_8057DA70 = .sdata2:0x8057DA70; // type:object size:0x4 data:float lbl_8057DA74 = .sdata2:0x8057DA74; // type:object size:0x4 data:float -lbl_8057DA78 = .sdata2:0x8057DA78; // type:object size:0x8 data:float +lbl_8057DA78 = .sdata2:0x8057DA78; // type:object size:0x4 data:float lbl_8057DA80 = .sdata2:0x8057DA80; // type:object size:0x4 data:float lbl_8057DA84 = .sdata2:0x8057DA84; // type:object size:0x4 data:float lbl_8057DA88 = .sdata2:0x8057DA88; // type:object size:0x4 data:float @@ -46829,7 +46830,7 @@ lbl_8057DAB0 = .sdata2:0x8057DAB0; // type:object size:0x4 data:float lbl_8057DAB4 = .sdata2:0x8057DAB4; // type:object size:0x4 data:float lbl_8057DAB8 = .sdata2:0x8057DAB8; // type:object size:0x4 data:float lbl_8057DAC0 = .sdata2:0x8057DAC0; // type:object size:0x8 data:double -lbl_8057DAC8 = .sdata2:0x8057DAC8; // type:object size:0x8 data:float +lbl_8057DAC8 = .sdata2:0x8057DAC8; // type:object size:0x4 data:float lbl_8057DAD0 = .sdata2:0x8057DAD0; // type:object size:0x4 data:float lbl_8057DAD4 = .sdata2:0x8057DAD4; // type:object size:0x4 data:float lbl_8057DAD8 = .sdata2:0x8057DAD8; // type:object size:0x4 data:float @@ -46858,7 +46859,7 @@ lbl_8057DB30 = .sdata2:0x8057DB30; // type:object size:0x4 data:float lbl_8057DB34 = .sdata2:0x8057DB34; // type:object size:0x4 data:float lbl_8057DB38 = .sdata2:0x8057DB38; // type:object size:0x4 data:float lbl_8057DB3C = .sdata2:0x8057DB3C; // type:object size:0x4 data:float -lbl_8057DB40 = .sdata2:0x8057DB40; // type:object size:0x8 data:float +lbl_8057DB40 = .sdata2:0x8057DB40; // type:object size:0x4 data:float lbl_8057DB48 = .sdata2:0x8057DB48; // type:object size:0x4 data:4byte lbl_8057DB4C = .sdata2:0x8057DB4C; // type:object size:0x4 data:float lbl_8057DB50 = .sdata2:0x8057DB50; // type:object size:0x4 data:float @@ -46937,7 +46938,7 @@ lbl_8057DC98 = .sdata2:0x8057DC98; // type:object size:0x4 data:float lbl_8057DC9C = .sdata2:0x8057DC9C; // type:object size:0x4 data:float lbl_8057DCA0 = .sdata2:0x8057DCA0; // type:object size:0x4 data:float lbl_8057DCA4 = .sdata2:0x8057DCA4; // type:object size:0x4 data:float -lbl_8057DCA8 = .sdata2:0x8057DCA8; // type:object size:0x8 data:float +lbl_8057DCA8 = .sdata2:0x8057DCA8; // type:object size:0x4 data:float lbl_8057DCB0 = .sdata2:0x8057DCB0; // type:object size:0x4 data:float lbl_8057DCB4 = .sdata2:0x8057DCB4; // type:object size:0x4 data:float lbl_8057DCB8 = .sdata2:0x8057DCB8; // type:object size:0x4 data:float @@ -46997,7 +46998,7 @@ lbl_8057DDD0 = .sdata2:0x8057DDD0; // type:object size:0x4 data:float lbl_8057DDD4 = .sdata2:0x8057DDD4; // type:object size:0x4 data:float lbl_8057DDD8 = .sdata2:0x8057DDD8; // type:object size:0x4 data:float lbl_8057DDDC = .sdata2:0x8057DDDC; // type:object size:0x4 data:float -lbl_8057DDE0 = .sdata2:0x8057DDE0; // type:object size:0x8 data:float +lbl_8057DDE0 = .sdata2:0x8057DDE0; // type:object size:0x4 data:float lbl_8057DDE8 = .sdata2:0x8057DDE8; // type:object size:0x4 data:float lbl_8057DDEC = .sdata2:0x8057DDEC; // type:object size:0x4 data:float lbl_8057DDF0 = .sdata2:0x8057DDF0; // type:object size:0x4 data:float @@ -47196,7 +47197,7 @@ lbl_8057E3A0 = .sdata2:0x8057E3A0; // type:object size:0x4 data:float lbl_8057E3A4 = .sdata2:0x8057E3A4; // type:object size:0x4 data:float lbl_8057E3A8 = .sdata2:0x8057E3A8; // type:object size:0x4 data:float lbl_8057E3AC = .sdata2:0x8057E3AC; // type:object size:0x4 data:float -lbl_8057E3B0 = .sdata2:0x8057E3B0; // type:object size:0x8 data:float +lbl_8057E3B0 = .sdata2:0x8057E3B0; // type:object size:0x4 data:float lbl_8057E3B8 = .sdata2:0x8057E3B8; // type:object size:0x4 data:float lbl_8057E3BC = .sdata2:0x8057E3BC; // type:object size:0x4 data:float lbl_8057E3C0 = .sdata2:0x8057E3C0; // type:object size:0x4 data:float @@ -47284,7 +47285,7 @@ lbl_8057E510 = .sdata2:0x8057E510; // type:object size:0x4 data:float lbl_8057E514 = .sdata2:0x8057E514; // type:object size:0x4 data:float lbl_8057E518 = .sdata2:0x8057E518; // type:object size:0x4 data:float lbl_8057E51C = .sdata2:0x8057E51C; // type:object size:0x4 data:float -lbl_8057E520 = .sdata2:0x8057E520; // type:object size:0x8 data:float +lbl_8057E520 = .sdata2:0x8057E520; // type:object size:0x4 data:float lbl_8057E528 = .sdata2:0x8057E528; // type:object size:0x4 data:float lbl_8057E52C = .sdata2:0x8057E52C; // type:object size:0x4 data:float lbl_8057E530 = .sdata2:0x8057E530; // type:object size:0x4 data:float @@ -47301,7 +47302,7 @@ lbl_8057E558 = .sdata2:0x8057E558; // type:object size:0x4 data:float lbl_8057E55C = .sdata2:0x8057E55C; // type:object size:0x4 data:float lbl_8057E560 = .sdata2:0x8057E560; // type:object size:0x4 data:float lbl_8057E564 = .sdata2:0x8057E564; // type:object size:0x4 data:float -lbl_8057E568 = .sdata2:0x8057E568; // type:object size:0x8 data:float +lbl_8057E568 = .sdata2:0x8057E568; // type:object size:0x4 data:float lbl_8057E570 = .sdata2:0x8057E570; // type:object size:0x4 data:float lbl_8057E574 = .sdata2:0x8057E574; // type:object size:0x4 data:float lbl_8057E578 = .sdata2:0x8057E578; // type:object size:0x4 data:float @@ -47310,7 +47311,7 @@ lbl_8057E580 = .sdata2:0x8057E580; // type:object size:0x4 data:float lbl_8057E584 = .sdata2:0x8057E584; // type:object size:0x4 data:float lbl_8057E588 = .sdata2:0x8057E588; // type:object size:0x4 data:float lbl_8057E58C = .sdata2:0x8057E58C; // type:object size:0x4 data:float -lbl_8057E590 = .sdata2:0x8057E590; // type:object size:0x8 data:float +lbl_8057E590 = .sdata2:0x8057E590; // type:object size:0x4 data:float lbl_8057E598 = .sdata2:0x8057E598; // type:object size:0x4 data:float lbl_8057E59C = .sdata2:0x8057E59C; // type:object size:0x4 data:float lbl_8057E5A0 = .sdata2:0x8057E5A0; // type:object size:0x4 data:float @@ -47396,7 +47397,7 @@ lbl_8057E740 = .sdata2:0x8057E740; // type:object size:0x4 data:float lbl_8057E744 = .sdata2:0x8057E744; // type:object size:0x4 data:float lbl_8057E748 = .sdata2:0x8057E748; // type:object size:0x4 data:float lbl_8057E74C = .sdata2:0x8057E74C; // type:object size:0x4 data:float -lbl_8057E750 = .sdata2:0x8057E750; // type:object size:0x8 data:float +lbl_8057E750 = .sdata2:0x8057E750; // type:object size:0x4 data:float lbl_8057E758 = .sdata2:0x8057E758; // type:object size:0x4 data:float lbl_8057E75C = .sdata2:0x8057E75C; // type:object size:0x4 data:float lbl_8057E760 = .sdata2:0x8057E760; // type:object size:0x4 data:float @@ -47407,7 +47408,7 @@ lbl_8057E770 = .sdata2:0x8057E770; // type:object size:0x4 data:float lbl_8057E774 = .sdata2:0x8057E774; // type:object size:0x4 data:float lbl_8057E778 = .sdata2:0x8057E778; // type:object size:0x4 data:float lbl_8057E77C = .sdata2:0x8057E77C; // type:object size:0x4 data:float -lbl_8057E780 = .sdata2:0x8057E780; // type:object size:0x8 data:float +lbl_8057E780 = .sdata2:0x8057E780; // type:object size:0x4 data:float lbl_8057E788 = .sdata2:0x8057E788; // type:object size:0x4 data:float lbl_8057E78C = .sdata2:0x8057E78C; // type:object size:0x4 data:float lbl_8057E790 = .sdata2:0x8057E790; // type:object size:0x4 data:float @@ -47434,7 +47435,7 @@ lbl_8057E7F0 = .sdata2:0x8057E7F0; // type:object size:0x4 data:float lbl_8057E7F4 = .sdata2:0x8057E7F4; // type:object size:0x4 data:float lbl_8057E7F8 = .sdata2:0x8057E7F8; // type:object size:0x4 data:float lbl_8057E7FC = .sdata2:0x8057E7FC; // type:object size:0x4 data:float -lbl_8057E800 = .sdata2:0x8057E800; // type:object size:0x8 data:float +lbl_8057E800 = .sdata2:0x8057E800; // type:object size:0x4 data:float lbl_8057E808 = .sdata2:0x8057E808; // type:object size:0x4 data:float lbl_8057E810 = .sdata2:0x8057E810; // type:object size:0x8 data:double lbl_8057E818 = .sdata2:0x8057E818; // type:object size:0x4 data:float @@ -47469,7 +47470,7 @@ lbl_8057E8B4 = .sdata2:0x8057E8B4; // type:object size:0x4 data:float lbl_8057E8B8 = .sdata2:0x8057E8B8; // type:object size:0x4 data:float lbl_8057E8C0 = .sdata2:0x8057E8C0; // type:object size:0x8 data:double lbl_8057E8C8 = .sdata2:0x8057E8C8; // type:object size:0x8 data:double -lbl_8057E8D0 = .sdata2:0x8057E8D0; // type:object size:0x8 data:float +lbl_8057E8D0 = .sdata2:0x8057E8D0; // type:object size:0x4 data:float lbl_8057E8D8 = .sdata2:0x8057E8D8; // type:object size:0x4 data:float lbl_8057E8DC = .sdata2:0x8057E8DC; // type:object size:0x4 data:float lbl_8057E8E0 = .sdata2:0x8057E8E0; // type:object size:0x4 data:float @@ -47540,7 +47541,7 @@ lbl_8057EA40 = .sdata2:0x8057EA40; // type:object size:0x4 data:float lbl_8057EA44 = .sdata2:0x8057EA44; // type:object size:0x4 data:float lbl_8057EA48 = .sdata2:0x8057EA48; // type:object size:0x4 data:4byte lbl_8057EA4C = .sdata2:0x8057EA4C; // type:object size:0x2 data:2byte -lbl_8057EA50 = .sdata2:0x8057EA50; // type:object size:0x8 data:float +lbl_8057EA50 = .sdata2:0x8057EA50; // type:object size:0x4 data:float lbl_8057EA58 = .sdata2:0x8057EA58; // type:object size:0x4 data:float lbl_8057EA5C = .sdata2:0x8057EA5C; // type:object size:0x4 data:float lbl_8057EA60 = .sdata2:0x8057EA60; // type:object size:0x4 data:float @@ -47612,14 +47613,14 @@ lbl_8057EBB8 = .sdata2:0x8057EBB8; // type:object size:0x4 data:float lbl_8057EBBC = .sdata2:0x8057EBBC; // type:object size:0x4 data:float lbl_8057EBC0 = .sdata2:0x8057EBC0; // type:object size:0x4 data:float lbl_8057EBC4 = .sdata2:0x8057EBC4; // type:object size:0x4 data:float -lbl_8057EBC8 = .sdata2:0x8057EBC8; // type:object size:0x8 data:float +lbl_8057EBC8 = .sdata2:0x8057EBC8; // type:object size:0x4 data:float lbl_8057EBD0 = .sdata2:0x8057EBD0; // type:object size:0x4 data:float lbl_8057EBD4 = .sdata2:0x8057EBD4; // type:object size:0x4 data:float lbl_8057EBD8 = .sdata2:0x8057EBD8; // type:object size:0x4 data:float lbl_8057EBDC = .sdata2:0x8057EBDC; // type:object size:0x4 data:float lbl_8057EBE0 = .sdata2:0x8057EBE0; // type:object size:0x4 data:float lbl_8057EBE4 = .sdata2:0x8057EBE4; // type:object size:0x4 data:float -lbl_8057EBE8 = .sdata2:0x8057EBE8; // type:object size:0x8 data:float +lbl_8057EBE8 = .sdata2:0x8057EBE8; // type:object size:0x4 data:float lbl_8057EBF0 = .sdata2:0x8057EBF0; // type:object size:0x4 data:float lbl_8057EBF4 = .sdata2:0x8057EBF4; // type:object size:0x4 data:float lbl_8057EBF8 = .sdata2:0x8057EBF8; // type:object size:0x8 @@ -47627,7 +47628,7 @@ lbl_8057EC00 = .sdata2:0x8057EC00; // type:object size:0x4 data:float lbl_8057EC04 = .sdata2:0x8057EC04; // type:object size:0x4 data:float lbl_8057EC08 = .sdata2:0x8057EC08; // type:object size:0x4 data:float lbl_8057EC0C = .sdata2:0x8057EC0C; // type:object size:0x4 data:float -lbl_8057EC10 = .sdata2:0x8057EC10; // type:object size:0x8 data:float +lbl_8057EC10 = .sdata2:0x8057EC10; // type:object size:0x4 data:float lbl_8057EC18 = .sdata2:0x8057EC18; // type:object size:0x4 data:float lbl_8057EC1C = .sdata2:0x8057EC1C; // type:object size:0x4 data:float lbl_8057EC20 = .sdata2:0x8057EC20; // type:object size:0x8 data:double @@ -47636,15 +47637,15 @@ lbl_8057EC30 = .sdata2:0x8057EC30; // type:object size:0x4 data:float lbl_8057EC34 = .sdata2:0x8057EC34; // type:object size:0x4 data:float lbl_8057EC38 = .sdata2:0x8057EC38; // type:object size:0x4 data:float lbl_8057EC40 = .sdata2:0x8057EC40; // type:object size:0x8 data:double -lbl_8057EC48 = .sdata2:0x8057EC48; // type:object size:0x8 data:float +lbl_8057EC48 = .sdata2:0x8057EC48; // type:object size:0x4 data:float lbl_8057EC50 = .sdata2:0x8057EC50; // type:object size:0x4 data:float lbl_8057EC54 = .sdata2:0x8057EC54; // type:object size:0x4 data:float -lbl_8057EC58 = .sdata2:0x8057EC58; // type:object size:0x8 data:float +lbl_8057EC58 = .sdata2:0x8057EC58; // type:object size:0x4 data:float lbl_8057EC60 = .sdata2:0x8057EC60; // type:object size:0x4 data:float lbl_8057EC64 = .sdata2:0x8057EC64; // type:object size:0x4 data:float lbl_8057EC68 = .sdata2:0x8057EC68; // type:object size:0x4 data:float lbl_8057EC6C = .sdata2:0x8057EC6C; // type:object size:0x4 data:float -lbl_8057EC70 = .sdata2:0x8057EC70; // type:object size:0x8 data:float +lbl_8057EC70 = .sdata2:0x8057EC70; // type:object size:0x4 data:float lbl_8057EC78 = .sdata2:0x8057EC78; // type:object size:0x4 data:float lbl_8057EC80 = .sdata2:0x8057EC80; // type:object size:0x8 data:double lbl_8057EC88 = .sdata2:0x8057EC88; // type:object size:0x4 data:float @@ -47659,13 +47660,13 @@ lbl_8057ECB0 = .sdata2:0x8057ECB0; // type:object size:0x4 data:float lbl_8057ECB8 = .sdata2:0x8057ECB8; // type:object size:0x8 data:double lbl_8057ECC0 = .sdata2:0x8057ECC0; // type:object size:0x4 data:float lbl_8057ECC4 = .sdata2:0x8057ECC4; // type:object size:0x4 data:float -lbl_8057ECC8 = .sdata2:0x8057ECC8; // type:object size:0x8 data:float +lbl_8057ECC8 = .sdata2:0x8057ECC8; // type:object size:0x4 data:float lbl_8057ECD0 = .sdata2:0x8057ECD0; // type:object size:0x4 data:float lbl_8057ECD8 = .sdata2:0x8057ECD8; // type:object size:0x8 data:double lbl_8057ECE0 = .sdata2:0x8057ECE0; // type:object size:0x4 data:float lbl_8057ECE8 = .sdata2:0x8057ECE8; // type:object size:0x8 data:double -lbl_8057ECF0 = .sdata2:0x8057ECF0; // type:object size:0x8 data:float -lbl_8057ECF8 = .sdata2:0x8057ECF8; // type:object size:0x8 +lbl_8057ECF0 = .sdata2:0x8057ECF0; // type:object size:0x4 data:float +dat_epsilon__Q34nw4r3g3d6detail = .sdata2:0x8057ECF8; // type:object size:0x4 data:float lbl_8057ED00 = .sdata2:0x8057ED00; // type:object size:0x4 data:float lbl_8057ED04 = .sdata2:0x8057ED04; // type:object size:0x4 data:float lbl_8057ED08 = .sdata2:0x8057ED08; // type:object size:0x8 data:double @@ -47687,14 +47688,14 @@ lbl_8057ED60 = .sdata2:0x8057ED60; // type:object size:0x8 data:double lbl_8057ED68 = .sdata2:0x8057ED68; // type:object size:0x4 data:float lbl_8057ED6C = .sdata2:0x8057ED6C; // type:object size:0x4 data:float lbl_8057ED70 = .sdata2:0x8057ED70; // type:object size:0x8 data:double -lbl_8057ED78 = .sdata2:0x8057ED78; // type:object size:0x8 data:float +lbl_8057ED78 = .sdata2:0x8057ED78; // type:object size:0x4 data:float lbl_8057ED80 = .sdata2:0x8057ED80; // type:object size:0x4 lbl_8057ED84 = .sdata2:0x8057ED84; // type:object size:0x4 data:float lbl_8057ED88 = .sdata2:0x8057ED88; // type:object size:0x4 data:float lbl_8057ED8C = .sdata2:0x8057ED8C; // type:object size:0x4 data:float lbl_8057ED90 = .sdata2:0x8057ED90; // type:object size:0x4 data:float lbl_8057ED94 = .sdata2:0x8057ED94; // type:object size:0x4 data:float -lbl_8057ED98 = .sdata2:0x8057ED98; // type:object size:0x8 data:float +lbl_8057ED98 = .sdata2:0x8057ED98; // type:object size:0x4 data:float lbl_8057EDA0 = .sdata2:0x8057EDA0; // type:object size:0x4 lbl_8057EDA4 = .sdata2:0x8057EDA4; // type:object size:0x4 data:float lbl_8057EDA8 = .sdata2:0x8057EDA8; // type:object size:0x4 data:float @@ -47709,12 +47710,12 @@ lbl_8057EDD8 = .sdata2:0x8057EDD8; // type:object size:0x4 data:float lbl_8057EDE0 = .sdata2:0x8057EDE0; // type:object size:0x8 data:double lbl_8057EDE8 = .sdata2:0x8057EDE8; // type:object size:0x4 data:float lbl_8057EDEC = .sdata2:0x8057EDEC; // type:object size:0x4 data:float -lbl_8057EDF0 = .sdata2:0x8057EDF0; // type:object size:0x8 +norm_epsilon__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@ = .sdata2:0x8057EDF0; // type:object size:0x4 data:float lbl_8057EDF8 = .sdata2:0x8057EDF8; // type:object size:0x4 data:float lbl_8057EDFC = .sdata2:0x8057EDFC; // type:object size:0x4 data:float lbl_8057EE00 = .sdata2:0x8057EE00; // type:object size:0x4 data:float lbl_8057EE04 = .sdata2:0x8057EE04; // type:object size:0x4 data:float -lbl_8057EE08 = .sdata2:0x8057EE08; // type:object size:0x8 data:float +lbl_8057EE08 = .sdata2:0x8057EE08; // type:object size:0x4 data:float lbl_8057EE10 = .sdata2:0x8057EE10; // type:object size:0x4 data:float lbl_8057EE14 = .sdata2:0x8057EE14; // type:object size:0x4 data:float lbl_8057EE18 = .sdata2:0x8057EE18; // type:object size:0x4 data:float @@ -47729,26 +47730,26 @@ lbl_8057EE40 = .sdata2:0x8057EE40; // type:object size:0x4 data:float lbl_8057EE44 = .sdata2:0x8057EE44; // type:object size:0x4 data:float lbl_8057EE48 = .sdata2:0x8057EE48; // type:object size:0x4 data:float lbl_8057EE4C = .sdata2:0x8057EE4C; // type:object size:0x4 data:float -lbl_8057EE50 = .sdata2:0x8057EE50; // type:object size:0x8 data:float +lbl_8057EE50 = .sdata2:0x8057EE50; // type:object size:0x4 data:float lbl_8057EE58 = .sdata2:0x8057EE58; // type:object size:0x4 data:float lbl_8057EE5C = .sdata2:0x8057EE5C; // type:object size:0x4 data:float lbl_8057EE60 = .sdata2:0x8057EE60; // type:object size:0x4 data:float lbl_8057EE64 = .sdata2:0x8057EE64; // type:object size:0x4 data:float -lbl_8057EE68 = .sdata2:0x8057EE68; // type:object size:0x8 data:float +lbl_8057EE68 = .sdata2:0x8057EE68; // type:object size:0x4 data:float lbl_8057EE70 = .sdata2:0x8057EE70; // type:object size:0x4 data:float lbl_8057EE74 = .sdata2:0x8057EE74; // type:object size:0x4 data:float -lbl_8057EE78 = .sdata2:0x8057EE78; // type:object size:0x8 data:float +lbl_8057EE78 = .sdata2:0x8057EE78; // type:object size:0x4 data:float lbl_8057EE80 = .sdata2:0x8057EE80; // type:object size:0x4 data:float lbl_8057EE84 = .sdata2:0x8057EE84; // type:object size:0x4 data:float lbl_8057EE88 = .sdata2:0x8057EE88; // type:object size:0x4 data:float lbl_8057EE8C = .sdata2:0x8057EE8C; // type:object size:0x4 data:float -lbl_8057EE90 = .sdata2:0x8057EE90; // type:object size:0x8 data:float +lbl_8057EE90 = .sdata2:0x8057EE90; // type:object size:0x4 data:float lbl_8057EE98 = .sdata2:0x8057EE98; // type:object size:0x4 data:float lbl_8057EE9C = .sdata2:0x8057EE9C; // type:object size:0x4 data:float -lbl_8057EEA0 = .sdata2:0x8057EEA0; // type:object size:0x8 data:float -lbl_8057EEA8 = .sdata2:0x8057EEA8; // type:object size:0x8 data:float -lbl_8057EEB0 = .sdata2:0x8057EEB0; // type:object size:0x8 data:float -lbl_8057EEB8 = .sdata2:0x8057EEB8; // type:object size:0x8 data:float +lbl_8057EEA0 = .sdata2:0x8057EEA0; // type:object size:0x4 data:float +lbl_8057EEA8 = .sdata2:0x8057EEA8; // type:object size:0x4 data:float +lbl_8057EEB0 = .sdata2:0x8057EEB0; // type:object size:0x4 data:float +lbl_8057EEB8 = .sdata2:0x8057EEB8; // type:object size:0x4 data:float lbl_8057EEC0 = .sdata2:0x8057EEC0; // type:object size:0x4 data:float lbl_8057EEC4 = .sdata2:0x8057EEC4; // type:object size:0x4 data:float lbl_8057EEC8 = .sdata2:0x8057EEC8; // type:object size:0x4 data:float @@ -47759,8 +47760,8 @@ lbl_8057EED8 = .sdata2:0x8057EED8; // type:object size:0x4 data:float lbl_8057EEDC = .sdata2:0x8057EEDC; // type:object size:0x4 data:float lbl_8057EEE0 = .sdata2:0x8057EEE0; // type:object size:0x4 data:float lbl_8057EEE4 = .sdata2:0x8057EEE4; // type:object size:0x4 data:float -lbl_8057EEE8 = .sdata2:0x8057EEE8; // type:object size:0x8 data:float -lbl_8057EEF0 = .sdata2:0x8057EEF0; // type:object size:0x8 data:float +lbl_8057EEE8 = .sdata2:0x8057EEE8; // type:object size:0x4 data:float +lbl_8057EEF0 = .sdata2:0x8057EEF0; // type:object size:0x4 data:float lbl_8057EEF8 = .sdata2:0x8057EEF8; // type:object size:0x4 data:float lbl_8057EEFC = .sdata2:0x8057EEFC; // type:object size:0x4 data:float lbl_8057EF00 = .sdata2:0x8057EF00; // type:object size:0x8 data:double @@ -47785,14 +47786,14 @@ lbl_8057EF5C = .sdata2:0x8057EF5C; // type:object size:0x4 data:float lbl_8057EF60 = .sdata2:0x8057EF60; // type:object size:0x4 data:float lbl_8057EF68 = .sdata2:0x8057EF68; // type:object size:0x8 data:double lbl_8057EF70 = .sdata2:0x8057EF70; // type:object size:0x8 data:double -lbl_8057EF78 = .sdata2:0x8057EF78; // type:object size:0x8 data:float +lbl_8057EF78 = .sdata2:0x8057EF78; // type:object size:0x4 data:float lbl_8057EF80 = .sdata2:0x8057EF80; // type:object size:0x4 data:float lbl_8057EF84 = .sdata2:0x8057EF84; // type:object size:0x4 data:float lbl_8057EF88 = .sdata2:0x8057EF88; // type:object size:0x4 data:float lbl_8057EF8C = .sdata2:0x8057EF8C; // type:object size:0x4 data:float lbl_8057EF90 = .sdata2:0x8057EF90; // type:object size:0x8 data:double lbl_8057EF98 = .sdata2:0x8057EF98; // type:object size:0x8 data:double -lbl_8057EFA0 = .sdata2:0x8057EFA0; // type:object size:0x8 data:float +lbl_8057EFA0 = .sdata2:0x8057EFA0; // type:object size:0x4 data:float lbl_8057EFA8 = .sdata2:0x8057EFA8; // type:object size:0x4 data:float lbl_8057EFAC = .sdata2:0x8057EFAC; // type:object size:0x4 data:float lbl_8057EFB0 = .sdata2:0x8057EFB0; // type:object size:0x4 data:float @@ -47833,7 +47834,7 @@ lbl_8057F060 = .sdata2:0x8057F060; // type:object size:0x8 data:double lbl_8057F068 = .sdata2:0x8057F068; // type:object size:0x4 data:float lbl_8057F06C = .sdata2:0x8057F06C; // type:object size:0x4 data:float lbl_8057F070 = .sdata2:0x8057F070; // type:object size:0x8 data:double -lbl_8057F078 = .sdata2:0x8057F078; // type:object size:0x8 data:float +lbl_8057F078 = .sdata2:0x8057F078; // type:object size:0x4 data:float lbl_8057F080 = .sdata2:0x8057F080; // type:object size:0x4 data:float lbl_8057F084 = .sdata2:0x8057F084; // type:object size:0x4 data:float lbl_8057F088 = .sdata2:0x8057F088; // type:object size:0x4 data:float @@ -47843,7 +47844,7 @@ lbl_8057F094 = .sdata2:0x8057F094; // type:object size:0x4 data:float lbl_8057F098 = .sdata2:0x8057F098; // type:object size:0x4 data:float lbl_8057F0A0 = .sdata2:0x8057F0A0; // type:object size:0x8 data:double lbl_8057F0A8 = .sdata2:0x8057F0A8; // type:object size:0x8 data:double -lbl_8057F0B0 = .sdata2:0x8057F0B0; // type:object size:0x8 data:float +lbl_8057F0B0 = .sdata2:0x8057F0B0; // type:object size:0x4 data:float lbl_8057F0B8 = .sdata2:0x8057F0B8; // type:object size:0x4 data:float lbl_8057F0BC = .sdata2:0x8057F0BC; // type:object size:0x4 data:float lbl_8057F0C0 = .sdata2:0x8057F0C0; // type:object size:0x4 data:float @@ -47863,10 +47864,10 @@ lbl_8057F100 = .sdata2:0x8057F100; // type:object size:0x4 data:float lbl_8057F104 = .sdata2:0x8057F104; // type:object size:0x4 data:float lbl_8057F108 = .sdata2:0x8057F108; // type:object size:0x4 data:float lbl_8057F10C = .sdata2:0x8057F10C; // type:object size:0x4 data:float -lbl_8057F110 = .sdata2:0x8057F110; // type:object size:0x8 data:float +lbl_8057F110 = .sdata2:0x8057F110; // type:object size:0x4 data:float lbl_8057F118 = .sdata2:0x8057F118; // type:object size:0x4 data:float lbl_8057F11C = .sdata2:0x8057F11C; // type:object size:0x4 data:float -lbl_8057F120 = .sdata2:0x8057F120; // type:object size:0x8 data:float +lbl_8057F120 = .sdata2:0x8057F120; // type:object size:0x4 data:float lbl_8057F128 = .sdata2:0x8057F128; // type:object size:0x4 data:float lbl_8057F12C = .sdata2:0x8057F12C; // type:object size:0x4 data:float lbl_8057F130 = .sdata2:0x8057F130; // type:object size:0x4 data:float @@ -47880,7 +47881,7 @@ lbl_8057F158 = .sdata2:0x8057F158; // type:object size:0x8 data:double lbl_8057F160 = .sdata2:0x8057F160; // type:object size:0x8 data:double lbl_8057F168 = .sdata2:0x8057F168; // type:object size:0x4 data:float lbl_8057F16C = .sdata2:0x8057F16C; // type:object size:0x4 data:float -lbl_8057F170 = .sdata2:0x8057F170; // type:object size:0x8 data:float +lbl_8057F170 = .sdata2:0x8057F170; // type:object size:0x4 data:float lbl_8057F178 = .sdata2:0x8057F178; // type:object size:0x4 data:float lbl_8057F17C = .sdata2:0x8057F17C; // type:object size:0x4 data:float lbl_8057F180 = .sdata2:0x8057F180; // type:object size:0x8 data:double @@ -47896,7 +47897,7 @@ lbl_8057F1A8 = .sdata2:0x8057F1A8; // type:object size:0x4 data:float lbl_8057F1AC = .sdata2:0x8057F1AC; // type:object size:0x4 data:float lbl_8057F1B0 = .sdata2:0x8057F1B0; // type:object size:0x4 data:float lbl_8057F1B4 = .sdata2:0x8057F1B4; // type:object size:0x4 data:float -lbl_8057F1B8 = .sdata2:0x8057F1B8; // type:object size:0x8 data:float +lbl_8057F1B8 = .sdata2:0x8057F1B8; // type:object size:0x4 data:float lbl_8057F1C0 = .sdata2:0x8057F1C0; // type:object size:0x4 data:float lbl_8057F1C4 = .sdata2:0x8057F1C4; // type:object size:0x4 data:float lbl_8057F1C8 = .sdata2:0x8057F1C8; // type:object size:0x4 data:float @@ -47909,7 +47910,7 @@ lbl_8057F1E0 = .sdata2:0x8057F1E0; // type:object size:0x4 data:float lbl_8057F1E4 = .sdata2:0x8057F1E4; // type:object size:0x4 data:float lbl_8057F1E8 = .sdata2:0x8057F1E8; // type:object size:0x4 data:float lbl_8057F1EC = .sdata2:0x8057F1EC; // type:object size:0x4 data:float -lbl_8057F1F0 = .sdata2:0x8057F1F0; // type:object size:0x8 data:float +lbl_8057F1F0 = .sdata2:0x8057F1F0; // type:object size:0x4 data:float lbl_8057F1F8 = .sdata2:0x8057F1F8; // type:object size:0x4 data:float lbl_8057F1FC = .sdata2:0x8057F1FC; // type:object size:0x4 data:float lbl_8057F200 = .sdata2:0x8057F200; // type:object size:0x4 data:float @@ -47976,12 +47977,12 @@ eggAllocatorFuncs = .sdata2:0x8057F2F0; // type:object size:0x8 scope:local @5759 = .sdata2:0x8057F354; // type:object size:0x4 scope:local data:float @5873 = .sdata2:0x8057F358; // type:object size:0x4 scope:local data:float @5874 = .sdata2:0x8057F35C; // type:object size:0x4 scope:local data:float -lbl_8057F360 = .sdata2:0x8057F360; // type:object size:0x8 data:float +lbl_8057F360 = .sdata2:0x8057F360; // type:object size:0x4 data:float lbl_8057F368 = .sdata2:0x8057F368; // type:object size:0x4 data:float lbl_8057F36C = .sdata2:0x8057F36C; // type:object size:0x4 data:float lbl_8057F370 = .sdata2:0x8057F370; // type:object size:0x4 data:float lbl_8057F374 = .sdata2:0x8057F374; // type:object size:0x4 data:float -lbl_8057F378 = .sdata2:0x8057F378; // type:object size:0x8 data:float +lbl_8057F378 = .sdata2:0x8057F378; // type:object size:0x4 data:float lbl_8057F380 = .sdata2:0x8057F380; // type:object size:0x4 data:float lbl_8057F384 = .sdata2:0x8057F384; // type:object size:0x4 data:float lbl_8057F388 = .sdata2:0x8057F388; // type:object size:0x4 data:float @@ -48053,7 +48054,7 @@ lbl_8057F560 = .sdata2:0x8057F560; // type:object size:0x4 data:float lbl_8057F564 = .sdata2:0x8057F564; // type:object size:0x4 data:float lbl_8057F568 = .sdata2:0x8057F568; // type:object size:0x4 data:float lbl_8057F570 = .sdata2:0x8057F570; // type:object size:0x8 data:double -lbl_8057F578 = .sdata2:0x8057F578; // type:object size:0x8 data:float +lbl_8057F578 = .sdata2:0x8057F578; // type:object size:0x4 data:float lbl_8057F580 = .sdata2:0x8057F580; // type:object size:0x4 lbl_8057F584 = .sdata2:0x8057F584; // type:object size:0x4 data:float lbl_8057F588 = .sdata2:0x8057F588; // type:object size:0x4 data:float @@ -48095,7 +48096,7 @@ lbl_8057F628 = .sdata2:0x8057F628; // type:object size:0x4 data:float lbl_8057F62C = .sdata2:0x8057F62C; // type:object size:0x4 data:float lbl_8057F630 = .sdata2:0x8057F630; // type:object size:0x4 data:float lbl_8057F634 = .sdata2:0x8057F634; // type:object size:0x4 data:float -lbl_8057F638 = .sdata2:0x8057F638; // type:object size:0x8 data:float +lbl_8057F638 = .sdata2:0x8057F638; // type:object size:0x4 data:float EGG__GXUtility__sTexMtxIDs = .sdata2:0x8057F640; // type:object size:0x8 lbl_8057F648 = .sdata2:0x8057F648; // type:object size:0x4 data:float lbl_8057F64C = .sdata2:0x8057F64C; // type:object size:0x4 data:float @@ -48105,7 +48106,7 @@ lbl_8057F660 = .sdata2:0x8057F660; // type:object size:0x4 data:float lbl_8057F664 = .sdata2:0x8057F664; // type:object size:0x4 data:float lbl_8057F668 = .sdata2:0x8057F668; // type:object size:0x4 data:float lbl_8057F66C = .sdata2:0x8057F66C; // type:object size:0x4 data:float -lbl_8057F670 = .sdata2:0x8057F670; // type:object size:0x8 data:float +lbl_8057F670 = .sdata2:0x8057F670; // type:object size:0x4 data:float lbl_8057F678 = .sdata2:0x8057F678; // type:object size:0x4 data:4byte lbl_8057F67C = .sdata2:0x8057F67C; // type:object size:0x4 data:float lbl_8057F680 = .sdata2:0x8057F680; // type:object size:0x4 data:float @@ -48142,7 +48143,7 @@ lbl_8057F734 = .sdata2:0x8057F734; // type:object size:0x4 data:float lbl_8057F738 = .sdata2:0x8057F738; // type:object size:0x8 data:double lbl_8057F740 = .sdata2:0x8057F740; // type:object size:0x4 data:float lbl_8057F744 = .sdata2:0x8057F744; // type:object size:0x4 data:float -lbl_8057F748 = .sdata2:0x8057F748; // type:object size:0x8 data:float +lbl_8057F748 = .sdata2:0x8057F748; // type:object size:0x4 data:float lbl_8057F750 = .sdata2:0x8057F750; // type:object size:0x4 data:4byte lbl_8057F754 = .sdata2:0x8057F754; // type:object size:0x4 data:float lbl_8057F758 = .sdata2:0x8057F758; // type:object size:0x4 data:float @@ -48155,7 +48156,7 @@ lbl_8057F778 = .sdata2:0x8057F778; // type:object size:0x4 data:float lbl_8057F780 = .sdata2:0x8057F780; // type:object size:0x8 data:double lbl_8057F788 = .sdata2:0x8057F788; // type:object size:0x4 data:float lbl_8057F78C = .sdata2:0x8057F78C; // type:object size:0x4 data:float -lbl_8057F790 = .sdata2:0x8057F790; // type:object size:0x8 data:float +lbl_8057F790 = .sdata2:0x8057F790; // type:object size:0x4 data:float lbl_8057F798 = .sdata2:0x8057F798; // type:object size:0x4 data:float lbl_8057F79C = .sdata2:0x8057F79C; // type:object size:0x4 data:float lbl_8057F7A0 = .sdata2:0x8057F7A0; // type:object size:0x4 data:float @@ -48163,7 +48164,7 @@ lbl_8057F7A8 = .sdata2:0x8057F7A8; // type:object size:0x8 data:double lbl_8057F7B0 = .sdata2:0x8057F7B0; // type:object size:0x8 data:double lbl_8057F7B8 = .sdata2:0x8057F7B8; // type:object size:0x4 data:float lbl_8057F7BC = .sdata2:0x8057F7BC; // type:object size:0x4 data:float -lbl_8057F7C0 = .sdata2:0x8057F7C0; // type:object size:0x8 data:float +lbl_8057F7C0 = .sdata2:0x8057F7C0; // type:object size:0x4 data:float lbl_8057F7C8 = .sdata2:0x8057F7C8; // type:object size:0x4 data:float lbl_8057F7CC = .sdata2:0x8057F7CC; // type:object size:0x4 data:float lbl_8057F7D0 = .sdata2:0x8057F7D0; // type:object size:0x4 @@ -48177,8 +48178,8 @@ lbl_8057F7F8 = .sdata2:0x8057F7F8; // type:object size:0x4 data:float lbl_8057F7FC = .sdata2:0x8057F7FC; // type:object size:0x4 data:float lbl_8057F800 = .sdata2:0x8057F800; // type:object size:0x4 data:float lbl_8057F804 = .sdata2:0x8057F804; // type:object size:0x4 data:float -lbl_8057F808 = .sdata2:0x8057F808; // type:object size:0x8 data:float -lbl_8057F810 = .sdata2:0x8057F810; // type:object size:0x8 data:float +lbl_8057F808 = .sdata2:0x8057F808; // type:object size:0x4 data:float +lbl_8057F810 = .sdata2:0x8057F810; // type:object size:0x4 data:float lbl_8057F818 = .sdata2:0x8057F818; // type:object size:0x4 data:float lbl_8057F81C = .sdata2:0x8057F81C; // type:object size:0x4 data:float lbl_8057F820 = .sdata2:0x8057F820; // type:object size:0x8 data:double @@ -48202,7 +48203,7 @@ lbl_8057F870 = .sdata2:0x8057F870; // type:object size:0x4 data:float lbl_8057F874 = .sdata2:0x8057F874; // type:object size:0x4 data:float lbl_8057F878 = .sdata2:0x8057F878; // type:object size:0x4 data:float lbl_8057F880 = .sdata2:0x8057F880; // type:object size:0x8 data:double -lbl_8057F888 = .sdata2:0x8057F888; // type:object size:0x8 data:float +lbl_8057F888 = .sdata2:0x8057F888; // type:object size:0x4 data:float lbl_8057F890 = .sdata2:0x8057F890; // type:object size:0x4 data:4byte lbl_8057F894 = .sdata2:0x8057F894; // type:object size:0x4 data:float lbl_8057F898 = .sdata2:0x8057F898; // type:object size:0x4 data:float @@ -48242,11 +48243,11 @@ lbl_8057F960 = .sdata2:0x8057F960; // type:object size:0x8 data:double lbl_8057F968 = .sdata2:0x8057F968; // type:object size:0x8 lbl_8057F970 = .sdata2:0x8057F970; // type:object size:0x8 lbl_8057F978 = .sdata2:0x8057F978; // type:object size:0x8 -lbl_8057F980 = .sdata2:0x8057F980; // type:object size:0x8 data:float +lbl_8057F980 = .sdata2:0x8057F980; // type:object size:0x4 data:float lbl_8057F988 = .sdata2:0x8057F988; // type:object size:0x8 -lbl_8057F990 = .sdata2:0x8057F990; // type:object size:0x8 data:float -lbl_8057F998 = .sdata2:0x8057F998; // type:object size:0x8 data:float -lbl_8057F9A0 = .sdata2:0x8057F9A0; // type:object size:0x8 data:float +lbl_8057F990 = .sdata2:0x8057F990; // type:object size:0x4 data:float +lbl_8057F998 = .sdata2:0x8057F998; // type:object size:0x4 data:float +lbl_8057F9A0 = .sdata2:0x8057F9A0; // type:object size:0x4 data:float lbl_8057F9A8 = .sdata2:0x8057F9A8; // type:object size:0x8 lbl_8057F9B0 = .sdata2:0x8057F9B0; // type:object size:0x4 data:float lbl_8057F9B8 = .sdata2:0x8057F9B8; // type:object size:0x8 data:double @@ -48256,7 +48257,7 @@ lbl_8057F9D0 = .sdata2:0x8057F9D0; // type:object size:0x8 data:double lbl_8057F9D8 = .sdata2:0x8057F9D8; // type:object size:0x8 data:double lbl_8057F9E0 = .sdata2:0x8057F9E0; // type:object size:0x4 data:float lbl_8057F9E4 = .sdata2:0x8057F9E4; // type:object size:0x4 data:float -lbl_8057F9E8 = .sdata2:0x8057F9E8; // type:object size:0x8 data:float +lbl_8057F9E8 = .sdata2:0x8057F9E8; // type:object size:0x4 data:float lbl_8057F9F0 = .sdata2:0x8057F9F0; // type:object size:0x8 lbl_8057F9F8 = .sdata2:0x8057F9F8; // type:object size:0x4 data:4byte lbl_8057F9FC = .sdata2:0x8057F9FC; // type:object size:0x4 data:float @@ -49740,22 +49741,22 @@ sException__Q24nw4r2db = .bss:0x80636FC0; // type:object size:0x360 scope:local sThreadBuffer__Q24nw4r2db = .bss:0x80637320; // type:object size:0x4000 scope:local sMapBuf__Q24nw4r2db = .bss:0x8063B320; // type:object size:0x200 scope:local sFileInfo__Q24nw4r2db = .bss:0x8063B520; // type:object size:0x3C scope:local -lbl_8063B560 = .bss:0x8063B560; // type:object size:0x300 -lbl_8063B860 = .bss:0x8063B860; // type:object size:0x140 -sGenMode2 = .bss:0x8063B9A0; // type:object size:0xC data:byte -sTexCoordScale = .bss:0x8063B9AC; // type:object size:0x74 data:4byte -sTexState = .bss:0x8063BA20; // type:object size:0x120 data:4byte -sTlut = .bss:0x8063BB40; // type:object size:0x70 -sPreTexMtxState = .bss:0x8063BBB0; // type:object size:0x20 data:4byte -sPosNrmArrayState = .bss:0x8063BBD0; // type:object size:0x10 data:4byte -sScnDependentTexMtxFuncTable = .bss:0x8063BBE0; // type:object size:0x800 data:4byte -sFogState = .bss:0x8063C3E0; // type:object size:0x608 data:4byte -sLightState = .bss:0x8063C9E8; // type:object size:0x2A2C -sCameraMtxState = .bss:0x8063F414; // type:object size:0x1A34 data:2byte -sRenderMode = .bss:0x80640E48; // type:object size:0x40 data:4byte -IndMtxOpDefault = .bss:0x80640E88; // type:object size:0x98 data:4byte -lbl_80640F20 = .bss:0x80640F20; // type:object size:0x60 -lbl_80640F80 = .bss:0x80640F80; // type:object size:0x18000 +saaTexRegion = .bss:0x8063B560; // type:object size:0x300 scope:local +saaTlutRegion = .bss:0x8063B860; // type:object size:0x140 scope:local +sGenMode2__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063B9A0; // type:object size:0xC scope:local data:byte +sTexCoordScale__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063B9AC; // type:object size:0x6C scope:local data:4byte +sTex__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063BA20; // type:object size:0x104 scope:local data:4byte +sTlut__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063BB40; // type:object size:0x64 scope:local +sPreTexMtxState__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063BBB0; // type:object size:0x20 scope:local data:4byte +sPosNrmArrayState__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063BBD0; // type:object size:0xC scope:local data:4byte +sScnDependentTexMtxFuncTable__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063BBE0; // type:object size:0x800 scope:local data:4byte +sFogState__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063C3E0; // type:object size:0x608 scope:local data:4byte +sLightState__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063C9E8; // type:object size:0x2A2C scope:local +sCameraMtxState__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x8063F414; // type:object size:0x1A34 scope:local data:2byte +sRenderMode__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x80640E48; // type:object size:0x3C scope:local data:4byte +IndMtxOpDefault__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x80640E88; // type:object size:0x98 scope:local data:4byte +@LOCAL@GetViewNrmMtxPtr__Q54nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@19PosNrmMtxArrayStateCFUl@m = .bss:0x80640F20; // type:object size:0x24 +sTemp__Q54nw4r3g3d6detail7workmem25@unnamed@g3d_workmem_cpp@ = .bss:0x80640F80; // type:object size:0x18000 scope:local lbl_80658F80 = .bss:0x80658F80; // type:object size:0x100 lbl_80659080 = .bss:0x80659080; // type:object size:0x200 lbl_80659280 = .bss:0x80659280; // type:object size:0xC diff --git a/configure.py b/configure.py index 8816101d..30da5166 100644 --- a/configure.py +++ b/configure.py @@ -645,68 +645,72 @@ config.libs = [ nw4rLib( "g3d", [ - Object(NonMatching, "nw4r/g3d/res/g3d_rescommon.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resdict.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resfile.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resmdl.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resshp.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_restev.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resmat.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resvtx.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_restex.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resnode.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanm.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmvis.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmclr.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmtexpat.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmtexsrt.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmchr.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_reslightset.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmamblight.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmlight.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmfog.cpp: .tex"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmcamera.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmscn.cpp"), - Object(NonMatching, "nw4r/g3d/res/g3d_resanmshp.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_transform.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_anmvis.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_anmclr.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_anmtexpat.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_anmtexsrt.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_anmchr.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_anmshp.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_anmscn.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_obj.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_anmobj.cpp"), - Object(NonMatching, "nw4r/g3d/platform/g3d_gpu.cpp"), - Object(NonMatching, "nw4r/g3d/platform/g3d_tmem.cpp"), - Object(NonMatching, "nw4r/g3d/platform/g3d_cpu.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_state.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_draw1mat1shp.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_calcview.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_dcc.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_workmem.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_calcworld.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_draw.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_camera.cpp"), - Object(NonMatching, "nw4r/g3d/dcc/g3d_basic.cpp"), - Object(NonMatching, "nw4r/g3d/dcc/g3d_maya.cpp"), - Object(NonMatching, "nw4r/g3d/dcc/g3d_xsi.cpp"), - Object(NonMatching, "nw4r/g3d/dcc/g3d_3dsmax.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_scnobj.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_scnroot.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_scnmdlsmpl.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_scnmdl.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_scnchoice.cpp: .tex"), - Object(NonMatching, "nw4r/g3d/g3d_scngroupex.cpp: .tex"), - Object(NonMatching, "nw4r/g3d/g3d_scnmdl1mat1shp.cpp: .tex"), - Object(NonMatching, "nw4r/g3d/g3d_scnmdlexpand.cpp: .tex"), - Object(NonMatching, "nw4r/g3d/g3d_calcmaterial.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_init.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_scnproc.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_fog.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_light.cpp"), - Object(NonMatching, "nw4r/g3d/g3d_calcvtx.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_rescommon.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resdict.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resfile.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resmdl.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resshp.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_restev.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resmat.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resvtx.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_restex.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resnode.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanm.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmvis.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmclr.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmtexpat.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmtexsrt.cpp"), + Object( + Matching, + "nw4r/g3d/res/g3d_resanmchr.cpp", + extra_cflags=["-opt level=3"], + ), + Object(Matching, "nw4r/g3d/res/g3d_reslightset.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmamblight.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmlight.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmfog.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmcamera.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmscn.cpp"), + Object(Matching, "nw4r/g3d/res/g3d_resanmshp.cpp"), + Object(Matching, "nw4r/g3d/g3d_transform.cpp"), + Object(Matching, "nw4r/g3d/g3d_anmvis.cpp"), + Object(Matching, "nw4r/g3d/g3d_anmclr.cpp"), + Object(Matching, "nw4r/g3d/g3d_anmtexpat.cpp"), + Object(Matching, "nw4r/g3d/g3d_anmtexsrt.cpp"), + Object(Matching, "nw4r/g3d/g3d_anmchr.cpp"), + Object(Matching, "nw4r/g3d/g3d_anmshp.cpp"), + Object(Matching, "nw4r/g3d/g3d_anmscn.cpp"), + Object(Matching, "nw4r/g3d/g3d_obj.cpp"), + Object(Matching, "nw4r/g3d/g3d_anmobj.cpp"), + Object(Matching, "nw4r/g3d/platform/g3d_gpu.cpp"), + Object(Matching, "nw4r/g3d/platform/g3d_tmem.cpp"), + Object(Matching, "nw4r/g3d/platform/g3d_cpu.cpp"), + Object(Matching, "nw4r/g3d/g3d_state.cpp"), + Object(Matching, "nw4r/g3d/g3d_draw1mat1shp.cpp"), + Object(Matching, "nw4r/g3d/g3d_calcview.cpp"), + Object(Matching, "nw4r/g3d/g3d_dcc.cpp"), + Object(Matching, "nw4r/g3d/g3d_workmem.cpp"), + Object(Matching, "nw4r/g3d/g3d_calcworld.cpp"), + Object(Matching, "nw4r/g3d/g3d_draw.cpp"), + Object(Matching, "nw4r/g3d/g3d_camera.cpp"), + Object(Matching, "nw4r/g3d/dcc/g3d_basic.cpp"), + Object(Matching, "nw4r/g3d/dcc/g3d_maya.cpp"), + Object(Matching, "nw4r/g3d/dcc/g3d_xsi.cpp"), + Object(Matching, "nw4r/g3d/dcc/g3d_3dsmax.cpp"), + Object(Matching, "nw4r/g3d/g3d_scnobj.cpp"), + Object(Matching, "nw4r/g3d/g3d_scnroot.cpp"), + Object(Matching, "nw4r/g3d/g3d_scnmdlsmpl.cpp"), + Object(Matching, "nw4r/g3d/g3d_scnmdl.cpp"), + # Object(NonMatching, "nw4r/g3d/g3d_scnchoice.cpp"), + # Object(NonMatching, "nw4r/g3d/g3d_scngroupex.cpp"), + # Object(NonMatching, "nw4r/g3d/g3d_scnmdl1mat1shp.cpp"), + # Object(NonMatching, "nw4r/g3d/g3d_scnmdlexpand.cpp"), + Object(Matching, "nw4r/g3d/g3d_calcmaterial.cpp"), + Object(Matching, "nw4r/g3d/g3d_init.cpp"), + Object(Matching, "nw4r/g3d/g3d_scnproc.cpp"), + Object(Matching, "nw4r/g3d/g3d_fog.cpp"), + Object(Matching, "nw4r/g3d/g3d_light.cpp"), + Object(Matching, "nw4r/g3d/g3d_calcvtx.cpp"), ], ), nw4rLib( diff --git a/include/common.h b/include/common.h index 85144d82..1dd07be5 100644 --- a/include/common.h +++ b/include/common.h @@ -6,11 +6,11 @@ #define CLAMP(low, high, x) ((x) > (high) ? (high) : ((x) < (low) ? (low) : (x))) -#define ROUND_UP(x, align) (((x) + (align)-1) & (-(align))) -#define ROUND_UP_PTR(x, align) ((void *)((((u32)(x)) + (align)-1) & (~((align)-1)))) +#define ROUND_UP(x, align) (((x) + (align) - 1) & (-(align))) +#define ROUND_UP_PTR(x, align) ((void *)((((u32)(x)) + (align) - 1) & (~((align) - 1)))) #define ROUND_DOWN(x, align) ((x) & (-(align))) -#define ROUND_DOWN_PTR(x, align) ((void *)(((u32)(x)) & (~((align)-1)))) +#define ROUND_DOWN_PTR(x, align) ((void *)(((u32)(x)) & (~((align) - 1)))) #define ARRAY_LENGTH(x) (sizeof((x)) / sizeof((x)[0])) @@ -44,6 +44,8 @@ #define DECOMP_FORCEACTIVE(module, ...) #define DECOMP_FORCELITERAL(module, x) #define DECOMP_FORCEDTOR(module, cls) +#define DECOMP_INLINE +#define DECOMP_DONT_INLINE #else // Force reference specific data #define __CONCAT(x, y) x##y @@ -69,6 +71,8 @@ cls dummy; \ dummy.~cls(); \ } +#define DECOMP_INLINE inline +#define DECOMP_DONT_INLINE __attribute__((never_inline)) #endif #include "stddef.h" diff --git a/include/nw4r/g3d.h b/include/nw4r/g3d.h index 16df4b85..84eff487 100644 --- a/include/nw4r/g3d.h +++ b/include/nw4r/g3d.h @@ -1,40 +1,42 @@ #ifndef NW4R_PUBLIC_G3D_H #define NW4R_PUBLIC_G3D_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// IWYU pragma: begin_keep +#include "nw4r/g3d/g3d_3dsmax.h" +#include "nw4r/g3d/g3d_anmchr.h" +#include "nw4r/g3d/g3d_anmclr.h" +#include "nw4r/g3d/g3d_anmobj.h" +#include "nw4r/g3d/g3d_anmscn.h" +#include "nw4r/g3d/g3d_anmshp.h" +#include "nw4r/g3d/g3d_anmtexpat.h" +#include "nw4r/g3d/g3d_anmtexsrt.h" +#include "nw4r/g3d/g3d_anmvis.h" +#include "nw4r/g3d/g3d_basic.h" +#include "nw4r/g3d/g3d_calcmaterial.h" +#include "nw4r/g3d/g3d_calcview.h" +#include "nw4r/g3d/g3d_calcvtx.h" +#include "nw4r/g3d/g3d_calcworld.h" +#include "nw4r/g3d/g3d_camera.h" +#include "nw4r/g3d/g3d_dcc.h" +#include "nw4r/g3d/g3d_draw.h" +#include "nw4r/g3d/g3d_draw1mat1shp.h" +#include "nw4r/g3d/g3d_fog.h" +#include "nw4r/g3d/g3d_init.h" +#include "nw4r/g3d/g3d_light.h" +#include "nw4r/g3d/g3d_maya.h" +#include "nw4r/g3d/g3d_obj.h" +#include "nw4r/g3d/g3d_rtti.h" +#include "nw4r/g3d/g3d_scnmdl.h" +#include "nw4r/g3d/g3d_scnmdl1mat1shp.h" +#include "nw4r/g3d/g3d_scnmdlsmpl.h" +#include "nw4r/g3d/g3d_scnobj.h" +#include "nw4r/g3d/g3d_scnproc.h" +#include "nw4r/g3d/g3d_scnrfl.h" +#include "nw4r/g3d/g3d_scnroot.h" +#include "nw4r/g3d/g3d_state.h" +#include "nw4r/g3d/g3d_transform.h" +#include "nw4r/g3d/g3d_workmem.h" +#include "nw4r/g3d/g3d_xsi.h" /****************************************************************************** * @@ -42,30 +44,31 @@ * ******************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_resanmamblight.h" +#include "nw4r/g3d/res/g3d_resanmcamera.h" +#include "nw4r/g3d/res/g3d_resanmchr.h" +#include "nw4r/g3d/res/g3d_resanmclr.h" +#include "nw4r/g3d/res/g3d_resanmfog.h" +#include "nw4r/g3d/res/g3d_resanmlight.h" +#include "nw4r/g3d/res/g3d_resanmscn.h" +#include "nw4r/g3d/res/g3d_resanmshp.h" +#include "nw4r/g3d/res/g3d_resanmtexpat.h" +#include "nw4r/g3d/res/g3d_resanmtexsrt.h" +#include "nw4r/g3d/res/g3d_resanmvis.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_resdict.h" +#include "nw4r/g3d/res/g3d_resfile.h" +#include "nw4r/g3d/res/g3d_reslightset.h" +#include "nw4r/g3d/res/g3d_resmat.h" +#include "nw4r/g3d/res/g3d_resmdl.h" +#include "nw4r/g3d/res/g3d_resnode.h" +#include "nw4r/g3d/res/g3d_respltt.h" +#include "nw4r/g3d/res/g3d_resshp.h" +#include "nw4r/g3d/res/g3d_restev.h" +#include "nw4r/g3d/res/g3d_restex.h" +#include "nw4r/g3d/res/g3d_resuser.h" +#include "nw4r/g3d/res/g3d_resvtx.h" /****************************************************************************** * @@ -73,9 +76,10 @@ * ******************************************************************************/ -#include -#include -#include -#include +#include "nw4r/g3d/platform/g3d_allocator.h" +#include "nw4r/g3d/platform/g3d_cpu.h" +#include "nw4r/g3d/platform/g3d_gpu.h" +#include "nw4r/g3d/platform/g3d_tmem.h" +// IWYU pragma: end_keep #endif diff --git a/include/nw4r/g3d/g3d_3dsmax.h b/include/nw4r/g3d/g3d_3dsmax.h index 2affb665..a8fabfda 100644 --- a/include/nw4r/g3d/g3d_3dsmax.h +++ b/include/nw4r/g3d/g3d_3dsmax.h @@ -2,7 +2,7 @@ #define NW4R_G3D_3DSMAX_H #include -#include +#include "nw4r/g3d/res/g3d_resanmtexsrt.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_anmcamera.h b/include/nw4r/g3d/g3d_anmcamera.h index cca7bd9b..fa751030 100644 --- a/include/nw4r/g3d/g3d_anmcamera.h +++ b/include/nw4r/g3d/g3d_anmcamera.h @@ -2,8 +2,8 @@ #define NW4R_G3D_ANMCAMERA_H #include "common.h" -#include "rvl/GX.h" // IWYU pragma: export +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_anmchr.h b/include/nw4r/g3d/g3d_anmchr.h index c322f8be..41284081 100644 --- a/include/nw4r/g3d/g3d_anmchr.h +++ b/include/nw4r/g3d/g3d_anmchr.h @@ -2,8 +2,8 @@ #define NW4R_G3D_ANM_CHR_H #include -#include -#include +#include "nw4r/g3d/g3d_anmobj.h" +#include "nw4r/g3d/res/g3d_resanmchr.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_anmclr.h b/include/nw4r/g3d/g3d_anmclr.h index b1fc9a6d..9e9f3368 100644 --- a/include/nw4r/g3d/g3d_anmclr.h +++ b/include/nw4r/g3d/g3d_anmclr.h @@ -2,9 +2,9 @@ #define NW4R_G3D_ANM_CLR_H #include -#include -#include -#include +#include "nw4r/g3d/g3d_anmobj.h" +#include "nw4r/g3d/res/g3d_resanmclr.h" +#include "nw4r/g3d/res/g3d_resmat.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_anmfog.h b/include/nw4r/g3d/g3d_anmfog.h index 3ba289f8..271cb873 100644 --- a/include/nw4r/g3d/g3d_anmfog.h +++ b/include/nw4r/g3d/g3d_anmfog.h @@ -2,6 +2,7 @@ #define NW4R_G3D_ANMFOG_H #include "common.h" #include "nw4r/ut/ut_Color.h" + #include "rvl/GX.h" // IWYU pragma: export namespace nw4r { diff --git a/include/nw4r/g3d/g3d_anmobj.h b/include/nw4r/g3d/g3d_anmobj.h index 9020c6c4..43144ebf 100644 --- a/include/nw4r/g3d/g3d_anmobj.h +++ b/include/nw4r/g3d/g3d_anmobj.h @@ -2,8 +2,8 @@ #define NW4R_G3D_ANM_OBJ_H #include -#include -#include +#include "nw4r/g3d/g3d_obj.h" +#include "nw4r/g3d/res/g3d_resanm.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_anmscn.h b/include/nw4r/g3d/g3d_anmscn.h index afe445a3..41c98062 100644 --- a/include/nw4r/g3d/g3d_anmscn.h +++ b/include/nw4r/g3d/g3d_anmscn.h @@ -2,11 +2,11 @@ #define NW4R_G3D_ANM_SCN_H #include -#include -#include -#include -#include -#include +#include "nw4r/g3d/g3d_anmobj.h" +#include "nw4r/g3d/g3d_camera.h" +#include "nw4r/g3d/g3d_fog.h" +#include "nw4r/g3d/g3d_light.h" +#include "nw4r/g3d/g3d_obj.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_anmshp.h b/include/nw4r/g3d/g3d_anmshp.h index 95355f24..deaab879 100644 --- a/include/nw4r/g3d/g3d_anmshp.h +++ b/include/nw4r/g3d/g3d_anmshp.h @@ -2,8 +2,8 @@ #define NW4R_G3D_ANM_SHP_H #include -#include -#include +#include "nw4r/g3d/g3d_anmobj.h" +#include "nw4r/g3d/res/g3d_resanmshp.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_anmtexpat.h b/include/nw4r/g3d/g3d_anmtexpat.h index be0de680..8da20293 100644 --- a/include/nw4r/g3d/g3d_anmtexpat.h +++ b/include/nw4r/g3d/g3d_anmtexpat.h @@ -2,8 +2,8 @@ #define NW4R_G3D_ANM_TEX_PAT_H #include -#include -#include +#include "nw4r/g3d/g3d_anmobj.h" +#include "nw4r/g3d/res/g3d_resanmtexpat.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_anmtexsrt.h b/include/nw4r/g3d/g3d_anmtexsrt.h index e2f60b20..85aa7076 100644 --- a/include/nw4r/g3d/g3d_anmtexsrt.h +++ b/include/nw4r/g3d/g3d_anmtexsrt.h @@ -2,15 +2,15 @@ #define NW4R_G3D_ANM_TEX_SRT_H #include -#include -#include -#include +#include "nw4r/g3d/g3d_anmobj.h" +#include "nw4r/g3d/res/g3d_resanmtexsrt.h" +#include "nw4r/g3d/res/g3d_resmat.h" namespace nw4r { namespace g3d { -void ApplyTexSrtAnmResult(ResTexSrt srt, const TexSrtAnmResult *pResult); void ApplyTexSrtAnmResult(ResTexSrt srt, ResMatIndMtxAndScale ind, const TexSrtAnmResult *pResult); +void ApplyTexSrtAnmResult(ResTexSrt srt, const TexSrtAnmResult *pResult) DECOMP_DONT_INLINE; /****************************************************************************** * diff --git a/include/nw4r/g3d/g3d_anmvis.h b/include/nw4r/g3d/g3d_anmvis.h index ae756d9a..edf9b959 100644 --- a/include/nw4r/g3d/g3d_anmvis.h +++ b/include/nw4r/g3d/g3d_anmvis.h @@ -2,8 +2,8 @@ #define NW4R_G3D_ANM_VIS_H #include -#include -#include +#include "nw4r/g3d/g3d_anmobj.h" +#include "nw4r/g3d/res/g3d_resanmvis.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_basic.h b/include/nw4r/g3d/g3d_basic.h index 0762296a..4587fbce 100644 --- a/include/nw4r/g3d/g3d_basic.h +++ b/include/nw4r/g3d/g3d_basic.h @@ -2,7 +2,9 @@ #define NW4R_G3D_BASIC_H #include -#include +#include "nw4r/g3d/res/g3d_resanmtexsrt.h" + +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -13,6 +15,8 @@ struct ChrAnmResult; namespace detail { namespace dcc { +bool CalcTexMtx_Basic(math::MTX34 *pMtx, bool set, const TexSrt &rSrt, TexSrt::Flag flag); + u32 CalcWorldMtx_Basic( math::MTX34 *pW, math::VEC3 *pS, const math::MTX34 *pW1, const math::VEC3 *pS1, u32 attr, const ChrAnmResult *pResult diff --git a/include/nw4r/g3d/g3d_calcmaterial.h b/include/nw4r/g3d/g3d_calcmaterial.h index 18776f3a..94376565 100644 --- a/include/nw4r/g3d/g3d_calcmaterial.h +++ b/include/nw4r/g3d/g3d_calcmaterial.h @@ -2,7 +2,7 @@ #define NW4R_G3D_CALC_MATERIAL_H #include -#include +#include "nw4r/g3d/res/g3d_resmdl.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_calcview.h b/include/nw4r/g3d/g3d_calcview.h index 4a623c10..daafd276 100644 --- a/include/nw4r/g3d/g3d_calcview.h +++ b/include/nw4r/g3d/g3d_calcview.h @@ -2,7 +2,7 @@ #define NW4R_G3D_CALC_VIEW_H #include -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_calcvtx.h b/include/nw4r/g3d/g3d_calcvtx.h index 63aaaac8..d142f7e6 100644 --- a/include/nw4r/g3d/g3d_calcvtx.h +++ b/include/nw4r/g3d/g3d_calcvtx.h @@ -2,7 +2,7 @@ #define NW4R_G3D_CALC_VTX_H #include -#include +#include "nw4r/g3d/res/g3d_resmdl.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_calcworld.h b/include/nw4r/g3d/g3d_calcworld.h index d50605ac..989886eb 100644 --- a/include/nw4r/g3d/g3d_calcworld.h +++ b/include/nw4r/g3d/g3d_calcworld.h @@ -2,10 +2,10 @@ #define NW4R_G3D_CALC_WORLD_H #include -#include -#include +#include "nw4r/g3d/g3d_scnobj.h" +#include "nw4r/g3d/res/g3d_resmdl.h" -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -40,7 +40,7 @@ void CalcSkinning(math::MTX34 *pModelMtxArray, u32 *pModelMtxAttribArray, const ******************************************************************************/ class ICalcWorldCallback { public: - virtual ~ICalcWorldCallback(){}; // at 0x8 + virtual ~ICalcWorldCallback() {}; // at 0x8 virtual void ExecCallbackA(ChrAnmResult *pResult, ResMdl mdl, FuncObjCalcWorld *pFuncObj) = 0; // at 0xC @@ -61,7 +61,7 @@ class WorldMtxManip { public: WorldMtxManip(math::MTX34 *pM, math::VEC3 *pS, u32 *pWMAttr) : mpM(pM), mpS(pS), mpWMAttr(pWMAttr) {} - void SetScale(f32, f32, f32); + void SetScale(f32 x, f32 y, f32 z); void GetMtx(nw4r::math::MTX34 *out) { if (out != nullptr) { PSMTXCopy(*mpM, *out); diff --git a/include/nw4r/g3d/g3d_camera.h b/include/nw4r/g3d/g3d_camera.h index b9cd2a17..bd46486f 100644 --- a/include/nw4r/g3d/g3d_camera.h +++ b/include/nw4r/g3d/g3d_camera.h @@ -2,11 +2,11 @@ #define NW4R_G3D_CAMERA_H #include -#include +#include "nw4r/g3d/res/g3d_rescommon.h" -#include +#include "nw4r/math.h" // IWYU pragma: export -#include +#include "rvl/MTX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -89,6 +89,7 @@ public: void SetPerspective(f32 fovy, f32 aspect, f32 near, f32 far); void SetOrtho(f32 top, f32 bottom, f32 left, f32 right, f32 near, f32 far); void SetProjectionMtxDirectly(const math::MTX44 *pMtx); + void SetTexMtxParam(f32 lightScaleS, f32 lightScaleT, f32 lightTransS, f32 lightTransT); void SetScissor(u32 x, u32 y, u32 width, u32 height); void SetScissorBoxOffset(s32 ox, s32 oy); @@ -97,6 +98,8 @@ public: void SetViewportZRange(f32 near, f32 far); void GetViewport(f32 *pX, f32 *pY, f32 *pWidth, f32 *pHeight, f32 *pNear, f32 *pFar) const; + void Project(math::VEC3 *pSrcPos, const math::VEC3 &worldPos) const; + void GetCameraMtx(math::MTX34 *pMtx) const; void GetProjectionMtx(math::MTX44 *pMtx) const; void GetProjectionTexMtx(math::MTX34 *pMtx) const; diff --git a/include/nw4r/g3d/g3d_dcc.h b/include/nw4r/g3d/g3d_dcc.h index 5a728b3a..8fd5d91d 100644 --- a/include/nw4r/g3d/g3d_dcc.h +++ b/include/nw4r/g3d/g3d_dcc.h @@ -2,13 +2,14 @@ #define NW4R_G3D_DCC_H #include -#include -#include +#include "nw4r/g3d/res/g3d_resanmtexsrt.h" +#include "nw4r/g3d/res/g3d_resnode.h" namespace nw4r { namespace g3d { -void CalcTexMtx(math::MTX34 *pMtx, bool set, const TexSrt &rSrt, TexSrt::Flag flag, TexSrtTypedef::TexMatrixMode mode); +void CalcTexMtx(math::MTX34 *pMtx, bool set, const TexSrt &rSrt, TexSrt::Flag flag); +void CalcTexMtx(math::MTX34 *pMtx, bool set, const TexSrt &rSrt, TexSrt::Flag flag, TexSrt::TexMatrixMode mode); namespace detail { diff --git a/include/nw4r/g3d/g3d_draw.h b/include/nw4r/g3d/g3d_draw.h index c571e477..e34206b1 100644 --- a/include/nw4r/g3d/g3d_draw.h +++ b/include/nw4r/g3d/g3d_draw.h @@ -2,12 +2,12 @@ #define NW4R_G3D_DRAW_H #include -#include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resmat.h" +#include "nw4r/g3d/res/g3d_resmdl.h" +#include "nw4r/g3d/res/g3d_resnode.h" +#include "nw4r/g3d/res/g3d_resshp.h" -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -24,21 +24,22 @@ G3DState::IndMtxOp *GetIndMtxOp(ResMat mat, ResNode node, ResShp shp); } // namespace detail struct DrawResMdlReplacement { - u8 *visArray; // at 0x0 - ResTexObjData *texObjDataArray; // at 0x4 - ResTlutObjData *tlutObjDataArray; // at 0x8 - ResTexSrtData *texSrtDataArray; // at 0xC - ResChanData *chanDataArray; // at 0x10 - ResGenModeData *genModeDataArray; // at 0x14 - ResMatMiscData *matMiscDataArray; // at 0x18 - ResPixDL *pixDLArray; // at 0x1C - ResTevColorDL *tevColorDLArray; // at 0x20 - ResIndMtxAndScaleDL *indMtxAndScaleDLArray; // at 0x24 - ResTexCoordGenDL *texCoordGenDLArray; // at 0x28 - ResTevData *tevDataArray; // at 0x2C - ResVtxPosData **vtxPosTable; // at 0x30 - ResVtxNrmData **vtxNrmTable; // at 0x34 - ResVtxClrData **vtxClrTable; // at 0x38 + u32 flag; // at 0x0 + u8 *visArray; // at 0x4 + ResTexObjData *texObjDataArray; // at 0x8 + ResTlutObjData *tlutObjDataArray; // at 0xC + ResTexSrtData *texSrtDataArray; // at 0x10 + ResChanData *chanDataArray; // at 0x14 + ResGenModeData *genModeDataArray; // at 0x18 + ResMatMiscData *matMiscDataArray; // at 0x1C + ResPixDL *pixDLArray; // at 0x20 + ResTevColorDL *tevColorDLArray; // at 0x24 + ResIndMtxAndScaleDL *indMtxAndScaleDLArray; // at 0x28 + ResTexCoordGenDL *texCoordGenDLArray; // at 0x2C + ResTevData *tevDataArray; // at 0x30 + ResVtxPosData **vtxPosTable; // at 0x34 + ResVtxNrmData **vtxNrmTable; // at 0x38 + ResVtxClrData **vtxClrTable; // at 0x3C }; void DrawResMdlDirectly( diff --git a/include/nw4r/g3d/g3d_draw1mat1shp.h b/include/nw4r/g3d/g3d_draw1mat1shp.h index 956222bb..3dbd5bdd 100644 --- a/include/nw4r/g3d/g3d_draw1mat1shp.h +++ b/include/nw4r/g3d/g3d_draw1mat1shp.h @@ -2,10 +2,10 @@ #define NW4R_G3D_DRAW_1MAT_1SHP_H #include -#include -#include +#include "nw4r/g3d/res/g3d_resmat.h" +#include "nw4r/g3d/res/g3d_resshp.h" -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -20,6 +20,7 @@ enum Draw1Mat1ShpCtrl { DRAW1MAT1SHP_CTRL_NOSWAPSHP = (1 << 1), DRAW1MAT1SHP_CTRL_CULL_FRONT = (1 << 2), DRAW1MAT1SHP_CTRL_FORCE_LIGHTOFF = (1 << 3), + DRAW1MAT1SHP_CTRL_IGNORE_MAT = (1 << 4), }; struct Draw1Mat1ShpSwap { diff --git a/include/nw4r/g3d/g3d_fog.h b/include/nw4r/g3d/g3d_fog.h index 03e41cf6..417198d3 100644 --- a/include/nw4r/g3d/g3d_fog.h +++ b/include/nw4r/g3d/g3d_fog.h @@ -2,12 +2,12 @@ #define NW4R_G3D_FOG_H #include -#include +#include "nw4r/g3d/res/g3d_rescommon.h" -#include -#include +#include "nw4r/math.h" // IWYU pragma: export +#include "nw4r/ut.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_init.h b/include/nw4r/g3d/g3d_init.h index 6cf6ed9e..d0b8a408 100644 --- a/include/nw4r/g3d/g3d_init.h +++ b/include/nw4r/g3d/g3d_init.h @@ -2,7 +2,7 @@ #define NW4R_G3D_INIT_H #include -#include +#include "rvl/OS.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_light.h b/include/nw4r/g3d/g3d_light.h index 8fe540d3..2cd6291e 100644 --- a/include/nw4r/g3d/g3d_light.h +++ b/include/nw4r/g3d/g3d_light.h @@ -2,10 +2,10 @@ #define NW4R_G3D_LIGHT_H #include -#include -#include +#include "nw4r/g3d/g3d_state.h" +#include "nw4r/g3d/res/g3d_rescommon.h" -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_maya.h b/include/nw4r/g3d/g3d_maya.h index f890eda6..d8b36f26 100644 --- a/include/nw4r/g3d/g3d_maya.h +++ b/include/nw4r/g3d/g3d_maya.h @@ -2,7 +2,7 @@ #define NW4R_G3D_MAYA_H #include -#include +#include "nw4r/g3d/res/g3d_resanmtexsrt.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_obj.h b/include/nw4r/g3d/g3d_obj.h index 5991c458..07b7ebcf 100644 --- a/include/nw4r/g3d/g3d_obj.h +++ b/include/nw4r/g3d/g3d_obj.h @@ -2,8 +2,8 @@ #define NW4R_G3D_OBJ_H #include -#include -#include +#include "nw4r/g3d/g3d_rtti.h" +#include "nw4r/g3d/platform/g3d_allocator.h" namespace nw4r { namespace g3d { @@ -114,7 +114,7 @@ public: } void Destroy(); - void DetachFromParent(); + G3dObj *DetachFromParent(); static void *Alloc(MEMAllocator *pAllocator, u32 size) { return detail::AllocFromAllocator(pAllocator, size); diff --git a/include/nw4r/g3d/g3d_scnmdl.h b/include/nw4r/g3d/g3d_scnmdl.h index e7d7e586..8aa4cc22 100644 --- a/include/nw4r/g3d/g3d_scnmdl.h +++ b/include/nw4r/g3d/g3d_scnmdl.h @@ -3,9 +3,9 @@ #include -#include -#include -#include +#include "nw4r/g3d/g3d_draw.h" +#include "nw4r/g3d/g3d_scnmdlsmpl.h" +#include "nw4r/g3d/res/g3d_resmat.h" namespace nw4r { namespace g3d { @@ -23,11 +23,14 @@ public: ResTexSrt GetResTexSrt(bool markDirty); ResMatChan GetResMatChan(bool markDirty); ResGenMode GetResGenMode(bool markDirty); + ResMatMisc GetResMatMisc(bool markDirty); ResMatPix GetResMatPix(bool markDirty); ResMatTevColor GetResMatTevColor(bool markDirty); ResTev GetResTev(bool markDirty); + ResTexObj GetResTexObjEx(); ResTexSrt GetResTexSrtEx(); + ResMatChan GetResMatChanEx(); private: ScnMdl *mpScnMdl; // at 0x0 @@ -59,6 +62,41 @@ public: u8 *mpVis; // at 0x8 }; + class CopiedVtxAccess { + public: + ResVtxPos GetResVtxPos(u32 id); + ResVtxNrm GetResVtxNrm(u32 id); + ResVtxClr GetResVtxClr(u32 id); + + ResVtxPos GetResVtxPosEx(u32 id); + ResVtxNrm GetResVtxNrmEx(u32 id); + ResVtxClr GetResVtxClrEx(u32 id); + + // Needed an Inline + ResVtxPos GetPos(u32 id) { + if (mpScnMdl != NULL) { + if (id < mpScnMdl->GetResMdl().GetResVtxPosNumEntries()) { + return ResVtxPos(mpScnMdl->mReplacement.vtxPosTable[id]); + } + } + return ResVtxPos(NULL); + } + + // Needed an Inline + ResVtxNrm GetNrm(u32 id) { + if (mpScnMdl != NULL) { + if (id < mpScnMdl->GetResMdl().GetResVtxNrmNumEntries()) { + return ResVtxNrm(mpScnMdl->mReplacement.vtxNrmTable[id]); + } + } + return ResVtxNrm(NULL); + } + + private: + // Idk + ScnMdl *mpScnMdl; // at 0x0 + }; + #define OPT(KEY, VALUE) OPTION_##KEY = (0x30000 | (VALUE)) enum ScnMdlOption { OPT(NONE, 0), @@ -72,7 +110,7 @@ public: ScnMdl( MEMAllocator *pAllocator, ResMdl mdl, math::MTX34 *pWorldMtxArray, u32 *pWorldMtxAttribArray, math::MTX34 *pViewPosMtxArray, math::MTX33 *pViewNrmMtxArray, math::MTX34 *pViewTexMtxArray, int numView, - int numViewMtx, DrawResMdlReplacement *pReplacement, u32 *pMatBufferDirtyFlag + int numViewMtx, DrawResMdlReplacement *pReplacement, u32 *pMatBufferDirtyFlag, u32 replacementFlag ); virtual void G3dProc(u32 task, u32 param, void *pInfo); // at 0xC @@ -128,6 +166,8 @@ private: BUFOPTION_VTXPOS = (1 << 12), BUFOPTION_VTXNRM = (1 << 13), BUFOPTION_VTXCLR = (1 << 14), + + BUFOPTION_0x1000000 = (1 << 24), }; private: @@ -153,6 +193,7 @@ private: u32 mFlagVisBuffer; // at 0x13C u32 *mpMatBufferDirtyFlag; // at 0x140 DrawResMdlReplacement mReplacement; // at 0x144 + u32 mReplacementFlag; // at 0x184 NW4R_G3D_RTTI_DECL_DERIVED(ScnMdl, ScnMdlSimple); }; diff --git a/include/nw4r/g3d/g3d_scnmdl1mat1shp.h b/include/nw4r/g3d/g3d_scnmdl1mat1shp.h index 1131c1bb..0acbc9de 100644 --- a/include/nw4r/g3d/g3d_scnmdl1mat1shp.h +++ b/include/nw4r/g3d/g3d_scnmdl1mat1shp.h @@ -2,9 +2,9 @@ #define NW4R_G3D_SCN_MDL_1MAT_1SHP_H #include -#include -#include -#include +#include "nw4r/g3d/g3d_scnobj.h" +#include "nw4r/g3d/res/g3d_resmat.h" +#include "nw4r/g3d/res/g3d_resshp.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_scnmdlsmpl.h b/include/nw4r/g3d/g3d_scnmdlsmpl.h index c41c9bcb..7e250c00 100644 --- a/include/nw4r/g3d/g3d_scnmdlsmpl.h +++ b/include/nw4r/g3d/g3d_scnmdlsmpl.h @@ -2,11 +2,11 @@ #define NW4R_G3D_SCN_MDL_SMPL_H #include -#include -#include -#include +#include "nw4r/g3d/g3d_calcview.h" +#include "nw4r/g3d/g3d_scnobj.h" +#include "nw4r/g3d/res/g3d_resmdl.h" -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_scnobj.h b/include/nw4r/g3d/g3d_scnobj.h index 84bb0c54..24724f6f 100644 --- a/include/nw4r/g3d/g3d_scnobj.h +++ b/include/nw4r/g3d/g3d_scnobj.h @@ -2,9 +2,9 @@ #define NW4R_G3D_SCN_OBJ_H #include -#include +#include "nw4r/g3d/g3d_obj.h" -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -109,6 +109,7 @@ public: void CalcViewMtx(const math::MTX34 *pCamera); bool SetMtx(ScnObjMtxType type, const math::MTX34 *pMtx); + bool SetMtx(ScnObjMtxType type, const math::MTX34 &rMtx); bool GetMtx(ScnObjMtxType type, math::MTX34 *pMtx) const; const math::MTX34 *GetMtxPtr(ScnObjMtxType type) const { return &mMtxArray[type]; @@ -125,6 +126,7 @@ public: } void EnableScnObjCallbackTiming(Timing timing); + void DisableScnObjCallbackTiming(Timing timing); void EnableScnObjCallbackExecOp(ExecOp op); bool SetBoundingVolume(ScnObjBoundingVolumeType type, const math::AABB *pAABB); @@ -175,7 +177,7 @@ protected: } bool IsG3dProcDisabled(u32 task) const { - if (task < __G3DPROC_OPTIONAL_END && ((1 << task - 1) & mScnObjFlags)) { + if (task < __G3DPROC_OPTIONAL_END && ((1 << (task - 1)) & mScnObjFlags)) { return true; } @@ -225,6 +227,11 @@ public: CULLINGSTATUS_NOTEST }; + enum CheckStatus { + CHECKSTATUS_GATHER_SCNOBJ, + CHECKSTATUS_IGNORE_SCNOBJ + }; + public: virtual ~IScnObjGather() {} // at 0x8 diff --git a/include/nw4r/g3d/g3d_scnproc.h b/include/nw4r/g3d/g3d_scnproc.h index 66df4a83..09e7896b 100644 --- a/include/nw4r/g3d/g3d_scnproc.h +++ b/include/nw4r/g3d/g3d_scnproc.h @@ -2,7 +2,7 @@ #define NW4R_G3D_SCN_PROC_H #include -#include +#include "nw4r/g3d/g3d_scnobj.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_scnroot.h b/include/nw4r/g3d/g3d_scnroot.h index 600ca308..2e7d72fd 100644 --- a/include/nw4r/g3d/g3d_scnroot.h +++ b/include/nw4r/g3d/g3d_scnroot.h @@ -2,11 +2,11 @@ #define NW4R_G3D_SCN_ROOT_H #include -#include -#include -#include -#include -#include +#include "nw4r/g3d/g3d_camera.h" +#include "nw4r/g3d/g3d_fog.h" +#include "nw4r/g3d/g3d_light.h" +#include "nw4r/g3d/g3d_scnobj.h" +#include "nw4r/g3d/g3d_state.h" namespace nw4r { namespace g3d { @@ -122,6 +122,8 @@ public: virtual void DrawOpa(ResMdlDrawMode *pForceMode); // at 0x20 virtual void DrawXlu(ResMdlDrawMode *pForceMode); // at 0x24 + virtual CheckStatus CheckScnObj(ScnObj *); // at 0x28 + protected: ScnObj **mpArrayOpa; // at 0x4 ScnObj **mpArrayXlu; // at 0x8 diff --git a/include/nw4r/g3d/g3d_state.h b/include/nw4r/g3d/g3d_state.h index aa696a22..845b280c 100644 --- a/include/nw4r/g3d/g3d_state.h +++ b/include/nw4r/g3d/g3d_state.h @@ -2,13 +2,13 @@ #define NW4R_G3D_STATE_H #include -#include -#include -#include +#include "nw4r/g3d/g3d_camera.h" +#include "nw4r/g3d/g3d_fog.h" +#include "nw4r/g3d/res/g3d_resmat.h" -#include +#include "nw4r/math.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_transform.h b/include/nw4r/g3d/g3d_transform.h new file mode 100644 index 00000000..8812a8f2 --- /dev/null +++ b/include/nw4r/g3d/g3d_transform.h @@ -0,0 +1,18 @@ +#ifndef NW4R_G3D_TRANSFORM_H +#define NW4R_G3D_TRANSFORM_H + +#include "nw4r/math.h" // IWYU pragma: export + +namespace nw4r { +namespace g3d { +namespace detail { + +bool CalcViewNrmMtx(nw4r::math::MTX33 *pOut, const nw4r::math::MTX34 *pW); +bool CalcViewTexMtx(nw4r::math::MTX34 *pOut, const nw4r::math::MTX34 *pW); +bool CalcInvWorldMtx(nw4r::math::MTX34 *pOut, const nw4r::math::MTX34 *pW); + +} // namespace detail +} // namespace g3d +} // namespace nw4r + +#endif diff --git a/include/nw4r/g3d/g3d_workmem.h b/include/nw4r/g3d/g3d_workmem.h index e30f6f37..b9929e86 100644 --- a/include/nw4r/g3d/g3d_workmem.h +++ b/include/nw4r/g3d/g3d_workmem.h @@ -2,9 +2,9 @@ #define NW4R_G3D_WORK_MEM_H #include -#include +#include "nw4r/g3d/res/g3d_resanmshp.h" -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/g3d_xsi.h b/include/nw4r/g3d/g3d_xsi.h index 818e243f..ca57b162 100644 --- a/include/nw4r/g3d/g3d_xsi.h +++ b/include/nw4r/g3d/g3d_xsi.h @@ -2,7 +2,7 @@ #define NW4R_G3D_XSI_H #include -#include +#include "nw4r/g3d/res/g3d_resanmtexsrt.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/platform/g3d_allocator.h b/include/nw4r/g3d/platform/g3d_allocator.h index 2f76bc0e..f0d3516a 100644 --- a/include/nw4r/g3d/platform/g3d_allocator.h +++ b/include/nw4r/g3d/platform/g3d_allocator.h @@ -2,7 +2,7 @@ #define NW4R_G3D_PLATFORM_ALLOCATOR_H #include -#include +#include "rvl/MEM.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/platform/g3d_cpu.h b/include/nw4r/g3d/platform/g3d_cpu.h index ba3ebdea..b8e9d420 100644 --- a/include/nw4r/g3d/platform/g3d_cpu.h +++ b/include/nw4r/g3d/platform/g3d_cpu.h @@ -2,7 +2,7 @@ #define NW4R_G3D_PLATFORM_CPU_H #include -#include +#include "rvl/OS.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/platform/g3d_gpu.h b/include/nw4r/g3d/platform/g3d_gpu.h index b2e824ec..a9db6719 100644 --- a/include/nw4r/g3d/platform/g3d_gpu.h +++ b/include/nw4r/g3d/platform/g3d_gpu.h @@ -2,11 +2,9 @@ #define NW4R_G3D_PLATFORM_GPU_H #include -#include +#include "nw4r/math.h" // IWYU pragma: export -#include - -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -95,11 +93,11 @@ inline void GDSetChanCtrlLightOff(GXChannelID chan, u32 param, u32 lightMask) { } inline void GDSetChanAmbColor(GXChannelID chan, GXColor color) { - LoadXFCmd(GX_XF_REG_AMBIENT0 + chan, *reinterpret_cast(&color)); + LoadXFCmd(GX_XF_REG_AMBIENT0 + (chan & 1), *reinterpret_cast(&color)); } inline void GDSetChanMatColor(GXChannelID chan, GXColor color) { - LoadXFCmd(GX_XF_REG_MATERIAL0 + chan, *reinterpret_cast(&color)); + LoadXFCmd(GX_XF_REG_MATERIAL0 + (chan & 1), *reinterpret_cast(&color)); } } // namespace fifo diff --git a/include/nw4r/g3d/res/g3d_resanmcamera.h b/include/nw4r/g3d/res/g3d_resanmcamera.h index 5bc6e976..f4c45f27 100644 --- a/include/nw4r/g3d/res/g3d_resanmcamera.h +++ b/include/nw4r/g3d/res/g3d_resanmcamera.h @@ -2,12 +2,12 @@ #define NW4R_G3D_RES_RES_ANM_CAMERA_H #include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_rescommon.h" -#include +#include "nw4r/math.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resanmchr.h b/include/nw4r/g3d/res/g3d_resanmchr.h index a2989b89..808e9fa7 100644 --- a/include/nw4r/g3d/res/g3d_resanmchr.h +++ b/include/nw4r/g3d/res/g3d_resanmchr.h @@ -6,11 +6,11 @@ #include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_resmdl.h" -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -49,11 +49,15 @@ struct ChrAnmResult { math::MTX34 rt; // at 0x1C void GetScale(math::VEC3 *pScale) const; + void GetMtx(math::MTX34 *pMtx) const; bool GetRotateDeg(math::VEC3 *pRotate) const; - void GetTranslate(math::VEC3 *pTrans) const; + void GetTranslate(math::VEC3 *pTranslate) const; void GetRotTrans(math::MTX34 *pRotTrans) const; void SetScale(const math::VEC3 *pScale); + void SetMtx(const math::MTX34 *pMtx); + void SetRotateDeg(const math::VEC3 *pRotate); + void SetTranslate(const math::VEC3 *pTranslate); void SetRotTrans(const math::MTX34 *pRotTrans); }; diff --git a/include/nw4r/g3d/res/g3d_resanmclr.h b/include/nw4r/g3d/res/g3d_resanmclr.h index 52577dcf..0c06ea19 100644 --- a/include/nw4r/g3d/res/g3d_resanmclr.h +++ b/include/nw4r/g3d/res/g3d_resanmclr.h @@ -6,9 +6,9 @@ #include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_resdict.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resanmfog.h b/include/nw4r/g3d/res/g3d_resanmfog.h index afcca2b5..da0aa458 100644 --- a/include/nw4r/g3d/res/g3d_resanmfog.h +++ b/include/nw4r/g3d/res/g3d_resanmfog.h @@ -2,12 +2,12 @@ #define NW4R_G3D_RES_RES_ANM_FOG_H #include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_rescommon.h" -#include +#include "nw4r/ut.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resanmlight.h b/include/nw4r/g3d/res/g3d_resanmlight.h index 304927fa..7d5c9f66 100644 --- a/include/nw4r/g3d/res/g3d_resanmlight.h +++ b/include/nw4r/g3d/res/g3d_resanmlight.h @@ -2,13 +2,13 @@ #define NW4R_G3D_RES_RES_ANM_LIGHT_H #include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_rescommon.h" -#include -#include +#include "nw4r/math.h" // IWYU pragma: export +#include "nw4r/ut.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resanmscn.h b/include/nw4r/g3d/res/g3d_resanmscn.h index a7663547..57540436 100644 --- a/include/nw4r/g3d/res/g3d_resanmscn.h +++ b/include/nw4r/g3d/res/g3d_resanmscn.h @@ -6,13 +6,13 @@ #include -#include -#include -#include -#include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_resanmamblight.h" +#include "nw4r/g3d/res/g3d_resanmcamera.h" +#include "nw4r/g3d/res/g3d_resanmfog.h" +#include "nw4r/g3d/res/g3d_resanmlight.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_reslightset.h" namespace nw4r { namespace g3d { @@ -74,14 +74,21 @@ public: ResLightSet GetResLightSet(u32 idx) const; u32 GetResLightSetNumEntries() const; + ResAnmAmbLight GetResAnmAmbLight(const char *name) const; ResAnmAmbLight GetResAnmAmbLight(const ResName name) const; ResAnmAmbLight GetResAnmAmbLight(int idx) const; ResAnmAmbLight GetResAnmAmbLight(u32 idx) const; + ResAnmLight GetResAnmLight(const char *name) const; ResAnmLight GetResAnmLight(const ResName name) const; ResAnmLight GetResAnmLight(int idx) const; ResAnmLight GetResAnmLight(u32 idx) const; + ResAnmCamera GetResAnmCamera(const char *name) const; + ResAnmCamera GetResAnmCamera(const ResName name) const; + ResAnmCamera GetResAnmCamera(int idx) const; + ResAnmCamera GetResAnmCamera(u32 idx) const; + ResLightSet GetResLightSetByRefNumber(u32 refNumber) const; ResAnmAmbLight GetResAnmAmbLightByRefNumber(u32 refNumber) const; ResAnmLight GetResAnmLightByRefNumber(u32 refNumber) const; diff --git a/include/nw4r/g3d/res/g3d_resanmshp.h b/include/nw4r/g3d/res/g3d_resanmshp.h index 627835e0..2f06f193 100644 --- a/include/nw4r/g3d/res/g3d_resanmshp.h +++ b/include/nw4r/g3d/res/g3d_resanmshp.h @@ -6,10 +6,10 @@ #include -#include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_resdict.h" +#include "nw4r/g3d/res/g3d_resvtx.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resanmtexpat.h b/include/nw4r/g3d/res/g3d_resanmtexpat.h index bd1c651d..fd51657d 100644 --- a/include/nw4r/g3d/res/g3d_resanmtexpat.h +++ b/include/nw4r/g3d/res/g3d_resanmtexpat.h @@ -6,12 +6,12 @@ #include -#include -#include -#include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_resdict.h" +#include "nw4r/g3d/res/g3d_resmat.h" +#include "nw4r/g3d/res/g3d_respltt.h" +#include "nw4r/g3d/res/g3d_restex.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resanmtexsrt.h b/include/nw4r/g3d/res/g3d_resanmtexsrt.h index 0a4f093a..296b2387 100644 --- a/include/nw4r/g3d/res/g3d_resanmtexsrt.h +++ b/include/nw4r/g3d/res/g3d_resanmtexsrt.h @@ -6,9 +6,9 @@ #include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_resdict.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resanmvis.h b/include/nw4r/g3d/res/g3d_resanmvis.h index fc32bdb0..b6144c7e 100644 --- a/include/nw4r/g3d/res/g3d_resanmvis.h +++ b/include/nw4r/g3d/res/g3d_resanmvis.h @@ -6,9 +6,9 @@ #include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanm.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_resdict.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_rescommon.h b/include/nw4r/g3d/res/g3d_rescommon.h index 19513c3e..6211c288 100644 --- a/include/nw4r/g3d/res/g3d_rescommon.h +++ b/include/nw4r/g3d/res/g3d_rescommon.h @@ -2,7 +2,8 @@ #define NW4R_G3D_RESCOMMON_H #include "common.h" -#include +#include "rvl/GX.h" // IWYU pragma: export + /****************************************************************************** * * Macros diff --git a/include/nw4r/g3d/res/g3d_resdict.h b/include/nw4r/g3d/res/g3d_resdict.h index cb757e47..64c75f9d 100644 --- a/include/nw4r/g3d/res/g3d_resdict.h +++ b/include/nw4r/g3d/res/g3d_resdict.h @@ -2,7 +2,7 @@ #define NW4R_G3D_RES_RES_DICT_H #include -#include +#include "nw4r/g3d/res/g3d_rescommon.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resfile.h b/include/nw4r/g3d/res/g3d_resfile.h index 6426f74b..1c5e1820 100644 --- a/include/nw4r/g3d/res/g3d_resfile.h +++ b/include/nw4r/g3d/res/g3d_resfile.h @@ -2,19 +2,19 @@ #define NW4R_G3D_RES_RES_FILE_H #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanmchr.h" +#include "nw4r/g3d/res/g3d_resanmclr.h" +#include "nw4r/g3d/res/g3d_resanmscn.h" +#include "nw4r/g3d/res/g3d_resanmshp.h" +#include "nw4r/g3d/res/g3d_resanmtexpat.h" +#include "nw4r/g3d/res/g3d_resanmtexsrt.h" +#include "nw4r/g3d/res/g3d_resanmvis.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_resmdl.h" +#include "nw4r/g3d/res/g3d_respltt.h" +#include "nw4r/g3d/res/g3d_restex.h" -#include +#include "nw4r/ut.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -86,6 +86,8 @@ public: ResAnmScn GetResAnmScn(int idx) const; ResAnmScn GetResAnmScn(u32 idx) const; + void *GetExternalData(const char *pName) const; + u32 GetResMdlNumEntries() const; u32 GetResPlttNumEntries() const; u32 GetResTexNumEntries() const; diff --git a/include/nw4r/g3d/res/g3d_reslightset.h b/include/nw4r/g3d/res/g3d_reslightset.h index 6f467811..3669d25c 100644 --- a/include/nw4r/g3d/res/g3d_reslightset.h +++ b/include/nw4r/g3d/res/g3d_reslightset.h @@ -2,9 +2,9 @@ #define NW4R_G3D_RES_RES_LIGHT_SET_H #include -#include -// #include -#include +#include "nw4r/g3d/g3d_state.h" +// #include "nw4r/g3d/res/g3d_resanmscn.h" +#include "nw4r/g3d/res/g3d_rescommon.h" namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resmat.h b/include/nw4r/g3d/res/g3d_resmat.h index 883ab107..7b74e7c6 100644 --- a/include/nw4r/g3d/res/g3d_resmat.h +++ b/include/nw4r/g3d/res/g3d_resmat.h @@ -2,15 +2,16 @@ #define NW4R_G3D_RES_RES_MAT_H #include -#include -#include -#include -#include -#include +#include "nw4r/g3d/res/g3d_resanmtexsrt.h" +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_respltt.h" +#include "nw4r/g3d/res/g3d_restev.h" +#include "nw4r/g3d/res/g3d_restex.h" +#include "nw4r/g3d/res/g3d_resuser.h" -#include +#include "nw4r/math.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -99,7 +100,11 @@ public: ResMatMisc CopyTo(void *pDst) const; GXBool GXGetZCompLoc() const; + + void SetLightSetIdx(int idx); int GetLightSetIdx() const; + + void SetFogIdx(int idx); int GetFogIdx() const; void GetIndirectTexMtxCalcMethod(GXIndTexMtxID id, ResMatMiscData::IndirectMethod *pMethod, s8 *pLightRef); @@ -127,6 +132,7 @@ class ResMatTexCoordGen : public ResCommon { public: NW4R_G3D_RESOURCE_FUNC_DEF_EX(ResMatTexCoordGen, ResTexCoordGenDL); + void Disable(GXTexCoordID coord); void DCStore(bool sync); ResMatTexCoordGen CopyTo(void *pDst) const; @@ -429,6 +435,7 @@ public: void CallDisplayList(u8 indNum, bool sync) const; bool GXGetIndTexMtx(GXIndTexMtxID id, math::MTX34 *pMtx) const; + bool GXGetIndTexMtx(GXIndTexMtxID id, math::MTX34 *pMtx, s8 *pScaleExp) const; void GXSetIndTexMtx(GXIndTexMtxID id, const math::MTX34 &rMtx, s8 scaleExp); void EndEdit() { @@ -496,6 +503,47 @@ private: void BindPltt_(const ResPltt pltt, ResTlutObj tlutObj); }; +/****************************************************************************** + * + * ResMatFur + * + ******************************************************************************/ + +struct ResMatFurData { + enum LayerInterval { + UNIFORM = 0, + TIP = 1, + }; + f32 length; // at 0x0 + u32 lyrSize; // at 0x4 + LayerInterval lyrInterval; // at 0x8 + f32 alphaCurve; // at 0xC + f32 specCurve; // at 0x10 +}; + +class ResMatFur : public ResCommon { +public: + NW4R_G3D_RESOURCE_FUNC_DEF(ResMatFur); + + void SetLength(f32 len); + f32 GetLength() const; + + u32 GetLyrSize() const; + + void SetLytInterval(ResMatFurData::LayerInterval interval); + ResMatFurData::LayerInterval GetLytInterval() const; + + void SetAlphaCurve(f32 curve); + f32 GetAlphaCurve() const; + + void SetSpecCurve(f32 curve); + f32 GetSpecCurve() const; + + f32 GetLyrRate(u32 idx) const; + + ResMatFur CopyTo(void *pDst) const; +}; + /****************************************************************************** * * ResMat @@ -533,12 +581,12 @@ public: NW4R_G3D_RESOURCE_FUNC_DEF(ResMat); void Init(); - bool Bind(const ResFile file); void Release(); bool IsOpaque() const; ResMdl GetParent(); + const ResMdl GetParent() const; u32 GetID() const { return ref().id; @@ -555,6 +603,9 @@ public: ResTev GetResTev(); ResTev GetResTev() const; + ResMatFur GetResMatFur(); + ResUserData GetResUserData(); + u32 GetNumResTexPlttInfo() const { return ref().numResTexPlttInfo; } diff --git a/include/nw4r/g3d/res/g3d_resmdl.h b/include/nw4r/g3d/res/g3d_resmdl.h index 11f9ce97..3d38c6ce 100644 --- a/include/nw4r/g3d/res/g3d_resmdl.h +++ b/include/nw4r/g3d/res/g3d_resmdl.h @@ -6,14 +6,14 @@ #include -#include -#include -#include -#include -#include -#include +#include "nw4r/g3d/res/g3d_rescommon.h" +#include "nw4r/g3d/res/g3d_resdict.h" +#include "nw4r/g3d/res/g3d_resmat.h" +#include "nw4r/g3d/res/g3d_resnode.h" +#include "nw4r/g3d/res/g3d_resshp.h" +#include "nw4r/g3d/res/g3d_resvtx.h" -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -139,7 +139,7 @@ public: bool Bind(const ResFile file); void Release(); - bool IsOpaque() const; + bool IsOpaque(u32 mat) const; u32 GetRevision() const { return ref().revision; } @@ -153,6 +153,7 @@ public: } const u8 *GetResByteCode(const char *pName) const; + u32 GetResByteCodeNumEntries() const; ResNode GetResNode(const char *pName) const; ResNode GetResNode(const ResName name) const; @@ -178,6 +179,12 @@ public: ResVtxTexCoord GetResVtxTexCoord(int idx) const; u32 GetResVtxTexCoordNumEntries() const; + ResVtxFurPos GetResVtxFurPos(int idx) const; + u32 GetResVtxFurPosNumEntries() const; + + ResVtxFurVec GetResVtxFurVec(int idx) const; + u32 GetResVtxFurVecNumEntries() const; + ResMat GetResMat(const char *pName) const; ResMat GetResMat(const ResName name) const; ResMat GetResMat(int idx) const; @@ -198,6 +205,21 @@ public: ResMdlInfo GetResMdlInfo() const { return ResMdlInfo(const_cast(&ref().info)); } + + class DrawEnumerator { + const u8 *drawOpa; + const u8 *drawXlu; + bool bOpa; + + public: + DrawEnumerator(const u8 *pDrawOpa, const u8 *pDrawXlu); + + bool IsValid() const; + void MoveNext(); + u32 GetMatID() const; + u32 GetShpID() const; + u32 GetNodeID() const; + }; }; } // namespace g3d diff --git a/include/nw4r/g3d/res/g3d_resnode.h b/include/nw4r/g3d/res/g3d_resnode.h index e31a3617..29242792 100644 --- a/include/nw4r/g3d/res/g3d_resnode.h +++ b/include/nw4r/g3d/res/g3d_resnode.h @@ -2,9 +2,9 @@ #define NW4R_G3D_RES_RES_NODE_H #include -#include +#include "nw4r/g3d/res/g3d_rescommon.h" -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_respltt.h b/include/nw4r/g3d/res/g3d_respltt.h index 0ba3ab33..94ce4bf2 100644 --- a/include/nw4r/g3d/res/g3d_respltt.h +++ b/include/nw4r/g3d/res/g3d_respltt.h @@ -5,9 +5,9 @@ /** NOTICE: Revision change from 1->??. Structures, Enums, and/or Functions may have changed and not yet done so * (Zeldex72, Feb 1, 2025) */ -#include +#include "nw4r/g3d/res/g3d_rescommon.h" -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/include/nw4r/g3d/res/g3d_resshp.h b/include/nw4r/g3d/res/g3d_resshp.h index b3f74228..344f8757 100644 --- a/include/nw4r/g3d/res/g3d_resshp.h +++ b/include/nw4r/g3d/res/g3d_resshp.h @@ -3,11 +3,11 @@ #include -#include -// #include -#include +#include "nw4r/g3d/res/g3d_rescommon.h" +// #include "nw4r/g3d/res/g3d_resmdl.h" +#include "nw4r/g3d/res/g3d_resvtx.h" -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -89,8 +89,10 @@ struct ResShpData { s16 idVtxNormal; // at 0x4A s16 idVtxColor[GX_VA_TEX0 - GX_VA_CLR0]; // at 0x4C s16 idVtxTexCoord[GX_POS_MTX_ARRAY - GX_VA_TEX0]; // at 0x50 - s32 toMtxSetUsed; // at 0x60 - ResMtxSetUsed msu; // at 0x64 + s16 idVtxFurVec; // at 0x60 + s16 idVtxFurPos; // at 0x62 + s32 toMtxSetUsed; // at 0x64 + ResMtxSetUsed msu; // at 0x68 }; class ResShp : public ResCommon { @@ -111,6 +113,8 @@ public: ResVtxNrm GetResVtxNrm() const; ResVtxClr GetResVtxClr(u32 idx) const; ResVtxTexCoord GetResVtxTexCoord(u32 idx) const; + ResVtxClr GetResVtxFurVec(u32 idx) const; + ResVtxFurPos GetResVtxFurPos() const; void CallPrePrimitiveDisplayList(bool sync, bool cacheIsSame) const; void CallPrimitiveDisplayList(bool sync) const; @@ -143,6 +147,8 @@ public: bool IsVisible() const { return !(ref().flag & ResShpData::FLAG_INVISIBLE); } + + void DCStore(bool sync); }; } // namespace g3d diff --git a/include/nw4r/g3d/res/g3d_restev.h b/include/nw4r/g3d/res/g3d_restev.h index 3237030b..b5c994d5 100644 --- a/include/nw4r/g3d/res/g3d_restev.h +++ b/include/nw4r/g3d/res/g3d_restev.h @@ -2,9 +2,9 @@ #define NW4R_G3D_RES_RES_TEV_H #include -#include +#include "nw4r/g3d/res/g3d_rescommon.h" -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -55,9 +55,9 @@ struct ResTevData { s32 toResMdlData; // at 0x4 u32 id; // at 0x8 u8 nStages; // at 0xC - u8 PADDING_0xD[0x10 - 0xD]; // at 0xD + u8 dummy_[0x10 - 0xD]; // at 0xD u8 texCoordToTexMapID[GX_MAX_TEXCOORD]; // at 0x10 - u8 PADDING_0x18[0x20 - 0x18]; // at 0x18 + u8 dummy[0x20 - 0x18]; // at 0x18 ResTevDL dl; // at 0x20 }; @@ -65,6 +65,9 @@ class ResTev : public ResCommon { public: NW4R_G3D_RESOURCE_FUNC_DEF(ResTev); + ResMdl GetParent(); + const ResMdl GetParent() const; + bool GXGetTevSwapModeTable( GXTevSwapSel swap, GXTevColorChan *pR, GXTevColorChan *pG, GXTevColorChan *pB, GXTevColorChan *pA ) const; @@ -72,6 +75,10 @@ public: GXSetTevSwapModeTable(GXTevSwapSel swap, GXTevColorChan r, GXTevColorChan g, GXTevColorChan b, GXTevColorChan a); bool GXGetTevOrder(GXTevStageID stage, GXTexCoordID *pCoord, GXTexMapID *pMap, GXChannelID *pChannel) const; + void GXSetTevOrder(GXTevStageID stage, GXTexCoordID coord, GXTexMapID map, GXChannelID channel); + + bool GXGetIndTexOrder(GXIndTexStageID stage, GXTexCoordID *pCoord, GXTexMapID *pMap) const; + void GXSetIndTexOrder(GXIndTexStageID stage, GXTexCoordID coord, GXTexMapID map); void GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d); diff --git a/include/nw4r/g3d/res/g3d_restex.h b/include/nw4r/g3d/res/g3d_restex.h index 07044718..0be299e2 100644 --- a/include/nw4r/g3d/res/g3d_restex.h +++ b/include/nw4r/g3d/res/g3d_restex.h @@ -2,9 +2,9 @@ #define NW4R_G3D_RES_RES_TEX_H #include -#include +#include "nw4r/g3d/res/g3d_rescommon.h" -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -25,7 +25,7 @@ struct ResTexData { union { GXTexFmt fmt; GXCITexFmt cifmt; - }; // at 0x20 + }; // at 0x20 u32 mipmap_level; // at 0x24 f32 min_lod; // at 0x28 f32 max_lod; // at 0x2C diff --git a/include/nw4r/g3d/res/g3d_resuser.h b/include/nw4r/g3d/res/g3d_resuser.h new file mode 100644 index 00000000..9eda47d5 --- /dev/null +++ b/include/nw4r/g3d/res/g3d_resuser.h @@ -0,0 +1,21 @@ +#ifndef NW4R_G3D_RES_RES_USER_H +#define NW4R_G3D_RES_RES_USER_H +#include + +#include "nw4r/g3d/res/g3d_rescommon.h" + +namespace nw4r { +namespace g3d { + +struct ResUserDataData {}; + +class ResUserData : public ResCommon { +public: + NW4R_G3D_RESOURCE_FUNC_DEF(ResUserData); + // TODO +}; + +} // namespace g3d +} // namespace nw4r + +#endif diff --git a/include/nw4r/g3d/res/g3d_resvtx.h b/include/nw4r/g3d/res/g3d_resvtx.h index 6d4184e3..984b1989 100644 --- a/include/nw4r/g3d/res/g3d_resvtx.h +++ b/include/nw4r/g3d/res/g3d_resvtx.h @@ -2,11 +2,11 @@ #define NW4R_G3D_RES_RES_VTX_H #include -#include +#include "nw4r/g3d/res/g3d_rescommon.h" -#include +#include "nw4r/math.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -50,10 +50,22 @@ public: } void *GetData() { - return ofs_to_ptr(ref().toVtxPosArray); + ResVtxPosData &r = ref(); + + if (r.toVtxPosArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toVtxPosArray); + } + + return NULL; } const void *GetData() const { - return ofs_to_ptr(ref().toVtxPosArray); + const ResVtxPosData &r = ref(); + + if (r.toVtxPosArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toVtxPosArray); + } + + return NULL; } u32 GetID() const { @@ -102,10 +114,22 @@ public: } void *GetData() { - return ofs_to_ptr(ref().toVtxNrmArray); + ResVtxNrmData &r = ref(); + + if (r.toVtxNrmArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toVtxNrmArray); + } + + return NULL; } const void *GetData() const { - return ofs_to_ptr(ref().toVtxNrmArray); + const ResVtxNrmData &r = ref(); + + if (r.toVtxNrmArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toVtxNrmArray); + } + + return NULL; } u32 GetID() const { @@ -154,10 +178,22 @@ public: } void *GetData() { - return ofs_to_ptr(ref().toVtxClrArray); + ResVtxClrData &r = ref(); + + if (r.toVtxClrArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toVtxClrArray); + } + + return NULL; } const void *GetData() const { - return ofs_to_ptr(ref().toVtxClrArray); + const ResVtxClrData &r = ref(); + + if (r.toVtxClrArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toVtxClrArray); + } + + return NULL; } u32 GetID() const { @@ -205,10 +241,22 @@ public: } void *GetData() { - return ofs_to_ptr(ref().toTexCoordArray); + ResVtxTexCoordData &r = ref(); + + if (r.toTexCoordArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toTexCoordArray); + } + + return NULL; } const void *GetData() const { - return ofs_to_ptr(ref().toTexCoordArray); + const ResVtxTexCoordData &r = ref(); + + if (r.toTexCoordArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toTexCoordArray); + } + + return NULL; } u32 GetID() const { @@ -220,6 +268,130 @@ public: } }; +/****************************************************************************** + * + * ResVtxFurPos + * + ******************************************************************************/ +struct ResVtxFurPosData { + u32 size; // at 0x0 + s32 toResMdlData; // at 0x4 + s32 toFurPosArray; // at 0x8 + s32 name; // at 0xC + u32 id; // at 0x10 + GXCompCnt cmpcnt; // at 0x14 + GXCompType tp; // at 0x18 + u8 frac; // at 0x1C + u8 stride; // at 0x1D + u16 numFurPos; // at 0x1E + u32 numLayer; // at 0x20 + u32 ofsLayer; // at 0x24 +}; +class ResVtxFurPos : public ResCommon { +public: + NW4R_G3D_RESOURCE_FUNC_DEF(ResVtxFurPos); + + void Init() { + DCStore(false); + } + + void GetArray(const void **ppBase, u8 *pStride) const; + void SetArray(u16 idx); + void DCStore(bool sync); + + u32 GetSize() const { + return ref().size; + } + + void *GetData(int idx) { + ResVtxFurPosData &r = ref(); + + // ternary was required -_- Probably means other GetData funcs are ternaries + return (r.toFurPosArray != 0 && idx < (int)r.numLayer && idx >= 0) ? + reinterpret_cast(reinterpret_cast(&r) + r.toFurPosArray + idx * r.ofsLayer) : + NULL; + } + + const void *GetData(int idx) const { + const ResVtxFurPosData &r = ref(); + + return (r.toFurPosArray != 0 && idx < (int)r.numLayer && idx >= 0) ? + reinterpret_cast( + reinterpret_cast(&r) + r.toFurPosArray + idx * r.ofsLayer + ) : + NULL; + + return NULL; + } + + u32 GetID() const { + return ref().id; + } + + u16 GetNumFurPos() const { + return ref().toFurPosArray; + } + u32 GetNumLayer() const { + return ref().numLayer; + } +}; + +/****************************************************************************** + * + * ResVtxFurVec + * + ******************************************************************************/ +struct ResVtxFurVecData { + u32 size; // at 0x0 + s32 toResMdlData; // at 0x4 + s32 toFurVecArray; // at 0x8 + s32 name; // at 0xC + u32 id; // at 0x10 + u16 numFurVec; // at 0x14 +}; +class ResVtxFurVec : public ResCommon { +public: + NW4R_G3D_RESOURCE_FUNC_DEF(ResVtxFurVec); + + void Init() { + DCStore(false); + } + + void GetArray(const void **ppBase, u8 *pStride) const; + void DCStore(bool sync); + + u32 GetSize() const { + return ref().size; + } + + void *GetData() { + ResVtxFurVecData &r = ref(); + + if (r.toFurVecArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toFurVecArray); + } + + return NULL; + } + const void *GetData() const { + const ResVtxFurVecData &r = ref(); + + if (r.toFurVecArray != 0) { + return reinterpret_cast(reinterpret_cast(&r) + r.toFurVecArray); + } + + return NULL; + } + + u32 GetID() const { + return ref().id; + } + + u16 GetNumFurVec() const { + return ref().toFurVecArray; + } +}; + } // namespace g3d } // namespace nw4r diff --git a/include/nw4r/math/math_arithmetic.h b/include/nw4r/math/math_arithmetic.h index b532cd41..8bd573cb 100644 --- a/include/nw4r/math/math_arithmetic.h +++ b/include/nw4r/math/math_arithmetic.h @@ -64,15 +64,11 @@ inline f32 FMod(f32 x, f32 y) { } inline f32 FModf(f32 x, f32 *y) { - return fmodff(x, y); + return modff(x, y); } inline f32 FSqrt(f32 x) { - if (x <= 0.0f) { - return 0.0f; - } - - return x * FrSqrt(x); + return (x <= 0.0f) ? 0.0f : x * FrSqrt(x); } inline f32 FLog(f32 x) { diff --git a/include/nw4r/ut/ut_Color.h b/include/nw4r/ut/ut_Color.h index cbff07fe..e94ba43a 100644 --- a/include/nw4r/ut/ut_Color.h +++ b/include/nw4r/ut/ut_Color.h @@ -10,7 +10,7 @@ namespace ut { class Color : public GXColor { public: Color() { - *this = 0xFFFFFFFF; + *this = WHITE; } Color(u32 color) { *this = color; @@ -19,7 +19,7 @@ public: Set(red, green, blue, alpha); } Color(const GXColor &clr) { - ToU32ref() = *(u32 *)&clr; + *this = clr; } ~Color() {} @@ -36,7 +36,7 @@ public: } Color &operator=(const GXColor &c) { - ToU32ref() = *(u32 *)&c; // TODO -> This Seems Maybe Wrong + *this = *reinterpret_cast(&c); return *this; } diff --git a/include/rvl/GX/GXHardware.h b/include/rvl/GX/GXHardware.h index 99de19a9..1498e733 100644 --- a/include/rvl/GX/GXHardware.h +++ b/include/rvl/GX/GXHardware.h @@ -13,7 +13,7 @@ #ifndef RVL_SDK_GX_HARDWARE_H #define RVL_SDK_GX_HARDWARE_H -#include +#include "rvl/GX/GXTypes.h" #include diff --git a/include/rvl/GX/GXHardwareBP.h b/include/rvl/GX/GXHardwareBP.h index 2e117738..6d1af1cf 100644 --- a/include/rvl/GX/GXHardwareBP.h +++ b/include/rvl/GX/GXHardwareBP.h @@ -1,6 +1,6 @@ #ifndef RVL_SDK_GX_HARDWARE_BP_H #define RVL_SDK_GX_HARDWARE_BP_H -#include +#include "rvl/GX/GXTypes.h" #include diff --git a/include/rvl/GX/GXHardwareCP.h b/include/rvl/GX/GXHardwareCP.h index aa77d6dd..1b56a1ff 100644 --- a/include/rvl/GX/GXHardwareCP.h +++ b/include/rvl/GX/GXHardwareCP.h @@ -1,10 +1,9 @@ #ifndef RVL_SDK_GX_HARDWARE_CP_H #define RVL_SDK_GX_HARDWARE_CP_H -#include +#include "rvl/GX/GXTypes.h" #include - #ifdef __cplusplus extern "C" { #endif diff --git a/include/rvl/GX/GXHardwareXF.h b/include/rvl/GX/GXHardwareXF.h index 0719745c..71d3aa84 100644 --- a/include/rvl/GX/GXHardwareXF.h +++ b/include/rvl/GX/GXHardwareXF.h @@ -1,10 +1,9 @@ #ifndef RVL_SDK_GX_HARDWARE_XF_H #define RVL_SDK_GX_HARDWARE_XF_H -#include +#include "rvl/GX/GXTypes.h" #include - #ifdef __cplusplus extern "C" { #endif diff --git a/include/rvl/GX/GXInternal.h b/include/rvl/GX/GXInternal.h index 59a05e01..279c044f 100644 --- a/include/rvl/GX/GXInternal.h +++ b/include/rvl/GX/GXInternal.h @@ -24,7 +24,7 @@ extern "C" { */ #define GX_DECL_PUBLIC_STRUCT(name, size) \ typedef struct _##name { \ - u8 dummy[(size) - sizeof(name##Impl) + sizeof(name##Impl)]; \ + u32 dummy[((size) - sizeof(name##Impl) + sizeof(name##Impl)) / sizeof(u32)]; \ } name; typedef struct _GXFifoObjImpl { diff --git a/include/rvl/GX/GXTransform.h b/include/rvl/GX/GXTransform.h index 349556b5..bc571398 100644 --- a/include/rvl/GX/GXTransform.h +++ b/include/rvl/GX/GXTransform.h @@ -2,17 +2,22 @@ #define RVL_SDK_GX_TRANSFORM_H #include "common.h" #include "rvl/GX/GXTypes.h" -#include "rvl/MTX.h" + +#include "rvl/MTX.h" // IWYU pragma: export #ifdef __cplusplus extern "C" { #endif +#define GX_PROJECTION_SZ 7 +#define GX_VIEWPORT_SZ 6 + typedef enum { GX_FIELD_EVEN, GX_FIELD_ODD, } GXInterlaceField; +void GXProject(f32 x, f32 y, f32 z, f32 mtx[3][4], f32 *pm, f32 *vp, f32 *sx, f32 *sy, f32 *sz); void GXSetProjection(const Mtx44 proj, GXProjectionType type); void GXSetProjectionv(const f32 proj[7]); void GXGetProjectionv(f32 proj[7]); diff --git a/include/rvl/GX/GXTypes.h b/include/rvl/GX/GXTypes.h index 1fcdfb91..924968f7 100644 --- a/include/rvl/GX/GXTypes.h +++ b/include/rvl/GX/GXTypes.h @@ -10,7 +10,8 @@ extern "C" { * Value is shifted to the specified bit position. * (Bit indices are LSB) */ -#define GX_BITSET(field, pos, size, value) __rlwimi((field), (value), 31 - (pos) - (size) + 1, (pos), (pos) + (size)-1) +#define GX_BITSET(field, pos, size, value) \ + __rlwimi((field), (value), 31 - (pos) - (size) + 1, (pos), (pos) + (size) - 1) /** * Compose value from bitfield. @@ -24,7 +25,7 @@ extern "C" { * Value is not shifted, only masked. * (Bit indices are LSB) */ -#define GX_BITSET_TRUNC(field, pos, size, value) __rlwimi((field), (value), 0, (pos), (pos) + (size)-1) +#define GX_BITSET_TRUNC(field, pos, size, value) __rlwimi((field), (value), 0, (pos), (pos) + (size) - 1) /** * Compose value from bitfield. @@ -840,7 +841,7 @@ typedef enum _GXTexWrapMode { GX_MAX_TEXWRAPMODE } GXTexWrapMode; -typedef enum GXTlut { +typedef enum _GXTlut { GX_TLUT0, GX_TLUT1, GX_TLUT2, diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h index 5a02a030..0d311c0e 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h @@ -45,67 +45,83 @@ float fmodf(float, float); float fmodff(float, float *); extern float __fabsf(float); -inline double fabs(double f) { return __fabs(f); } -inline double fabsf2(float f) { return __fabsf(f); } -inline float fabsf(float f) { return fabsf2(f); } +inline double fabs(double f) { + return __fabs(f); +} +inline double fabsf2(float f) { + return __fabsf(f); +} +inline float fabsf(float f) { + return fabsf2(f); +} -inline float fmodf(float f1, float f2) { return fmod(f1, f2); } +inline float fmodf(float f1, float f2) { + return fmod(f1, f2); +} inline float modff(float x, float *iptr) { - float frac; - double intg; + float frac; + double intg; - frac = modf((double)x, &intg); - *iptr = intg; + frac = modf((double)x, &intg); + *iptr = intg; - return frac; + return frac; } inline double sqrt_step(double tmpd, float mag) { - return tmpd * 0.5 * (3.0 - mag * (tmpd * tmpd)); + return tmpd * 0.5 * (3.0 - mag * (tmpd * tmpd)); +} +inline float floorf(float f) { + return floor(f); } extern inline float sqrtf(float x) { - const double _half = .5; - const double _three = 3.0; - volatile float y; - if (x > 0.0f) { - double guess = __frsqrte((double)x); // returns an approximation to - guess = - _half * guess * (_three - guess * guess * x); // now have 12 sig bits - guess = - _half * guess * (_three - guess * guess * x); // now have 24 sig bits - guess = - _half * guess * (_three - guess * guess * x); // now have 32 sig bits - y = (float)(x * guess); - return y; - } - return x; + const double _half = .5; + const double _three = 3.0; + volatile float y; + if (x > 0.0f) { + double guess = __frsqrte((double)x); // returns an approximation to + guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits + guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits + guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits + y = (float)(x * guess); + return y; + } + return x; } extern inline double sqrt(double x) { - if (x > 0.0) { - double guess = __frsqrte(x); /* returns an approximation to */ - guess = .5 * guess * (3.0 - guess * guess * x); /* now have 8 sig bits */ - guess = .5 * guess * (3.0 - guess * guess * x); /* now have 16 sig bits */ - guess = .5 * guess * (3.0 - guess * guess * x); /* now have 32 sig bits */ - guess = .5 * guess * (3.0 - guess * guess * x); /* now have > 53 sig bits */ - return x * guess; - } else if (x == 0) { - return 0; - } else if (x) { - return NAN; - } + if (x > 0.0) { + double guess = __frsqrte(x); /* returns an approximation to */ + guess = .5 * guess * (3.0 - guess * guess * x); /* now have 8 sig bits */ + guess = .5 * guess * (3.0 - guess * guess * x); /* now have 16 sig bits */ + guess = .5 * guess * (3.0 - guess * guess * x); /* now have 32 sig bits */ + guess = .5 * guess * (3.0 - guess * guess * x); /* now have > 53 sig bits */ + return x * guess; + } else if (x == 0) { + return 0; + } else if (x) { + return NAN; + } - return HUGE_VALF; + return HUGE_VALF; } -inline float atan2f(float y, float x) { return (float)atan2(y, x); } +inline float atan2f(float y, float x) { + return (float)atan2(y, x); +} // these are duplicated due to sinf/cosf having a symbol, but // still being used as inlines elsewhere -inline float i_sinf(float x) { return sin(x); } -inline float i_cosf(float x) { return cos(x); } -inline float i_tanf(float x) { return tanf(x); } +inline float i_sinf(float x) { + return sin(x); +} +inline float i_cosf(float x) { + return cos(x); +} +inline float i_tanf(float x) { + return tanf(x); +} #ifdef __cplusplus }; diff --git a/src/nw4r/g3d/g3d_3dsmax.cpp b/src/nw4r/g3d/dcc/g3d_3dsmax.cpp similarity index 99% rename from src/nw4r/g3d/g3d_3dsmax.cpp rename to src/nw4r/g3d/dcc/g3d_3dsmax.cpp index 3aca9cc6..4bc1043e 100644 --- a/src/nw4r/g3d/g3d_3dsmax.cpp +++ b/src/nw4r/g3d/dcc/g3d_3dsmax.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/src/nw4r/g3d/dcc/g3d_basic.cpp b/src/nw4r/g3d/dcc/g3d_basic.cpp new file mode 100644 index 00000000..d56f2e96 --- /dev/null +++ b/src/nw4r/g3d/dcc/g3d_basic.cpp @@ -0,0 +1,90 @@ +#include "nw4r/g3d.h" // IWYU pragma: export + +namespace nw4r { +namespace g3d { +namespace detail { +namespace dcc { + +bool CalcTexMtx_Basic(math::MTX34 *pMtx, bool set, const TexSrt &rSrt, TexSrt::Flag flag) { + // Extract S/R/T flags + u32 index = flag >> 1 & 0b111; + + // Scale-one, no rotate/trans + if (index == 0b111) { + return false; + } + + f32 sinR, cosR; + math::SinCosDeg(&sinR, &cosR, rSrt.R); + + if (set) { + // clang-format off + pMtx->m[0][0] = rSrt.Su * cosR; pMtx->m[0][1] = -rSrt.Sv * sinR; pMtx->m[0][2] = 0.0f; pMtx->m[0][3] = rSrt.Tu; + pMtx->m[1][0] = rSrt.Su * sinR; pMtx->m[1][1] = rSrt.Sv * cosR; pMtx->m[1][2] = 0.0f; pMtx->m[1][3] = rSrt.Tv; + pMtx->m[2][0] = 0.0f; pMtx->m[2][1] = 0.0f; pMtx->m[2][2] = 1.0f; pMtx->m[2][3] = 0.0f; + // clang-format on + } else { + // clang-format off + math::MTX34 m; + m[0][0] = rSrt.Su * cosR; m[0][1] = -rSrt.Sv * sinR; m[0][2] = 0.0f; m[0][3] = rSrt.Tu; + m[1][0] = rSrt.Su * sinR; m[1][1] = rSrt.Sv * cosR; m[1][2] = 0.0f; m[1][3] = rSrt.Tv; + m[2][0] = 0.0f; m[2][1] = 0.0f; m[2][2] = 1.0f; m[2][3] = 0.0f; + // clang-format on + math::MTX34Mult(pMtx, &m, pMtx); + } + + return true; +} + +u32 CalcWorldMtx_Basic( + math::MTX34 *pW, math::VEC3 *pS, const math::MTX34 *pW1, const math::VEC3 *pS1, u32 attr, + const ChrAnmResult *pResult +) { + u32 flag = pResult->flags; + u32 newAttr = attr; + + if ((flag & ChrAnmResult::FLAG_MTX_IDENT) || (flag & ChrAnmResult::FLAG_ROT_TRANS_ZERO)) { + if (detail::WorldMtxAttr::IsScaleOne(attr)) { + math::MTX34Copy(pW, pW1); + } else { + math::MTX34Scale(pW, pW1, pS1); + } + } else if (flag & ChrAnmResult::FLAG_ROT_ZERO) { + if (detail::WorldMtxAttr::IsScaleOne(attr)) { + math::VEC3 trans(pResult->rt._03, pResult->rt._13, pResult->rt._23); + + math::MTX34Trans(pW, pW1, &trans); + } else { + math::MTX34 temp; + + math::MTX34Scale(&temp, pS1, &pResult->rt); + math::MTX34Mult(pW, pW1, &temp); + } + } else if (detail::WorldMtxAttr::IsScaleOne(attr)) { + math::MTX34Mult(pW, pW1, &pResult->rt); + } else { + math::MTX34Scale(pW, pW1, pS1); + math::MTX34Mult(pW, pW, &pResult->rt); + } + + if (flag & ChrAnmResult::FLAG_SCALE_ONE) { + newAttr = detail::WorldMtxAttr::AnmScaleOne(newAttr); + pS->x = pS->y = pS->z = 1.0f; + } else { + newAttr = detail::WorldMtxAttr::AnmNotScaleOne(newAttr); + *pS = pResult->s; + } + + if (flag & ChrAnmResult::FLAG_SCALE_UNIFORM) { + newAttr = detail::WorldMtxAttr::AnmScaleUniform(newAttr); + } else { + newAttr = detail::WorldMtxAttr::AnmNotScaleUniform(newAttr); + } + + return newAttr; +} + +} // namespace dcc +} // namespace detail +} // namespace g3d +} // namespace nw4r diff --git a/src/nw4r/g3d/g3d_maya.cpp b/src/nw4r/g3d/dcc/g3d_maya.cpp similarity index 82% rename from src/nw4r/g3d/g3d_maya.cpp rename to src/nw4r/g3d/dcc/g3d_maya.cpp index ad54068b..38cfa04a 100644 --- a/src/nw4r/g3d/g3d_maya.cpp +++ b/src/nw4r/g3d/dcc/g3d_maya.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -6,7 +6,7 @@ namespace detail { namespace dcc { namespace { -void MakeTexSrtMtx_S(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_S(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 = rSrt.Su; pMtx->_01 = 0.0f; pMtx->_02 = 0.0f; @@ -18,7 +18,7 @@ void MakeTexSrtMtx_S(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = 1.0f - rSrt.Sv; } -void MakeTexSrtMtx_R(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_R(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -36,7 +36,7 @@ void MakeTexSrtMtx_R(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = cosPart + sinPart; } -void MakeTexSrtMtx_T(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_T(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 = 1.0f; pMtx->_01 = 0.0f; pMtx->_02 = 0.0f; @@ -48,7 +48,7 @@ void MakeTexSrtMtx_T(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = rSrt.Tv; } -void MakeTexSrtMtx_SR(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_SR(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -68,7 +68,7 @@ void MakeTexSrtMtx_SR(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = 0.5f * (svsr - svcr - rSrt.Sv) + 1.0f; } -void MakeTexSrtMtx_RT(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_RT(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -86,7 +86,7 @@ void MakeTexSrtMtx_RT(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = cosPart + sinPart + rSrt.Tv; } -void MakeTexSrtMtx_ST(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_ST(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 = rSrt.Su; pMtx->_01 = 0.0f; pMtx->_02 = 0.0f; @@ -98,7 +98,7 @@ void MakeTexSrtMtx_ST(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = rSrt.Sv * (rSrt.Tv - 1.0f) + 1.0f; } -void MakeTexSrtMtx_SRT(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_SRT(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -116,7 +116,7 @@ void MakeTexSrtMtx_SRT(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = rSrt.Sv * (cosPart + sinPart + rSrt.Tv) + 1.0f; } -void ProductTexSrtMtx_S(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_S(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 *= rSrt.Su; pMtx->_01 *= rSrt.Su; pMtx->_02 *= rSrt.Su; @@ -128,7 +128,7 @@ void ProductTexSrtMtx_S(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = 1.0f + pMtx->_13 * rSrt.Sv - rSrt.Sv; } -void ProductTexSrtMtx_R(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_R(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; f32 _0x, _1x; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -157,12 +157,12 @@ void ProductTexSrtMtx_R(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = _1x; } -void ProductTexSrtMtx_T(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_T(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_03 += -rSrt.Tu; pMtx->_13 += rSrt.Tv; } -void ProductTexSrtMtx_SR(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_SR(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; f32 _0x, _1x; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -201,7 +201,7 @@ void ProductTexSrtMtx_SR(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = _1x; } -void ProductTexSrtMtx_RT(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_RT(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; f32 _0x, _1x; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -230,7 +230,7 @@ void ProductTexSrtMtx_RT(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = _1x; } -void ProductTexSrtMtx_ST(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_ST(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 *= rSrt.Su; pMtx->_01 *= rSrt.Su; pMtx->_02 *= rSrt.Su; @@ -242,7 +242,7 @@ void ProductTexSrtMtx_ST(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = rSrt.Sv * (pMtx->_13 + rSrt.Tv - 1.0f) + 1.0f; } -void ProductTexSrtMtx_SRT(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_SRT(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; f32 _0x, _1x; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -267,11 +267,9 @@ void ProductTexSrtMtx_SRT(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_02 = _0x; pMtx->_12 = _1x; - _0x = sucr * (pMtx->_03 - 0.5f) + susr * (pMtx->_13 - 0.5f) + - (0.5f - rSrt.Tu) * rSrt.Su; + _0x = sucr * (pMtx->_03 - 0.5f) + susr * (pMtx->_13 - 0.5f) + (0.5f - rSrt.Tu) * rSrt.Su; - _1x = -svsr * (0.5f + pMtx->_03) + svcr * (pMtx->_13 - 0.5f) - - (0.5f - rSrt.Tv) * rSrt.Sv + 1.0f; + _1x = -svsr * (0.5f + pMtx->_03) + svcr * (pMtx->_13 - 0.5f) - (0.5f - rSrt.Tv) * rSrt.Sv + 1.0f; pMtx->_03 = _0x; pMtx->_13 = _1x; @@ -279,10 +277,9 @@ void ProductTexSrtMtx_SRT(math::MTX34* pMtx, const TexSrt& rSrt) { } // namespace -typedef void (*CalcTexMtxFunc)(math::MTX34* pMtx, const TexSrt& rSrt); +typedef void (*CalcTexMtxFunc)(math::MTX34 *pMtx, const TexSrt &rSrt); -bool CalcTexMtx_Maya(math::MTX34* pMtx, bool set, const TexSrt& rSrt, - TexSrt::Flag flag) { +bool CalcTexMtx_Maya(math::MTX34 *pMtx, bool set, const TexSrt &rSrt, TexSrt::Flag flag) { // Extract S/R/T flags u32 index = flag >> 1 & 0b111; @@ -325,12 +322,39 @@ bool CalcTexMtx_Maya(math::MTX34* pMtx, bool set, const TexSrt& rSrt, return true; } -u32 CalcWorldMtx_Maya_SSC_Apply(math::MTX34* pW, math::VEC3* pS, - const math::MTX34* pW1, const math::VEC3* pS1, - u32 attr, const ChrAnmResult* pResult) { +u32 CalcWorldMtx_Maya_SSC_Apply( + math::MTX34 *pW, math::VEC3 *pS, const math::MTX34 *pW1, const math::VEC3 *pS1, u32 attr, + const ChrAnmResult *pResult +) { u32 flag = pResult->flags; u32 newAttr = attr; + if ((flag & ChrAnmResult::FLAG_MTX_IDENT) || (flag & ChrAnmResult::FLAG_ROT_TRANS_ZERO)) { + math::MTX34Copy(pW, pW1); + } else if (flag & ChrAnmResult::FLAG_ROT_ZERO) { + if (detail::WorldMtxAttr::IsScaleOne(attr)) { + math::VEC3 trans(pResult->rt._03, pResult->rt._13, pResult->rt._23); + + math::MTX34Trans(pW, pW1, &trans); + } else { + math::VEC3 trans(pS1->x * pResult->rt._03, pS1->y * pResult->rt._13, pS1->z * pResult->rt._23); + + math::MTX34Trans(pW, pW1, &trans); + } + } else if (detail::WorldMtxAttr::IsScaleOne(attr)) { + math::MTX34Mult(pW, pW1, &pResult->rt); + } else { + math::MTX34 m; + + math::MTX34Copy(&m, &pResult->rt); + + m._03 *= pS1->x; + m._13 *= pS1->y; + m._23 *= pS1->z; + + math::MTX34Mult(pW, pW1, &m); + } + if (flag & ChrAnmResult::FLAG_SCALE_ONE) { newAttr = detail::WorldMtxAttr::AnmScaleOne(newAttr); pS->x = pS->y = pS->z = 1.0f; @@ -339,34 +363,6 @@ u32 CalcWorldMtx_Maya_SSC_Apply(math::MTX34* pW, math::VEC3* pS, *pS = pResult->s; } - if ((flag & ChrAnmResult::FLAG_MTX_IDENT) || - (flag & ChrAnmResult::FLAG_ROT_TRANS_ZERO)) { - - math::MTX34Copy(pW, pW1); - } else if (flag & ChrAnmResult::FLAG_ROT_ZERO) { - - if (detail::WorldMtxAttr::IsScaleOne(attr)) { - math::VEC3 trans(pResult->rt._03, pResult->rt._13, pResult->rt._23); - - math::MTX34Trans(pW, pW1, &trans); - } else { - math::VEC3 trans(pS1->x * pResult->rt._03, pS1->y * pResult->rt._13, - pS1->z * pResult->rt._23); - - math::MTX34Trans(pW, pW1, &trans); - } - } else if (detail::WorldMtxAttr::IsScaleOne(attr)) { - math::MTX34Mult(pW, pW1, &pResult->rt); - } else { - math::MTX34Copy(pW, &pResult->rt); - - pW->_03 *= pS1->x; - pW->_13 *= pS1->y; - pW->_23 *= pS1->z; - - math::MTX34Mult(pW, pW1, pW); - } - if (flag & ChrAnmResult::FLAG_SCALE_UNIFORM) { newAttr = detail::WorldMtxAttr::AnmScaleUniform(newAttr); } else { diff --git a/src/nw4r/g3d/g3d_xsi.cpp b/src/nw4r/g3d/dcc/g3d_xsi.cpp similarity index 83% rename from src/nw4r/g3d/g3d_xsi.cpp rename to src/nw4r/g3d/dcc/g3d_xsi.cpp index 3847e62f..71535c08 100644 --- a/src/nw4r/g3d/g3d_xsi.cpp +++ b/src/nw4r/g3d/dcc/g3d_xsi.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -6,7 +6,7 @@ namespace detail { namespace dcc { namespace { -void MakeTexSrtMtx_S(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_S(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 = rSrt.Su; pMtx->_01 = 0.0f; pMtx->_02 = 0.0f; @@ -18,7 +18,7 @@ void MakeTexSrtMtx_S(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = 1.0f - rSrt.Sv; } -void MakeTexSrtMtx_R(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_R(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -33,7 +33,7 @@ void MakeTexSrtMtx_R(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = 1.0f - cosR; } -void MakeTexSrtMtx_T(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_T(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 = 1.0f; pMtx->_01 = 0.0f; pMtx->_02 = 0.0f; @@ -45,7 +45,7 @@ void MakeTexSrtMtx_T(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = rSrt.Tv; } -void MakeTexSrtMtx_SR(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_SR(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -65,7 +65,7 @@ void MakeTexSrtMtx_SR(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = -svcr + 1.0f; } -void MakeTexSrtMtx_RT(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_RT(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -80,7 +80,7 @@ void MakeTexSrtMtx_RT(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = (-cosR - sinR * rSrt.Tu) + cosR * rSrt.Tv + 1.0f; } -void MakeTexSrtMtx_ST(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_ST(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 = rSrt.Su; pMtx->_01 = 0.0f; pMtx->_02 = 0.0f; @@ -92,7 +92,7 @@ void MakeTexSrtMtx_ST(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = rSrt.Sv * (rSrt.Tv - 1.0f) + 1.0f; } -void MakeTexSrtMtx_SRT(math::MTX34* pMtx, const TexSrt& rSrt) { +void MakeTexSrtMtx_SRT(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -112,7 +112,7 @@ void MakeTexSrtMtx_SRT(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = (-svcr - svsr * rSrt.Tu) + svcr * rSrt.Tv + 1.0f; } -void ProductTexSrtMtx_S(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_S(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 *= rSrt.Su; pMtx->_01 *= rSrt.Su; pMtx->_02 *= rSrt.Su; @@ -124,7 +124,7 @@ void ProductTexSrtMtx_S(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = rSrt.Sv * (pMtx->_13 - 1.0f) + 1.0f; } -void ProductTexSrtMtx_R(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_R(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; f32 _0x, _1x; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -150,12 +150,12 @@ void ProductTexSrtMtx_R(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = _1x; } -void ProductTexSrtMtx_T(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_T(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_03 -= rSrt.Tu; pMtx->_13 += rSrt.Tv; } -void ProductTexSrtMtx_SR(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_SR(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; f32 _0x, _1x; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -187,7 +187,7 @@ void ProductTexSrtMtx_SR(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = _1x; } -void ProductTexSrtMtx_RT(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_RT(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; f32 _0x, _1x; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -221,7 +221,7 @@ void ProductTexSrtMtx_RT(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = _1x; } -void ProductTexSrtMtx_ST(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_ST(math::MTX34 *pMtx, const TexSrt &rSrt) { pMtx->_00 *= rSrt.Su; pMtx->_01 *= rSrt.Su; pMtx->_02 *= rSrt.Su; @@ -233,7 +233,7 @@ void ProductTexSrtMtx_ST(math::MTX34* pMtx, const TexSrt& rSrt) { pMtx->_13 = (pMtx->_13 + rSrt.Tv - 1.0f) * rSrt.Sv + 1.0f; } -void ProductTexSrtMtx_SRT(math::MTX34* pMtx, const TexSrt& rSrt) { +void ProductTexSrtMtx_SRT(math::MTX34 *pMtx, const TexSrt &rSrt) { f32 sinR, cosR; f32 _0x, _1x; math::SinCosDeg(&sinR, &cosR, rSrt.R); @@ -274,10 +274,9 @@ void ProductTexSrtMtx_SRT(math::MTX34* pMtx, const TexSrt& rSrt) { } // namespace -typedef void (*CalcTexMtxFunc)(math::MTX34* pMtx, const TexSrt& rSrt); +typedef void (*CalcTexMtxFunc)(math::MTX34 *pMtx, const TexSrt &rSrt); -bool CalcTexMtx_Xsi(math::MTX34* pMtx, bool set, const TexSrt& rSrt, - TexSrt::Flag flag) { +bool CalcTexMtx_Xsi(math::MTX34 *pMtx, bool set, const TexSrt &rSrt, TexSrt::Flag flag) { // Extract S/R/T flags u32 index = flag >> 1 & 0b111; @@ -320,12 +319,39 @@ bool CalcTexMtx_Xsi(math::MTX34* pMtx, bool set, const TexSrt& rSrt, return true; } -u32 CalcWorldMtx_Xsi(math::MTX34* pW, math::VEC3* pS, const math::MTX34* pW1, - const math::VEC3* pS1, u32 attr, - const ChrAnmResult* pResult) { +u32 CalcWorldMtx_Xsi( + math::MTX34 *pW, math::VEC3 *pS, const math::MTX34 *pW1, const math::VEC3 *pS1, u32 attr, + const ChrAnmResult *pResult +) { u32 flag = pResult->flags; u32 newAttr = attr; + if ((flag & ChrAnmResult::FLAG_MTX_IDENT) || (flag & ChrAnmResult::FLAG_ROT_TRANS_ZERO)) { + math::MTX34Copy(pW, pW1); + } else if (flag & ChrAnmResult::FLAG_ROT_ZERO) { + if (detail::WorldMtxAttr::IsAllScaleOne(attr)) { + math::VEC3 trans(pResult->rt._03, pResult->rt._13, pResult->rt._23); + + math::MTX34Trans(pW, pW1, &trans); + } else { + math::VEC3 trans(pS1->x * pResult->rt._03, pS1->y * pResult->rt._13, pS1->z * pResult->rt._23); + + math::MTX34Trans(pW, pW1, &trans); + } + } else if (detail::WorldMtxAttr::IsAllScaleOne(attr)) { + math::MTX34Mult(pW, pW1, &pResult->rt); + } else { + math::MTX34 m; + + math::MTX34Copy(&m, &pResult->rt); + + m._03 *= pS1->x; + m._13 *= pS1->y; + m._23 *= pS1->z; + + math::MTX34Mult(pW, pW1, &m); + } + if (flag & ChrAnmResult::FLAG_SCALE_ONE) { newAttr = detail::WorldMtxAttr::AnmScaleOne(newAttr); *pS = *pS1; @@ -336,34 +362,6 @@ u32 CalcWorldMtx_Xsi(math::MTX34* pW, math::VEC3* pS, const math::MTX34* pW1, pS->z = pS1->z * pResult->s.z; } - if ((flag & ChrAnmResult::FLAG_MTX_IDENT) || - (flag & ChrAnmResult::FLAG_ROT_TRANS_ZERO)) { - - math::MTX34Copy(pW, pW1); - } else if (flag & ChrAnmResult::FLAG_ROT_ZERO) { - - if (detail::WorldMtxAttr::IsAllScaleOne(attr)) { - math::VEC3 trans(pResult->rt._03, pResult->rt._13, pResult->rt._23); - - math::MTX34Trans(pW, pW1, &trans); - } else { - math::VEC3 trans(pS1->x * pResult->rt._03, pS1->y * pResult->rt._13, - pS1->z * pResult->rt._23); - - math::MTX34Trans(pW, pW1, &trans); - } - } else if (detail::WorldMtxAttr::IsAllScaleOne(attr)) { - math::MTX34Mult(pW, pW1, &pResult->rt); - } else { - math::MTX34Copy(pW, &pResult->rt); - - pW->_03 *= pS1->x; - pW->_13 *= pS1->y; - pW->_23 *= pS1->z; - - math::MTX34Mult(pW, pW1, pW); - } - if (flag & ChrAnmResult::FLAG_SCALE_UNIFORM) { newAttr = detail::WorldMtxAttr::AnmScaleUniform(newAttr); } else { diff --git a/src/nw4r/g3d/g3d_anmchr.cpp b/src/nw4r/g3d/g3d_anmchr.cpp index 82d64f82..5541270f 100644 --- a/src/nw4r/g3d/g3d_anmchr.cpp +++ b/src/nw4r/g3d/g3d_anmchr.cpp @@ -1,8 +1,9 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export +#include "nw4r/math/math_types.h" -#include +#include "nw4r/ut.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export #include @@ -78,7 +79,7 @@ AnmObjChrRes *AnmObjChr::Detach(int idx) { return NULL; } -void AnmObjChr::SetWeight(int idx, f32 weight){ +void AnmObjChr::SetWeight(int idx, f32 weight) { #pragma unused(idx) #pragma unused(weight) } @@ -479,6 +480,17 @@ const ChrAnmResult *AnmObjChrBlend::GetResult(ChrAnmResult *pResult, u32 idx) { f32 t = weight * invAddedWeight; math::C_QUATSlerp(&rot, &rot, &q, t); } else if (!(flags & ChrAnmResult::FLAG_ROT_ZERO)) { + if (i == 0) { + firstRot._00 = pMyResult->rt._00; + firstRot._01 = pMyResult->rt._01; + firstRot._02 = pMyResult->rt._02; + firstRot._10 = pMyResult->rt._10; + firstRot._11 = pMyResult->rt._11; + firstRot._12 = pMyResult->rt._12; + firstRot._20 = pMyResult->rt._20; + firstRot._21 = pMyResult->rt._21; + firstRot._22 = pMyResult->rt._22; + } pResult->rt._00 += pMyResult->rt._00 * ratio; pResult->rt._01 += pMyResult->rt._01 * ratio; pResult->rt._02 += pMyResult->rt._02 * ratio; @@ -487,6 +499,9 @@ const ChrAnmResult *AnmObjChrBlend::GetResult(ChrAnmResult *pResult, u32 idx) { pResult->rt._11 += pMyResult->rt._11 * ratio; pResult->rt._12 += pMyResult->rt._12 * ratio; } else { + if (i == 0) { + math::MTX33Identity(&firstRot); + } pResult->rt._00 += ratio; pResult->rt._11 += ratio; } @@ -523,9 +538,21 @@ const ChrAnmResult *AnmObjChrBlend::GetResult(ChrAnmResult *pResult, u32 idx) { math::VEC3 *pV2 = reinterpret_cast(&pResult->rt._20); math::VEC3Cross(pV2, pV0, pV1); - math::VEC3Normalize(pV0, pV0); - math::VEC3Normalize(pV2, pV2); - math::VEC3Cross(pV1, pV2, pV0); + if (math::VEC3LenSq(pV0) == 0.f || math::VEC3LenSq(pV2) == 0.f) { + pResult->rt._00 = firstRot._00; + pResult->rt._01 = firstRot._01; + pResult->rt._02 = firstRot._02; + pResult->rt._10 = firstRot._10; + pResult->rt._11 = firstRot._11; + pResult->rt._12 = firstRot._12; + pResult->rt._20 = firstRot._20; + pResult->rt._21 = firstRot._21; + pResult->rt._22 = firstRot._22; + } else { + math::VEC3Normalize(pV0, pV0); + math::VEC3Normalize(pV2, pV2); + math::VEC3Cross(pV1, pV2, pV0); + } } pResult->flags &= ~ChrAnmResult::FLAG_ROT_RAW_FMT; @@ -606,6 +633,9 @@ f32 AnmObjChrRes::GetFrame() const { void AnmObjChrRes::SetUpdateRate(f32 rate) { SetRate(rate); + if (rate == 0.f && mpResultCache != NULL) { + UpdateCache(); + } } f32 AnmObjChrRes::GetUpdateRate() const { @@ -613,10 +643,12 @@ f32 AnmObjChrRes::GetUpdateRate() const { } void AnmObjChrRes::UpdateFrame() { - UpdateFrm(); + if (GetRate() != 0.f) { + UpdateFrm(); - if (mpResultCache != NULL) { - UpdateCache(); + if (mpResultCache != NULL) { + UpdateCache(); + } } } diff --git a/src/nw4r/g3d/g3d_anmclr.cpp b/src/nw4r/g3d/g3d_anmclr.cpp index 8a7585c8..5773949b 100644 --- a/src/nw4r/g3d/g3d_anmclr.cpp +++ b/src/nw4r/g3d/g3d_anmclr.cpp @@ -1,6 +1,6 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/ut.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -15,12 +15,8 @@ NW4R_G3D_RTTI_DEF(AnmObjMatClrRes); * AnmObjMatClr * ******************************************************************************/ -AnmObjMatClr::AnmObjMatClr(MEMAllocator* pAllocator, u16* pBindingBuf, - int numBinding) - : AnmObj(pAllocator, NULL), - mNumBinding(numBinding), - mpBinding(pBindingBuf) { - +AnmObjMatClr::AnmObjMatClr(MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding) + : AnmObj(pAllocator, NULL), mNumBinding(numBinding), mpBinding(pBindingBuf) { Release(); } @@ -40,14 +36,14 @@ void AnmObjMatClr::Release() { SetAnmFlag(FLAG_ANM_BOUND, false); } -AnmObjMatClrRes* AnmObjMatClr::Attach(int idx, AnmObjMatClrRes* pRes) { +AnmObjMatClrRes *AnmObjMatClr::Attach(int idx, AnmObjMatClrRes *pRes) { #pragma unused(idx) #pragma unused(pRes) return NULL; } -AnmObjMatClrRes* AnmObjMatClr::Detach(int idx) { +AnmObjMatClrRes *AnmObjMatClr::Detach(int idx) { #pragma unused(idx) return NULL; @@ -60,14 +56,12 @@ void AnmObjMatClr::DetachAll() {} * AnmObjMatClrNode * ******************************************************************************/ -AnmObjMatClrNode::AnmObjMatClrNode(MEMAllocator* pAllocator, u16* pBindingBuf, - int numBinding, - AnmObjMatClrRes** ppChildrenBuf, - int numChildren) +AnmObjMatClrNode::AnmObjMatClrNode( + MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding, AnmObjMatClrRes **ppChildrenBuf, int numChildren +) : AnmObjMatClr(pAllocator, pBindingBuf, numBinding), mChildrenArraySize(numChildren), mpChildrenArray(ppChildrenBuf) { - for (int i = 0; i < mChildrenArraySize; i++) { mpChildrenArray[i] = NULL; } @@ -77,8 +71,8 @@ AnmObjMatClrNode::~AnmObjMatClrNode() { DetachAll(); } -AnmObjMatClrRes* AnmObjMatClrNode::Attach(int idx, AnmObjMatClrRes* pRes) { - AnmObjMatClrRes* pOld = Detach(idx); +AnmObjMatClrRes *AnmObjMatClrNode::Attach(int idx, AnmObjMatClrRes *pRes) { + AnmObjMatClrRes *pOld = Detach(idx); bool hasAnm = false; for (u32 i = 0; i < mNumBinding; i++) { @@ -99,8 +93,8 @@ AnmObjMatClrRes* AnmObjMatClrNode::Attach(int idx, AnmObjMatClrRes* pRes) { return pOld; } -AnmObjMatClrRes* AnmObjMatClrNode::Detach(int idx) { - AnmObjMatClrRes* pOld = mpChildrenArray[idx]; +AnmObjMatClrRes *AnmObjMatClrNode::Detach(int idx) { + AnmObjMatClrRes *pOld = mpChildrenArray[idx]; if (pOld != NULL) { pOld->G3dProc(G3DPROC_DETACH_PARENT, 0, this); @@ -111,7 +105,7 @@ AnmObjMatClrRes* AnmObjMatClrNode::Detach(int idx) { u16 binding = BINDING_UNDEFINED; for (int j = 0; j < mChildrenArraySize; j++) { - AnmObjMatClrRes* pChild = mpChildrenArray[j]; + AnmObjMatClrRes *pChild = mpChildrenArray[j]; if (pChild == NULL || !pChild->TestDefined(i)) { continue; @@ -187,7 +181,7 @@ bool AnmObjMatClrNode::Bind(const ResMdl mdl) { bool success = false; for (int i = 0; i < mChildrenArraySize; i++) { - AnmObjMatClrRes* pChild = mpChildrenArray[i]; + AnmObjMatClrRes *pChild = mpChildrenArray[i]; if (pChild == NULL) { continue; } @@ -216,30 +210,30 @@ void AnmObjMatClrNode::Release() { AnmObjMatClr::Release(); } -void AnmObjMatClrNode::G3dProc(u32 task, u32 param, void* pInfo) { +void AnmObjMatClrNode::G3dProc(u32 task, u32 param, void *pInfo) { #pragma unused(param) switch (task) { - case G3DPROC_CHILD_DETACHED: { - for (int i = 0; i < mChildrenArraySize; i++) { - if (mpChildrenArray[i] == pInfo) { - Detach(i); - return; + case G3DPROC_CHILD_DETACHED: { + for (int i = 0; i < mChildrenArraySize; i++) { + if (mpChildrenArray[i] == pInfo) { + Detach(i); + return; + } } + + break; } - break; - } + case G3DPROC_DETACH_PARENT: { + SetParent(NULL); + break; + } - case G3DPROC_DETACH_PARENT: { - SetParent(NULL); - break; - } - - case G3DPROC_ATTACH_PARENT: { - SetParent(static_cast(pInfo)); - break; - } + case G3DPROC_ATTACH_PARENT: { + SetParent(static_cast(pInfo)); + break; + } } } @@ -248,9 +242,8 @@ void AnmObjMatClrNode::G3dProc(u32 task, u32 param, void* pInfo) { * AnmObjMatClrOverride * ******************************************************************************/ -AnmObjMatClrOverride* AnmObjMatClrOverride::Construct(MEMAllocator* pAllocator, - u32* pSize, ResMdl mdl, - int numChildren) { +AnmObjMatClrOverride * +AnmObjMatClrOverride::Construct(MEMAllocator *pAllocator, u32 *pSize, ResMdl mdl, int numChildren) { if (!mdl.IsValid()) { return NULL; } @@ -260,7 +253,7 @@ AnmObjMatClrOverride* AnmObjMatClrOverride::Construct(MEMAllocator* pAllocator, u32 objSize = sizeof(AnmObjMatClrOverride); u32 bindSize = bindNum * sizeof(u16); - u32 childrenSize = numChildren * sizeof(AnmObjMatClrRes*); + u32 childrenSize = numChildren * sizeof(AnmObjMatClrRes *); u32 bindOfs = align4(objSize); u32 childrenOfs = align4(bindOfs + bindSize); @@ -274,7 +267,7 @@ AnmObjMatClrOverride* AnmObjMatClrOverride::Construct(MEMAllocator* pAllocator, return NULL; } - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer == NULL) { return NULL; } @@ -289,16 +282,15 @@ AnmObjMatClrOverride* AnmObjMatClrOverride::Construct(MEMAllocator* pAllocator, // clang-format on } -const ClrAnmResult* AnmObjMatClrOverride::GetResult(ClrAnmResult* pResult, - u32 idx) { +const ClrAnmResult *AnmObjMatClrOverride::GetResult(ClrAnmResult *pResult, u32 idx) { for (int i = mChildrenArraySize - 1; i >= 0; i--) { - AnmObjMatClrRes* pChild = mpChildrenArray[i]; + AnmObjMatClrRes *pChild = mpChildrenArray[i]; if (pChild == NULL || !pChild->TestExistence(idx)) { continue; } - const ClrAnmResult* pChildResult = pChild->GetResult(pResult, idx); + const ClrAnmResult *pChildResult = pChild->GetResult(pResult, idx); if (pChildResult->bRgbaExist != 0) { return pChildResult; @@ -314,9 +306,8 @@ const ClrAnmResult* AnmObjMatClrOverride::GetResult(ClrAnmResult* pResult, * AnmObjMatClrRes * ******************************************************************************/ -AnmObjMatClrRes* AnmObjMatClrRes::Construct(MEMAllocator* pAllocator, - u32* pSize, ResAnmClr clr, - ResMdl mdl, bool cache) { +AnmObjMatClrRes * +AnmObjMatClrRes::Construct(MEMAllocator *pAllocator, u32 *pSize, ResAnmClr clr, ResMdl mdl, bool cache) { if (!clr.IsValid() || !mdl.IsValid()) { return NULL; } @@ -339,31 +330,25 @@ AnmObjMatClrRes* AnmObjMatClrRes::Construct(MEMAllocator* pAllocator, return NULL; } - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer == NULL) { return NULL; } - ClrAnmResult* pCacheBuf = - cache - ? reinterpret_cast(pBuffer + sizeof(AnmObjMatClrRes)) - : NULL; + ClrAnmResult *pCacheBuf = cache ? reinterpret_cast(pBuffer + sizeof(AnmObjMatClrRes)) : NULL; - u16* pBindingBuf = - reinterpret_cast(cacheSize + (pBuffer + sizeof(AnmObjMatClrRes))); + u16 *pBindingBuf = reinterpret_cast(cacheSize + (pBuffer + sizeof(AnmObjMatClrRes))); - return new (pBuffer) - AnmObjMatClrRes(pAllocator, clr, pBindingBuf, bindNum, pCacheBuf); + return new (pBuffer) AnmObjMatClrRes(pAllocator, clr, pBindingBuf, bindNum, pCacheBuf); } -AnmObjMatClrRes::AnmObjMatClrRes(MEMAllocator* pAllocator, ResAnmClr clr, - u16* pBindingBuf, int numBinding, - ClrAnmResult* pCacheBuf) +AnmObjMatClrRes::AnmObjMatClrRes( + MEMAllocator *pAllocator, ResAnmClr clr, u16 *pBindingBuf, int numBinding, ClrAnmResult *pCacheBuf +) : AnmObjMatClr(pAllocator, pBindingBuf, numBinding), FrameCtrl(0.0f, clr.GetNumFrame(), GetAnmPlayPolicy(clr.GetAnmPolicy())), mRes(clr), mpResultCache(pCacheBuf) { - if (mpResultCache != NULL) { UpdateCache(); } @@ -383,6 +368,9 @@ f32 AnmObjMatClrRes::GetFrame() const { void AnmObjMatClrRes::SetUpdateRate(f32 rate) { SetRate(rate); + if (rate == 0.f && mpResultCache != NULL) { + UpdateCache(); + } } f32 AnmObjMatClrRes::GetUpdateRate() const { @@ -390,10 +378,11 @@ f32 AnmObjMatClrRes::GetUpdateRate() const { } void AnmObjMatClrRes::UpdateFrame() { - UpdateFrm(); - - if (mpResultCache != NULL) { - UpdateCache(); + if (GetRate() != 0.f) { + UpdateFrm(); + if (mpResultCache != NULL) { + UpdateCache(); + } } } @@ -402,7 +391,7 @@ bool AnmObjMatClrRes::Bind(const ResMdl mdl) { bool success = false; for (u16 i = 0; i < numAnim; i++) { - const ResAnmClrMatData* pData = mRes.GetMatAnm(i); + const ResAnmClrMatData *pData = mRes.GetMatAnm(i); // Seek back from name string to start of ResName ResName name(ut::AddOffsetToPtr(pData, pData->name - 4)); @@ -420,7 +409,7 @@ bool AnmObjMatClrRes::Bind(const ResMdl mdl) { return success; } -const ClrAnmResult* AnmObjMatClrRes::GetResult(ClrAnmResult* pResult, u32 idx) { +const ClrAnmResult *AnmObjMatClrRes::GetResult(ClrAnmResult *pResult, u32 idx) { u32 id = mpBinding[idx]; if (id & (BINDING_UNDEFINED | BINDING_INVALID)) { @@ -449,24 +438,24 @@ void AnmObjMatClrRes::UpdateCache() { } } -void AnmObjMatClrRes::G3dProc(u32 task, u32 param, void* pInfo) { +void AnmObjMatClrRes::G3dProc(u32 task, u32 param, void *pInfo) { #pragma unused(param) switch (task) { - case G3DPROC_UPDATEFRAME: { - UpdateFrame(); - break; - } + case G3DPROC_UPDATEFRAME: { + UpdateFrame(); + break; + } - case G3DPROC_DETACH_PARENT: { - SetParent(NULL); - break; - } + case G3DPROC_DETACH_PARENT: { + SetParent(NULL); + break; + } - case G3DPROC_ATTACH_PARENT: { - SetParent(static_cast(pInfo)); - break; - } + case G3DPROC_ATTACH_PARENT: { + SetParent(static_cast(pInfo)); + break; + } } } @@ -475,61 +464,51 @@ void AnmObjMatClrRes::G3dProc(u32 task, u32 param, void* pInfo) { * ApplyClrAnmResult * ******************************************************************************/ -void ApplyClrAnmResult(ResMatChan chan, ResMatTevColor tev, - const ClrAnmResult* pResult) { +void ApplyClrAnmResult(ResMatChan chan, ResMatTevColor tev, const ClrAnmResult *pResult) { ut::Color c; - if (pResult->bRgbaExist & - (1 << ClrAnmResult::CLA_CLR0 | 1 << ClrAnmResult::CLA_CLR1 | - 1 << ClrAnmResult::CLA_AMB0 | 1 << ClrAnmResult::CLA_AMB1)) { - + if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_CLR0 | 1 << ClrAnmResult::CLA_CLR1 | 1 << ClrAnmResult::CLA_AMB0 | + 1 << ClrAnmResult::CLA_AMB1)) { if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_CLR0)) { - GXColor& rMatColor = chan.ref().chan[0].matColor; + GXColor &rMatColor = chan.ref().chan[0].matColor; c = rMatColor; - rMatColor = (c & pResult->rgbaMask[ClrAnmResult::CLA_CLR0]) | - pResult->rgba[ClrAnmResult::CLA_CLR0]; + rMatColor = (c & pResult->rgbaMask[ClrAnmResult::CLA_CLR0]) | pResult->rgba[ClrAnmResult::CLA_CLR0]; } if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_AMB0)) { - GXColor& rMatColor = chan.ref().chan[0].ambColor; + GXColor &rMatColor = chan.ref().chan[0].ambColor; c = rMatColor; - rMatColor = (c & pResult->rgbaMask[ClrAnmResult::CLA_AMB0]) | - pResult->rgba[ClrAnmResult::CLA_AMB0]; + rMatColor = (c & pResult->rgbaMask[ClrAnmResult::CLA_AMB0]) | pResult->rgba[ClrAnmResult::CLA_AMB0]; } if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_CLR1)) { - GXColor& rMatColor = chan.ref().chan[1].matColor; + GXColor &rMatColor = chan.ref().chan[1].matColor; c = rMatColor; - rMatColor = (c & pResult->rgbaMask[ClrAnmResult::CLA_CLR1]) | - pResult->rgba[ClrAnmResult::CLA_CLR1]; + rMatColor = (c & pResult->rgbaMask[ClrAnmResult::CLA_CLR1]) | pResult->rgba[ClrAnmResult::CLA_CLR1]; } if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_AMB1)) { - GXColor& rMatColor = chan.ref().chan[1].ambColor; + GXColor &rMatColor = chan.ref().chan[1].ambColor; c = rMatColor; - rMatColor = (c & pResult->rgbaMask[ClrAnmResult::CLA_AMB1]) | - pResult->rgba[ClrAnmResult::CLA_AMB1]; + rMatColor = (c & pResult->rgbaMask[ClrAnmResult::CLA_AMB1]) | pResult->rgba[ClrAnmResult::CLA_AMB1]; } } - if (pResult->bRgbaExist & - (1 << ClrAnmResult::CLA_TEV0 | 1 << ClrAnmResult::CLA_TEV1 | - 1 << ClrAnmResult::CLA_TEV2 | 1 << ClrAnmResult::CLA_TEVK0 | - 1 << ClrAnmResult::CLA_TEVK1 | 1 << ClrAnmResult::CLA_TEVK2 | - 1 << ClrAnmResult::CLA_TEVK3)) { - + if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_TEV0 | 1 << ClrAnmResult::CLA_TEV1 | 1 << ClrAnmResult::CLA_TEV2 | + 1 << ClrAnmResult::CLA_TEVK0 | 1 << ClrAnmResult::CLA_TEVK1 | + 1 << ClrAnmResult::CLA_TEVK2 | 1 << ClrAnmResult::CLA_TEVK3)) { if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_TEV0)) { if (!tev.GXGetTevColor(GX_TEVREG0, &c)) { c = ut::Color::BLACK; } - tev.GXSetTevColor(GX_TEVREG0, - c & pResult->rgbaMask[ClrAnmResult::CLA_TEV0] | - pResult->rgba[ClrAnmResult::CLA_TEV0]); + tev.GXSetTevColor( + GX_TEVREG0, c & pResult->rgbaMask[ClrAnmResult::CLA_TEV0] | pResult->rgba[ClrAnmResult::CLA_TEV0] + ); } if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_TEV1)) { @@ -537,9 +516,9 @@ void ApplyClrAnmResult(ResMatChan chan, ResMatTevColor tev, c = ut::Color::BLACK; } - tev.GXSetTevColor(GX_TEVREG1, - c & pResult->rgbaMask[ClrAnmResult::CLA_TEV1] | - pResult->rgba[ClrAnmResult::CLA_TEV1]); + tev.GXSetTevColor( + GX_TEVREG1, c & pResult->rgbaMask[ClrAnmResult::CLA_TEV1] | pResult->rgba[ClrAnmResult::CLA_TEV1] + ); } if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_TEV2)) { @@ -547,9 +526,9 @@ void ApplyClrAnmResult(ResMatChan chan, ResMatTevColor tev, c = ut::Color::BLACK; } - tev.GXSetTevColor(GX_TEVREG2, - c & pResult->rgbaMask[ClrAnmResult::CLA_TEV2] | - pResult->rgba[ClrAnmResult::CLA_TEV2]); + tev.GXSetTevColor( + GX_TEVREG2, c & pResult->rgbaMask[ClrAnmResult::CLA_TEV2] | pResult->rgba[ClrAnmResult::CLA_TEV2] + ); } if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_TEVK0)) { @@ -557,9 +536,9 @@ void ApplyClrAnmResult(ResMatChan chan, ResMatTevColor tev, c = ut::Color::BLACK; } - tev.GXSetTevKColor(GX_KCOLOR0, - c & pResult->rgbaMask[ClrAnmResult::CLA_TEVK0] | - pResult->rgba[ClrAnmResult::CLA_TEVK0]); + tev.GXSetTevKColor( + GX_KCOLOR0, c & pResult->rgbaMask[ClrAnmResult::CLA_TEVK0] | pResult->rgba[ClrAnmResult::CLA_TEVK0] + ); } if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_TEVK1)) { @@ -567,9 +546,9 @@ void ApplyClrAnmResult(ResMatChan chan, ResMatTevColor tev, c = ut::Color::BLACK; } - tev.GXSetTevKColor(GX_KCOLOR1, - c & pResult->rgbaMask[ClrAnmResult::CLA_TEVK1] | - pResult->rgba[ClrAnmResult::CLA_TEVK1]); + tev.GXSetTevKColor( + GX_KCOLOR1, c & pResult->rgbaMask[ClrAnmResult::CLA_TEVK1] | pResult->rgba[ClrAnmResult::CLA_TEVK1] + ); } if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_TEVK2)) { @@ -577,9 +556,9 @@ void ApplyClrAnmResult(ResMatChan chan, ResMatTevColor tev, c = ut::Color::BLACK; } - tev.GXSetTevKColor(GX_KCOLOR2, - c & pResult->rgbaMask[ClrAnmResult::CLA_TEVK2] | - pResult->rgba[ClrAnmResult::CLA_TEVK2]); + tev.GXSetTevKColor( + GX_KCOLOR2, c & pResult->rgbaMask[ClrAnmResult::CLA_TEVK2] | pResult->rgba[ClrAnmResult::CLA_TEVK2] + ); } if (pResult->bRgbaExist & (1 << ClrAnmResult::CLA_TEVK3)) { @@ -587,9 +566,9 @@ void ApplyClrAnmResult(ResMatChan chan, ResMatTevColor tev, c = ut::Color::BLACK; } - tev.GXSetTevKColor(GX_KCOLOR3, - c & pResult->rgbaMask[ClrAnmResult::CLA_TEVK3] | - pResult->rgba[ClrAnmResult::CLA_TEVK3]); + tev.GXSetTevKColor( + GX_KCOLOR3, c & pResult->rgbaMask[ClrAnmResult::CLA_TEVK3] | pResult->rgba[ClrAnmResult::CLA_TEVK3] + ); } tev.DCStore(false); diff --git a/src/nw4r/g3d/g3d_anmobj.cpp b/src/nw4r/g3d/g3d_anmobj.cpp index ac34e1b5..ce2ea861 100644 --- a/src/nw4r/g3d/g3d_anmobj.cpp +++ b/src/nw4r/g3d/g3d_anmobj.cpp @@ -1,6 +1,6 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/src/nw4r/g3d/g3d_anmscn.cpp b/src/nw4r/g3d/g3d_anmscn.cpp index ec8520e5..98fcb6c5 100644 --- a/src/nw4r/g3d/g3d_anmscn.cpp +++ b/src/nw4r/g3d/g3d_anmscn.cpp @@ -1,11 +1,11 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export #include namespace nw4r { namespace g3d { -void AnmScn::GetLightSetting(LightSetting* pSetting) { +void AnmScn::GetLightSetting(LightSetting *pSetting) { const u32 numLightSet = GetLightSetMaxRefNumber(); const u32 numAmbLight = GetAmbLightMaxRefNumber(); const u32 numDiffLight = GetDiffuseLightMaxRefNumber(); @@ -21,18 +21,18 @@ void AnmScn::GetLightSetting(LightSetting* pSetting) { } if (numAmbLight > 0) { - AmbLightObj* pAmbObjArray = pSetting->GetAmbLightObjArray(); + AmbLightObj *pAmbObjArray = pSetting->GetAmbLightObjArray(); const u32 numAmbObj = pSetting->GetNumLightObj(); const u32 numLoadableAmb = std::min(numAmbLight, numAmbObj); for (u32 i = 0; i < numLoadableAmb; i++) { - AmbLightObj* pAmbObj = &pAmbObjArray[i]; - *reinterpret_cast(&pAmbObj->r) = GetAmbLightColor(i); + AmbLightObj *pAmbObj = &pAmbObjArray[i]; + *reinterpret_cast(&pAmbObj->r) = GetAmbLightColor(i); } } if (numDiffLight > 0) { - LightObj* pLightObjArray = pSetting->GetLightObjArray(); + LightObj *pLightObjArray = pSetting->GetLightObjArray(); const u32 numLightObj = pSetting->GetNumLightObj(); const u32 numSpecLight = GetNumSpecularLight(); @@ -41,13 +41,13 @@ void AnmScn::GetLightSetting(LightSetting* pSetting) { const u32 numLoadableLight = std::min(numLight, numLightObj); for (u32 i = 0; i < numLoadableDiffLight; i++) { - LightObj* pObj = &pLightObjArray[i]; + LightObj *pObj = &pLightObjArray[i]; pObj->Disable(); } for (u32 i = 0; i < numLoadableDiffLight; i++) { - LightObj* pDiffObj = &pLightObjArray[i]; - LightObj* pSpecObj = NULL; + LightObj *pDiffObj = &pLightObjArray[i]; + LightObj *pSpecObj = NULL; if (pDiffObj->IsEnable()) { continue; diff --git a/src/nw4r/g3d/g3d_anmshp.cpp b/src/nw4r/g3d/g3d_anmshp.cpp index 271c5b85..99fce6a5 100644 --- a/src/nw4r/g3d/g3d_anmshp.cpp +++ b/src/nw4r/g3d/g3d_anmshp.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -13,11 +13,8 @@ NW4R_G3D_RTTI_DEF(AnmObjShpRes); * AnmObjShp * ******************************************************************************/ -AnmObjShp::AnmObjShp(MEMAllocator* pAllocator, u16* pBindingBuf, int numBinding) - : AnmObj(pAllocator, NULL), - mNumBinding(numBinding), - mpBinding(pBindingBuf) { - +AnmObjShp::AnmObjShp(MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding) + : AnmObj(pAllocator, NULL), mNumBinding(numBinding), mpBinding(pBindingBuf) { Release(); } @@ -37,14 +34,14 @@ void AnmObjShp::Release() { SetAnmFlag(FLAG_ANM_BOUND, false); } -AnmObjShpRes* AnmObjShp::Attach(int idx, AnmObjShpRes* pRes) { +AnmObjShpRes *AnmObjShp::Attach(int idx, AnmObjShpRes *pRes) { #pragma unused(idx) #pragma unused(pRes) return NULL; } -AnmObjShpRes* AnmObjShp::Detach(int idx) { +AnmObjShpRes *AnmObjShp::Detach(int idx) { #pragma unused(idx) return NULL; @@ -68,13 +65,10 @@ void AnmObjShp::DetachAll() {} * AnmObjShpNode * ******************************************************************************/ -AnmObjShpNode::AnmObjShpNode(MEMAllocator* pAllocator, u16* pBindingBuf, - int numBinding, AnmObjShpRes** ppChildrenBuf, - int numChildren) - : AnmObjShp(pAllocator, pBindingBuf, numBinding), - mChildrenArraySize(numChildren), - mpChildrenArray(ppChildrenBuf) { - +AnmObjShpNode::AnmObjShpNode( + MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding, AnmObjShpRes **ppChildrenBuf, int numChildren +) + : AnmObjShp(pAllocator, pBindingBuf, numBinding), mChildrenArraySize(numChildren), mpChildrenArray(ppChildrenBuf) { for (int i = 0; i < mChildrenArraySize; i++) { mpChildrenArray[i] = NULL; } @@ -84,8 +78,8 @@ AnmObjShpNode::~AnmObjShpNode() { DetachAll(); } -AnmObjShpRes* AnmObjShpNode::Attach(int idx, AnmObjShpRes* pRes) { - AnmObjShpRes* pOld = Detach(idx); +AnmObjShpRes *AnmObjShpNode::Attach(int idx, AnmObjShpRes *pRes) { + AnmObjShpRes *pOld = Detach(idx); bool hasAnm = false; for (u32 i = 0; i < mNumBinding; i++) { @@ -106,8 +100,8 @@ AnmObjShpRes* AnmObjShpNode::Attach(int idx, AnmObjShpRes* pRes) { return pOld; } -AnmObjShpRes* AnmObjShpNode::Detach(int idx) { - AnmObjShpRes* pOld = mpChildrenArray[idx]; +AnmObjShpRes *AnmObjShpNode::Detach(int idx) { + AnmObjShpRes *pOld = mpChildrenArray[idx]; if (pOld != NULL) { pOld->G3dProc(G3DPROC_DETACH_PARENT, 0, this); @@ -118,7 +112,7 @@ AnmObjShpRes* AnmObjShpNode::Detach(int idx) { u16 binding = BINDING_UNDEFINED; for (int j = 0; j < mChildrenArraySize; j++) { - AnmObjShpRes* pChild = mpChildrenArray[j]; + AnmObjShpRes *pChild = mpChildrenArray[j]; if (pChild == NULL || !pChild->TestDefined(i)) { continue; @@ -194,7 +188,7 @@ bool AnmObjShpNode::Bind(const ResMdl mdl) { bool success = false; for (int i = 0; i < mChildrenArraySize; i++) { - AnmObjShpRes* pChild = mpChildrenArray[i]; + AnmObjShpRes *pChild = mpChildrenArray[i]; if (pChild == NULL) { continue; } @@ -223,30 +217,30 @@ void AnmObjShpNode::Release() { AnmObjShp::Release(); } -void AnmObjShpNode::G3dProc(u32 task, u32 param, void* pInfo) { +void AnmObjShpNode::G3dProc(u32 task, u32 param, void *pInfo) { #pragma unused(param) switch (task) { - case G3DPROC_CHILD_DETACHED: { - for (int i = 0; i < mChildrenArraySize; i++) { - if (mpChildrenArray[i] == pInfo) { - Detach(i); - return; + case G3DPROC_CHILD_DETACHED: { + for (int i = 0; i < mChildrenArraySize; i++) { + if (mpChildrenArray[i] == pInfo) { + Detach(i); + return; + } } + + break; } - break; - } + case G3DPROC_DETACH_PARENT: { + SetParent(NULL); + break; + } - case G3DPROC_DETACH_PARENT: { - SetParent(NULL); - break; - } - - case G3DPROC_ATTACH_PARENT: { - SetParent(static_cast(pInfo)); - break; - } + case G3DPROC_ATTACH_PARENT: { + SetParent(static_cast(pInfo)); + break; + } } } @@ -255,8 +249,7 @@ void AnmObjShpNode::G3dProc(u32 task, u32 param, void* pInfo) { * AnmObjShpBlend * ******************************************************************************/ -AnmObjShpBlend* AnmObjShpBlend::Construct(MEMAllocator* pAllocator, u32* pSize, - ResMdl mdl, int numChildren) { +AnmObjShpBlend *AnmObjShpBlend::Construct(MEMAllocator *pAllocator, u32 *pSize, ResMdl mdl, int numChildren) { if (!mdl.IsValid()) { return NULL; } @@ -264,7 +257,7 @@ AnmObjShpBlend* AnmObjShpBlend::Construct(MEMAllocator* pAllocator, u32* pSize, int bindNum = mdl.GetResVtxPosNumEntries(); u32 bindSize = bindNum * sizeof(u16); - u32 childrenSize = numChildren * sizeof(AnmObjShpRes*); + u32 childrenSize = numChildren * sizeof(AnmObjShpRes *); u32 weightSize = numChildren * sizeof(f32); u32 bindOfs = ut::RoundUp(sizeof(AnmObjShpBlend), 4); @@ -280,7 +273,7 @@ AnmObjShpBlend* AnmObjShpBlend::Construct(MEMAllocator* pAllocator, u32* pSize, return NULL; } - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer == NULL) { return NULL; } @@ -296,28 +289,25 @@ AnmObjShpBlend* AnmObjShpBlend::Construct(MEMAllocator* pAllocator, u32* pSize, // clang-format on } -AnmObjShpBlend::AnmObjShpBlend(MEMAllocator* pAllocator, u16* pBindingBuf, - int numBinding, AnmObjShpRes** ppChildrenBuf, - int numChildren, f32* pWeightBuf) - : AnmObjShpNode(pAllocator, pBindingBuf, numBinding, ppChildrenBuf, - numChildren), - mpWeightArray(pWeightBuf) { - +AnmObjShpBlend::AnmObjShpBlend( + MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding, AnmObjShpRes **ppChildrenBuf, int numChildren, + f32 *pWeightBuf +) + : AnmObjShpNode(pAllocator, pBindingBuf, numBinding, ppChildrenBuf, numChildren), mpWeightArray(pWeightBuf) { for (int i = 0; i < mChildrenArraySize; i++) { mpWeightArray[i] = 1.0f; } } -const ShpAnmResult* AnmObjShpBlend::GetResult(ShpAnmResult* pResult, u32 idx) { - detail::workmem::ShpAnmResultBuf* pWorkBuffer = - detail::workmem::GetShpAnmResultBufTemporary(); +const ShpAnmResult *AnmObjShpBlend::GetResult(ShpAnmResult *pResult, u32 idx) { + detail::workmem::ShpAnmResultBuf *pWorkBuffer = detail::workmem::GetShpAnmResultBufTemporary(); int blendNum = 0; f32 weightSum = 0.0f; for (int i = 0; i < mChildrenArraySize; i++) { f32 weight = mpWeightArray[i]; - AnmObjShpRes* pChild = mpChildrenArray[i]; + AnmObjShpRes *pChild = mpChildrenArray[i]; // @note Bitwise AND if (!(pChild != NULL & weight != 0.0f)) { @@ -328,10 +318,9 @@ const ShpAnmResult* AnmObjShpBlend::GetResult(ShpAnmResult* pResult, u32 idx) { continue; } - detail::workmem::ShpAnmResultBuf& rAnmBuf = pWorkBuffer[blendNum]; + detail::workmem::ShpAnmResultBuf &rAnmBuf = pWorkBuffer[blendNum]; - const ShpAnmResult* pMyResult = - pChild->GetResult(&rAnmBuf.resultBuf, idx); + const ShpAnmResult *pMyResult = pChild->GetResult(&rAnmBuf.resultBuf, idx); if (!(pMyResult->flags & 1)) { continue; @@ -350,7 +339,7 @@ const ShpAnmResult* AnmObjShpBlend::GetResult(ShpAnmResult* pResult, u32 idx) { } if (blendNum == 1) { - detail::workmem::ShpAnmResultBuf& rAnmBuf = *pWorkBuffer; + detail::workmem::ShpAnmResultBuf &rAnmBuf = *pWorkBuffer; if (rAnmBuf.pResult == &rAnmBuf.resultBuf) { *pResult = *rAnmBuf.pResult; @@ -368,14 +357,14 @@ const ShpAnmResult* AnmObjShpBlend::GetResult(ShpAnmResult* pResult, u32 idx) { pResult->baseShapeWeight = 0.0f; for (int i = 0; i < blendNum; i++) { - const ShpAnmResult* pMyResult = pWorkBuffer[i].pResult; + const ShpAnmResult *pMyResult = pWorkBuffer[i].pResult; f32 weight = pWorkBuffer[i].weight; f32 ratio = weight * invWeightSum; pResult->baseShapeWeight += pMyResult->baseShapeWeight * ratio; for (u32 myKey = 0; myKey < pMyResult->numKeyShape; myKey++) { - const BlendVtx& rMyKeyShape = pMyResult->keyShape[myKey]; + const BlendVtx &rMyKeyShape = pMyResult->keyShape[myKey]; u32 otherKey; for (otherKey = 0; otherKey < pResult->numKeyShape; otherKey++) { @@ -410,8 +399,7 @@ f32 AnmObjShpBlend::GetWeight(int idx) const { * AnmObjShpRes * ******************************************************************************/ -AnmObjShpRes* AnmObjShpRes::Construct(MEMAllocator* pAllocator, u32* pSize, - ResAnmShp shp, ResMdl mdl, bool cache) { +AnmObjShpRes *AnmObjShpRes::Construct(MEMAllocator *pAllocator, u32 *pSize, ResAnmShp shp, ResMdl mdl, bool cache) { if (!shp.IsValid() || !mdl.IsValid()) { return NULL; } @@ -439,33 +427,30 @@ AnmObjShpRes* AnmObjShpRes::Construct(MEMAllocator* pAllocator, u32* pSize, return NULL; } - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer == NULL) { return NULL; } - u16* const pBindingBuf = reinterpret_cast(pBuffer + bindOfs); + u16 *const pBindingBuf = reinterpret_cast(pBuffer + bindOfs); - ShpAnmVtxSet* const pVtxSetBuf = - reinterpret_cast(pBuffer + vtxSetOfs); + ShpAnmVtxSet *const pVtxSetBuf = reinterpret_cast(pBuffer + vtxSetOfs); - ShpAnmResult* const pCacheBuf = - reinterpret_cast(pBuffer + cacheOfs); + ShpAnmResult *const pCacheBuf = reinterpret_cast(pBuffer + cacheOfs); return new (pBuffer) - AnmObjShpRes(pAllocator, shp, pBindingBuf, pVtxSetBuf, bindNum, - cacheSize != 0 ? pCacheBuf : NULL); + AnmObjShpRes(pAllocator, shp, pBindingBuf, pVtxSetBuf, bindNum, cacheSize != 0 ? pCacheBuf : NULL); } -AnmObjShpRes::AnmObjShpRes(MEMAllocator* pAllocator, ResAnmShp shp, - u16* pBindingBuf, ShpAnmVtxSet* pVtxSetBuf, - int numBinding, ShpAnmResult* pCacheBuf) +AnmObjShpRes::AnmObjShpRes( + MEMAllocator *pAllocator, ResAnmShp shp, u16 *pBindingBuf, ShpAnmVtxSet *pVtxSetBuf, int numBinding, + ShpAnmResult *pCacheBuf +) : AnmObjShp(pAllocator, pBindingBuf, numBinding), FrameCtrl(0.0f, shp.GetNumFrame(), GetAnmPlayPolicy(shp.GetAnmPolicy())), mRes(shp), mpVtxSetArray(pVtxSetBuf), mpResultCache(pCacheBuf) { - if (mpResultCache != NULL) { UpdateCache(); } @@ -485,6 +470,10 @@ f32 AnmObjShpRes::GetFrame() const { void AnmObjShpRes::SetUpdateRate(f32 rate) { SetRate(rate); + + if (rate == 0.f && mpResultCache != NULL) { + UpdateCache(); + } } f32 AnmObjShpRes::GetUpdateRate() const { @@ -492,10 +481,12 @@ f32 AnmObjShpRes::GetUpdateRate() const { } void AnmObjShpRes::UpdateFrame() { - UpdateFrm(); + if (GetRate() != 0.f) { + UpdateFrm(); - if (mpResultCache != NULL) { - UpdateCache(); + if (mpResultCache != NULL) { + UpdateCache(); + } } } @@ -504,7 +495,7 @@ bool AnmObjShpRes::Bind(const ResMdl mdl) { u32 numAnim = mRes.GetShapeAnmNumEntries(); for (u16 i = 0; i < numAnim; i++) { - const ResAnmShpAnmData* pData = mRes.GetShapeAnm(i); + const ResAnmShpAnmData *pData = mRes.GetShapeAnm(i); // Seek back from name string to start of ResName ResName name(ut::AddOffsetToPtr(pData, pData->name - 4)); @@ -519,10 +510,10 @@ bool AnmObjShpRes::Bind(const ResMdl mdl) { } int nameNum = mRes.GetNumVtxNames(); - const s32* pVtxNameArray = mRes.GetVtxNameArray(); + const s32 *pVtxNameArray = mRes.GetVtxNameArray(); for (int i = 0; i < nameNum; i++) { - ShpAnmVtxSet& rSet = mpVtxSetArray[i]; + ShpAnmVtxSet &rSet = mpVtxSetArray[i]; s32 offset = pVtxNameArray[i]; // Seek back from name string to start of ResName @@ -537,7 +528,7 @@ bool AnmObjShpRes::Bind(const ResMdl mdl) { return success; } -const ShpAnmResult* AnmObjShpRes::GetResult(ShpAnmResult* pResult, u32 idx) { +const ShpAnmResult *AnmObjShpRes::GetResult(ShpAnmResult *pResult, u32 idx) { u32 id = mpBinding[idx]; if (id & (BINDING_UNDEFINED | BINDING_INVALID)) { @@ -566,24 +557,24 @@ void AnmObjShpRes::UpdateCache() { } } -void AnmObjShpRes::G3dProc(u32 task, u32 param, void* pInfo) { +void AnmObjShpRes::G3dProc(u32 task, u32 param, void *pInfo) { #pragma unused(param) switch (task) { - case G3DPROC_UPDATEFRAME: { - UpdateFrame(); - break; - } + case G3DPROC_UPDATEFRAME: { + UpdateFrame(); + break; + } - case G3DPROC_DETACH_PARENT: { - SetParent(NULL); - break; - } + case G3DPROC_DETACH_PARENT: { + SetParent(NULL); + break; + } - case G3DPROC_ATTACH_PARENT: { - SetParent(static_cast(pInfo)); - break; - } + case G3DPROC_ATTACH_PARENT: { + SetParent(static_cast(pInfo)); + break; + } } } diff --git a/src/nw4r/g3d/g3d_anmtexpat.cpp b/src/nw4r/g3d/g3d_anmtexpat.cpp index b3c24c84..1dd1287b 100644 --- a/src/nw4r/g3d/g3d_anmtexpat.cpp +++ b/src/nw4r/g3d/g3d_anmtexpat.cpp @@ -1,8 +1,8 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/ut.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -371,6 +371,9 @@ f32 AnmObjTexPatRes::GetFrame() const { void AnmObjTexPatRes::SetUpdateRate(f32 rate) { SetRate(rate); + if (rate == 0.f && mpResultCache != NULL) { + UpdateCache(); + } } f32 AnmObjTexPatRes::GetUpdateRate() const { @@ -378,10 +381,12 @@ f32 AnmObjTexPatRes::GetUpdateRate() const { } void AnmObjTexPatRes::UpdateFrame() { - UpdateFrm(); + if (GetRate() != 0.f) { + UpdateFrm(); - if (mpResultCache != NULL) { - UpdateCache(); + if (mpResultCache != NULL) { + UpdateCache(); + } } } diff --git a/src/nw4r/g3d/g3d_anmtexsrt.cpp b/src/nw4r/g3d/g3d_anmtexsrt.cpp index 2d6df293..7c479a19 100644 --- a/src/nw4r/g3d/g3d_anmtexsrt.cpp +++ b/src/nw4r/g3d/g3d_anmtexsrt.cpp @@ -1,8 +1,8 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/ut.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export #include @@ -296,12 +296,13 @@ const TexSrtAnmResult *AnmObjTexSrtOverride::GetResult(TexSrtAnmResult *pResult, const TexSrtAnmResult *pChildResult = pChild->GetResult(pResult, idx); - if (pChildResult->flags != 0) { + if (pChildResult->flags != 0 || pChildResult->indFlags != 0) { return pChildResult; } } pResult->flags = 0; + pResult->indFlags = 0; return pResult; } @@ -372,6 +373,9 @@ f32 AnmObjTexSrtRes::GetFrame() const { void AnmObjTexSrtRes::SetUpdateRate(f32 rate) { SetRate(rate); + if (rate == 0.f && mpResultCache != NULL) { + UpdateCache(); + } } f32 AnmObjTexSrtRes::GetUpdateRate() const { @@ -379,10 +383,12 @@ f32 AnmObjTexSrtRes::GetUpdateRate() const { } void AnmObjTexSrtRes::UpdateFrame() { - UpdateFrm(); + if (GetRate() != 0.f) { + UpdateFrm(); - if (mpResultCache != NULL) { - UpdateCache(); + if (mpResultCache != NULL) { + UpdateCache(); + } } } @@ -414,6 +420,7 @@ const TexSrtAnmResult *AnmObjTexSrtRes::GetResult(TexSrtAnmResult *pResult, u32 if (id & (BINDING_UNDEFINED | BINDING_INVALID)) { pResult->flags = 0; + pResult->indFlags = 0; return pResult; } @@ -466,12 +473,13 @@ void AnmObjTexSrtRes::G3dProc(u32 task, u32 param, void *pInfo) { ******************************************************************************/ void ApplyTexSrtAnmResult(ResTexSrt srt, const TexSrtAnmResult *pResult) { ResTexSrtData &r = srt.ref(); - - u32 flags = pResult->flags; + u32 mdlFlags = r.flag; + u32 anmFlags = pResult->flags; u32 mask = 0x0F; - for (int i = 0; flags != 0; flags >>= TexSrt::NUM_OF_FLAGS, mask <<= 4, i++) { - if (!(flags & 1)) { + for (int i = 0; mdlFlags != 0 && anmFlags != 0; + mdlFlags >>= TexSrt::NUM_OF_FLAGS, anmFlags >>= TexSrt::NUM_OF_FLAGS, mask <<= 4, i++) { + if (!(mdlFlags & TexSrt::FLAG_ANM_EXISTS) || !(anmFlags & TexSrt::FLAG_ANM_EXISTS)) { continue; } @@ -482,6 +490,7 @@ void ApplyTexSrtAnmResult(ResTexSrt srt, const TexSrtAnmResult *pResult) { } void ApplyTexSrtAnmResult(ResTexSrt srt, ResMatIndMtxAndScale ind, const TexSrtAnmResult *pResult) { + // I need this to not inline :( ApplyTexSrtAnmResult(srt, pResult); u32 flags = pResult->indFlags; @@ -493,23 +502,20 @@ void ApplyTexSrtAnmResult(ResTexSrt srt, ResMatIndMtxAndScale ind, const TexSrtA math::MTX34 mtx; - CalcTexMtx( - &mtx, true, pResult->srt[i], static_cast(flags & TexSrt::FLAGSET_IDENTITY), - TexSrtTypedef::TEXMATRIXMODE_MAYA - ); + CalcTexMtx(&mtx, true, pResult->srt[i], static_cast(flags & TexSrt::FLAGSET_IDENTITY)); s8 scaleExp; f32 maxElem = 0.000000000000000001f; - maxElem = ut::Max(maxElem, math::FAbs(mtx._00)); - maxElem = ut::Max(maxElem, math::FAbs(mtx._01)); - maxElem = ut::Max(maxElem, math::FAbs(mtx._03)); - maxElem = ut::Max(maxElem, math::FAbs(mtx._10)); - maxElem = ut::Max(maxElem, math::FAbs(mtx._11)); - maxElem = ut::Max(maxElem, math::FAbs(mtx._13)); + maxElem = ut::Max(maxElem, ut::Abs(mtx._00)); + maxElem = ut::Max(maxElem, ut::Abs(mtx._01)); + maxElem = ut::Max(maxElem, ut::Abs(mtx._03)); + maxElem = ut::Max(maxElem, ut::Abs(mtx._10)); + maxElem = ut::Max(maxElem, ut::Abs(mtx._11)); + maxElem = ut::Max(maxElem, ut::Abs(mtx._13)); scaleExp = static_cast(math::FGetExpPart(maxElem) + 1); - f32 invScale = 0.f; // TODO: ldexpf(1.0f, -scaleExp); + f32 invScale = std::ldexp(1.0f, -scaleExp); // TODO ldexpf rename mtx._00 *= invScale; mtx._01 *= invScale; diff --git a/src/nw4r/g3d/g3d_anmvis.cpp b/src/nw4r/g3d/g3d_anmvis.cpp index cec0f644..d2681071 100644 --- a/src/nw4r/g3d/g3d_anmvis.cpp +++ b/src/nw4r/g3d/g3d_anmvis.cpp @@ -1,6 +1,6 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/ut.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -15,11 +15,8 @@ NW4R_G3D_RTTI_DEF(AnmObjVisRes); * AnmObjVis * ******************************************************************************/ -AnmObjVis::AnmObjVis(MEMAllocator* pAllocator, u16* pBindingBuf, int numBinding) - : AnmObj(pAllocator, NULL), - mpBinding(pBindingBuf), - mNumBinding(numBinding) { - +AnmObjVis::AnmObjVis(MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding) + : AnmObj(pAllocator, NULL), mpBinding(pBindingBuf), mNumBinding(numBinding) { Release(); } @@ -39,14 +36,14 @@ void AnmObjVis::Release() { SetAnmFlag(FLAG_ANM_BOUND, false); } -AnmObjVisRes* AnmObjVis::Attach(int idx, AnmObjVisRes* pRes) { +AnmObjVisRes *AnmObjVis::Attach(int idx, AnmObjVisRes *pRes) { #pragma unused(idx) #pragma unused(pRes) return NULL; } -AnmObjVisRes* AnmObjVis::Detach(int idx) { +AnmObjVisRes *AnmObjVis::Detach(int idx) { #pragma unused(idx) return NULL; @@ -58,24 +55,24 @@ void AnmObjVis::DetachAll() { } } -void AnmObjVis::G3dProc(u32 task, u32 param, void* pInfo) { +void AnmObjVis::G3dProc(u32 task, u32 param, void *pInfo) { #pragma unused(param) switch (task) { - case G3DPROC_UPDATEFRAME: { - SetAnmFlag(FLAG_CACHE_OBSOLETE, true); - break; - } + case G3DPROC_UPDATEFRAME: { + SetAnmFlag(FLAG_CACHE_OBSOLETE, true); + break; + } - case G3DPROC_DETACH_PARENT: { - SetParent(NULL); - break; - } + case G3DPROC_DETACH_PARENT: { + SetParent(NULL); + break; + } - case G3DPROC_ATTACH_PARENT: { - SetParent(static_cast(pInfo)); - break; - } + case G3DPROC_ATTACH_PARENT: { + SetParent(static_cast(pInfo)); + break; + } } } @@ -84,10 +81,8 @@ void AnmObjVis::G3dProc(u32 task, u32 param, void* pInfo) { * AnmObjVisNode * ******************************************************************************/ -AnmObjVisNode::AnmObjVisNode(MEMAllocator* pAllocator, u16* pBindingBuf, - int numBinding) +AnmObjVisNode::AnmObjVisNode(MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding) : AnmObjVis(pAllocator, pBindingBuf, numBinding) { - for (int i = 0; i < MAX_CHILD; i++) { mpChildren[i] = NULL; } @@ -97,8 +92,8 @@ AnmObjVisNode::~AnmObjVisNode() { DetachAll(); } -AnmObjVisRes* AnmObjVisNode::Attach(int idx, AnmObjVisRes* pRes) { - AnmObjVisRes* pOld = Detach(idx); +AnmObjVisRes *AnmObjVisNode::Attach(int idx, AnmObjVisRes *pRes) { + AnmObjVisRes *pOld = Detach(idx); bool hasAnm = false; for (u32 i = 0; i < mNumBinding; i++) { @@ -119,8 +114,8 @@ AnmObjVisRes* AnmObjVisNode::Attach(int idx, AnmObjVisRes* pRes) { return pOld; } -AnmObjVisRes* AnmObjVisNode::Detach(int idx) { - AnmObjVisRes* pOld = mpChildren[idx]; +AnmObjVisRes *AnmObjVisNode::Detach(int idx) { + AnmObjVisRes *pOld = mpChildren[idx]; if (pOld != NULL) { pOld->G3dProc(G3DPROC_DETACH_PARENT, 0, this); @@ -131,7 +126,7 @@ AnmObjVisRes* AnmObjVisNode::Detach(int idx) { u16 binding = BINDING_UNDEFINED; for (int j = 0; j < MAX_CHILD; j++) { - AnmObjVisRes* pChild = mpChildren[j]; + AnmObjVisRes *pChild = mpChildren[j]; if (pChild == NULL || !pChild->TestDefined(i)) { continue; @@ -201,7 +196,7 @@ bool AnmObjVisNode::Bind(ResMdl mdl) { bool success = false; for (int i = 0; i < MAX_CHILD; i++) { - AnmObjVisRes* pChild = mpChildren[i]; + AnmObjVisRes *pChild = mpChildren[i]; if (pChild == NULL) { continue; } @@ -230,30 +225,30 @@ void AnmObjVisNode::Release() { AnmObjVis::Release(); } -void AnmObjVisNode::G3dProc(u32 task, u32 param, void* pInfo) { +void AnmObjVisNode::G3dProc(u32 task, u32 param, void *pInfo) { #pragma unused(param) switch (task) { - case G3DPROC_CHILD_DETACHED: { - for (int i = 0; i < MAX_CHILD; i++) { - if (mpChildren[i] == pInfo) { - Detach(i); - return; + case G3DPROC_CHILD_DETACHED: { + for (int i = 0; i < MAX_CHILD; i++) { + if (mpChildren[i] == pInfo) { + Detach(i); + return; + } } + + break; } - break; - } + case G3DPROC_DETACH_PARENT: { + SetParent(NULL); + break; + } - case G3DPROC_DETACH_PARENT: { - SetParent(NULL); - break; - } - - case G3DPROC_ATTACH_PARENT: { - SetParent(static_cast(pInfo)); - break; - } + case G3DPROC_ATTACH_PARENT: { + SetParent(static_cast(pInfo)); + break; + } } } @@ -262,8 +257,7 @@ void AnmObjVisNode::G3dProc(u32 task, u32 param, void* pInfo) { * AnmObjVisOR * ******************************************************************************/ -AnmObjVisOR* AnmObjVisOR::Construct(MEMAllocator* pAllocator, u32* pSize, - ResMdl mdl) { +AnmObjVisOR *AnmObjVisOR::Construct(MEMAllocator *pAllocator, u32 *pSize, ResMdl mdl) { if (!mdl.IsValid()) { return NULL; } @@ -282,22 +276,21 @@ AnmObjVisOR* AnmObjVisOR::Construct(MEMAllocator* pAllocator, u32* pSize, return NULL; } - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer == NULL) { return NULL; } - u16* pBindingBuf = reinterpret_cast(pBuffer + sizeof(AnmObjVisOR)); + u16 *pBindingBuf = reinterpret_cast(pBuffer + sizeof(AnmObjVisOR)); - AnmObjVisOR* pObjVis = - new (pBuffer) AnmObjVisOR(pAllocator, pBindingBuf, bindNum); + AnmObjVisOR *pObjVis = new (pBuffer) AnmObjVisOR(pAllocator, pBindingBuf, bindNum); return pObjVis; } bool AnmObjVisOR::GetResult(u32 idx) { for (int i = 0; i < MAX_CHILD; i++) { - AnmObjVisRes* pChild = mpChildren[i]; + AnmObjVisRes *pChild = mpChildren[i]; if (pChild == NULL || !pChild->TestExistence(idx)) { continue; @@ -316,8 +309,7 @@ bool AnmObjVisOR::GetResult(u32 idx) { * AnmObjVisRes * ******************************************************************************/ -AnmObjVisRes* AnmObjVisRes::Construct(MEMAllocator* pAllocator, u32* pSize, - ResAnmVis vis, ResMdl mdl) { +AnmObjVisRes *AnmObjVisRes::Construct(MEMAllocator *pAllocator, u32 *pSize, ResAnmVis vis, ResMdl mdl) { if (!vis.IsValid() || !mdl.IsValid()) { return NULL; } @@ -336,21 +328,19 @@ AnmObjVisRes* AnmObjVisRes::Construct(MEMAllocator* pAllocator, u32* pSize, return NULL; } - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer == NULL) { return NULL; } - u16* pBindingBuf = reinterpret_cast(pBuffer + sizeof(AnmObjVisRes)); + u16 *pBindingBuf = reinterpret_cast(pBuffer + sizeof(AnmObjVisRes)); - AnmObjVisRes* pObjVis = - new (pBuffer) AnmObjVisRes(pAllocator, vis, pBindingBuf, bindNum); + AnmObjVisRes *pObjVis = new (pBuffer) AnmObjVisRes(pAllocator, vis, pBindingBuf, bindNum); return pObjVis; } -AnmObjVisRes::AnmObjVisRes(MEMAllocator* pAllocator, ResAnmVis vis, - u16* pBindingBuf, int numBinding) +AnmObjVisRes::AnmObjVisRes(MEMAllocator *pAllocator, ResAnmVis vis, u16 *pBindingBuf, int numBinding) : AnmObjVis(pAllocator, pBindingBuf, numBinding), FrameCtrl(0.0f, vis.GetNumFrame(), GetAnmPlayPolicy(vis.GetAnmPolicy())), mRes(vis) {} @@ -373,8 +363,10 @@ f32 AnmObjVisRes::GetUpdateRate() const { } void AnmObjVisRes::UpdateFrame() { - UpdateFrm(); - G3dProc(G3DPROC_UPDATEFRAME, 0, NULL); + if (GetRate() != 0.f) { + UpdateFrm(); + G3dProc(G3DPROC_UPDATEFRAME, 0, NULL); + } } bool AnmObjVisRes::Bind(ResMdl mdl) { @@ -382,7 +374,7 @@ bool AnmObjVisRes::Bind(ResMdl mdl) { bool success = false; for (u16 i = 0; i < numAnim; i++) { - const ResAnmVisAnmData* pData = mRes.GetNodeAnm(i); + const ResAnmVisAnmData *pData = mRes.GetNodeAnm(i); // Seek back from name string to start of ResName ResName name(ut::AddOffsetToPtr(pData, pData->name - 4)); @@ -415,7 +407,7 @@ bool AnmObjVisRes::GetResult(u32 idx) { * ApplyVisAnmResult * ******************************************************************************/ -void ApplyVisAnmResult(ResMdl mdl, AnmObjVis* pObj) { +void ApplyVisAnmResult(ResMdl mdl, AnmObjVis *pObj) { u32 numNode = mdl.GetResNodeNumEntries(); for (u32 i = 0; i < numNode; i++) { @@ -428,7 +420,7 @@ void ApplyVisAnmResult(ResMdl mdl, AnmObjVis* pObj) { } } -void ApplyVisAnmResult(u8* byteVec, ResMdl mdl, AnmObjVis* pObj) { +void ApplyVisAnmResult(u8 *byteVec, ResMdl mdl, AnmObjVis *pObj) { u32 numNode = mdl.GetResNodeNumEntries(); for (u32 i = 0; i < numNode; i++) { diff --git a/src/nw4r/g3d/g3d_basic.cpp b/src/nw4r/g3d/g3d_basic.cpp deleted file mode 100644 index 293f6362..00000000 --- a/src/nw4r/g3d/g3d_basic.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include - -namespace nw4r { -namespace g3d { -namespace detail { -namespace dcc { - -u32 CalcWorldMtx_Basic(math::MTX34* pW, math::VEC3* pS, const math::MTX34* pW1, - const math::VEC3* pS1, u32 attr, - const ChrAnmResult* pResult) { - - u32 flag = pResult->flags; - u32 newAttr = attr; - - if (flag & ChrAnmResult::FLAG_SCALE_ONE) { - newAttr = detail::WorldMtxAttr::AnmScaleOne(newAttr); - pS->x = pS->y = pS->z = 1.0f; - } else { - newAttr = detail::WorldMtxAttr::AnmNotScaleOne(newAttr); - *pS = pResult->s; - } - - if ((flag & ChrAnmResult::FLAG_MTX_IDENT) || - (flag & ChrAnmResult::FLAG_ROT_TRANS_ZERO)) { - - if (detail::WorldMtxAttr::IsScaleOne(attr)) { - math::MTX34Copy(pW, pW1); - } else { - math::MTX34Scale(pW, pW1, pS1); - } - } else if (flag & ChrAnmResult::FLAG_ROT_ZERO) { - if (detail::WorldMtxAttr::IsScaleOne(attr)) { - math::VEC3 trans(pResult->rt._03, pResult->rt._13, pResult->rt._23); - - math::MTX34Trans(pW, pW1, &trans); - } else { - math::MTX34 temp; - - math::MTX34Scale(&temp, pS1, &pResult->rt); - math::MTX34Mult(pW, pW1, &temp); - } - } else if (detail::WorldMtxAttr::IsScaleOne(attr)) { - math::MTX34Mult(pW, pW1, &pResult->rt); - } else { - math::MTX34Scale(pW, pW1, pS1); - math::MTX34Mult(pW, pW, &pResult->rt); - } - - if (flag & ChrAnmResult::FLAG_SCALE_UNIFORM) { - newAttr = detail::WorldMtxAttr::AnmScaleUniform(newAttr); - } else { - newAttr = detail::WorldMtxAttr::AnmNotScaleUniform(newAttr); - } - - return newAttr; -} - -} // namespace dcc -} // namespace detail -} // namespace g3d -} // namespace nw4r diff --git a/src/nw4r/g3d/g3d_calcmaterial.cpp b/src/nw4r/g3d/g3d_calcmaterial.cpp index 38392db3..710098b9 100644 --- a/src/nw4r/g3d/g3d_calcmaterial.cpp +++ b/src/nw4r/g3d/g3d_calcmaterial.cpp @@ -1,11 +1,9 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void CalcMaterialDirectly(ResMdl mdl, AnmObjTexPat* pAnmTexPat, - AnmObjTexSrt* pAnmTexSrt, AnmObjMatClr* pAnmMatClr) { - +void CalcMaterialDirectly(ResMdl mdl, AnmObjTexPat *pAnmTexPat, AnmObjTexSrt *pAnmTexSrt, AnmObjMatClr *pAnmMatClr) { u32 i; u32 numMatID = mdl.GetResMatNumEntries(); @@ -14,12 +12,11 @@ void CalcMaterialDirectly(ResMdl mdl, AnmObjTexPat* pAnmTexPat, if (pAnmTexPat != NULL && pAnmTexPat->TestExistence(i)) { TexPatAnmResult result; - const TexPatAnmResult* pResult; + const TexPatAnmResult *pResult; pResult = pAnmTexPat->GetResult(&result, i); - ApplyTexPatAnmResult(mat.GetResTexObj(), mat.GetResTlutObj(), - pResult); + ApplyTexPatAnmResult(mat.GetResTexObj(), mat.GetResTlutObj(), pResult); mat.GetResTexObj().EndEdit(); mat.GetResTlutObj().EndEdit(); @@ -27,7 +24,7 @@ void CalcMaterialDirectly(ResMdl mdl, AnmObjTexPat* pAnmTexPat, if (pAnmTexSrt != NULL && pAnmTexSrt->TestExistence(i)) { TexSrtAnmResult result; - const TexSrtAnmResult* pResult; + const TexSrtAnmResult *pResult; ResTexSrt srt = mat.GetResTexSrt(); ResMatIndMtxAndScale ind = mat.GetResMatIndMtxAndScale(); @@ -42,7 +39,7 @@ void CalcMaterialDirectly(ResMdl mdl, AnmObjTexPat* pAnmTexPat, if (pAnmMatClr != NULL && pAnmMatClr->TestExistence(i)) { ClrAnmResult result; - const ClrAnmResult* pResult; + const ClrAnmResult *pResult; ResMatTevColor tevColor = mat.GetResMatTevColor(); ResMatChan chan = mat.GetResMatChan(); diff --git a/src/nw4r/g3d/g3d_calcview.cpp b/src/nw4r/g3d/g3d_calcview.cpp index 5dd076a0..349d811a 100644 --- a/src/nw4r/g3d/g3d_calcview.cpp +++ b/src/nw4r/g3d/g3d_calcview.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export #include @@ -16,128 +16,129 @@ namespace { using nw4r::math::MTX34; using nw4r::math::VEC3; -asm void GetModelLocalAxisY2(register math::VEC3* pVec, - register const math::MTX34* pModelMtx, - register const math::MTX34* pParentModelMtx) { +const f32 norm_epsilon = 1e-18f; +asm void GetModelLocalAxisY2( + register math::VEC3 *pVec, register const math::MTX34 *pModelMtx, register const math::MTX34 *pParentModelMtx +) { // clang-format off nofralloc - - psq_l f2, MTX34._10(pParentModelMtx), 1, 0 - psq_l f3, MTX34._11(pParentModelMtx), 0, 0 - psq_l f0, MTX34._00(pParentModelMtx), 1, 0 - psq_l f1, MTX34._01(pParentModelMtx), 0, 0 - ps_merge10 f7, f3, f2 - psq_l f5, MTX34._21(pParentModelMtx), 0, 0 - psq_l f4, MTX34._20(pParentModelMtx), 1, 0 - ps_merge10 f6, f1, f0 - ps_mul f12, f5, f7 - ps_merge10 f8, f5, f4 - ps_mul f10, f3, f6 - ps_mul f9, f0, f5 - ps_mul f11, f1, f8 - ps_msub f12, f3, f8, f12 - ps_msub f10, f1, f7, f10 - ps_msub f11, f5, f6, f11 - ps_mul f7, f0, f12 - ps_sub f6, f6, f6 - ps_msub f9, f1, f4, f9 - ps_madd f7, f2, f11, f7 - stfs f6, VEC3.z(pVec) - ps_madd f7, f4, f10, f7 - ps_cmpo0 cr0, f7, f6 - bne _lbl_80068168 - psq_st f6, VEC3.x(pVec), 0, 0 - - blr - -_lbl_80068168: - fres f0, f7 - psq_l f1, MTX34._10(pModelMtx), 0, 0 - psq_l f2, MTX34._02(pModelMtx), 1, 0 + psq_l f0, MTX34._00(pParentModelMtx), 1, 0 + psq_l f1, MTX34._01(pParentModelMtx), 0, 0 + psq_l f2, MTX34._10(pParentModelMtx), 1, 0 + ps_merge10 f6, f1, f0 + psq_l f3, MTX34._11(pParentModelMtx), 0, 0 + psq_l f4, MTX34._20(pParentModelMtx), 1, 0 + ps_merge10 f7, f3, f2 + psq_l f5, MTX34._21(pParentModelMtx), 0, 0 + ps_mul f11, f3, f6 + ps_mul f13, f5, f7 + ps_merge10 f8, f5, f4 + ps_msub f11, f1, f7, f11 + ps_mul f12, f1, f8 + ps_msub f13, f3, f8, f13 + lis r12, norm_epsilon@ha psq_l f3, MTX34._12(pModelMtx), 1, 0 - ps_add f6, f0, f0 - ps_mul f5, f0, f0 - ps_nmsub f0, f7, f5, f6 + ps_msub f12, f5, f6, f12 + addi r12, r12, norm_epsilon@l + ps_mul f7, f0, f13 + ps_mul f9, f0, f5 + psq_l f6, 0x0(r12), 1, 0 + ps_madd f7, f2, f12, f7 + ps_sub f13, f13, f13 + psq_l f2, MTX34._02(pModelMtx), 1, 0 + ps_madd f7, f4, f11, f7 + ps_msub f9, f1, f4, f9 + psq_l f1, MTX34._10(pModelMtx), 0, 0 + ps_abs f8, f7 + psq_st f13, VEC3.z(pVec), 1, 0 + ps_cmpo0 cr0, f8, f6 + bge _lbl_8044F884 + psq_st f13, VEC3.x(pVec), 0, 0 + blr +_lbl_8044F884: + fres f8, f7 + psq_l f0, MTX34._00(pModelMtx), 0, 0 + ps_add f11, f8, f8 + ps_mul f10, f7, f8 + ps_merge00 f4, f0, f1 + ps_nmsub f8, f8, f10, f11 + ps_merge11 f5, f0, f1 ps_merge00 f6, f2, f3 - ps_muls0 f11, f11, f0 - ps_muls0 f9, f9, f0 - psq_l f0, MTX34._00(pModelMtx), 0, 0 - ps_merge00 f4, f0, f1 - ps_merge11 f5, f0, f1 - ps_muls0 f0, f4, f11 - ps_madds1 f0, f5, f11, f0 - ps_madds0 f0, f6, f9, f0 - psq_st f0, VEC3.x(pVec), 0, 0 - + ps_muls0 f12, f12, f8 + ps_muls0 f9, f9, f8 + ps_muls0 f0, f4, f12 + ps_madds1 f0, f5, f12, f0 + ps_madds0 f0, f6, f9, f0 + psq_st f0, VEC3.x(pVec), 0, 0 blr // clang-format on } -asm void GetModelLocalAxisY3(register math::VEC3* pVec, - register const math::MTX34* pModelMtx, - register const math::MTX34* pParentModelMtx) { +asm void GetModelLocalAxisY3( + register math::VEC3 *pVec, register const math::MTX34 *pModelMtx, register const math::MTX34 *pParentModelMtx +) { // clang-format off nofralloc - psq_l f2, MTX34._10(pParentModelMtx), 1, 0 - psq_l f3, MTX34._11(pParentModelMtx), 0, 0 - psq_l f0, MTX34._00(pParentModelMtx), 1, 0 - psq_l f1, MTX34._01(pParentModelMtx), 0, 0 - ps_merge10 f7, f3, f2 - psq_l f5, MTX34._21(pParentModelMtx), 0, 0 - psq_l f4, MTX34._20(pParentModelMtx), 1, 0 - ps_merge10 f6, f1, f0 - ps_mul f12, f5, f7 - ps_merge10 f8, f5, f4 - ps_mul f10, f3, f6 - ps_mul f9, f0, f5 - ps_mul f11, f1, f8 - ps_msub f12, f3, f8, f12 - ps_msub f10, f1, f7, f10 - ps_msub f11, f5, f6, f11 - ps_mul f7, f0, f12 - ps_sub f6, f6, f6 - ps_msub f9, f1, f4, f9 - ps_madd f7, f2, f11, f7 - ps_madd f7, f4, f10, f7 - ps_cmpo0 cr0, f7, f6 - bne _lbl_80068218 - psq_st f6, VEC3.x(pVec), 0, 0 - stfs f6, VEC3.z(pVec) - + psq_l f0, MTX34._00(pParentModelMtx), 1, 0 + psq_l f1, MTX34._01(pParentModelMtx), 0, 0 + psq_l f2, MTX34._10(pParentModelMtx), 1, 0 + ps_merge10 f6, f1, f0 + psq_l f3, MTX34._11(pParentModelMtx), 0, 0 + psq_l f4, MTX34._20(pParentModelMtx), 1, 0 + ps_merge10 f7, f3, f2 + psq_l f5, MTX34._21(pParentModelMtx), 0, 0 + ps_mul f11, f3, f6 + ps_mul f13, f5, f7 + ps_merge10 f8, f5, f4 + ps_msub f11, f1, f7, f11 + ps_mul f12, f1, f8 + ps_msub f13, f3, f8, f13 + lis r12, norm_epsilon@ha + psq_l f3, MTX34._12(pModelMtx), 1, 0 + ps_msub f12, f5, f6, f12 + addi r12, r12, norm_epsilon@l + ps_mul f7, f0, f13 + ps_mul f9, f0, f5 + psq_l f6, 0x0(r12), 1, 0 + ps_madd f7, f2, f12, f7 + ps_sub f13, f13, f13 + psq_l f2, MTX34._02(pModelMtx), 1, 0 + ps_madd f7, f4, f11, f7 + ps_msub f9, f1, f4, f9 + psq_l f1, MTX34._10(pModelMtx), 0, 0 + ps_abs f8, f7 + psq_st f13, VEC3.z(pVec), 1, 0 + ps_cmpo0 cr0, f8, f6 + bge _lbl_8044F944 + psq_st f13, VEC3.x(pVec), 0, 0 blr - -_lbl_80068218: - fres f0, f7 - psq_l f1, MTX34._10(pModelMtx), 0, 0 - psq_l f2, MTX34._02(pModelMtx), 1, 0 - psq_l f3, MTX34._12(pModelMtx), 1, 0 - ps_add f6, f0, f0 - ps_mul f5, f0, f0 - ps_nmsub f0, f7, f5, f6 - ps_merge00 f6, f2, f3 - psq_l f2, MTX34._22(pModelMtx), 1, 0 - ps_muls0 f11, f11, f0 - ps_muls0 f9, f9, f0 - psq_l f0, MTX34._00(pModelMtx), 0, 0 - ps_merge00 f4, f0, f1 - ps_merge11 f5, f0, f1 - psq_l f1, MTX34._20(pModelMtx), 0, 0 - ps_muls0 f0, f4, f11 - ps_mul f1, f1, f9 - ps_madds1 f0, f5, f11, f0 - ps_sum0 f1, f1, f1, f1 - ps_madds0 f0, f6, f9, f0 - fmadds f1, f2, f9, f1 - psq_st f0, VEC3.x(pVec), 0, 0 - psq_st f1, VEC3.z(pVec), 1, 0 - +_lbl_8044F944: + fres f8, f7 + psq_l f0, MTX34._00(pModelMtx), 0, 0 + ps_add f11, f8, f8 + ps_mul f10, f7, f8 + ps_merge00 f4, f0, f1 + ps_nmsub f8, f8, f10, f11 + ps_merge11 f5, f0, f1 + ps_merge00 f6, f2, f3 + ps_muls0 f12, f12, f8 + psq_l f1, MTX34._20(pModelMtx), 0, 0 + ps_muls0 f9, f9, f8 + psq_l f2, MTX34._22(pModelMtx), 1, 0 + ps_muls0 f0, f4, f12 + ps_mul f1, f1, f9 + ps_madds1 f0, f5, f12, f0 + ps_sum0 f1, f1, f1, f1 + ps_madds0 f0, f6, f9, f0 + fmadds f1, f2, f9, f1 + psq_st f0, VEC3.x(pVec), 0, 0 + psq_st f1, VEC3.z(pVec), 1, 0 blr // clang-format on } -inline void SetMdlViewMtxSR(register math::MTX34* pViewPos, - register const math::VEC3& rRY, register f32 s) { +inline void SetMdlViewMtxSR(register math::MTX34 *pViewPos, register const math::VEC3 &rRY, register f32 s) { register f32 work0, work1; register f32 c_zero = 0.0f; @@ -158,10 +159,9 @@ inline void SetMdlViewMtxSR(register math::MTX34* pViewPos, // clang-format on } -inline void SetMdlViewMtxSR(register math::MTX34* pViewPos, - register const math::VEC3& rRY, register f32 sx, - register f32 sy, register f32 sz) { - +inline void SetMdlViewMtxSR( + register math::MTX34 *pViewPos, register const math::VEC3 &rRY, register f32 sx, register f32 sy, register f32 sz +) { register f32 work0, work1, work2, work3; register f32 c_zero = 0.0f; @@ -184,12 +184,10 @@ inline void SetMdlViewMtxSR(register math::MTX34* pViewPos, // clang-format on } -inline void SetMdlViewMtxSR(register math::MTX34* pViewPos, - register const math::VEC3& rRX, - register const math::VEC3& rRY, - register const math::VEC3& rRZ, register f32 sx, - register f32 sy, register f32 sz) { - +inline void SetMdlViewMtxSR( + register math::MTX34 *pViewPos, register const math::VEC3 &rRX, register const math::VEC3 &rRY, + register const math::VEC3 &rRZ, register f32 sx, register f32 sy, register f32 sz +) { register f32 work0, work1, work2, work3; // clang-format off @@ -229,39 +227,41 @@ inline void SetMdlViewMtxSR(register math::MTX34* pViewPos, ******************************************************************************/ namespace { -inline f32 GetMtx34Scale(const math::MTX34& rMtx, int col) { - return math::FSqrt(rMtx.m[0][col] * rMtx.m[0][col] + - rMtx.m[1][col] * rMtx.m[1][col] + - rMtx.m[2][col] * rMtx.m[2][col]); +inline f32 GetMtx34Scale(const math::MTX34 &rMtx, int col) { + return math::FSqrt( + rMtx.m[0][col] * rMtx.m[0][col] + rMtx.m[1][col] * rMtx.m[1][col] + rMtx.m[2][col] * rMtx.m[2][col] + ); } -void Calc_BILLBOARD_STD(math::MTX34* pViewPos, - const math::MTX34* pModelMtxArray, bool uniformScale, - const math::MTX34* pViewMtx, const ResMdl mdl, - const u32 id) { - +void Calc_BILLBOARD_STD( + math::MTX34 *pViewPos, const math::MTX34 *pModelMtxArray, bool uniformScale, const math::MTX34 *pViewMtx, + const ResMdl mdl, const u32 id +) { #pragma unused(pViewMtx) #pragma unused(mdl) math::VEC3 vy(pViewPos->_01, pViewPos->_11, 0.0f); - math::VEC3Normalize(&vy, &vy); - if (uniformScale) { - f32 s = GetMtx34Scale(pModelMtxArray[id], 0); - SetMdlViewMtxSR(pViewPos, vy, s); + if (math::FAbs(vy.x) >= norm_epsilon || math::FAbs(vy.y) >= norm_epsilon) { + math::VEC3Normalize(&vy, &vy); + if (uniformScale) { + f32 s = GetMtx34Scale(pModelMtxArray[id], 0); + SetMdlViewMtxSR(pViewPos, vy, s); + } else { + f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); + f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); + f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); + SetMdlViewMtxSR(pViewPos, vy, sx, sy, sz); + } } else { - f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); - f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); - f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); - SetMdlViewMtxSR(pViewPos, vy, sx, sy, sz); + math::MTX34Zero(pViewPos); } } -void Calc_BILLBOARD_PERSP_STD(math::MTX34* pViewPos, - const math::MTX34* pModelMtxArray, - bool uniformScale, const math::MTX34* pViewMtx, - const ResMdl mdl, const u32 id) { - +void Calc_BILLBOARD_PERSP_STD( + math::MTX34 *pViewPos, const math::MTX34 *pModelMtxArray, bool uniformScale, const math::MTX34 *pViewMtx, + const ResMdl mdl, const u32 id +) { #pragma unused(pViewMtx) #pragma unused(mdl) @@ -269,28 +269,33 @@ void Calc_BILLBOARD_PERSP_STD(math::MTX34* pViewPos, math::VEC3 vy(pViewPos->_01, pViewPos->_11, pViewPos->_21); math::VEC3 vz(-pViewPos->_03, -pViewPos->_13, -pViewPos->_23); - math::VEC3Normalize(&vz, &vz); - math::VEC3Cross(&vx, &vy, &vz); + if (math::FAbs(vz.x) >= norm_epsilon || math::FAbs(vz.y) >= norm_epsilon || math::FAbs(vz.z) >= norm_epsilon) { + math::VEC3Normalize(&vz, &vz); + math::VEC3Cross(&vx, &vy, &vz); - math::VEC3Normalize(&vx, &vx); - math::VEC3Cross(&vy, &vz, &vx); + if (math::FAbs(vx.x) >= norm_epsilon || math::FAbs(vx.y) >= norm_epsilon || math::FAbs(vx.z) >= norm_epsilon) { + math::VEC3Normalize(&vx, &vx); + math::VEC3Cross(&vy, &vz, &vx); - if (uniformScale) { - f32 s = GetMtx34Scale(pModelMtxArray[id], 0); - SetMdlViewMtxSR(pViewPos, vx, vy, vz, s, s, s); - } else { - f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); - f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); - f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); - SetMdlViewMtxSR(pViewPos, vx, vy, vz, sx, sy, sz); + if (uniformScale) { + f32 s = GetMtx34Scale(pModelMtxArray[id], 0); + SetMdlViewMtxSR(pViewPos, vx, vy, vz, s, s, s); + } else { + f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); + f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); + f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); + SetMdlViewMtxSR(pViewPos, vx, vy, vz, sx, sy, sz); + } + return; + } } + math::MTX34Zero(pViewPos); } -void Calc_BILLBOARD_ROT(math::MTX34* pViewPos, - const math::MTX34* pModelMtxArray, bool uniformScale, - const math::MTX34* pViewMtx, const ResMdl mdl, - const u32 id) { - +void Calc_BILLBOARD_ROT( + math::MTX34 *pViewPos, const math::MTX34 *pModelMtxArray, bool uniformScale, const math::MTX34 *pViewMtx, + const ResMdl mdl, const u32 id +) { #pragma unused(pViewMtx) math::VEC3 vy; @@ -303,8 +308,7 @@ void Calc_BILLBOARD_ROT(math::MTX34* pViewPos, if (parent.IsValid()) { u32 parentMtxID = parent.GetMtxID(); - GetModelLocalAxisY2(&vy, &pModelMtxArray[id], - &pModelMtxArray[parentMtxID]); + GetModelLocalAxisY2(&vy, &pModelMtxArray[id], &pModelMtxArray[parentMtxID]); } else { vy.x = pModelMtxArray[id]._01; vy.y = pModelMtxArray[id]._11; @@ -316,24 +320,27 @@ void Calc_BILLBOARD_ROT(math::MTX34* pViewPos, vy.z = 0.0f; } - math::VEC3Normalize(&vy, &vy); + if (math::FAbs(vy.x) >= norm_epsilon || math::FAbs(vy.y) >= norm_epsilon) { + math::VEC3Normalize(&vy, &vy); - if (uniformScale) { - f32 s = GetMtx34Scale(pModelMtxArray[id], 0); - SetMdlViewMtxSR(pViewPos, vy, s); + if (uniformScale) { + f32 s = GetMtx34Scale(pModelMtxArray[id], 0); + SetMdlViewMtxSR(pViewPos, vy, s); + } else { + f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); + f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); + f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); + SetMdlViewMtxSR(pViewPos, vy, sx, sy, sz); + } } else { - f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); - f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); - f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); - SetMdlViewMtxSR(pViewPos, vy, sx, sy, sz); + math::MTX34Zero(pViewPos); } } -void Calc_BILLBOARD_PERSP_ROT(math::MTX34* pViewPos, - const math::MTX34* pModelMtxArray, - bool uniformScale, const math::MTX34* pViewMtx, - const ResMdl mdl, const u32 id) { - +void Calc_BILLBOARD_PERSP_ROT( + math::MTX34 *pViewPos, const math::MTX34 *pModelMtxArray, bool uniformScale, const math::MTX34 *pViewMtx, + const ResMdl mdl, const u32 id +) { #pragma unused(pViewMtx) math::VEC3 vx; @@ -348,8 +355,7 @@ void Calc_BILLBOARD_PERSP_ROT(math::MTX34* pViewPos, if (parent.IsValid()) { u32 parentMtxID = parent.GetMtxID(); - GetModelLocalAxisY3(&vy, &pModelMtxArray[id], - &pModelMtxArray[parentMtxID]); + GetModelLocalAxisY3(&vy, &pModelMtxArray[id], &pModelMtxArray[parentMtxID]); } else { vy.x = pModelMtxArray[id]._01; vy.y = pModelMtxArray[id]._11; @@ -361,56 +367,66 @@ void Calc_BILLBOARD_PERSP_ROT(math::MTX34* pViewPos, vy.z = pModelMtxArray[id]._21; } - math::VEC3Normalize(&vz, &vz); - math::VEC3Cross(&vx, &vy, &vz); + if (math::FAbs(vz.x) >= norm_epsilon || math::FAbs(vz.y) >= norm_epsilon || math::FAbs(vz.z) >= norm_epsilon) { + math::VEC3Normalize(&vz, &vz); + math::VEC3Cross(&vx, &vy, &vz); - math::VEC3Normalize(&vx, &vx); - math::VEC3Cross(&vy, &vz, &vx); + if (math::FAbs(vx.x) >= norm_epsilon || math::FAbs(vx.y) >= norm_epsilon || math::FAbs(vx.z) >= norm_epsilon) { + math::VEC3Normalize(&vx, &vx); + math::VEC3Cross(&vy, &vz, &vx); - if (uniformScale) { - f32 s = GetMtx34Scale(pModelMtxArray[id], 0); - SetMdlViewMtxSR(pViewPos, vx, vy, vz, s, s, s); - } else { - f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); - f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); - f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); - SetMdlViewMtxSR(pViewPos, vx, vy, vz, sx, sy, sz); + if (uniformScale) { + f32 s = GetMtx34Scale(pModelMtxArray[id], 0); + SetMdlViewMtxSR(pViewPos, vx, vy, vz, s, s, s); + } else { + f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); + f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); + f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); + SetMdlViewMtxSR(pViewPos, vx, vy, vz, sx, sy, sz); + } + return; + } } + math::MTX34Zero(pViewPos); } -void Calc_BILLBOARD_Y(math::MTX34* pViewPos, const math::MTX34* pModelMtxArray, - bool uniformScale, const math::MTX34* pViewMtx, - const ResMdl mdl, const u32 id) { - +void Calc_BILLBOARD_Y( + math::MTX34 *pViewPos, const math::MTX34 *pModelMtxArray, bool uniformScale, const math::MTX34 *pViewMtx, + const ResMdl mdl, const u32 id +) { #pragma unused(pViewMtx) #pragma unused(mdl) math::VEC3 vz; math::VEC3 vy(pViewPos->_01, pViewPos->_11, pViewPos->_21); math::VEC3 vx(vy.y, -vy.x, 0.0f); + if (math::FAbs(vy.x) >= norm_epsilon || math::FAbs(vx.x) >= norm_epsilon || math::FAbs(vy.z) >= norm_epsilon) { + f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); + f32 invSY = math::FInv(sy); - f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); - f32 invSY = math::FInv(sy); + vy *= invSY; - vy *= invSY; + if (math::FAbs(vx.x) >= norm_epsilon || math::FAbs(vx.y) >= norm_epsilon) { + math::VEC3Normalize(&vx, &vx); + math::VEC3Cross(&vz, &vx, &vy); - math::VEC3Normalize(&vx, &vx); - math::VEC3Cross(&vz, &vx, &vy); - - if (uniformScale) { - SetMdlViewMtxSR(pViewPos, vx, vy, vz, sy, sy, sy); - } else { - f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); - f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); - SetMdlViewMtxSR(pViewPos, vx, vy, vz, sx, sy, sz); + if (uniformScale) { + SetMdlViewMtxSR(pViewPos, vx, vy, vz, sy, sy, sy); + } else { + f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); + f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); + SetMdlViewMtxSR(pViewPos, vx, vy, vz, sx, sy, sz); + } + return; + } } + math::MTX34Zero(pViewPos); } -void Calc_BILLBOARD_PERSP_Y(math::MTX34* pViewPos, - const math::MTX34* pModelMtxArray, - bool uniformScale, const math::MTX34* pViewMtx, - const ResMdl mdl, const u32 id) { - +void Calc_BILLBOARD_PERSP_Y( + math::MTX34 *pViewPos, const math::MTX34 *pModelMtxArray, bool uniformScale, const math::MTX34 *pViewMtx, + const ResMdl mdl, const u32 id +) { #pragma unused(pViewMtx) #pragma unused(mdl) @@ -418,28 +434,34 @@ void Calc_BILLBOARD_PERSP_Y(math::MTX34* pViewPos, math::VEC3 vy(pViewPos->_01, pViewPos->_11, pViewPos->_21); math::VEC3 vz(-pViewPos->_03, -pViewPos->_13, -pViewPos->_23); - f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); - f32 invSY = math::FInv(sy); + if (math::FAbs(vy.x) >= norm_epsilon || math::FAbs(vy.y) >= norm_epsilon || math::FAbs(vy.z) >= norm_epsilon) { + f32 sy = GetMtx34Scale(pModelMtxArray[id], 1); + f32 invSY = math::FInv(sy); - vy *= invSY; - math::VEC3Cross(&vx, &vy, &vz); + vy *= invSY; + math::VEC3Cross(&vx, &vy, &vz); - math::VEC3Normalize(&vx, &vx); - math::VEC3Cross(&vz, &vx, &vy); + if (math::FAbs(vx.x) >= norm_epsilon || math::FAbs(vx.y) >= norm_epsilon || math::FAbs(vx.z) >= norm_epsilon) { + math::VEC3Normalize(&vx, &vx); + math::VEC3Cross(&vz, &vx, &vy); - if (uniformScale) { - SetMdlViewMtxSR(pViewPos, vx, vy, vz, sy, sy, sy); - } else { - f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); - f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); - SetMdlViewMtxSR(pViewPos, vx, vy, vz, sx, sy, sz); + if (uniformScale) { + SetMdlViewMtxSR(pViewPos, vx, vy, vz, sy, sy, sy); + } else { + f32 sx = GetMtx34Scale(pModelMtxArray[id], 0); + f32 sz = GetMtx34Scale(pModelMtxArray[id], 2); + SetMdlViewMtxSR(pViewPos, vx, vy, vz, sx, sy, sz); + } + return; + } } + math::MTX34Zero(pViewPos); } -typedef void (*BillBoardFunc)(math::MTX34* pViewPos, - const math::MTX34* pModelMtxArray, - bool uniformScale, const math::MTX34* pViewMtx, - const ResMdl mdl, const u32 id); +typedef void (*BillBoardFunc)( + math::MTX34 *pViewPos, const math::MTX34 *pModelMtxArray, bool uniformScale, const math::MTX34 *pViewMtx, + const ResMdl mdl, const u32 id +); const BillBoardFunc bbFunc[ResNodeData::NUM_BILLBOARD] = { NULL, // BILLBOARD_OFF is ignored @@ -461,19 +483,18 @@ const BillBoardFunc bbFunc[ResNodeData::NUM_BILLBOARD] = { * CalcView * ******************************************************************************/ -void CalcView(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, - const math::MTX34* pModelMtxArray, - const u32* pModelMtxAttribArray, u32 numMtx, - const math::MTX34* pViewMtx, const ResMdl mdl, - math::MTX34* pViewTexMtxArray) { - +void CalcView( + math::MTX34 *pViewPosArray, math::MTX33 *pViewNrmArray, const math::MTX34 *pModelMtxArray, + const u32 *pModelMtxAttribArray, u32 numMtx, const math::MTX34 *pViewMtx, const ResMdl mdl, + math::MTX34 *pViewTexMtxArray +) { if (numMtx <= 0) { return; } - math::MTX34* pVArray; - math::MTX33* pNArray; - math::MTX34* pCurTArray; + math::MTX34 *pVArray; + math::MTX33 *pNArray; + math::MTX34 *pCurTArray; u32 sizeVArray = align32(numMtx * sizeof(math::MTX34)); u32 sizeNArray = align32(numMtx * sizeof(math::MTX33)); @@ -487,20 +508,17 @@ void CalcView(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, math::MTX34Mult(pVArray, pViewMtx, pModelMtxArray); } - math::MTX34* pBbMtxArray = detail::workmem::GetBillboardMtxTemporary(); + math::MTX34 *pBbMtxArray = detail::workmem::GetBillboardMtxTemporary(); for (u32 i = 0; i < numMtx; i++) { u32 attr = pModelMtxAttribArray[i]; - ResNodeData::Billboard bbType = - detail::WorldMtxAttr::GetBillboard(attr); + ResNodeData::Billboard bbType = detail::WorldMtxAttr::GetBillboard(attr); if (bbType != ResNodeData::BILLBOARD_OFF) { - math::MTX34& rVMtx = pVArray[i]; + math::MTX34 &rVMtx = pVArray[i]; - bbFunc[bbType](&rVMtx, pModelMtxArray, - detail::WorldMtxAttr::IsAllScaleUniform(attr), - pViewMtx, mdl, i); + bbFunc[bbType](&rVMtx, pModelMtxArray, detail::WorldMtxAttr::IsAllScaleUniform(attr), pViewMtx, mdl, i); s32 nodeID = mdl.GetResMdlInfo().GetNodeIDFromMtxID(i); ResNode node = mdl.GetResNode(static_cast(nodeID)); @@ -508,11 +526,14 @@ void CalcView(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, if (node.IsValid() && node.GetChildNode().IsValid()) { math::MTX34 invWorld; - u32 ret = math::MTX34Inv(&invWorld, &pModelMtxArray[i]); + u32 ret = detail::CalcInvWorldMtx(&invWorld, &pModelMtxArray[i]); if (ret == TRUE) { math::MTX34Mult(&pBbMtxArray[i], &pVArray[i], &invWorld); } else { math::MTX34Identity(&pBbMtxArray[i]); + pBbMtxArray[i]._03 = pViewMtx->_03; + pBbMtxArray[i]._13 = pViewMtx->_13; + pBbMtxArray[i]._23 = pViewMtx->_23; } } } else { @@ -532,8 +553,7 @@ void CalcView(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, u32 bbMtxID = mdl.GetResNode(node.ref().bbref_nodeid).GetMtxID(); - math::MTX34Mult(&pVArray[i], &pBbMtxArray[bbMtxID], - &pModelMtxArray[i]); + math::MTX34Mult(&pVArray[i], &pBbMtxArray[bbMtxID], &pModelMtxArray[i]); } } @@ -542,24 +562,23 @@ void CalcView(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, if (pNArray != NULL) { for (u32 i = 0; i < numMtx; i++) { - math::MTX34& rVMtx = pVArray[i]; - math::MTX33& rNMtx = pNArray[i]; + math::MTX34 &rVMtx = pVArray[i]; + math::MTX33 &rNMtx = pNArray[i]; u32 attr = pModelMtxAttribArray[i]; if (detail::WorldMtxAttr::IsAllScaleUniform(attr)) { if (pCurTArray != NULL) { math::MTX34Copy(&pCurTArray[i], &rVMtx); - pCurTArray[i]._03 = pCurTArray[i]._13 = pCurTArray[i]._23 = - 0.0f; + pCurTArray[i]._03 = pCurTArray[i]._13 = pCurTArray[i]._23 = 0.0f; } math::MTX34ToMTX33(&rNMtx, &rVMtx); } else { if (pCurTArray != NULL) { - math::MTX34InvTranspose(&pCurTArray[i], &rVMtx); + detail::CalcViewTexMtx(&pCurTArray[i], &rVMtx); math::MTX34ToMTX33(&rNMtx, &pCurTArray[i]); } else { - math::MTX34InvTranspose(&rNMtx, &rVMtx); + detail::CalcViewNrmMtx(&rNMtx, &rVMtx); } } } @@ -576,32 +595,24 @@ void CalcView(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, } } -void CalcView_LC(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, - const math::MTX34* pModelMtxArray, - const u32* pModelMtxAttribArray, u32 numMtx, - const math::MTX34* pViewMtx, const ResMdl mdl, - math::MTX34* pViewTexMtxArray) { - +void CalcView_LC( + math::MTX34 *pViewPosArray, math::MTX33 *pViewNrmArray, const math::MTX34 *pModelMtxArray, + const u32 *pModelMtxAttribArray, u32 numMtx, const math::MTX34 *pViewMtx, const ResMdl mdl, + math::MTX34 *pViewTexMtxArray +) { if (numMtx <= 0) { return; } - detail::MtxCacheMap* pMtxCache = - static_cast(ut::LC::GetBase()); + detail::MtxCacheMap *pMtxCache = static_cast(ut::LC::GetBase()); - math::MTX34* pCurVArray = - reinterpret_cast(pMtxCache->currViewArray); - math::MTX33* pCurNArray = - reinterpret_cast(pMtxCache->currNrmArray); - math::MTX34* pCurTArray = - reinterpret_cast(pMtxCache->currTexArray); + math::MTX34 *pCurVArray = reinterpret_cast(pMtxCache->currViewArray); + math::MTX33 *pCurNArray = reinterpret_cast(pMtxCache->currNrmArray); + math::MTX34 *pCurTArray = reinterpret_cast(pMtxCache->currTexArray); - math::MTX34* pPrevVArray = - reinterpret_cast(pMtxCache->prevViewArray); - math::MTX33* pPrevNArray = - reinterpret_cast(pMtxCache->prevNrmArray); - math::MTX34* pPrevTArray = - reinterpret_cast(pMtxCache->prevTexArray); + math::MTX34 *pPrevVArray = reinterpret_cast(pMtxCache->prevViewArray); + math::MTX33 *pPrevNArray = reinterpret_cast(pMtxCache->prevNrmArray); + math::MTX34 *pPrevTArray = reinterpret_cast(pMtxCache->prevTexArray); u32 sizeVArray = align32(numMtx * sizeof(math::MTX34)); DC::InvalidateRange(pViewPosArray, sizeVArray); @@ -623,7 +634,7 @@ void CalcView_LC(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, } } - math::MTX34* pBbMtxArray = detail::workmem::GetBillboardMtxTemporary(); + math::MTX34 *pBbMtxArray = detail::workmem::GetBillboardMtxTemporary(); ut::LC::QueueWait(0); @@ -644,8 +655,7 @@ void CalcView_LC(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, ut::LC::QueueWait(queueLen); if (remain > 1) { - math::MTX34MultArray(pCurVArray, pViewMtx, &pModelMtxArray[baseMtx], - remain); + math::MTX34MultArray(pCurVArray, pViewMtx, &pModelMtxArray[baseMtx], remain); } else { math::MTX34Mult(pCurVArray, pViewMtx, &pModelMtxArray[baseMtx]); } @@ -653,37 +663,35 @@ void CalcView_LC(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, for (u32 i = 0; i < remain; i++) { u32 attr = pModelMtxAttribArray[baseMtx + i]; - ResNodeData::Billboard bbType = - detail::WorldMtxAttr::GetBillboard(attr); + ResNodeData::Billboard bbType = detail::WorldMtxAttr::GetBillboard(attr); if (bbType != ResNodeData::BILLBOARD_OFF) { - math::MTX34& rVMtx = pCurVArray[i]; + math::MTX34 &rVMtx = pCurVArray[i]; - bbFunc[bbType](&rVMtx, pModelMtxArray, - detail::WorldMtxAttr::IsAllScaleUniform(attr), - pViewMtx, mdl, baseMtx + i); + bbFunc[bbType]( + &rVMtx, pModelMtxArray, detail::WorldMtxAttr::IsAllScaleUniform(attr), pViewMtx, mdl, baseMtx + i + ); - s32 nodeID = - mdl.GetResMdlInfo().GetNodeIDFromMtxID(baseMtx + i); + s32 nodeID = mdl.GetResMdlInfo().GetNodeIDFromMtxID(baseMtx + i); ResNode node = mdl.GetResNode(static_cast(nodeID)); if (node.IsValid() && node.GetChildNode().IsValid()) { math::MTX34 invWorld; - u32 ret = - math::MTX34Inv(&invWorld, &pModelMtxArray[baseMtx + i]); + u32 ret = detail::CalcInvWorldMtx(&invWorld, &pModelMtxArray[baseMtx + i]); if (ret == TRUE) { - math::MTX34Mult(&pBbMtxArray[baseMtx + i], - &pCurVArray[i], &invWorld); + math::MTX34Mult(&pBbMtxArray[baseMtx + i], &pCurVArray[i], &invWorld); } else { math::MTX34Identity(&pBbMtxArray[baseMtx + i]); + pBbMtxArray[baseMtx + i]._03 = pViewMtx->_03; + pBbMtxArray[baseMtx + i]._13 = pViewMtx->_13; + pBbMtxArray[baseMtx + i]._23 = pViewMtx->_23; } } } else { - s32 nodeID = - mdl.GetResMdlInfo().GetNodeIDFromMtxID(baseMtx + i); + s32 nodeID = mdl.GetResMdlInfo().GetNodeIDFromMtxID(baseMtx + i); if (nodeID < 0) { continue; } @@ -697,11 +705,9 @@ void CalcView_LC(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, continue; } - u32 bbMtxID = - mdl.GetResNode(node.ref().bbref_nodeid).GetMtxID(); + u32 bbMtxID = mdl.GetResNode(node.ref().bbref_nodeid).GetMtxID(); - math::MTX34Mult(&pCurVArray[i], &pBbMtxArray[bbMtxID], - &pModelMtxArray[baseMtx + i]); + math::MTX34Mult(&pCurVArray[i], &pBbMtxArray[bbMtxID], &pModelMtxArray[baseMtx + i]); } } @@ -709,37 +715,34 @@ void CalcView_LC(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, if (pViewNrmArray != NULL) { for (u32 i = 0; i < remain; i++) { - math::MTX34& rVMtx = pCurVArray[i]; - math::MTX33& rNMtx = pCurNArray[i]; + math::MTX34 &rVMtx = pCurVArray[i]; + math::MTX33 &rNMtx = pCurNArray[i]; u32 attr = pModelMtxAttribArray[baseMtx + i]; if (detail::WorldMtxAttr::IsAllScaleUniform(attr)) { if (pViewTexMtxArray != NULL) { math::MTX34Copy(&pCurTArray[i], &rVMtx); - pCurTArray[i]._03 = pCurTArray[i]._13 = - pCurTArray[i]._23 = 0.0f; + pCurTArray[i]._03 = pCurTArray[i]._13 = pCurTArray[i]._23 = 0.0f; } math::MTX34ToMTX33(&rNMtx, &rVMtx); } else { if (pViewTexMtxArray != NULL) { - math::MTX34InvTranspose(&pCurTArray[i], &rVMtx); + detail::CalcViewTexMtx(&pCurTArray[i], &rVMtx); math::MTX34ToMTX33(&rNMtx, &pCurTArray[i]); } else { - math::MTX34InvTranspose(&rNMtx, &rVMtx); + detail::CalcViewNrmMtx(&rNMtx, &rVMtx); } } } } if (pViewNrmArray != NULL) { - ut::LC::StoreBlocks(&pViewNrmArray[baseMtx], pCurNArray, - numBlocksNrm); + ut::LC::StoreBlocks(&pViewNrmArray[baseMtx], pCurNArray, numBlocksNrm); if (pViewTexMtxArray != NULL) { - ut::LC::StoreBlocks(&pViewTexMtxArray[baseMtx], pCurTArray, - numBlocks); + ut::LC::StoreBlocks(&pViewTexMtxArray[baseMtx], pCurTArray, numBlocks); } } @@ -749,37 +752,26 @@ void CalcView_LC(math::MTX34* pViewPosArray, math::MTX33* pViewNrmArray, } } -void CalcView_LC_DMA_ModelMtx(math::MTX34* pViewPosArray, - math::MTX33* pViewNrmArray, - const math::MTX34* pModelMtxArray, - const u32* pModelMtxAttribArray, u32 numMtx, - const math::MTX34* pViewMtx, const ResMdl mdl, - math::MTX34* pViewTexMtxArray) { - +void CalcView_LC_DMA_ModelMtx( + math::MTX34 *pViewPosArray, math::MTX33 *pViewNrmArray, const math::MTX34 *pModelMtxArray, + const u32 *pModelMtxAttribArray, u32 numMtx, const math::MTX34 *pViewMtx, const ResMdl mdl, + math::MTX34 *pViewTexMtxArray +) { if (numMtx <= 0) { return; } - detail::MtxCacheMap* pMtxCache = - static_cast(ut::LC::GetBase()); + detail::MtxCacheMap *pMtxCache = static_cast(ut::LC::GetBase()); - math::MTX34* pCurMArray = - reinterpret_cast(pMtxCache->currDmaArray); - math::MTX34* pCurVArray = - reinterpret_cast(pMtxCache->currViewArray); - math::MTX33* pCurNArray = - reinterpret_cast(pMtxCache->currNrmArray); - math::MTX34* pCurTArray = - reinterpret_cast(pMtxCache->currTexArray); + math::MTX34 *pCurMArray = reinterpret_cast(pMtxCache->currDmaArray); + math::MTX34 *pCurVArray = reinterpret_cast(pMtxCache->currViewArray); + math::MTX33 *pCurNArray = reinterpret_cast(pMtxCache->currNrmArray); + math::MTX34 *pCurTArray = reinterpret_cast(pMtxCache->currTexArray); - math::MTX34* pPrevMArray = - reinterpret_cast(pMtxCache->prevDmaArray); - math::MTX34* pPrevVArray = - reinterpret_cast(pMtxCache->prevViewArray); - math::MTX33* pPrevNArray = - reinterpret_cast(pMtxCache->prevNrmArray); - math::MTX34* pPrevTArray = - reinterpret_cast(pMtxCache->prevTexArray); + math::MTX34 *pPrevMArray = reinterpret_cast(pMtxCache->prevDmaArray); + math::MTX34 *pPrevVArray = reinterpret_cast(pMtxCache->prevViewArray); + math::MTX33 *pPrevNArray = reinterpret_cast(pMtxCache->prevNrmArray); + math::MTX34 *pPrevTArray = reinterpret_cast(pMtxCache->prevTexArray); u32 sizeVArray = align32(numMtx * sizeof(math::MTX34)); DC::InvalidateRange(pViewPosArray, sizeVArray); @@ -801,7 +793,7 @@ void CalcView_LC_DMA_ModelMtx(math::MTX34* pViewPosArray, } } - math::MTX34* pBbMtxArray = detail::workmem::GetBillboardMtxTemporary(); + math::MTX34 *pBbMtxArray = detail::workmem::GetBillboardMtxTemporary(); ut::LC::QueueWait(0); @@ -812,8 +804,7 @@ void CalcView_LC_DMA_ModelMtx(math::MTX34* pViewPosArray, numBlocks = align32(numMtx * sizeof(math::MTX34)) / 32; } - ut::LC::LoadBlocks(pCurMArray, const_cast(pModelMtxArray), - numBlocks); + ut::LC::LoadBlocks(pCurMArray, const_cast(pModelMtxArray), numBlocks); if (numMtx > 20) { ut::LC::QueueWaitEx(0); @@ -847,10 +838,7 @@ void CalcView_LC_DMA_ModelMtx(math::MTX34* pViewPosArray, blocks = align32(n * sizeof(math::MTX34)) / 32; } - ut::LC::LoadBlocks( - pPrevMArray, - const_cast(&pModelMtxArray[baseMtx + 40]), - blocks); + ut::LC::LoadBlocks(pPrevMArray, const_cast(&pModelMtxArray[baseMtx + 40]), blocks); } if (remain > 1) { @@ -862,37 +850,35 @@ void CalcView_LC_DMA_ModelMtx(math::MTX34* pViewPosArray, for (u32 i = 0; i < remain; i++) { u32 attr = pModelMtxAttribArray[baseMtx + i]; - ResNodeData::Billboard bbType = - detail::WorldMtxAttr::GetBillboard(attr); + ResNodeData::Billboard bbType = detail::WorldMtxAttr::GetBillboard(attr); if (bbType != ResNodeData::BILLBOARD_OFF) { - math::MTX34& rVMtx = pCurVArray[i]; + math::MTX34 &rVMtx = pCurVArray[i]; - bbFunc[bbType](&rVMtx, pModelMtxArray, - detail::WorldMtxAttr::IsAllScaleUniform(attr), - pViewMtx, mdl, baseMtx + i); + bbFunc[bbType]( + &rVMtx, pModelMtxArray, detail::WorldMtxAttr::IsAllScaleUniform(attr), pViewMtx, mdl, baseMtx + i + ); - s32 nodeID = - mdl.GetResMdlInfo().GetNodeIDFromMtxID(baseMtx + i); + s32 nodeID = mdl.GetResMdlInfo().GetNodeIDFromMtxID(baseMtx + i); ResNode node = mdl.GetResNode(static_cast(nodeID)); if (node.IsValid() && node.GetChildNode().IsValid()) { math::MTX34 invWorld; - u32 ret = - math::MTX34Inv(&invWorld, &pModelMtxArray[baseMtx + i]); + u32 ret = detail::CalcInvWorldMtx(&invWorld, &pModelMtxArray[baseMtx + i]); if (ret == TRUE) { - math::MTX34Mult(&pBbMtxArray[baseMtx + i], - &pCurVArray[i], &invWorld); + math::MTX34Mult(&pBbMtxArray[baseMtx + i], &pCurVArray[i], &invWorld); } else { math::MTX34Identity(&pBbMtxArray[baseMtx + i]); + pBbMtxArray[baseMtx + i]._03 = pViewMtx->_03; + pBbMtxArray[baseMtx + i]._13 = pViewMtx->_13; + pBbMtxArray[baseMtx + i]._23 = pViewMtx->_23; } } } else { - s32 nodeID = - mdl.GetResMdlInfo().GetNodeIDFromMtxID(baseMtx + i); + s32 nodeID = mdl.GetResMdlInfo().GetNodeIDFromMtxID(baseMtx + i); if (nodeID < 0) { continue; } @@ -906,11 +892,9 @@ void CalcView_LC_DMA_ModelMtx(math::MTX34* pViewPosArray, continue; } - u32 bbMtxID = - mdl.GetResNode(node.ref().bbref_nodeid).GetMtxID(); + u32 bbMtxID = mdl.GetResNode(node.ref().bbref_nodeid).GetMtxID(); - math::MTX34Mult(&pCurVArray[i], &pBbMtxArray[bbMtxID], - &pModelMtxArray[baseMtx + i]); + math::MTX34Mult(&pCurVArray[i], &pBbMtxArray[bbMtxID], &pModelMtxArray[baseMtx + i]); } } @@ -918,37 +902,34 @@ void CalcView_LC_DMA_ModelMtx(math::MTX34* pViewPosArray, if (pViewNrmArray != NULL) { for (u32 i = 0; i < remain; i++) { - math::MTX34& rVMtx = pCurVArray[i]; - math::MTX33& rNMtx = pCurNArray[i]; + math::MTX34 &rVMtx = pCurVArray[i]; + math::MTX33 &rNMtx = pCurNArray[i]; u32 attr = pModelMtxAttribArray[baseMtx + i]; if (detail::WorldMtxAttr::IsAllScaleUniform(attr)) { if (pViewTexMtxArray != NULL) { math::MTX34Copy(&pCurTArray[i], &rVMtx); - pCurTArray[i]._03 = pCurTArray[i]._13 = - pCurTArray[i]._23 = 0.0f; + pCurTArray[i]._03 = pCurTArray[i]._13 = pCurTArray[i]._23 = 0.0f; } math::MTX34ToMTX33(&rNMtx, &rVMtx); } else { if (pViewTexMtxArray != NULL) { - math::MTX34InvTranspose(&pCurTArray[i], &rVMtx); + detail::CalcViewTexMtx(&pCurTArray[i], &rVMtx); math::MTX34ToMTX33(&rNMtx, &pCurTArray[i]); } else { - math::MTX34InvTranspose(&rNMtx, &rVMtx); + detail::CalcViewNrmMtx(&rNMtx, &rVMtx); } } } } if (pViewNrmArray != NULL) { - ut::LC::StoreBlocks(&pViewNrmArray[baseMtx], pCurNArray, - numBlocksNrm); + ut::LC::StoreBlocks(&pViewNrmArray[baseMtx], pCurNArray, numBlocksNrm); if (pViewTexMtxArray != NULL) { - ut::LC::StoreBlocks(&pViewTexMtxArray[baseMtx], pCurTArray, - numBlocks); + ut::LC::StoreBlocks(&pViewTexMtxArray[baseMtx], pCurTArray, numBlocks); } } diff --git a/src/nw4r/g3d/g3d_calcvtx.cpp b/src/nw4r/g3d/g3d_calcvtx.cpp index 2eda30f2..cd8d4403 100644 --- a/src/nw4r/g3d/g3d_calcvtx.cpp +++ b/src/nw4r/g3d/g3d_calcvtx.cpp @@ -1,13 +1,14 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, - ResVtxNrmData** ppVtxNrmTable, ResVtxClrData** ppVtxClrTable) { - +void CalcVtx( + ResMdl mdl, AnmObjShp *pAnmShp, ResVtxPosData **ppVtxPosTable, ResVtxNrmData **ppVtxNrmTable, + ResVtxClrData **ppVtxClrTable +) { // Allows struct offsets inside assembly using nw4r::math::VEC3; using nw4r::ut::Color; @@ -20,7 +21,7 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, } ShpAnmResult result; - const ShpAnmResult* pResult = pAnmShp->GetResult(&result, id); + const ShpAnmResult *pResult = pAnmShp->GetResult(&result, id); if (!(pResult->flags & ShpAnmResult::FLAG_ANM_EXISTS)) { continue; @@ -28,7 +29,7 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, if (pResult->flags & ShpAnmResult::FLAG_ANM_VTXPOS) { struct KeyShape { - const math::VEC3* pVtx; // at 0x0 + const math::VEC3 *pVtx; // at 0x0 f32 weight; // at 0x4 }; @@ -38,14 +39,13 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, int numKeyShape = 0; ResVtxPos vtxPos(ppVtxPosTable[id]); - math::VEC3* pVtxPosBuf = static_cast(vtxPos.GetData()); + math::VEC3 *pVtxPosBuf = static_cast(vtxPos.GetData()); if (pResult->baseShapeWeight != 0.0f) { - const math::VEC3* pBase; + const math::VEC3 *pBase; u8 stride; - basePos.GetArray(reinterpret_cast(&pBase), - &stride); + basePos.GetArray(reinterpret_cast(&pBase), &stride); keyShape[numKeyShape].pVtx = pBase; keyShape[numKeyShape].weight = pResult->baseShapeWeight; @@ -58,10 +58,9 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, } ResVtxPos key(pResult->keyShape[i].vtxSet.resVtxPos); - const void* pData = key.GetData(); + const void *pData = key.GetData(); - keyShape[numKeyShape].pVtx = - static_cast(pData); + keyShape[numKeyShape].pVtx = static_cast(pData); keyShape[numKeyShape].weight = pResult->keyShape[i].weight; numKeyShape++; } @@ -73,14 +72,14 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, reinterpret_cast(pVtxPosBuf) + numVtx * sizeof(math::VEC3)); // clang-format on - const KeyShape* const pKeyEnd = keyShape + numKeyShape; + const KeyShape *const pKeyEnd = keyShape + numKeyShape; for (; pVtxPosBuf < pVtxPosBufEnd; pVtxPosBuf++) { register f32 xy, z_; - KeyShape& rFirst = keyShape[0]; + KeyShape &rFirst = keyShape[0]; register f32 firstWeight = rFirst.weight; - register const void* pVtx = rFirst.pVtx; + register const void *pVtx = rFirst.pVtx; // clang-format off asm { @@ -96,9 +95,9 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, reinterpret_cast(rFirst.pVtx) + sizeof(math::VEC3)); // clang-format on - for (KeyShape* pKey = &keyShape[1]; pKey < pKeyEnd; pKey++) { + for (KeyShape *pKey = &keyShape[1]; pKey < pKeyEnd; pKey++) { register f32 keyWeight = pKey->weight; - register const void* pKeyVtx = pKey->pVtx; + register const void *pKeyVtx = pKey->pVtx; register f32 key_xy, key_z_; // clang-format off @@ -116,7 +115,7 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, // clang-format on } - register void* pDst = pVtxPosBuf; + register void *pDst = pVtxPosBuf; // clang-format off asm { @@ -129,11 +128,9 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, DC::StoreRange(vtxPos.GetData(), numVtx * sizeof(math::VEC3)); } - if ((pResult->flags & ShpAnmResult::FLAG_ANM_VTXNRM) && - ppVtxNrmTable != NULL) { - + if ((pResult->flags & ShpAnmResult::FLAG_ANM_VTXNRM) && ppVtxNrmTable != NULL) { struct KeyShape { - const math::VEC3* pVtx; // at 0x0 + const math::VEC3 *pVtx; // at 0x0 f32 weight; // at 0x4 }; @@ -143,14 +140,13 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, int numKeyShape = 0; ResVtxNrm vtxNrm(ppVtxNrmTable[baseNrm.GetID()]); - math::VEC3* pVtxNrmBuf = static_cast(vtxNrm.GetData()); + math::VEC3 *pVtxNrmBuf = static_cast(vtxNrm.GetData()); if (pResult->baseShapeWeight != 0.0f) { - const math::VEC3* pBase; + const math::VEC3 *pBase; u8 stride; - baseNrm.GetArray(reinterpret_cast(&pBase), - &stride); + baseNrm.GetArray(reinterpret_cast(&pBase), &stride); keyShape[numKeyShape].pVtx = pBase; keyShape[numKeyShape].weight = pResult->baseShapeWeight; @@ -163,10 +159,9 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, } ResVtxNrm key(pResult->keyShape[i].vtxSet.resVtxNrm); - const void* pData = key.GetData(); + const void *pData = key.GetData(); - keyShape[numKeyShape].pVtx = - static_cast(pData); + keyShape[numKeyShape].pVtx = static_cast(pData); keyShape[numKeyShape].weight = pResult->keyShape[i].weight; numKeyShape++; } @@ -178,14 +173,14 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, reinterpret_cast(pVtxNrmBuf) + numVtx * sizeof(math::VEC3)); // clang-format on - const KeyShape* const pKeyEnd = keyShape + numKeyShape; + const KeyShape *const pKeyEnd = keyShape + numKeyShape; for (; pVtxNrmBuf < pVtxNrmBufEnd; pVtxNrmBuf++) { register f32 xy, z_; - KeyShape& rFirst = keyShape[0]; + KeyShape &rFirst = keyShape[0]; register f32 firstWeight = rFirst.weight; - register const void* pVtx = rFirst.pVtx; + register const void *pVtx = rFirst.pVtx; // clang-format off asm { @@ -201,9 +196,9 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, reinterpret_cast(rFirst.pVtx) + sizeof(math::VEC3)); // clang-format on - for (KeyShape* pKey = &keyShape[1]; pKey < pKeyEnd; pKey++) { + for (KeyShape *pKey = &keyShape[1]; pKey < pKeyEnd; pKey++) { register f32 keyWeight = pKey->weight; - register const void* pKeyVtx = pKey->pVtx; + register const void *pKeyVtx = pKey->pVtx; register f32 key_xy, key_z_; // clang-format off @@ -221,7 +216,7 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, // clang-format on } - register void* pDst = pVtxNrmBuf; + register void *pDst = pVtxNrmBuf; // clang-format off asm { @@ -234,11 +229,9 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, DC::StoreRange(vtxNrm.GetData(), numVtx * sizeof(math::VEC3)); } - if ((pResult->flags & ShpAnmResult::FLAG_ANM_VTXCLR) && - ppVtxClrTable != NULL) { - + if ((pResult->flags & ShpAnmResult::FLAG_ANM_VTXCLR) && ppVtxClrTable != NULL) { struct KeyShape { - const ut::Color* pVtx; // at 0x0 + const ut::Color *pVtx; // at 0x0 f32 weight; // at 0x4 }; @@ -248,14 +241,13 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, int numKeyShape = 0; ResVtxClr vtxClr(ppVtxClrTable[baseClr.GetID()]); - ut::Color* pVtxClrBuf = static_cast(vtxClr.GetData()); + ut::Color *pVtxClrBuf = static_cast(vtxClr.GetData()); if (pResult->baseShapeWeight != 0.0f) { - const ut::Color* pBase; + const ut::Color *pBase; u8 stride; - baseClr.GetArray(reinterpret_cast(&pBase), - &stride); + baseClr.GetArray(reinterpret_cast(&pBase), &stride); keyShape[numKeyShape].pVtx = pBase; keyShape[numKeyShape].weight = pResult->baseShapeWeight; @@ -268,10 +260,9 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, } ResVtxClr key(pResult->keyShape[i].vtxSet.resVtxClr); - const void* pData = key.GetData(); + const void *pData = key.GetData(); - keyShape[numKeyShape].pVtx = - static_cast(pData); + keyShape[numKeyShape].pVtx = static_cast(pData); keyShape[numKeyShape].weight = pResult->keyShape[i].weight; numKeyShape++; } @@ -283,14 +274,14 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, reinterpret_cast(pVtxClrBuf) + numVtx * sizeof(ut::Color)); // clang-format on - const KeyShape* const pKeyEnd = keyShape + numKeyShape; + const KeyShape *const pKeyEnd = keyShape + numKeyShape; for (; pVtxClrBuf < pVtxClrBufEnd; pVtxClrBuf++) { register f32 rg, ba; - KeyShape& rFirst = keyShape[0]; + KeyShape &rFirst = keyShape[0]; register f32 firstWeight = rFirst.weight; - register const void* pVtx = rFirst.pVtx; + register const void *pVtx = rFirst.pVtx; // clang-format off asm { @@ -306,9 +297,9 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, reinterpret_cast(rFirst.pVtx) + sizeof(ut::Color)); // clang-format on - for (KeyShape* pKey = &keyShape[1]; pKey < pKeyEnd; pKey++) { + for (KeyShape *pKey = &keyShape[1]; pKey < pKeyEnd; pKey++) { register f32 keyWeight = pKey->weight; - register const void* pKeyVtx = pKey->pVtx; + register const void *pKeyVtx = pKey->pVtx; register f32 key_rg, key_ba; // clang-format off @@ -326,7 +317,7 @@ void CalcVtx(ResMdl mdl, AnmObjShp* pAnmShp, ResVtxPosData** ppVtxPosTable, // clang-format on } - register void* pDst = pVtxClrBuf; + register void *pDst = pVtxClrBuf; // clang-format off asm { diff --git a/src/nw4r/g3d/g3d_calcworld.cpp b/src/nw4r/g3d/g3d_calcworld.cpp index bc1fd749..f777367e 100644 --- a/src/nw4r/g3d/g3d_calcworld.cpp +++ b/src/nw4r/g3d/g3d_calcworld.cpp @@ -1,20 +1,38 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void CalcWorld(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, - const u8* pByteCode, const math::MTX34* pBaseMtx, ResMdl mdl, - AnmObjChr* pAnmChr, FuncObjCalcWorld* pFuncObj, u32 rootAttrib) { +void WorldMtxManip::SetScale(f32 x, f32 y, f32 z) { + mpS->x = x; + mpS->y = y; + mpS->z = z; -#define pCalcCmd reinterpret_cast(pByteCode) -#define pMtxDupCmd \ - reinterpret_cast(pByteCode) + if (x == y && x == z) { + if (1.f == x) { + *mpWMAttr |= detail::WorldMtxAttr::ATTR_S_ONE; + } else { + *mpWMAttr |= detail::WorldMtxAttr::ATTR_S_UNIFORM; + *mpWMAttr &= ~(detail::WorldMtxAttr::ATTR_S_ONE | detail::WorldMtxAttr::ATTR_ALL_S_ONE); + } + } else { + *mpWMAttr &= + ~(detail::WorldMtxAttr::ATTR_S_UNIFORM | detail::WorldMtxAttr::ATTR_ALL_S_UNIFORM | + detail::WorldMtxAttr::ATTR_S_ONE | detail::WorldMtxAttr::ATTR_ALL_S_ONE); + } +} + +void CalcWorld( + math::MTX34 *pModelMtxArray, u32 *pModelMtxAttribArray, const u8 *pByteCode, const math::MTX34 *pBaseMtx, + ResMdl mdl, AnmObjChr *pAnmChr, FuncObjCalcWorld *pFuncObj, u32 rootAttrib +) { +#define pCalcCmd reinterpret_cast(pByteCode) +#define pMtxDupCmd reinterpret_cast(pByteCode) u8 c; ChrAnmResult result; - const ChrAnmResult* pResult = NULL; + const ChrAnmResult *pResult = NULL; if (pByteCode == NULL) { pByteCode = mdl.GetResByteCode("NodeTree"); @@ -28,12 +46,12 @@ void CalcWorld(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, bool ignoreTrans = detail::WorldMtxAttr::IsIgnoreTrans(rootAttrib); - math::VEC3* pScaleArray = detail::workmem::GetScaleTemporary(); + math::VEC3 *pScaleArray = detail::workmem::GetScaleTemporary(); pScaleArray[0].x = pScaleArray[0].y = pScaleArray[0].z = 1.0f; math::MTX34Copy(pModelMtxArray, pBaseMtx); - u32* pMtxIDArray = detail::workmem::GetMtxIDTemporary(); + u32 *pMtxIDArray = detail::workmem::GetMtxIDTemporary(); u32 numMtxID = 0; pModelMtxAttribArray[0] = rootAttrib; @@ -42,19 +60,18 @@ void CalcWorld(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, if (c == ResByteCodeData::CALC) { u32 nodeID = (pCalcCmd->nodeIdHi << 8) + pCalcCmd->nodeIdLo; - u32 parentMtxID = - (pCalcCmd->parentMtxIdHi << 8) + pCalcCmd->parentMtxIdLo; + u32 parentMtxID = (pCalcCmd->parentMtxIdHi << 8) + pCalcCmd->parentMtxIdLo; ResNode node = mdl.GetResNode(nodeID); u32 mtxID = node.GetMtxID(); pMtxIDArray[numMtxID++] = mtxID; - math::MTX34* pModelMtx = &pModelMtxArray[mtxID]; - math::VEC3* pScale = &pScaleArray[mtxID]; + math::MTX34 *pModelMtx = &pModelMtxArray[mtxID]; + math::VEC3 *pScale = &pScaleArray[mtxID]; - math::MTX34* pParentModelMtx = &pModelMtxArray[parentMtxID]; - math::VEC3* pParentScale = &pScaleArray[parentMtxID]; + math::MTX34 *pParentModelMtx = &pModelMtxArray[parentMtxID]; + math::VEC3 *pParentScale = &pScaleArray[parentMtxID]; u32 parentAttr = pModelMtxAttribArray[parentMtxID]; @@ -88,25 +105,23 @@ void CalcWorld(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, if (xsi) { pModelMtxAttribArray[mtxID] = detail::dcc::CalcWorldMtx_Xsi( - pModelMtx, pScale, pParentModelMtx, pParentScale, - parentAttr, pResult); + pModelMtx, pScale, pParentModelMtx, pParentScale, parentAttr, pResult + ); } else if (pResult->flags & ChrAnmResult::FLAG_SSC_APPLY) { - pModelMtxAttribArray[mtxID] = - detail::dcc::CalcWorldMtx_Maya_SSC_Apply( - pModelMtx, pScale, pParentModelMtx, pParentScale, - parentAttr, pResult); + pModelMtxAttribArray[mtxID] = detail::dcc::CalcWorldMtx_Maya_SSC_Apply( + pModelMtx, pScale, pParentModelMtx, pParentScale, parentAttr, pResult + ); } else { pModelMtxAttribArray[mtxID] = detail::dcc::CalcWorldMtx_Basic( - pModelMtx, pScale, pParentModelMtx, pParentScale, - parentAttr, pResult); + pModelMtx, pScale, pParentModelMtx, pParentScale, parentAttr, pResult + ); } - pModelMtxAttribArray[mtxID] = detail::WorldMtxAttr::SetBillboard( - pModelMtxAttribArray[mtxID], node.GetBillboardMode()); + pModelMtxAttribArray[mtxID] = + detail::WorldMtxAttr::SetBillboard(pModelMtxAttribArray[mtxID], node.GetBillboardMode()); if (pFuncObj != NULL) { - pFuncObj->CheckCallbackB(nodeID, pModelMtx, pScale, - &pModelMtxAttribArray[mtxID], mdl); + pFuncObj->CheckCallbackB(nodeID, pModelMtx, pScale, &pModelMtxAttribArray[mtxID], mdl); } pByteCode += sizeof(ResByteCodeData::CalcParams); @@ -114,14 +129,12 @@ void CalcWorld(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, } else /* Assume MTXDUP */ { u32 toMtxID = (pMtxDupCmd->toMtxIdHi << 8) + pMtxDupCmd->toMtxIdLo; - u32 fromMtxID = - (pMtxDupCmd->fromMtxIdHi << 8) + pMtxDupCmd->fromMtxIdLo; + u32 fromMtxID = (pMtxDupCmd->fromMtxIdHi << 8) + pMtxDupCmd->fromMtxIdLo; pMtxIDArray[numMtxID++] = toMtxID; pModelMtxAttribArray[toMtxID] = pModelMtxAttribArray[fromMtxID]; - math::MTX34Copy(&pModelMtxArray[toMtxID], - &pModelMtxArray[fromMtxID]); + math::MTX34Copy(&pModelMtxArray[toMtxID], &pModelMtxArray[fromMtxID]); pScaleArray[toMtxID] = pScaleArray[fromMtxID]; @@ -132,13 +145,11 @@ void CalcWorld(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, for (u32 i = 0; i < numMtxID; i++) { u32 mtxID = pMtxIDArray[i]; - if (pScaleArray[mtxID].x == 1.0f && pScaleArray[mtxID].y == 1.0f && - pScaleArray[mtxID].z == 1.0f) { + if (pScaleArray[mtxID].x == 1.0f && pScaleArray[mtxID].y == 1.0f && pScaleArray[mtxID].z == 1.0f) { continue; } - math::MTX34Scale(&pModelMtxArray[mtxID], &pModelMtxArray[mtxID], - &pScaleArray[mtxID]); + math::MTX34Scale(&pModelMtxArray[mtxID], &pModelMtxArray[mtxID], &pScaleArray[mtxID]); } if (pFuncObj != NULL) { @@ -149,26 +160,23 @@ void CalcWorld(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, #undef pMtxDupCmd } -void CalcWorld(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, - const u8* pByteCode, const math::MTX34* pBaseMtx, ResMdl mdl, - AnmObjChr* pAnmChr, FuncObjCalcWorld* pFuncObj) { - - CalcWorld(pModelMtxArray, pModelMtxAttribArray, pByteCode, pBaseMtx, mdl, - pAnmChr, pFuncObj, detail::WorldMtxAttr::GetRootMtxAttr()); +void CalcWorld( + math::MTX34 *pModelMtxArray, u32 *pModelMtxAttribArray, const u8 *pByteCode, const math::MTX34 *pBaseMtx, + ResMdl mdl, AnmObjChr *pAnmChr, FuncObjCalcWorld *pFuncObj +) { + CalcWorld( + pModelMtxArray, pModelMtxAttribArray, pByteCode, pBaseMtx, mdl, pAnmChr, pFuncObj, + detail::WorldMtxAttr::GetRootMtxAttr() + ); } -void CalcSkinning(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, - const ResMdl mdl, const u8* pByteCode) { - +void CalcSkinning(math::MTX34 *pModelMtxArray, u32 *pModelMtxAttribArray, const ResMdl mdl, const u8 *pByteCode) { // Allows struct offsets inside assembly using nw4r::math::MTX34; -#define pWeightCmd \ - reinterpret_cast(pByteCode) -#define pWeightEntry \ - reinterpret_cast(pByteCode) -#define pEvpMtxCmd \ - reinterpret_cast(pByteCode) +#define pWeightCmd reinterpret_cast(pByteCode) +#define pWeightEntry reinterpret_cast(pByteCode) +#define pEvpMtxCmd reinterpret_cast(pByteCode) u8 c; @@ -180,15 +188,14 @@ void CalcSkinning(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, } } - math::MTX34* pSkinMtxArray = detail::workmem::GetSkinningMtxTemporary(); + math::MTX34 *pSkinMtxArray = detail::workmem::GetSkinningMtxTemporary(); while ((c = *pByteCode) != ResByteCodeData::END) { if (c == ResByteCodeData::WEIGHT) { u32 targetMtxID = (pWeightCmd->tgtIdHi << 8) + pWeightCmd->tgtIdLo; u32 numBlendMtx = pWeightCmd->numBlendMtx; - pModelMtxAttribArray[targetMtxID] = - detail::WorldMtxAttr::GetRootMtxAttr(); + pModelMtxAttribArray[targetMtxID] = detail::WorldMtxAttr::GetRootMtxAttr(); pByteCode += sizeof(ResByteCodeData::WeightParams); @@ -210,21 +217,18 @@ void CalcSkinning(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, // clang-format on for (u32 i = 0; i < numBlendMtx; i++) { - u32 mtxID = - (pWeightEntry->mtxIdHi << 8) + pWeightEntry->mtxIdLo; + u32 mtxID = (pWeightEntry->mtxIdHi << 8) + pWeightEntry->mtxIdLo; - u32 iraito = pWeightEntry->fWeight0 << 24 | - pWeightEntry->fWeight1 << 16 | - pWeightEntry->fWeight2 << 8 | + u32 iraito = pWeightEntry->fWeight0 << 24 | pWeightEntry->fWeight1 << 16 | pWeightEntry->fWeight2 << 8 | pWeightEntry->fWeight3; - register f32 R = *reinterpret_cast(&iraito); + register f32 R = *reinterpret_cast(&iraito); register f32 T00, T02; register f32 T10, T12; register f32 T20, T22; - register math::MTX34* pT = &pSkinMtxArray[mtxID]; + register math::MTX34 *pT = &pSkinMtxArray[mtxID]; // clang-format off asm { @@ -244,13 +248,12 @@ void CalcSkinning(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, } // clang-format on - pModelMtxAttribArray[targetMtxID] &= - pModelMtxAttribArray[mtxID]; + pModelMtxAttribArray[targetMtxID] &= pModelMtxAttribArray[mtxID]; pByteCode += sizeof(ResByteCodeData::WeightEntry); } - register math::MTX34* pTargetMtx = &pModelMtxArray[targetMtxID]; + register math::MTX34 *pTargetMtx = &pModelMtxArray[targetMtxID]; // clang-format off asm { @@ -267,13 +270,39 @@ void CalcSkinning(math::MTX34* pModelMtxArray, u32* pModelMtxAttribArray, u32 mtxID = (pEvpMtxCmd->mtxIdHi << 8) + pEvpMtxCmd->mtxIdLo; u32 nodeID = (pEvpMtxCmd->nodeIdHi << 8) + pEvpMtxCmd->nodeIdLo; - math::MTX34Mult(&pSkinMtxArray[mtxID], &pModelMtxArray[mtxID], - static_cast( - &mdl.GetResNode(nodeID).ref().invModelMtx)); + math::MTX34Mult( + &pSkinMtxArray[mtxID], &pModelMtxArray[mtxID], + static_cast(&mdl.GetResNode(nodeID).ref().invModelMtx) + ); pByteCode += sizeof(ResByteCodeData::EvpMtxParams); } } + ResMdlInfo mdlInfo = mdl.GetResMdlInfo(); + switch (mdlInfo.GetEnvelopeMatrixMode()) { + case ResMdlInfo::EVPMATRIXMODE_NORMAL: { + return; + } break; + case ResMdlInfo::EVPMATRIXMODE_APPROX: { + u32 numWeighted = mdlInfo.GetNumPosNrmMtx() - mdl.GetResNodeNumEntries(); + u32 end = mdlInfo.GetNumViewMtx(); + u32 begin = end - numWeighted; + + for (u32 i = begin; i < end; i++) { + pModelMtxAttribArray[i] |= detail::WorldMtxAttr::ATTR_S_UNIFORM; + pModelMtxAttribArray[i] |= detail::WorldMtxAttr::ATTR_ALL_S_UNIFORM; + } + } break; + case ResMdlInfo::EVPMATRIXMODE_EXACT: { + u32 numWeighted = mdlInfo.GetNumPosNrmMtx() - mdl.GetResNodeNumEntries(); + u32 end = mdlInfo.GetNumViewMtx(); + u32 begin = end - numWeighted; + + for (u32 i = begin; i < end; i++) { + pModelMtxAttribArray[i] &= ~detail::WorldMtxAttr::ATTR_ALL_S_UNIFORM; + } + } break; + } #undef pWeightCmd #undef pWeightEntry diff --git a/src/nw4r/g3d/g3d_camera.cpp b/src/nw4r/g3d/g3d_camera.cpp index 618d624e..5876cd89 100644 --- a/src/nw4r/g3d/g3d_camera.cpp +++ b/src/nw4r/g3d/g3d_camera.cpp @@ -1,9 +1,9 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/math.h" // IWYU pragma: export -#include -#include +#include "rvl/GX.h" // IWYU pragma: export +#include "rvl/MTX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -224,6 +224,17 @@ void Camera::SetProjectionMtxDirectly(const math::MTX44 *pMtx) { } } +void Camera::SetTexMtxParam(f32 lightScaleS, f32 lightScaleT, f32 lightTransS, f32 lightTransT) { + if (IsValid()) { + CameraData &r = ref(); + + r.lightScaleS = lightScaleS; + r.lightScaleT = lightScaleT; + r.lightTransS = lightTransS; + r.lightTransT = lightTransT; + } +} + void Camera::SetScissor(u32 x, u32 y, u32 width, u32 height) { if (!IsValid()) { return; @@ -303,8 +314,40 @@ void Camera::GetViewport(f32 *pX, f32 *pY, f32 *pWidth, f32 *pHeight, f32 *pNear } } +void Camera::Project(math::VEC3 *pSrcPos, const math::VEC3 &worldPos) const { + if (pSrcPos == NULL) { + return; + } + + math::MTX34 cam; + math::MTX44 proj; + + f32 vp[GX_VIEWPORT_SZ]; + f32 p[GX_PROJECTION_SZ]; + + GetCameraMtx(&cam); + GetProjectionMtx(&proj); + + p[0] = GetProjectionType(); + p[1] = proj._00; + p[3] = proj._11; + p[5] = proj._22; + p[6] = proj._23; + + if (p[0] == 1.0f) { + p[2] = proj._03; + p[4] = proj._13; + } else { + p[2] = proj._02; + p[4] = proj._12; + } + + GetViewport(&vp[0], &vp[1], &vp[2], &vp[3], &vp[4], &vp[5]); + ::GXProject(worldPos.x, worldPos.y, worldPos.z, cam, p, vp, &pSrcPos->x, &pSrcPos->y, &pSrcPos->z); +} + void Camera::GetCameraMtx(math::MTX34 *pMtx) const { - if (pMtx != NULL && IsValid()) { + if (pMtx && IsValid()) { const CameraData &r = ref(); if (!(r.flags & CameraData::FLAG_CAM_MTX_READY)) { @@ -316,7 +359,7 @@ void Camera::GetCameraMtx(math::MTX34 *pMtx) const { } void Camera::GetProjectionMtx(math::MTX44 *pMtx) const { - if (pMtx != NULL && IsValid()) { + if (pMtx && IsValid()) { const CameraData &r = ref(); if (!(r.flags & CameraData::FLAG_PROJ_MTX_READY)) { diff --git a/src/nw4r/g3d/g3d_dcc.cpp b/src/nw4r/g3d/g3d_dcc.cpp index 4cbf928d..7bcacf50 100644 --- a/src/nw4r/g3d/g3d_dcc.cpp +++ b/src/nw4r/g3d/g3d_dcc.cpp @@ -1,12 +1,11 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void CalcTexMtx(math::MTX34* pMtx, bool set, const TexSrt& rSrt, - TexSrt::Flag flag, TexSrtTypedef::TexMatrixMode mode) { +void CalcTexMtx(math::MTX34 *pMtx, bool set, const TexSrt &rSrt, TexSrt::Flag flag, TexSrtTypedef::TexMatrixMode mode) { bool ident = true; if (mode == TexSrtTypedef::TEXMATRIXMODE_MAYA) { @@ -22,5 +21,15 @@ void CalcTexMtx(math::MTX34* pMtx, bool set, const TexSrt& rSrt, } } +void CalcTexMtx(math::MTX34 *pMtx, bool set, const TexSrt &rSrt, TexSrt::Flag flag) { + bool ident = true; + + ident = !detail::dcc::CalcTexMtx_Basic(pMtx, set, rSrt, flag); + + if (ident && set) { + math::MTX34Identity(pMtx); + } +} + } // namespace g3d } // namespace nw4r diff --git a/src/nw4r/g3d/g3d_draw.cpp b/src/nw4r/g3d/g3d_draw.cpp index 9c5e8841..164fef89 100644 --- a/src/nw4r/g3d/g3d_draw.cpp +++ b/src/nw4r/g3d/g3d_draw.cpp @@ -1,8 +1,8 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/ut.h" // IWYU pragma: export -#include +#include "rvl/BASE.h" // IWYU pragma: export #include @@ -220,9 +220,15 @@ void SetupDraw1Mat1ShpSwap(Draw1Mat1ShpSwap *pSwap, DrawResMdlReplacement *pRepl pSwap->tev = ResTev(NULL); } - pSwap->vtxPosTable = pReplacement->vtxPosTable; - pSwap->vtxNrmTable = pReplacement->vtxNrmTable; - pSwap->vtxClrTable = pReplacement->vtxClrTable; + if (pReplacement->flag & 1) { + pSwap->vtxPosTable = NULL; + pSwap->vtxNrmTable = NULL; + pSwap->vtxClrTable = NULL; + } else { + pSwap->vtxPosTable = pReplacement->vtxPosTable; + pSwap->vtxNrmTable = pReplacement->vtxNrmTable; + pSwap->vtxClrTable = pReplacement->vtxClrTable; + } } inline bool FrontToBack(const detail::workmem::MdlZ &rLhs, const detail::workmem::MdlZ &rRhs) { @@ -272,28 +278,30 @@ void DrawResMdlLoop(const ResMdl mdl, const u8 *pByteCode, u32 drawMode) { ResShp shp; ResNode node; - bool ignoreMat = (drawMode & RESMDL_DRAWMODE_IGNORE_MATERIAL); u32 ctrl = DRAW1MAT1SHP_CTRL_NOPPCSYNC; if (drawMode & RESMDL_DRAWMODE_FORCE_LIGHTOFF) { ctrl |= DRAW1MAT1SHP_CTRL_FORCE_LIGHTOFF; } + if (drawMode & RESMDL_DRAWMODE_IGNORE_MATERIAL) { + ctrl |= RESMDL_DRAWMODE_NOPPCSYNC; + } + for (; (c = *pByteCode) != ResByteCodeData::END; pByteCode += sizeof(ResByteCodeData::DrawParams)) { node = mdl.GetResNode(pDrawCmd->nodeIdHi << 8 | pDrawCmd->nodeIdLo); - if (!node.IsVisible()) { - continue; - } - - mat = mdl.GetResMat(pDrawCmd->matIdHi << 8 | pDrawCmd->matIdLo); shp = mdl.GetResShp(pDrawCmd->shpIdHi << 8 | pDrawCmd->shpIdLo); - Draw1Mat1ShpDirectly( - ignoreMat || mat == prevMat ? ResMat(NULL) : mat, shp, NULL, NULL, ctrl, NULL, - detail::GetIndMtxOp(mat, node, shp) - ); + if (node.IsVisible() && shp.IsVisible()) { + mat = mdl.GetResMat(pDrawCmd->matIdHi << 8 | pDrawCmd->matIdLo); - prevMat = mat; + Draw1Mat1ShpDirectly( + mat, shp, NULL, NULL, mat == prevMat ? ctrl | RESMDL_DRAWMODE_NOPPCSYNC : ctrl, NULL, + detail::GetIndMtxOp(mat, node, shp) + ); + + prevMat = mat; + } } #undef pDrawCmd @@ -312,15 +320,19 @@ void DrawResMdlLoop(const ResMdl mdl, const u8 *pByteCode, DrawResMdlReplacement Draw1Mat1ShpSwap swap; - bool ignoreMat = (drawMode & RESMDL_DRAWMODE_IGNORE_MATERIAL); u32 ctrl = DRAW1MAT1SHP_CTRL_NOPPCSYNC; if (drawMode & RESMDL_DRAWMODE_FORCE_LIGHTOFF) { ctrl |= DRAW1MAT1SHP_CTRL_FORCE_LIGHTOFF; } + if (drawMode & RESMDL_DRAWMODE_IGNORE_MATERIAL) { + ctrl |= RESMDL_DRAWMODE_NOPPCSYNC; + } + for (; (c = *pByteCode) != ResByteCodeData::END; pByteCode += sizeof(ResByteCodeData::DrawParams)) { node = mdl.GetResNode(pDrawCmd->nodeIdHi << 8 | pDrawCmd->nodeIdLo); + shp = mdl.GetResShp(pDrawCmd->shpIdHi << 8 | pDrawCmd->shpIdLo); bool visible; // @bug Replacement pointer not validated @@ -330,21 +342,18 @@ void DrawResMdlLoop(const ResMdl mdl, const u8 *pByteCode, DrawResMdlReplacement visible = node.IsVisible(); } - if (!visible) { - continue; + if (visible && shp.IsVisible()) { + mat = mdl.GetResMat(pDrawCmd->matIdHi << 8 | pDrawCmd->matIdLo); + + SetupDraw1Mat1ShpSwap(&swap, pReplacement, mat.GetID()); + + Draw1Mat1ShpDirectly( + mat, shp, NULL, NULL, mat == prevMat ? ctrl | RESMDL_DRAWMODE_NOPPCSYNC : ctrl, &swap, + detail::GetIndMtxOp(mat, node, shp) + ); + + prevMat = mat; } - - mat = mdl.GetResMat(pDrawCmd->matIdHi << 8 | pDrawCmd->matIdLo); - shp = mdl.GetResShp(pDrawCmd->shpIdHi << 8 | pDrawCmd->shpIdLo); - - SetupDraw1Mat1ShpSwap(&swap, pReplacement, mat.GetID()); - - Draw1Mat1ShpDirectly( - ignoreMat || mat == prevMat ? ResMat(NULL) : mat, shp, NULL, NULL, ctrl, &swap, - detail::GetIndMtxOp(mat, node, shp) - ); - - prevMat = mat; } #undef pDrawCmd @@ -359,26 +368,30 @@ void DrawResMdlLoop(const ResMdl mdl, const detail::workmem::MdlZ *pMdlZArray, u ResShp shp; ResNode node; - bool ignoreMat = (drawMode & RESMDL_DRAWMODE_IGNORE_MATERIAL); u32 ctrl = DRAW1MAT1SHP_CTRL_NOPPCSYNC; if (drawMode & RESMDL_DRAWMODE_FORCE_LIGHTOFF) { ctrl |= DRAW1MAT1SHP_CTRL_FORCE_LIGHTOFF; } + if (drawMode & RESMDL_DRAWMODE_IGNORE_MATERIAL) { + ctrl |= RESMDL_DRAWMODE_NOPPCSYNC; + } + for (i = 0; i < numMdlZ; i++) { const detail::workmem::MdlZ &rMdlZ = pMdlZArray[i]; - mat = mdl.GetResMat(rMdlZ.matID); shp = mdl.GetResShp(rMdlZ.shpID); - node = mdl.GetResNode(rMdlZ.nodeID); + if (shp.IsVisible()) { + mat = mdl.GetResMat(rMdlZ.matID); + node = mdl.GetResNode(rMdlZ.nodeID); - Draw1Mat1ShpDirectly( - ignoreMat || mat == prevMat ? ResMat(NULL) : mat, shp, NULL, NULL, ctrl, NULL, - detail::GetIndMtxOp(mat, node, shp) - ); - - prevMat = mat; + Draw1Mat1ShpDirectly( + mat, shp, NULL, NULL, mat == prevMat ? ctrl | RESMDL_DRAWMODE_NOPPCSYNC : ctrl, NULL, + detail::GetIndMtxOp(mat, node, shp) + ); + prevMat = mat; + } } } @@ -396,28 +409,31 @@ void DrawResMdlLoop( Draw1Mat1ShpSwap swap; - bool ignoreMat = (drawMode & RESMDL_DRAWMODE_IGNORE_MATERIAL); u32 ctrl = DRAW1MAT1SHP_CTRL_NOPPCSYNC; if (drawMode & RESMDL_DRAWMODE_FORCE_LIGHTOFF) { ctrl |= DRAW1MAT1SHP_CTRL_FORCE_LIGHTOFF; } + if (drawMode & RESMDL_DRAWMODE_IGNORE_MATERIAL) { + ctrl |= RESMDL_DRAWMODE_NOPPCSYNC; + } + for (i = 0; i < numMdlZ; i++) { const detail::workmem::MdlZ &rMdlZ = pMdlZArray[i]; - mat = mdl.GetResMat(rMdlZ.matID); shp = mdl.GetResShp(rMdlZ.shpID); - node = mdl.GetResNode(rMdlZ.nodeID); + if (shp.IsVisible()) { + mat = mdl.GetResMat(rMdlZ.matID); + node = mdl.GetResNode(rMdlZ.nodeID); - SetupDraw1Mat1ShpSwap(&swap, pReplacement, mat.GetID()); - - Draw1Mat1ShpDirectly( - ignoreMat || mat == prevMat ? ResMat(NULL) : mat, shp, NULL, NULL, ctrl, &swap, - detail::GetIndMtxOp(mat, node, shp) - ); - - prevMat = mat; + SetupDraw1Mat1ShpSwap(&swap, pReplacement, mat.GetID()); + Draw1Mat1ShpDirectly( + mat, shp, NULL, NULL, mat == prevMat ? ctrl | RESMDL_DRAWMODE_NOPPCSYNC : ctrl, &swap, + detail::GetIndMtxOp(mat, node, shp) + ); + prevMat = mat; + } } } @@ -457,9 +473,12 @@ detail::workmem::MdlZ *SetUpMdlZ( rMdlZ.matID = pDrawCmd->matIdHi << 8 | pDrawCmd->matIdLo; rMdlZ.shpID = pDrawCmd->shpIdHi << 8 | pDrawCmd->shpIdLo; - // @bug Matrix ID not validated mtxID = node.GetMtxID(); - rMdlZ.Z = pViewPosMtxArray[mtxID]._23; + if (mtxID < viewMtxNum) { + rMdlZ.Z = pViewPosMtxArray[mtxID]._23; + } else { + rMdlZ.Z = 0.f; + } rMdlZ.priority = pDrawCmd->priority; diff --git a/src/nw4r/g3d/g3d_draw1mat1shp.cpp b/src/nw4r/g3d/g3d_draw1mat1shp.cpp index 61c36bb2..cb281e7d 100644 --- a/src/nw4r/g3d/g3d_draw1mat1shp.cpp +++ b/src/nw4r/g3d/g3d_draw1mat1shp.cpp @@ -1,23 +1,18 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/ut.h" // IWYU pragma: export -#include -#include +#include "rvl/BASE.h" // IWYU pragma: export +#include "rvl/GX.h" // IWYU pragma: export + +#include namespace nw4r { namespace g3d { +namespace detail { -void Draw1Mat1ShpDirectly( - ResMat mat, ResShp shp, const math::MTX34 *pViewPos, const math::MTX34 *pViewNrm, u32 ctrl, Draw1Mat1ShpSwap *pSwap, - G3DState::IndMtxOp *pIndMtxOp -) { - if (!(ctrl & DRAW1MAT1SHP_CTRL_NOPPCSYNC)) { - ut::LC::QueueWait(0); - PPCSync(); - } - - if (mat.IsValid()) { +void LoadMaterial(ResMat mat, u32 ctrl, Draw1Mat1ShpSwap *pSwap, G3DState::IndMtxOp *pIndMtxOp, bool bIgnoreMaterial) { + if (!bIgnoreMaterial) { ResMatMisc misc; if (pSwap == NULL || !pSwap->misc.IsValid()) { @@ -118,7 +113,6 @@ void Draw1Mat1ShpDirectly( } else { G3DState::LoadResTexSrt(pSwap->texSrt); } - } else if (pIndMtxOp != NULL) { if (pSwap == NULL || !pSwap->indMtxAndScale.IsValid()) { G3DState::IndTexMtxInfo info; @@ -128,46 +122,196 @@ void Draw1Mat1ShpDirectly( G3DState::LoadResMatIndMtxAndScale(pSwap->indMtxAndScale, *pIndMtxOp); } } +} + +} // namespace detail + +void Draw1Mat1ShpDirectly( + ResMat mat, ResShp shp, const math::MTX34 *pViewPos, const math::MTX34 *pViewNrm, u32 ctrl, Draw1Mat1ShpSwap *pSwap, + G3DState::IndMtxOp *pIndMtxOp +) { + if (!(ctrl & DRAW1MAT1SHP_CTRL_NOPPCSYNC)) { + ut::LC::QueueWait(0); + PPCSync(); + } + + bool bIgnoreMaterial = false; + bool bFur = false; + ResMatFur fur; + if (mat.IsValid()) { + if (ctrl & DRAW1MAT1SHP_CTRL_IGNORE_MAT) { + bIgnoreMaterial = true; + } + fur = mat.GetResMatFur(); + if (fur.IsValid()) { + bFur = true; + } + } else { + bIgnoreMaterial = true; + } + + detail::LoadMaterial(mat, ctrl, pSwap, pIndMtxOp, bIgnoreMaterial); if (shp.IsValid() && shp.IsVisible()) { - if (!(ctrl & DRAW1MAT1SHP_CTRL_NOSWAPSHP)) { + if (bFur) { + f32 rateBright, rateAlpha, rateSpec; + f32 alphaCurve, specCurve; + f32 rate, rateInv; + + GXColor rootColor, tipColor, kcolor2; + + u8 brightness; + GXColorSrc matSrc[4]; + GXAttnFn attnFunc[4]; + GXColor matColor[2]; + + bool bIndTexMtx[3]; + math::MTX34 itm[3]; + s8 scale_exp[3]; + + const GXChannelID targetChan[4] = {GX_COLOR0, GX_ALPHA0, GX_COLOR1, GX_ALPHA1}; + + alphaCurve = fur.ref().alphaCurve; + specCurve = fur.ref().specCurve; + + const ResMatTevColor tevColor = + (!pSwap || !pSwap->tevColor.IsValid()) ? mat.GetResMatTevColor() : pSwap->tevColor; + + tevColor.GXGetTevKColor(GX_KCOLOR0, &rootColor); + tevColor.GXGetTevKColor(GX_KCOLOR1, &tipColor); + tevColor.GXGetTevKColor(GX_KCOLOR2, &kcolor2); + + brightness = kcolor2.g; + + const ResMatChan chan = (!pSwap || !pSwap->chan.IsValid()) ? mat.GetResMatChan() : pSwap->chan; + + chan.GXGetChanMatColor(GX_COLOR0, &matColor[0]); + chan.GXGetChanMatColor(GX_COLOR1, &matColor[1]); + for (u8 chanIdx = 0; chanIdx < 4; chanIdx++) { + chan.GXGetChanCtrl(targetChan[chanIdx], NULL, NULL, &matSrc[chanIdx], NULL, NULL, &attnFunc[chanIdx]); + } + + ResMatMisc misc = (!pSwap || !pSwap->misc.IsValid()) ? mat.GetResMatMisc() : pSwap->misc; + ResMatIndMtxAndScale indMtxAndScale = + (!pSwap || !pSwap->indMtxAndScale.IsValid()) ? mat.GetResMatIndMtxAndScale() : pSwap->indMtxAndScale; + + for (u32 itmIdx = 0; itmIdx < 3; itmIdx++) { + ResMatMiscData::IndirectMethod method; + s8 ref_light; + const GXIndTexMtxID id = static_cast(itmIdx + GX_ITM_0); + misc.GetIndirectTexMtxCalcMethod(id, &method, &ref_light); + if (method == ResMatMiscData::FUR) { + bIndTexMtx[itmIdx] = true; + indMtxAndScale.GXGetIndTexMtx(id, &itm[itmIdx], &scale_exp[itmIdx]); + } else { + bIndTexMtx[itmIdx] = false; + } + } + G3DState::LoadResShpPrePrimitive(shp); + if (ctrl & DRAW1MAT1SHP_CTRL_CULL_FRONT) { + fifo::GDSetCullMode(GX_CULL_FRONT); + G3DState::Invalidate(G3DState::INVALIDATE_SHP); + } - if (pSwap != NULL) { - if (pSwap->vtxPosTable != NULL) { - ResVtxPos(pSwap->vtxPosTable[shp.ref().idVtxPosition]).SetArray(); - } + ResVtxFurPos furPos = shp.GetResVtxFurPos(); + const u32 numLayer = furPos.ref().numLayer; + for (u16 i = 0; i < numLayer; i++) { + rate = fur.GetLyrRate(i); + rateInv = 1.f - rate; + rateAlpha = pow(rate, alphaCurve); + rateSpec = pow(rate, specCurve); + rateBright = pow(rate, 4.f); - if (pSwap->vtxNrmTable != NULL) { - int nrmID = shp.ref().idVtxNormal; + kcolor2.r = 255 * rate; + kcolor2.g = brightness * rateBright; + GXSetTevKColor(GX_KCOLOR2, kcolor2); - if (nrmID >= 0) { - ResVtxNrm(pSwap->vtxNrmTable[nrmID]).SetArray(); + for (u8 itmIdx = 0; itmIdx < 3; itmIdx++) { + if (bIndTexMtx[itmIdx]) { + f32 newItm[2][3] = { + { + itm[itmIdx]._00 * rate, + itm[itmIdx]._01 * rate, + itm[itmIdx]._02, + }, + { + itm[itmIdx]._10 * rate, + itm[itmIdx]._11 * rate, + itm[itmIdx]._12, + } + }; + GXSetIndTexMtx(static_cast(itmIdx + GX_ITM_0), newItm, scale_exp[itmIdx]); } } - if (pSwap->vtxClrTable != NULL) { - int clrID = shp.ref().idVtxColor[0]; + GXColor diffColor = { + rootColor.r * rateInv + tipColor.r * rate, rootColor.g * rateInv + tipColor.g * rate, + rootColor.b * rateInv + tipColor.b * rate, rootColor.a * (1.f - rateAlpha) + tipColor.a * rateAlpha + }; - if (clrID >= 0) { - ResVtxClr(pSwap->vtxClrTable[clrID]).SetArray(GX_VA_CLR0); + for (u8 colorIdx = 0; colorIdx < 2; colorIdx++) { + u8 chanIdx = colorIdx * 2; + GXColor newMatColor; + + if (matSrc[chanIdx] == GX_SRC_REG || matSrc[chanIdx + 1] == GX_SRC_REG) { + if (attnFunc[chanIdx] == GX_AF_SPEC) { + newMatColor.r = matColor[colorIdx].r * rateSpec; + newMatColor.g = matColor[colorIdx].g * rateSpec; + newMatColor.b = matColor[colorIdx].b * rateSpec; + } else { + newMatColor.r = diffColor.r; + newMatColor.g = diffColor.g; + newMatColor.b = diffColor.b; + } + newMatColor.a = attnFunc[chanIdx + 1] == GX_AF_SPEC ? matColor[colorIdx].a : diffColor.a; + + fifo::GDSetChanMatColor(targetChan[chanIdx], newMatColor); + } + } + furPos.SetArray(i); + G3DState::LoadResShpPrimitive(shp, pViewPos, pViewNrm); + } + + } else { + if (!(ctrl & DRAW1MAT1SHP_CTRL_NOSWAPSHP)) { + G3DState::LoadResShpPrePrimitive(shp); + + if (pSwap != NULL) { + if (pSwap->vtxPosTable != NULL) { + ResVtxPos(pSwap->vtxPosTable[shp.ref().idVtxPosition]).SetArray(); } - clrID = shp.ref().idVtxColor[1]; + if (pSwap->vtxNrmTable != NULL) { + int idVtxNormal = shp.ref().idVtxNormal; - if (clrID >= 0) { - ResVtxClr(pSwap->vtxClrTable[clrID]).SetArray(GX_VA_CLR1); + if (idVtxNormal >= 0) { + ResVtxNrm(pSwap->vtxNrmTable[idVtxNormal]).SetArray(); + } + } + + if (pSwap->vtxClrTable != NULL) { + int idVtxColor = shp.ref().idVtxColor[0]; + + if (idVtxColor >= 0) { + ResVtxClr(pSwap->vtxClrTable[idVtxColor]).SetArray(GX_VA_CLR0); + } + + idVtxColor = shp.ref().idVtxColor[1]; + + if (idVtxColor >= 0) { + ResVtxClr(pSwap->vtxClrTable[idVtxColor]).SetArray(GX_VA_CLR1); + } } } } - } + if (ctrl & DRAW1MAT1SHP_CTRL_CULL_FRONT) { + fifo::GDSetCullMode(GX_CULL_FRONT); + G3DState::Invalidate(G3DState::INVALIDATE_SHP); + } - if (ctrl & DRAW1MAT1SHP_CTRL_CULL_FRONT) { - fifo::GDSetCullMode(GX_CULL_FRONT); - G3DState::Invalidate(G3DState::INVALIDATE_SHP); + G3DState::LoadResShpPrimitive(shp, pViewPos, pViewNrm); } - - G3DState::LoadResShpPrimitive(shp, pViewPos, pViewNrm); } } diff --git a/src/nw4r/g3d/g3d_fog.cpp b/src/nw4r/g3d/g3d_fog.cpp index ac1ed594..a4a5b90c 100644 --- a/src/nw4r/g3d/g3d_fog.cpp +++ b/src/nw4r/g3d/g3d_fog.cpp @@ -1,6 +1,6 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/src/nw4r/g3d/g3d_init.cpp b/src/nw4r/g3d/g3d_init.cpp index 5fba25ad..7244c4ac 100644 --- a/src/nw4r/g3d/g3d_init.cpp +++ b/src/nw4r/g3d/g3d_init.cpp @@ -1,14 +1,14 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/ut.h" // IWYU pragma: export -#include -#include -#include +#include "rvl/GX.h" // IWYU pragma: export +#include "rvl/OS.h" // IWYU pragma: export +#include "rvl/VI.h" namespace { -NW4R_LIB_VERSION(G3D, "Jun 8 2007", "11:16:25", "0x4199_60831"); +NW4R_LIB_VERSION(G3D, "Dec 22 2009", "02:11:33", "0x4302_158"); } // namespace @@ -27,7 +27,7 @@ void G3dInit(bool enableLockedCache) { InitFastCast(); GXRenderModeObj *pMode; - switch (VIGetTvFormat()) { + switch ((u32)VIGetTvFormat()) { case VI_TV_FMT_NTSC: { pMode = &GXNtsc480IntDf; break; diff --git a/src/nw4r/g3d/g3d_light.cpp b/src/nw4r/g3d/g3d_light.cpp index 6af986b4..7c7c8fd7 100644 --- a/src/nw4r/g3d/g3d_light.cpp +++ b/src/nw4r/g3d/g3d_light.cpp @@ -1,6 +1,6 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/math.h" // IWYU pragma: export #include @@ -12,7 +12,7 @@ namespace g3d { * LightObj * ******************************************************************************/ -LightObj& LightObj::operator=(const LightObj& rOther) { +LightObj &LightObj::operator=(const LightObj &rOther) { if (this != &rOther) { mFlag = rOther.mFlag; detail::Copy32ByteBlocks(&mObj, &rOther.mObj, sizeof(GXLightObj)); @@ -41,13 +41,6 @@ void LightObj::InitLightDir(f32 nx, f32 ny, f32 nz) { mFlag |= FLAG_SPOT; } -void LightObj::InitSpecularDir(f32 nx, f32 ny, f32 nz) { - GXInitLightDir(&mObj, nx, ny, nz); - mFlag &= ~FLAG_SPOT; - mFlag |= FLAG_SPECULAR; - mFlag |= FLAG_SPECULAR_DIR; -} - void LightObj::InitLightSpot(f32 cutoff, GXSpotFn spotFn) { GXInitLightSpot(&mObj, cutoff, spotFn); mFlag &= ~FLAG_SPECULAR; @@ -60,8 +53,7 @@ void LightObj::InitLightAttnA(f32 aa, f32 ab, f32 ac) { mFlag |= FLAG_SPOT; } -void LightObj::InitLightDistAttn(f32 distance, f32 brightness, - GXDistAttnFn distAttnFn) { +void LightObj::InitLightDistAttn(f32 distance, f32 brightness, GXDistAttnFn distAttnFn) { GXInitLightDistAttn(&mObj, distance, brightness, distAttnFn); mFlag &= ~FLAG_SPECULAR; mFlag |= FLAG_SPOT; @@ -73,14 +65,20 @@ void LightObj::InitLightAttnK(f32 ka, f32 kb, f32 kc) { mFlag |= FLAG_SPOT; } +void LightObj::InitSpecularDir(f32 nx, f32 ny, f32 nz) { + GXInitLightDir(&mObj, nx, ny, nz); + mFlag &= ~FLAG_SPOT; + mFlag |= FLAG_SPECULAR; + mFlag |= FLAG_SPECULAR_DIR; +} + void LightObj::InitLightShininess(f32 shininess) { - GXInitLightAttn(&mObj, 0.0f, 0.0f, 1.0f, shininess / 2.0f, 0.0f, - 1.0f - shininess / 2.0f); + GXInitLightAttn(&mObj, 0.0f, 0.0f, 1.0f, shininess / 2.0f, 0.0f, 1.0f - shininess / 2.0f); mFlag &= ~FLAG_SPOT; mFlag |= FLAG_SPECULAR; } -void LightObj::GetLightPos(math::VEC3* pPos) const { +void LightObj::GetLightPos(math::VEC3 *pPos) const { if (!pPos) { return; } @@ -88,7 +86,7 @@ void LightObj::GetLightPos(math::VEC3* pPos) const { GXGetLightPos(&mObj, &pPos->x, &pPos->y, &pPos->z); } -void LightObj::GetLightDir(math::VEC3* pDir) const { +void LightObj::GetLightDir(math::VEC3 *pDir) const { if (!pDir) { return; } @@ -96,7 +94,7 @@ void LightObj::GetLightDir(math::VEC3* pDir) const { GXGetLightDir(&mObj, &pDir->x, &pDir->y, &pDir->z); } -void LightObj::ApplyViewMtx(const math::MTX34& rCamera) { +void LightObj::ApplyViewMtx(const math::MTX34 &rCamera) { math::VEC3 dir; GetLightDir(&dir); math::VEC3TransformNormal(&dir, &rCamera, &dir); @@ -118,17 +116,17 @@ void LightObj::ApplyViewMtx(const math::MTX34& rCamera) { * LightSetting * ******************************************************************************/ -LightSetting::LightSetting(LightObj* pLightObjArray, - AmbLightObj* pAmbLightObjArray, u32 numLight, - LightSetData* pLightSetDataArray, u32 numLightSet) +LightSetting::LightSetting( + LightObj *pLightObjArray, AmbLightObj *pAmbLightObjArray, u32 numLight, LightSetData *pLightSetDataArray, + u32 numLightSet +) : mNumLight(numLight), mNumLightSet(numLightSet), mpLightObjArray(pLightObjArray), mpAmbLightObjArray(pAmbLightObjArray), mpLightSetDataArray(pLightSetDataArray) { - for (u32 i = 0; i < mNumLightSet; i++) { - LightSetData& rData = mpLightSetDataArray[i]; + LightSetData &rData = mpLightSetDataArray[i]; rData.idxAmbLight = -1; for (u32 j = 0; j < G3DState::NUM_LIGHT_IN_LIGHT_SET; j++) { @@ -188,9 +186,8 @@ LightSetting::LightSetting(LightObj* pLightObjArray, } } -bool LightSetting::Import(const LightSetting& rSetting) { - if (mNumLight < rSetting.mNumLight || - mNumLightSet < rSetting.mNumLightSet) { +bool LightSetting::Import(const LightSetting &rSetting) { + if (mNumLight < rSetting.mNumLight || mNumLightSet < rSetting.mNumLightSet) { return false; } @@ -211,7 +208,7 @@ bool LightSetting::Import(const LightSetting& rSetting) { return true; } -void LightSetting::ApplyViewMtx(const math::MTX34& rCamera, u32 numLight) { +void LightSetting::ApplyViewMtx(const math::MTX34 &rCamera, u32 numLight) { numLight = std::max(numLight, mNumLight); for (u32 i = 0; i < numLight; i++) { diff --git a/src/nw4r/g3d/g3d_obj.cpp b/src/nw4r/g3d/g3d_obj.cpp index ffd92ca9..f24e0a4d 100644 --- a/src/nw4r/g3d/g3d_obj.cpp +++ b/src/nw4r/g3d/g3d_obj.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -10,7 +10,7 @@ G3dObj::~G3dObj() { } void G3dObj::Destroy() { - G3dObj* pParent = GetParent(); + G3dObj *pParent = GetParent(); if (pParent != NULL) { pParent->G3dProc(G3DPROC_CHILD_DETACHED, 0, this); @@ -19,10 +19,15 @@ void G3dObj::Destroy() { delete this; } -// clang-format off -DECOMP_FORCEACTIVE(g3d_obj_cpp, - G3dObj::IsDerivedFrom); -// clang-format on +G3dObj *G3dObj::DetachFromParent() { + G3dObj *pParent = GetParent(); + + if (pParent != NULL) { + pParent->G3dProc(G3DPROC_CHILD_DETACHED, 0, this); + } + + return pParent; +} } // namespace g3d } // namespace nw4r diff --git a/src/nw4r/g3d/g3d_scnmdl.cpp b/src/nw4r/g3d/g3d_scnmdl.cpp index 2b536b44..efb0aedc 100644 --- a/src/nw4r/g3d/g3d_scnmdl.cpp +++ b/src/nw4r/g3d/g3d_scnmdl.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -42,7 +42,6 @@ ResMatChan ScnMdl::CopiedMatAccess::GetResMatChan(bool markDirty) { return mChan; } - return ResMatChan(NULL); } @@ -58,6 +57,18 @@ ResGenMode ScnMdl::CopiedMatAccess::GetResGenMode(bool markDirty) { return ResGenMode(NULL); } +ResMatMisc ScnMdl::CopiedMatAccess::GetResMatMisc(bool markDirty) { + if (mpScnMdl != NULL && mMatMisc.IsValid()) { + if (markDirty) { + mpScnMdl->MatBufferDirty(mMatID, ScnMdl::BUFOPTION_MATMISC); + } + + return mMatMisc; + } + + return ResMatMisc(NULL); +} + ResMatPix ScnMdl::CopiedMatAccess::GetResMatPix(bool markDirty) { if (mpScnMdl != NULL && mPix.IsValid()) { if (markDirty) { @@ -94,6 +105,18 @@ ResTev ScnMdl::CopiedMatAccess::GetResTev(bool markDirty) { return ResTev(NULL); } +ResTexObj ScnMdl::CopiedMatAccess::GetResTexObjEx() { + if (mpScnMdl != NULL) { + if (mTexObj.IsValid()) { + return mTexObj; + } + + return mpScnMdl->GetResMdl().GetResMat(mMatID).GetResTexObj(); + } + + return ResTexObj(NULL); +} + ResTexSrt ScnMdl::CopiedMatAccess::GetResTexSrtEx() { if (mpScnMdl != NULL) { if (mTexSrt.IsValid()) { @@ -106,7 +129,19 @@ ResTexSrt ScnMdl::CopiedMatAccess::GetResTexSrtEx() { return ResTexSrt(NULL); } -ScnMdl::CopiedMatAccess::CopiedMatAccess(ScnMdl* pScnMdl, u32 id) +ResMatChan ScnMdl::CopiedMatAccess::GetResMatChanEx() { + if (mpScnMdl != NULL) { + if (mChan.IsValid()) { + return mChan; + } + + return mpScnMdl->GetResMdl().GetResMat(mMatID).GetResMatChan(); + } + + return ResMatChan(NULL); +} + +ScnMdl::CopiedMatAccess::CopiedMatAccess(ScnMdl *pScnMdl, u32 id) : mTexObj(NULL), mTlutObj(NULL), mTexSrt(NULL), @@ -118,12 +153,11 @@ ScnMdl::CopiedMatAccess::CopiedMatAccess(ScnMdl* pScnMdl, u32 id) mIndMtxAndScale(NULL), mTexCoordGen(NULL), mTev(NULL) { - if (pScnMdl != NULL && pScnMdl->GetResMdl().GetResMat(id).IsValid()) { mpScnMdl = pScnMdl; mMatID = id; - DrawResMdlReplacement& rReplacement = pScnMdl->mReplacement; + DrawResMdlReplacement &rReplacement = pScnMdl->mReplacement; if (rReplacement.texObjDataArray != NULL) { mTexObj = ResTexObj(&rReplacement.texObjDataArray[id]); @@ -174,15 +208,13 @@ ScnMdl::CopiedMatAccess::CopiedMatAccess(ScnMdl* pScnMdl, u32 id) } if (rReplacement.indMtxAndScaleDLArray != NULL) { - mIndMtxAndScale = - ResMatIndMtxAndScale(&rReplacement.indMtxAndScaleDLArray[id]); + mIndMtxAndScale = ResMatIndMtxAndScale(&rReplacement.indMtxAndScaleDLArray[id]); } else { mIndMtxAndScale = ResMatIndMtxAndScale(NULL); } if (rReplacement.texCoordGenDLArray != NULL) { - mTexCoordGen = - ResMatTexCoordGen(&rReplacement.texCoordGenDLArray[id]); + mTexCoordGen = ResMatTexCoordGen(&rReplacement.texCoordGenDLArray[id]); } else { mTexCoordGen = ResMatTexCoordGen(NULL); } @@ -228,6 +260,22 @@ bool ScnMdl::CopiedVisAccess::IsVisible() const { return false; } +bool ScnMdl::CopiedVisAccess::SetVisibility(bool visible) { + if (mpScnMdl != NULL && mpVis != NULL) { + if (visible) { + if (*mpVis == 0) { + mpScnMdl->VisBufferDirty(); + *mpVis = 1; + } + } else if (*mpVis != 0) { + mpScnMdl->VisBufferDirty(); + *mpVis = 0; + } + return true; + } + return false; +} + bool ScnMdl::CopiedVisAccess::SetVisibilityEx(bool visible) { if (mpScnMdl != NULL) { if (mpVis != NULL) { @@ -246,7 +294,7 @@ bool ScnMdl::CopiedVisAccess::SetVisibilityEx(bool visible) { return false; } -ScnMdl::CopiedVisAccess::CopiedVisAccess(ScnMdl* pScnMdl, u32 id) { +ScnMdl::CopiedVisAccess::CopiedVisAccess(ScnMdl *pScnMdl, u32 id) { if (pScnMdl != NULL && pScnMdl->GetResMdl().GetResNode(id).IsValid()) { mpScnMdl = pScnMdl; mNodeID = id; @@ -263,14 +311,34 @@ ScnMdl::CopiedVisAccess::CopiedVisAccess(ScnMdl* pScnMdl, u32 id) { } } +/****************************************************************************** + * + * CopiedVtxAccess + * + ******************************************************************************/ + +ResVtxPos ScnMdl::CopiedVtxAccess::GetResVtxPos(u32 id) { + ResVtxPos res = GetPos(id); // goto signifies inline... Dwarf doesnt have info + if (mpScnMdl != NULL && res == mpScnMdl->GetResMdl().GetResVtxPos(id)) { + return ResVtxPos(NULL); + } + return res; +} + +ResVtxNrm ScnMdl::CopiedVtxAccess::GetResVtxNrm(u32 id) { + ResVtxNrm res = GetNrm(id); // goto signifies inline... Dwarf doesnt have info + if (mpScnMdl != NULL && res == mpScnMdl->GetResMdl().GetResVtxNrm(id)) { + return ResVtxNrm(NULL); + } + return res; +} + /****************************************************************************** * * ScnMdl * ******************************************************************************/ -ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, - u32 bufferOption, int numView) { - +ScnMdl *ScnMdl::Construct(MEMAllocator *pAllocator, u32 *pSize, ResMdl mdl, u32 bufferOption, int numView) { if (!mdl.IsValid()) { return NULL; } @@ -281,7 +349,7 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, numView = VIEW_MAX; } - ScnMdl* pScnMdl = NULL; + ScnMdl *pScnMdl = NULL; u32 worldMtxNum = mdl.GetResMdlInfo().GetNumPosNrmMtx(); u32 viewMtxNum = mdl.GetResMdlInfo().GetNumViewMtx(); @@ -296,16 +364,13 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, u32 viewPosMtxArraySize = numView * align32(viewPosMtxArrayUnitSize); u32 viewNrmMtxArrayUnitSize = viewMtxNum * sizeof(math::MTX33); - u32 viewNrmMtxArraySize = mdl.GetResMdlInfo().ref().need_nrm_mtx_array - ? numView * align32(viewNrmMtxArrayUnitSize) - : 0; + u32 viewNrmMtxArraySize = + mdl.GetResMdlInfo().ref().need_nrm_mtx_array ? numView * align32(viewNrmMtxArrayUnitSize) : 0; u32 viewTexMtxArrayUnitSize = viewPosMtxArrayUnitSize; // TODO: Fakematch - u32 viewTexMtxArraySize = mdl.ref().info.need_tex_mtx_array - ? numView * align32(viewTexMtxArrayUnitSize) - : 0; + u32 viewTexMtxArraySize = mdl.ref().info.need_tex_mtx_array ? numView * align32(viewTexMtxArrayUnitSize) : 0; u32 matBufferDirtyFlagSize = matNum * sizeof(u32); @@ -322,6 +387,7 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, u32 resIndMtxAndScaleSize = (bufferOption & BUFOPTION_MATINDMTXSCALE) ? matNum * sizeof(ResIndMtxAndScaleDL) : 0; u32 resTexCoordGenSize = (bufferOption & BUFOPTION_MATTEXCOORDGEN) ? matNum * sizeof(ResTexCoordGenDL) : 0; u32 resTevSize = (bufferOption & BUFOPTION_TEV) ? matNum * sizeof(ResTevData) : 0; + // clang-format on u32 vtxPosTableSize = 0; @@ -331,7 +397,7 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, u32 vtxPosNum = mdl.GetResVtxPosNumEntries(); u32 shpNum = mdl.GetResShpNumEntries(); - vtxPosTableSize = vtxPosNum * sizeof(ResVtxPosData*); + vtxPosTableSize = vtxPosNum * sizeof(ResVtxPosData *); for (u32 i = 0; i < vtxPosNum; i++) { u32 j; @@ -358,7 +424,7 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, u32 vtxNrmNum = mdl.GetResVtxNrmNumEntries(); u32 shpNum = mdl.GetResShpNumEntries(); - vtxNrmTableSize = vtxNrmNum * sizeof(ResVtxNrmData*); + vtxNrmTableSize = vtxNrmNum * sizeof(ResVtxNrmData *); for (u32 i = 0; i < vtxNrmNum; i++) { u32 j; @@ -385,7 +451,7 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, u32 vtxClrNum = mdl.GetResVtxClrNumEntries(); u32 shpNum = mdl.GetResShpNumEntries(); - vtxClrTableSize = vtxClrNum * sizeof(ResVtxClrData*); + vtxClrTableSize = vtxClrNum * sizeof(ResVtxClrData *); for (u32 i = 0; i < vtxClrNum; i++) { u32 j; @@ -394,8 +460,7 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, for (j = 0; j < shpNum; j++) { ResShp shp = mdl.GetResShp(j); - if (clr.ptr() == shp.GetResVtxClr(0).ptr() || - clr.ptr() == shp.GetResVtxClr(1).ptr()) { + if (clr.ptr() == shp.GetResVtxClr(0).ptr() || clr.ptr() == shp.GetResVtxClr(1).ptr()) { break; } } @@ -441,13 +506,16 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, } if (pAllocator != NULL) { - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer == NULL) { return NULL; } - - // clang-format off DrawResMdlReplacement replacement; + replacement.flag = 0; + if (!(bufferOption & BUFOPTION_0x1000000)) { + replacement.flag |= 1; + } + // clang-format off replacement.visArray = visSize != 0 ? reinterpret_cast(pBuffer + visOfs) : NULL; replacement.texObjDataArray = resTexObjSize != 0 ? reinterpret_cast(pBuffer + resTexObjOfs) : NULL; @@ -486,8 +554,7 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, } if (j != shpNum) { - replacement.vtxPosTable[i] = - reinterpret_cast(pBuffer + ofs); + replacement.vtxPosTable[i] = reinterpret_cast(pBuffer + ofs); ofs += align32(pos.GetSize()); pos.CopyTo(replacement.vtxPosTable[i]); @@ -516,8 +583,7 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, } if (j != shpNum) { - replacement.vtxNrmTable[i] = - reinterpret_cast(pBuffer + ofs); + replacement.vtxNrmTable[i] = reinterpret_cast(pBuffer + ofs); ofs += align32(nrm.GetSize()); nrm.CopyTo(replacement.vtxNrmTable[i]); @@ -540,15 +606,13 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, for (j = 0; j < shpNum; j++) { ResShp shp = mdl.GetResShp(j); - if (clr.ptr() == shp.GetResVtxClr(0).ptr() || - clr.ptr() == shp.GetResVtxClr(1).ptr()) { + if (clr.ptr() == shp.GetResVtxClr(0).ptr() || clr.ptr() == shp.GetResVtxClr(1).ptr()) { break; } } if (j != shpNum) { - replacement.vtxClrTable[i] = - reinterpret_cast(pBuffer + ofs); + replacement.vtxClrTable[i] = reinterpret_cast(pBuffer + ofs); ofs += align32(clr.GetSize()); clr.CopyTo(replacement.vtxClrTable[i]); @@ -557,6 +621,10 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, } } } + u32 replacementFlag = 0; + if (bufferOption & BUFOPTION_0x1000000) { + replacementFlag |= 1; + } // clang-format off pScnMdl = new (pBuffer) ScnMdl( @@ -570,7 +638,8 @@ ScnMdl* ScnMdl::Construct(MEMAllocator* pAllocator, u32* pSize, ResMdl mdl, numView, viewMtxNum, &replacement, - reinterpret_cast(pBuffer + matBufferDirtyFlagOfs)); + reinterpret_cast(pBuffer + matBufferDirtyFlagOfs), + replacementFlag); // clang-format off pScnMdl->InitBuffer(); @@ -632,6 +701,26 @@ void ScnMdl::ScnMdl_G3DPROC_CALC_MAT(u32 param, void* pInfo) { if (IsMatBufferDirty(i, BUFOPTION_MATTEVCOLOR)) { CleanMatBuffer(i, BUFOPTION_MATTEVCOLOR); } + + if (IsMatBufferDirty(i, BUFOPTION_GENMODE)) { + CleanMatBuffer(i, BUFOPTION_GENMODE); + } + + if (IsMatBufferDirty(i, BUFOPTION_MATMISC)) { + CleanMatBuffer(i, BUFOPTION_MATMISC); + } + + if (IsMatBufferDirty(i, BUFOPTION_MATPIX)) { + CleanMatBuffer(i, BUFOPTION_MATPIX); + } + + if (IsMatBufferDirty(i, BUFOPTION_MATTEXCOORDGEN)) { + CleanMatBuffer(i, BUFOPTION_MATTEXCOORDGEN); + } + + if (IsMatBufferDirty(i, BUFOPTION_TEV)) { + CleanMatBuffer(i, BUFOPTION_TEV); + } if (GetAnmObjTexPat() != NULL && GetAnmObjTexPat()->TestExistence(i)) { TexPatAnmResult resultBuf; @@ -1025,6 +1114,8 @@ bool ScnMdl::SetAnmObj(AnmObj* pObj, AnmObjType type) { mpAnmObjShp = pShp; pShp->G3dProc(G3DPROC_ATTACH_PARENT, 0, this); + + mReplacement.flag &= ~1; return true; } else { @@ -1051,41 +1142,46 @@ bool ScnMdl::RemoveAnmObj(AnmObj* pObj) { mpAnmObjShp->G3dProc(G3DPROC_DETACH_PARENT, 0, this); mpAnmObjShp = NULL; - if (mReplacement.vtxPosTable != NULL) { - u32 vtxPosNum = GetResMdl().GetResVtxPosNumEntries(); - - for (u32 i = 0; i < vtxPosNum; i++) { - ResVtxPos pos = GetResMdl().GetResVtxPos(i); - - if (pos.ptr() != mReplacement.vtxPosTable[i]) { - pos.CopyTo(mReplacement.vtxPosTable[i]); - } - } + if (!(mReplacementFlag & 1)) { + mReplacement.flag |= 1; + return true; } - if (mReplacement.vtxNrmTable != NULL) { - u32 vtxNrmNum = GetResMdl().GetResVtxNrmNumEntries(); - - for (u32 i = 0; i < vtxNrmNum; i++) { - ResVtxNrm nrm = GetResMdl().GetResVtxNrm(i); - - if (nrm.ptr() != mReplacement.vtxNrmTable[i]) { - nrm.CopyTo(mReplacement.vtxNrmTable[i]); + if (mReplacement.vtxPosTable != NULL) { + u32 vtxPosNum = GetResMdl().GetResVtxPosNumEntries(); + + for (u32 i = 0; i < vtxPosNum; i++) { + ResVtxPos pos = GetResMdl().GetResVtxPos(i); + + if (pos.ptr() != mReplacement.vtxPosTable[i]) { + pos.CopyTo(mReplacement.vtxPosTable[i]); + } } } - } - - if (mReplacement.vtxClrTable != NULL) { - u32 vtxClrNum = GetResMdl().GetResVtxClrNumEntries(); - - for (u32 i = 0; i < vtxClrNum; i++) { - ResVtxClr clr = GetResMdl().GetResVtxClr(i); - - if (clr.ptr() != mReplacement.vtxClrTable[i]) { - clr.CopyTo(mReplacement.vtxClrTable[i]); + + if (mReplacement.vtxNrmTable != NULL) { + u32 vtxNrmNum = GetResMdl().GetResVtxNrmNumEntries(); + + for (u32 i = 0; i < vtxNrmNum; i++) { + ResVtxNrm nrm = GetResMdl().GetResVtxNrm(i); + + if (nrm.ptr() != mReplacement.vtxNrmTable[i]) { + nrm.CopyTo(mReplacement.vtxNrmTable[i]); + } + } + } + + if (mReplacement.vtxClrTable != NULL) { + u32 vtxClrNum = GetResMdl().GetResVtxClrNumEntries(); + + for (u32 i = 0; i < vtxClrNum; i++) { + ResVtxClr clr = GetResMdl().GetResVtxClr(i); + + if (clr.ptr() != mReplacement.vtxClrTable[i]) { + clr.CopyTo(mReplacement.vtxClrTable[i]); + } } } - } return true; } @@ -1123,14 +1219,15 @@ ScnMdl::ScnMdl(MEMAllocator* pAllocator, ResMdl mdl, math::MTX34* pWorldMtxArray, u32* pWorldMtxAttribArray, math::MTX34* pViewPosMtxArray, math::MTX33* pViewNrmMtxArray, math::MTX34* pViewTexMtxArray, int numView, int numViewMtx, - DrawResMdlReplacement* pReplacement, u32* pMatBufferDirtyFlag) + DrawResMdlReplacement* pReplacement, u32* pMatBufferDirtyFlag, u32 replacementFlag) : ScnMdlSimple(pAllocator, mdl, pWorldMtxArray, pWorldMtxAttribArray, pViewPosMtxArray, pViewNrmMtxArray, pViewTexMtxArray, numView, numViewMtx), mpAnmObjShp(NULL), mFlagVisBuffer(NULL), mpMatBufferDirtyFlag(pMatBufferDirtyFlag), - mReplacement(*pReplacement) {} + mReplacement(*pReplacement), + mReplacementFlag(replacementFlag) {} ScnMdl::~ScnMdl() { if (mpAnmObjShp != NULL) { diff --git a/src/nw4r/g3d/g3d_scnmdl1mat1shp.cpp b/src/nw4r/g3d/g3d_scnmdl1mat1shp.cpp index 225f9a01..0f228de6 100644 --- a/src/nw4r/g3d/g3d_scnmdl1mat1shp.cpp +++ b/src/nw4r/g3d/g3d_scnmdl1mat1shp.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/src/nw4r/g3d/g3d_scnmdlsmpl.cpp b/src/nw4r/g3d/g3d_scnmdlsmpl.cpp index 105825b9..a6cb0002 100644 --- a/src/nw4r/g3d/g3d_scnmdlsmpl.cpp +++ b/src/nw4r/g3d/g3d_scnmdlsmpl.cpp @@ -1,14 +1,13 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/ut.h" // IWYU pragma: export namespace nw4r { namespace g3d { NW4R_G3D_RTTI_DEF(ScnMdlSimple); -ScnMdlSimple* ScnMdlSimple::Construct(MEMAllocator* pAllocator, u32* pSize, - ResMdl mdl, int numView) { +ScnMdlSimple *ScnMdlSimple::Construct(MEMAllocator *pAllocator, u32 *pSize, ResMdl mdl, int numView) { if (!mdl.IsValid()) { return NULL; } @@ -19,7 +18,7 @@ ScnMdlSimple* ScnMdlSimple::Construct(MEMAllocator* pAllocator, u32* pSize, numView = VIEW_MAX; } - ScnMdlSimple* pSimple = NULL; + ScnMdlSimple *pSimple = NULL; u32 simpleSize = sizeof(ScnMdlSimple); u32 posNrmMtxNum = mdl.GetResMdlInfo().GetNumPosNrmMtx(); @@ -33,14 +32,10 @@ ScnMdlSimple* ScnMdlSimple::Construct(MEMAllocator* pAllocator, u32* pSize, u32 viewPosMtxSize = numView * align32(viewPosTexMtxSizeUnit); - u32 viewNrmMtxSize = mdl.GetResMdlInfo().ref().need_nrm_mtx_array - ? numView * align32(viewNrmMtxSizeUnit) - : 0; + u32 viewNrmMtxSize = mdl.GetResMdlInfo().ref().need_nrm_mtx_array ? numView * align32(viewNrmMtxSizeUnit) : 0; // TODO: Fakematch - u32 viewTexMtxSize = mdl.ref().info.need_tex_mtx_array - ? numView * align32(viewPosTexMtxSizeUnit) - : 0; + u32 viewTexMtxSize = mdl.ref().info.need_tex_mtx_array ? numView * align32(viewPosTexMtxSizeUnit) : 0; u32 worldMtxOfs = align32(simpleSize); u32 worldAttrOfs = align32(worldMtxOfs + worldMtxSize); @@ -54,7 +49,7 @@ ScnMdlSimple* ScnMdlSimple::Construct(MEMAllocator* pAllocator, u32* pSize, } if (pAllocator != NULL) { - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer == NULL) { return NULL; } @@ -76,26 +71,21 @@ ScnMdlSimple* ScnMdlSimple::Construct(MEMAllocator* pAllocator, u32* pSize, return pSimple; } -void ScnMdlSimple::ScnMdlSmpl_CalcPosture(u32 param, - const math::MTX34* pParent) { - CheckCallback_CALC_WORLD(CALLBACK_TIMING_A, param, - const_cast(pParent)); +void ScnMdlSimple::ScnMdlSmpl_CalcPosture(u32 param, const math::MTX34 *pParent) { + CheckCallback_CALC_WORLD(CALLBACK_TIMING_A, param, const_cast(pParent)); CalcWorldMtx(pParent, ¶m); - CheckCallback_CALC_WORLD(CALLBACK_TIMING_B, param, - const_cast(pParent)); + CheckCallback_CALC_WORLD(CALLBACK_TIMING_B, param, const_cast(pParent)); u32 mtxNum = GetResMdl().GetResMdlInfo().GetNumPosNrmMtx(); - math::MTX34* pWorldMtxArray; + math::MTX34 *pWorldMtxArray; bool locked = false; - if (mtxNum > MTX_CACHE_MIN && mtxNum < MTX_CACHE_MAX && - (locked = ut::LC::Lock()) == true) { - + if (mtxNum > MTX_CACHE_MIN && mtxNum < MTX_CACHE_MAX && (locked = ut::LC::Lock()) == true) { mFlagScnMdlSimple |= SCNMDLSMPLFLAG_LC_DMA; DC::InvalidateRange(GetWldMtxArray(), mtxNum * sizeof(math::MTX34)); - pWorldMtxArray = static_cast(ut::LC::GetBase()); + pWorldMtxArray = static_cast(ut::LC::GetBase()); } else { mFlagScnMdlSimple &= ~SCNMDLSMPLFLAG_LC_DMA; pWorldMtxArray = GetWldMtxArray(); @@ -118,217 +108,207 @@ void ScnMdlSimple::ScnMdlSmpl_CalcPosture(u32 param, } if (GetScnMdlCallback() != NULL) { - FuncObjCalcWorld funcObj(GetScnMdlCallback(), GetScnMdlCallbackTiming(), - GetScnMdlCallbackNodeID()); + FuncObjCalcWorld funcObj(GetScnMdlCallback(), GetScnMdlCallbackTiming(), GetScnMdlCallbackNodeID()); - CalcWorld(pWorldMtxArray, GetWldMtxAttribArray(), GetByteCodeCalc(), - GetMtxPtr(MTX_WORLD), GetResMdl(), GetAnmObjChr(), &funcObj, - rootAttr); + CalcWorld( + pWorldMtxArray, GetWldMtxAttribArray(), GetByteCodeCalc(), GetMtxPtr(MTX_WORLD), GetResMdl(), + GetAnmObjChr(), &funcObj, rootAttr + ); } else { - CalcWorld(pWorldMtxArray, GetWldMtxAttribArray(), GetByteCodeCalc(), - GetMtxPtr(MTX_WORLD), GetResMdl(), GetAnmObjChr(), NULL, - rootAttr); + CalcWorld( + pWorldMtxArray, GetWldMtxAttribArray(), GetByteCodeCalc(), GetMtxPtr(MTX_WORLD), GetResMdl(), + GetAnmObjChr(), NULL, rootAttr + ); } if (GetByteCodeMix() != NULL) { - CalcSkinning(pWorldMtxArray, GetWldMtxAttribArray(), GetResMdl(), - GetByteCodeMix()); + CalcSkinning(pWorldMtxArray, GetWldMtxAttribArray(), GetResMdl(), GetByteCodeMix()); } if (locked) { - ut::LC::StoreData(GetWldMtxArray(), ut::LC::GetBase(), - mtxNum * sizeof(math::MTX34)); + ut::LC::StoreData(GetWldMtxArray(), ut::LC::GetBase(), mtxNum * sizeof(math::MTX34)); ut::LC::Unlock(); } } -void ScnMdlSimple::ScnMdlSmpl_G3DPROC_GATHER_SCNOBJ( - u32 param, IScnObjGather* pCollection) { +void ScnMdlSimple::ScnMdlSmpl_G3DPROC_GATHER_SCNOBJ(u32 param, IScnObjGather *pCollection) { #pragma unused(param) - pCollection->Add(this, !TestScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_OPA), - !TestScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_XLU)); + pCollection->Add( + this, !TestScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_OPA), !TestScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_XLU) + ); } -void ScnMdlSimple::ScnMdlSmpl_G3DPROC_CALC_WORLD(u32 param, - const math::MTX34* pParent) { +void ScnMdlSimple::ScnMdlSmpl_G3DPROC_CALC_WORLD(u32 param, const math::MTX34 *pParent) { ScnMdlSmpl_CalcPosture(param, pParent); if (GetAnmObjVis() != NULL) { ApplyVisAnmResult(GetResMdl(), GetAnmObjVis()); } - CheckCallback_CALC_WORLD(CALLBACK_TIMING_C, param, - const_cast(pParent)); + CheckCallback_CALC_WORLD(CALLBACK_TIMING_C, param, const_cast(pParent)); } -void ScnMdlSimple::ScnMdlSmpl_G3DPROC_CALC_MAT(u32 param, void* pInfo) { +void ScnMdlSimple::ScnMdlSmpl_G3DPROC_CALC_MAT(u32 param, void *pInfo) { CheckCallback_CALC_MAT(CALLBACK_TIMING_A, param, pInfo); - if (GetAnmObjTexPat() != NULL || GetAnmObjTexSrt() != NULL || - GetAnmObjMatClr() != NULL) { - - CalcMaterialDirectly(GetResMdl(), GetAnmObjTexPat(), GetAnmObjTexSrt(), - GetAnmObjMatClr()); + if (GetAnmObjTexPat() != NULL || GetAnmObjTexSrt() != NULL || GetAnmObjMatClr() != NULL) { + CalcMaterialDirectly(GetResMdl(), GetAnmObjTexPat(), GetAnmObjTexSrt(), GetAnmObjMatClr()); } CheckCallback_CALC_MAT(CALLBACK_TIMING_C, param, pInfo); } -void ScnMdlSimple::ScnMdlSmpl_G3DPROC_CALC_VIEW(u32 param, - const math::MTX34* pCamera) { +void ScnMdlSimple::ScnMdlSmpl_G3DPROC_CALC_VIEW(u32 param, const math::MTX34 *pCamera) { mCurView = (mCurView + 1) % mNumView; - CheckCallback_CALC_VIEW(CALLBACK_TIMING_A, param, - const_cast(pCamera)); + CheckCallback_CALC_VIEW(CALLBACK_TIMING_A, param, const_cast(pCamera)); CalcViewMtx(pCamera); - CheckCallback_CALC_VIEW(CALLBACK_TIMING_B, param, - const_cast(pCamera)); + CheckCallback_CALC_VIEW(CALLBACK_TIMING_B, param, const_cast(pCamera)); if (ut::LC::Lock()) { if (mFlagScnMdlSimple & SCNMDLSMPLFLAG_LC_DMA) { - DC::StoreRange(GetWldMtxArray(), - GetNumViewMtx() * sizeof(math::MTX34)); + DC::StoreRange(GetWldMtxArray(), GetNumViewMtx() * sizeof(math::MTX34)); - CalcView_LC_DMA_ModelMtx(GetViewPosMtxArray(), GetViewNrmMtxArray(), - GetWldMtxArray(), GetWldMtxAttribArray(), - GetNumViewMtx(), pCamera, GetResMdl(), - GetViewTexMtxArray()); + CalcView_LC_DMA_ModelMtx( + GetViewPosMtxArray(), GetViewNrmMtxArray(), GetWldMtxArray(), GetWldMtxAttribArray(), GetNumViewMtx(), + pCamera, GetResMdl(), GetViewTexMtxArray() + ); } else { - CalcView_LC(GetViewPosMtxArray(), GetViewNrmMtxArray(), - GetWldMtxArray(), GetWldMtxAttribArray(), - GetNumViewMtx(), pCamera, GetResMdl(), - GetViewTexMtxArray()); + CalcView_LC( + GetViewPosMtxArray(), GetViewNrmMtxArray(), GetWldMtxArray(), GetWldMtxAttribArray(), GetNumViewMtx(), + pCamera, GetResMdl(), GetViewTexMtxArray() + ); } ut::LC::Unlock(); } else { - CalcView(GetViewPosMtxArray(), GetViewNrmMtxArray(), GetWldMtxArray(), - GetWldMtxAttribArray(), GetNumViewMtx(), pCamera, GetResMdl(), - GetViewTexMtxArray()); + CalcView( + GetViewPosMtxArray(), GetViewNrmMtxArray(), GetWldMtxArray(), GetWldMtxAttribArray(), GetNumViewMtx(), + pCamera, GetResMdl(), GetViewTexMtxArray() + ); } - CheckCallback_CALC_VIEW(CALLBACK_TIMING_C, param, - const_cast(pCamera)); + CheckCallback_CALC_VIEW(CALLBACK_TIMING_C, param, const_cast(pCamera)); } -void ScnMdlSimple::ScnMdlSmpl_G3DPROC_DRAW_OPA(u32 param, void* pInfo) { +void ScnMdlSimple::ScnMdlSmpl_G3DPROC_DRAW_OPA(u32 param, void *pInfo) { CheckCallback_DRAW_OPA(CALLBACK_TIMING_A, param, pInfo); - u32 drawMode = pInfo != NULL ? *static_cast(pInfo) : GetDrawMode(); + u32 drawMode = pInfo != NULL ? *static_cast(pInfo) : GetDrawMode(); - DrawResMdlDirectly(GetResMdl(), GetViewPosMtxArray(), GetViewNrmMtxArray(), - GetViewTexMtxArray(), GetByteCodeDrawOpa(), NULL, NULL, - drawMode); + DrawResMdlDirectly( + GetResMdl(), GetViewPosMtxArray(), GetViewNrmMtxArray(), GetViewTexMtxArray(), GetByteCodeDrawOpa(), NULL, NULL, + drawMode + ); CheckCallback_DRAW_OPA(CALLBACK_TIMING_C, param, pInfo); } -void ScnMdlSimple::ScnMdlSmpl_G3DPROC_DRAW_XLU(u32 param, void* pInfo) { +void ScnMdlSimple::ScnMdlSmpl_G3DPROC_DRAW_XLU(u32 param, void *pInfo) { CheckCallback_DRAW_XLU(CALLBACK_TIMING_A, param, pInfo); - u32 drawMode = pInfo != NULL ? *static_cast(pInfo) : GetDrawMode(); + u32 drawMode = pInfo != NULL ? *static_cast(pInfo) : GetDrawMode(); - DrawResMdlDirectly(GetResMdl(), GetViewPosMtxArray(), GetViewNrmMtxArray(), - GetViewTexMtxArray(), NULL, GetByteCodeDrawXlu(), NULL, - drawMode); + DrawResMdlDirectly( + GetResMdl(), GetViewPosMtxArray(), GetViewNrmMtxArray(), GetViewTexMtxArray(), NULL, GetByteCodeDrawXlu(), NULL, + drawMode + ); CheckCallback_DRAW_XLU(CALLBACK_TIMING_C, param, pInfo); } -void ScnMdlSimple::G3dProc(u32 task, u32 param, void* pInfo) { +void ScnMdlSimple::G3dProc(u32 task, u32 param, void *pInfo) { if (IsG3dProcDisabled(task)) { return; } switch (task) { - case G3DPROC_GATHER_SCNOBJ: { - ScnMdlSmpl_G3DPROC_GATHER_SCNOBJ(param, - static_cast(pInfo)); - break; - } + case G3DPROC_GATHER_SCNOBJ: { + ScnMdlSmpl_G3DPROC_GATHER_SCNOBJ(param, static_cast(pInfo)); + break; + } - case G3DPROC_CALC_WORLD: { - ScnMdlSmpl_G3DPROC_CALC_WORLD(param, static_cast(pInfo)); - break; - } + case G3DPROC_CALC_WORLD: { + ScnMdlSmpl_G3DPROC_CALC_WORLD(param, static_cast(pInfo)); + break; + } - case G3DPROC_CALC_MAT: { - ScnMdlSmpl_G3DPROC_CALC_MAT(param, pInfo); - break; - } + case G3DPROC_CALC_MAT: { + ScnMdlSmpl_G3DPROC_CALC_MAT(param, pInfo); + break; + } - case G3DPROC_CALC_VIEW: { - ScnMdlSmpl_G3DPROC_CALC_VIEW(param, static_cast(pInfo)); - break; - } + case G3DPROC_CALC_VIEW: { + ScnMdlSmpl_G3DPROC_CALC_VIEW(param, static_cast(pInfo)); + break; + } - case G3DPROC_DRAW_OPA: { - ScnMdlSmpl_G3DPROC_DRAW_OPA(param, pInfo); - break; - } + case G3DPROC_DRAW_OPA: { + ScnMdlSmpl_G3DPROC_DRAW_OPA(param, pInfo); + break; + } - case G3DPROC_DRAW_XLU: { - ScnMdlSmpl_G3DPROC_DRAW_XLU(param, pInfo); - break; - } + case G3DPROC_DRAW_XLU: { + ScnMdlSmpl_G3DPROC_DRAW_XLU(param, pInfo); + break; + } - case G3DPROC_UPDATEFRAME: { - ScnMdlSmpl_G3DPROC_UPDATEFRAME(param, pInfo); - break; - } + case G3DPROC_UPDATEFRAME: { + ScnMdlSmpl_G3DPROC_UPDATEFRAME(param, pInfo); + break; + } - case G3DPROC_CHILD_DETACHED: { - RemoveAnmObj(static_cast(pInfo)); - break; - } + case G3DPROC_CHILD_DETACHED: { + RemoveAnmObj(static_cast(pInfo)); + break; + } - default: { - DefG3dProcScnLeaf(task, param, pInfo); - break; - } + default: { + DefG3dProcScnLeaf(task, param, pInfo); + break; + } } } bool ScnMdlSimple::SetScnObjOption(u32 option, u32 value) { switch (option) { - case OPTION_IGNORE_ANMCHR_TRANS: { - SetScnObjFlag(SCNOBJFLAG_IGNORE_ANMCHR_TRANS, value); - break; - } + case OPTION_IGNORE_ANMCHR_TRANS: { + SetScnObjFlag(SCNOBJFLAG_IGNORE_ANMCHR_TRANS, value); + break; + } - default: { - return ScnLeaf::SetScnObjOption(option, value); - } + default: { + return ScnLeaf::SetScnObjOption(option, value); + } } return true; } -bool ScnMdlSimple::GetScnObjOption(u32 option, u32* pValue) const { +bool ScnMdlSimple::GetScnObjOption(u32 option, u32 *pValue) const { if (pValue == NULL) { return false; } switch (option) { - case OPTION_IGNORE_ANMCHR_TRANS: { - *pValue = TestScnObjFlag(SCNOBJFLAG_IGNORE_ANMCHR_TRANS); - break; - } + case OPTION_IGNORE_ANMCHR_TRANS: { + *pValue = TestScnObjFlag(SCNOBJFLAG_IGNORE_ANMCHR_TRANS); + break; + } - default: { - return ScnLeaf::GetScnObjOption(option, pValue); - } + default: { + return ScnLeaf::GetScnObjOption(option, pValue); + } } return true; } -bool ScnMdlSimple::GetScnMtxPos(math::MTX34* pMtx, ScnObjMtxType type, - u32 idx) const { +bool ScnMdlSimple::GetScnMtxPos(math::MTX34 *pMtx, ScnObjMtxType type, u32 idx) const { if (pMtx != NULL) { ResNode node = GetResMdl().GetResNode(idx); @@ -336,117 +316,103 @@ bool ScnMdlSimple::GetScnMtxPos(math::MTX34* pMtx, ScnObjMtxType type, s32 id = node.GetMtxID(); switch (type) { - case MTX_WORLD: { - math::MTX34Copy(pMtx, &mpWorldMtxArray[id]); - return true; - } + case MTX_WORLD: { + math::MTX34Copy(pMtx, &mpWorldMtxArray[id]); + return true; + } - case MTX_VIEW: { - if (id < GetResMdl().GetResMdlInfo().GetNumViewMtx()) { + case MTX_VIEW: { math::MTX34Copy(pMtx, &GetViewPosMtxArray()[id]); return true; } - const math::MTX34* pWorld = GetMtxPtr(MTX_WORLD); - const math::MTX34* pView = GetMtxPtr(MTX_VIEW); - - math::MTX34 work0; - math::MTX34 work1; - - if (math::MTX34Inv(&work0, pWorld) != FALSE) { - math::MTX34Mult(&work1, pView, &work0); - math::MTX34Mult(pMtx, &work1, &mpWorldMtxArray[id]); - return true; + default: { + break; } } - - default: { - break; - } - } } } return false; } -bool ScnMdlSimple::SetAnmObj(AnmObj* pObj, AnmObjType type) { +bool ScnMdlSimple::SetAnmObj(AnmObj *pObj, AnmObjType type) { if (pObj == NULL || pObj->GetParent() != NULL) { return false; } - AnmObjChr* pChr = NULL; - AnmObjVis* pVis = NULL; - AnmObjMatClr* pClr = NULL; - AnmObjTexPat* pPat = NULL; - AnmObjTexSrt* pSrt = NULL; + AnmObjChr *pChr = NULL; + AnmObjVis *pVis = NULL; + AnmObjMatClr *pClr = NULL; + AnmObjTexPat *pPat = NULL; + AnmObjTexSrt *pSrt = NULL; switch (type) { - case ANMOBJTYPE_CHR: { - if ((pChr = DynamicCast(pObj)) != NULL) { - goto _type_chr; + case ANMOBJTYPE_CHR: { + if ((pChr = DynamicCast(pObj)) != NULL) { + goto _type_chr; + } + + goto _bad_cast; } - goto _bad_cast; - } + case ANMOBJTYPE_VIS: { + if ((pVis = DynamicCast(pObj)) != NULL) { + goto _type_vis; + } - case ANMOBJTYPE_VIS: { - if ((pVis = DynamicCast(pObj)) != NULL) { - goto _type_vis; + goto _bad_cast; } - goto _bad_cast; - } + case ANMOBJTYPE_MATCLR: { + if ((pClr = DynamicCast(pObj)) != NULL) { + goto _type_clr; + } - case ANMOBJTYPE_MATCLR: { - if ((pClr = DynamicCast(pObj)) != NULL) { - goto _type_clr; + goto _bad_cast; } - goto _bad_cast; - } + case ANMOBJTYPE_TEXPAT: { + if ((pPat = DynamicCast(pObj)) != NULL) { + goto _type_pat; + } - case ANMOBJTYPE_TEXPAT: { - if ((pPat = DynamicCast(pObj)) != NULL) { - goto _type_pat; + goto _bad_cast; } - goto _bad_cast; - } + case ANMOBJTYPE_TEXSRT: { + if ((pSrt = DynamicCast(pObj)) != NULL) { + goto _type_srt; + } - case ANMOBJTYPE_TEXSRT: { - if ((pSrt = DynamicCast(pObj)) != NULL) { - goto _type_srt; + goto _bad_cast; } - goto _bad_cast; - } + case ANMOBJTYPE_NOT_SPECIFIED: { + if ((pChr = DynamicCast(pObj)) != NULL) { + goto _type_chr; + } + if ((pVis = DynamicCast(pObj)) != NULL) { + goto _type_vis; + } + if ((pClr = DynamicCast(pObj)) != NULL) { + goto _type_clr; + } + if ((pPat = DynamicCast(pObj)) != NULL) { + goto _type_pat; + } + if ((pSrt = DynamicCast(pObj)) != NULL) { + goto _type_srt; + } - case ANMOBJTYPE_NOT_SPECIFIED: { - if ((pChr = DynamicCast(pObj)) != NULL) { - goto _type_chr; - } - if ((pVis = DynamicCast(pObj)) != NULL) { - goto _type_vis; - } - if ((pClr = DynamicCast(pObj)) != NULL) { - goto _type_clr; - } - if ((pPat = DynamicCast(pObj)) != NULL) { - goto _type_pat; - } - if ((pSrt = DynamicCast(pObj)) != NULL) { - goto _type_srt; + // FALLTHROUGH } - // FALLTHROUGH - } - - _bad_cast: - case ANMOBJTYPE_SHP: - default: { - return false; - } + _bad_cast: + case ANMOBJTYPE_SHP: + default: { + return false; + } } _type_chr: @@ -515,7 +481,7 @@ _type_srt: return true; } -bool ScnMdlSimple::RemoveAnmObj(AnmObj* pObj) { +bool ScnMdlSimple::RemoveAnmObj(AnmObj *pObj) { if (pObj == NULL) { return false; } @@ -553,107 +519,107 @@ bool ScnMdlSimple::RemoveAnmObj(AnmObj* pObj) { return false; } -AnmObj* ScnMdlSimple::RemoveAnmObj(AnmObjType type) { - AnmObj* pObj = NULL; +AnmObj *ScnMdlSimple::RemoveAnmObj(AnmObjType type) { + AnmObj *pObj = NULL; switch (type) { - case ANMOBJTYPE_CHR: { - pObj = mpAnmObjChr; - RemoveAnmObj(mpAnmObjChr); - break; - } + case ANMOBJTYPE_CHR: { + pObj = mpAnmObjChr; + RemoveAnmObj(mpAnmObjChr); + break; + } - case ANMOBJTYPE_VIS: { - pObj = mpAnmObjVis; - RemoveAnmObj(mpAnmObjVis); - break; - } + case ANMOBJTYPE_VIS: { + pObj = mpAnmObjVis; + RemoveAnmObj(mpAnmObjVis); + break; + } - case ANMOBJTYPE_MATCLR: { - pObj = mpAnmObjMatClr; - RemoveAnmObj(mpAnmObjMatClr); - break; - } + case ANMOBJTYPE_MATCLR: { + pObj = mpAnmObjMatClr; + RemoveAnmObj(mpAnmObjMatClr); + break; + } - case ANMOBJTYPE_TEXPAT: { - pObj = mpAnmObjTexPat; - RemoveAnmObj(mpAnmObjTexPat); - break; - } + case ANMOBJTYPE_TEXPAT: { + pObj = mpAnmObjTexPat; + RemoveAnmObj(mpAnmObjTexPat); + break; + } - case ANMOBJTYPE_TEXSRT: { - pObj = mpAnmObjTexSrt; - RemoveAnmObj(mpAnmObjTexSrt); - break; - } + case ANMOBJTYPE_TEXSRT: { + pObj = mpAnmObjTexSrt; + RemoveAnmObj(mpAnmObjTexSrt); + break; + } - case ANMOBJTYPE_SHP: - case ANMOBJTYPE_NOT_SPECIFIED: - default: { - break; - } + case ANMOBJTYPE_SHP: + case ANMOBJTYPE_NOT_SPECIFIED: + default: { + break; + } } return pObj; } -AnmObj* ScnMdlSimple::GetAnmObj(AnmObjType type) { +AnmObj *ScnMdlSimple::GetAnmObj(AnmObjType type) { switch (type) { - case ANMOBJTYPE_CHR: { - return mpAnmObjChr; - } + case ANMOBJTYPE_CHR: { + return mpAnmObjChr; + } - case ANMOBJTYPE_VIS: { - return mpAnmObjVis; - } + case ANMOBJTYPE_VIS: { + return mpAnmObjVis; + } - case ANMOBJTYPE_MATCLR: { - return mpAnmObjMatClr; - } + case ANMOBJTYPE_MATCLR: { + return mpAnmObjMatClr; + } - case ANMOBJTYPE_TEXPAT: { - return mpAnmObjTexPat; - } + case ANMOBJTYPE_TEXPAT: { + return mpAnmObjTexPat; + } - case ANMOBJTYPE_TEXSRT: { - return mpAnmObjTexSrt; - } + case ANMOBJTYPE_TEXSRT: { + return mpAnmObjTexSrt; + } - case ANMOBJTYPE_SHP: - case ANMOBJTYPE_NOT_SPECIFIED: - default: { - return NULL; - } + case ANMOBJTYPE_SHP: + case ANMOBJTYPE_NOT_SPECIFIED: + default: { + return NULL; + } } } -const AnmObj* ScnMdlSimple::GetAnmObj(AnmObjType type) const { +const AnmObj *ScnMdlSimple::GetAnmObj(AnmObjType type) const { switch (type) { - case ANMOBJTYPE_CHR: { - return mpAnmObjChr; - } + case ANMOBJTYPE_CHR: { + return mpAnmObjChr; + } - case ANMOBJTYPE_VIS: { - return mpAnmObjVis; - } + case ANMOBJTYPE_VIS: { + return mpAnmObjVis; + } - case ANMOBJTYPE_MATCLR: { - return mpAnmObjMatClr; - } + case ANMOBJTYPE_MATCLR: { + return mpAnmObjMatClr; + } - case ANMOBJTYPE_TEXPAT: { - return mpAnmObjTexPat; - } + case ANMOBJTYPE_TEXPAT: { + return mpAnmObjTexPat; + } - case ANMOBJTYPE_TEXSRT: { - return mpAnmObjTexSrt; - } + case ANMOBJTYPE_TEXSRT: { + return mpAnmObjTexSrt; + } - case ANMOBJTYPE_SHP: - case ANMOBJTYPE_NOT_SPECIFIED: - default: { - return NULL; - } + case ANMOBJTYPE_SHP: + case ANMOBJTYPE_NOT_SPECIFIED: + default: { + return NULL; + } } } @@ -707,95 +673,87 @@ void ScnMdlSimple::DisableScnMdlCallbackTiming(Timing timing) { } } -math::MTX34* ScnMdlSimple::GetViewPosMtxArray() { - u8* pBase = reinterpret_cast(mpViewPosMtxArray); +math::MTX34 *ScnMdlSimple::GetViewPosMtxArray() { + u8 *pBase = reinterpret_cast(mpViewPosMtxArray); - return reinterpret_cast( - pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX34))); + return reinterpret_cast(pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX34))); } -const math::MTX34* ScnMdlSimple::GetViewPosMtxArray() const { - u8* pBase = reinterpret_cast(mpViewPosMtxArray); +const math::MTX34 *ScnMdlSimple::GetViewPosMtxArray() const { + u8 *pBase = reinterpret_cast(mpViewPosMtxArray); - return reinterpret_cast( - pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX34))); + return reinterpret_cast(pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX34))); } -math::MTX33* ScnMdlSimple::GetViewNrmMtxArray() { +math::MTX33 *ScnMdlSimple::GetViewNrmMtxArray() { if (mpViewNrmMtxArray != NULL) { - u8* pBase = reinterpret_cast(mpViewNrmMtxArray); + u8 *pBase = reinterpret_cast(mpViewNrmMtxArray); - return reinterpret_cast( - pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX33))); + return reinterpret_cast(pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX33))); } return NULL; } -const math::MTX33* ScnMdlSimple::GetViewNrmMtxArray() const { +const math::MTX33 *ScnMdlSimple::GetViewNrmMtxArray() const { if (mpViewNrmMtxArray != NULL) { - u8* pBase = reinterpret_cast(mpViewNrmMtxArray); + u8 *pBase = reinterpret_cast(mpViewNrmMtxArray); - return reinterpret_cast( - pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX33))); + return reinterpret_cast(pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX33))); } return NULL; } -math::MTX34* ScnMdlSimple::GetViewTexMtxArray() { +math::MTX34 *ScnMdlSimple::GetViewTexMtxArray() { if (mpViewTexMtxArray != NULL) { - u8* pBase = reinterpret_cast(mpViewTexMtxArray); + u8 *pBase = reinterpret_cast(mpViewTexMtxArray); - return reinterpret_cast( - pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX34))); + return reinterpret_cast(pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX34))); } return NULL; } -const math::MTX34* ScnMdlSimple::GetViewTexMtxArray() const { +const math::MTX34 *ScnMdlSimple::GetViewTexMtxArray() const { if (mpViewTexMtxArray != NULL) { - u8* pBase = reinterpret_cast(mpViewTexMtxArray); + u8 *pBase = reinterpret_cast(mpViewTexMtxArray); - return reinterpret_cast( - pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX34))); + return reinterpret_cast(pBase + mCurView * align32(mNumViewMtx * sizeof(math::MTX34))); } return NULL; } -const u8* ScnMdlSimple::GetByteCode(ByteCodeType type) const { +const u8 *ScnMdlSimple::GetByteCode(ByteCodeType type) const { switch (type) { - case BYTE_CODE_CALC: { - return mpByteCodeCalc; - } + case BYTE_CODE_CALC: { + return mpByteCodeCalc; + } - case BYTE_CODE_MIX: { - return mpByteCodeMix; - } + case BYTE_CODE_MIX: { + return mpByteCodeMix; + } - case BYTE_CODE_DRAW_OPA: { - return mpByteCodeDrawOpa; - } + case BYTE_CODE_DRAW_OPA: { + return mpByteCodeDrawOpa; + } - case BYTE_CODE_DRAW_XLU: { - return mpByteCodeDrawXlu; - } + case BYTE_CODE_DRAW_XLU: { + return mpByteCodeDrawXlu; + } - default: { - return NULL; - } + default: { + return NULL; + } } } -ScnMdlSimple::ScnMdlSimple(MEMAllocator* pAllocator, ResMdl mdl, - math::MTX34* pWorldMtxArray, - u32* pWorldMtxAttribArray, - math::MTX34* pViewPosMtxArray, - math::MTX33* pViewNrmMtxArray, - math::MTX34* pViewTexMtxArray, int numView, - int numViewMtx) +ScnMdlSimple::ScnMdlSimple( + MEMAllocator *pAllocator, ResMdl mdl, math::MTX34 *pWorldMtxArray, u32 *pWorldMtxAttribArray, + math::MTX34 *pViewPosMtxArray, math::MTX33 *pViewNrmMtxArray, math::MTX34 *pViewTexMtxArray, int numView, + int numViewMtx +) : ScnLeaf(pAllocator), mResMdl(mdl), mpWorldMtxArray(pWorldMtxArray), @@ -821,7 +779,6 @@ ScnMdlSimple::ScnMdlSimple(MEMAllocator* pAllocator, ResMdl mdl, mpAnmObjMatClr(NULL), mpAnmObjTexPat(NULL), mpAnmObjTexSrt(NULL) { - if (mpByteCodeDrawOpa != NULL) { SetScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_OPA, false); } else { @@ -835,30 +792,24 @@ ScnMdlSimple::ScnMdlSimple(MEMAllocator* pAllocator, ResMdl mdl, } if (mpViewPosMtxArray != NULL) { - DC::InvalidateRange(mpViewPosMtxArray, - numView * - align32(numViewMtx * sizeof(math::MTX34))); + DC::InvalidateRange(mpViewPosMtxArray, numView * align32(numViewMtx * sizeof(math::MTX34))); } if (mpViewNrmMtxArray != NULL) { - DC::InvalidateRange(mpViewNrmMtxArray, - numView * - align32(numViewMtx * sizeof(math::MTX33))); + DC::InvalidateRange(mpViewNrmMtxArray, numView * align32(numViewMtx * sizeof(math::MTX33))); } if (mpViewTexMtxArray != NULL) { - DC::InvalidateRange(mpViewTexMtxArray, - numView * - align32(numViewMtx * sizeof(math::MTX34))); + DC::InvalidateRange(mpViewTexMtxArray, numView * align32(numViewMtx * sizeof(math::MTX34))); } if (mdl.GetResMdlInfo().ref().is_valid_volume) { - const math::_VEC3& rMin = mdl.GetResMdlInfo().ref().volume_min; - const math::_VEC3& rMax = mdl.GetResMdlInfo().ref().volume_max; + const math::_VEC3 &rMin = mdl.GetResMdlInfo().ref().volume_min; + const math::_VEC3 &rMax = mdl.GetResMdlInfo().ref().volume_max; math::AABB box; - box.min = static_cast(rMin); - box.max = static_cast(rMax); + box.min = static_cast(rMin); + box.max = static_cast(rMax); SetBoundingVolume(&box); } @@ -866,10 +817,10 @@ ScnMdlSimple::ScnMdlSimple(MEMAllocator* pAllocator, ResMdl mdl, ScnMdlSimple::~ScnMdlSimple() { switch (mCwcbDeleteOption) { - case TRUE: { - delete mpCalcWorldCallback; - break; - } + case TRUE: { + delete mpCalcWorldCallback; + break; + } } if (mpAnmObjChr != NULL) { diff --git a/src/nw4r/g3d/g3d_scnobj.cpp b/src/nw4r/g3d/g3d_scnobj.cpp index f2a15ad2..35520c6b 100644 --- a/src/nw4r/g3d/g3d_scnobj.cpp +++ b/src/nw4r/g3d/g3d_scnobj.cpp @@ -1,6 +1,6 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/math.h" // IWYU pragma: export #include @@ -11,14 +11,14 @@ NW4R_G3D_RTTI_DEF(ScnObj); NW4R_G3D_RTTI_DEF(ScnLeaf); NW4R_G3D_RTTI_DEF(ScnGroup); -const math::FRUSTUM* gpCullingFrustum = NULL; +const math::FRUSTUM *gpCullingFrustum = NULL; /****************************************************************************** * * ScnObj * ******************************************************************************/ -void ScnObj::CalcWorldMtx(const math::MTX34* pParent, u32* pParam) { +void ScnObj::CalcWorldMtx(const math::MTX34 *pParent, u32 *pParam) { if (pParam != NULL && (*pParam & SCNOBJFLAG_DISABLE_CALC_WORLD)) { *pParam &= ~SCNOBJFLAG_DISABLE_CALC_WORLD; return; @@ -28,24 +28,22 @@ void ScnObj::CalcWorldMtx(const math::MTX34* pParent, u32* pParam) { if (TestScnObjFlag(SCNOBJFLAG_MTX_LOCAL_IDENTITY)) { math::MTX34Copy(&mMtxArray[MTX_WORLD], pParent); } else { - math::MTX34Mult(&mMtxArray[MTX_WORLD], pParent, - &mMtxArray[MTX_LOCAL]); + math::MTX34Mult(&mMtxArray[MTX_WORLD], pParent, &mMtxArray[MTX_LOCAL]); } } else { math::MTX34Copy(&mMtxArray[MTX_WORLD], &mMtxArray[MTX_LOCAL]); } if (TestScnObjFlag(SCNOBJFLAG_ENABLE_CULLING)) { - mAABB[BOUNDINGVOLUME_AABB_WORLD].Set(&mAABB[BOUNDINGVOLUME_AABB_LOCAL], - &mMtxArray[MTX_WORLD]); + mAABB[BOUNDINGVOLUME_AABB_WORLD].Set(&mAABB[BOUNDINGVOLUME_AABB_LOCAL], &mMtxArray[MTX_WORLD]); } } -void ScnObj::CalcViewMtx(const math::MTX34* pCamera) { +void ScnObj::CalcViewMtx(const math::MTX34 *pCamera) { math::MTX34Mult(&mMtxArray[MTX_VIEW], pCamera, &mMtxArray[MTX_WORLD]); } -ScnObj::ScnObj(MEMAllocator* pAllocator) +ScnObj::ScnObj(MEMAllocator *pAllocator) : G3dObj(pAllocator, NULL), mScnObjFlags(0), mPriorityDrawOpa(128), @@ -56,7 +54,6 @@ ScnObj::ScnObj(MEMAllocator* pAllocator) mCallbackTiming(0), mCallbackDeleteOption(FALSE), mCallbackExecOpMask(0) { - SetScnObjFlag(SCNOBJFLAG_MTX_LOCAL_IDENTITY, TRUE); math::MTX34Identity(&mMtxArray[MTX_LOCAL]); @@ -75,128 +72,128 @@ ScnObj::~ScnObj() { } switch (mCallbackDeleteOption) { - case TRUE: { - delete mpFuncObjExec; - break; - } + case TRUE: { + delete mpFuncObjExec; + break; + } } } bool ScnObj::SetScnObjOption(u32 option, u32 value) { switch (option) { - case OPTION_DISABLE_GATHER_SCNOBJ: { - SetScnObjFlag(SCNOBJFLAG_DISABLE_GATHER_SCNOBJ, value); - break; - } + case OPTION_DISABLE_GATHER_SCNOBJ: { + SetScnObjFlag(SCNOBJFLAG_DISABLE_GATHER_SCNOBJ, value); + break; + } - case OPTION_DISABLE_CALC_WORLD: { - SetScnObjFlag(SCNOBJFLAG_DISABLE_CALC_WORLD, value); - break; - } + case OPTION_DISABLE_CALC_WORLD: { + SetScnObjFlag(SCNOBJFLAG_DISABLE_CALC_WORLD, value); + break; + } - case OPTION_DISABLE_CALC_MAT: { - SetScnObjFlag(SCNOBJFLAG_DISABLE_CALC_MAT, value); - break; - } + case OPTION_DISABLE_CALC_MAT: { + SetScnObjFlag(SCNOBJFLAG_DISABLE_CALC_MAT, value); + break; + } - case OPTION_DISABLE_CALC_VTX: { - SetScnObjFlag(SCNOBJFLAG_DISABLE_CALC_VTX, value); - break; - } + case OPTION_DISABLE_CALC_VTX: { + SetScnObjFlag(SCNOBJFLAG_DISABLE_CALC_VTX, value); + break; + } - case OPTION_DISABLE_CALC_VIEW: { - SetScnObjFlag(SCNOBJFLAG_DISABLE_CALC_VIEW, value); - break; - } + case OPTION_DISABLE_CALC_VIEW: { + SetScnObjFlag(SCNOBJFLAG_DISABLE_CALC_VIEW, value); + break; + } - case OPTION_DISABLE_DRAW_OPA: { - SetScnObjFlag(SCNOBJFLAG_DISABLE_DRAW_OPA, value); - break; - } + case OPTION_DISABLE_DRAW_OPA: { + SetScnObjFlag(SCNOBJFLAG_DISABLE_DRAW_OPA, value); + break; + } - case OPTION_DISABLE_DRAW_XLU: { - SetScnObjFlag(SCNOBJFLAG_DISABLE_DRAW_XLU, value); - break; - } + case OPTION_DISABLE_DRAW_XLU: { + SetScnObjFlag(SCNOBJFLAG_DISABLE_DRAW_XLU, value); + break; + } - case OPTION_DISABLE_UPDATEFRAME: { - SetScnObjFlag(SCNOBJFLAG_DISABLE_UPDATEFRAME, value); - break; - } + case OPTION_DISABLE_UPDATEFRAME: { + SetScnObjFlag(SCNOBJFLAG_DISABLE_UPDATEFRAME, value); + break; + } - case OPTION_ENABLE_CULLING: { - SetScnObjFlag(SCNOBJFLAG_ENABLE_CULLING, value); - break; - } + case OPTION_ENABLE_CULLING: { + SetScnObjFlag(SCNOBJFLAG_ENABLE_CULLING, value); + break; + } - default: { - return false; - } + default: { + return false; + } } return true; } -bool ScnObj::GetScnObjOption(u32 option, u32* pValue) const { +bool ScnObj::GetScnObjOption(u32 option, u32 *pValue) const { if (pValue == NULL) { return false; } switch (option) { - case OPTION_DISABLE_GATHER_SCNOBJ: { - *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_GATHER_SCNOBJ); - break; - } + case OPTION_DISABLE_GATHER_SCNOBJ: { + *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_GATHER_SCNOBJ); + break; + } - case OPTION_DISABLE_CALC_WORLD: { - *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_CALC_WORLD); - break; - } + case OPTION_DISABLE_CALC_WORLD: { + *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_CALC_WORLD); + break; + } - case OPTION_DISABLE_CALC_MAT: { - *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_CALC_MAT); - break; - } + case OPTION_DISABLE_CALC_MAT: { + *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_CALC_MAT); + break; + } - case OPTION_DISABLE_CALC_VTX: { - *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_CALC_VTX); - break; - } + case OPTION_DISABLE_CALC_VTX: { + *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_CALC_VTX); + break; + } - case OPTION_DISABLE_CALC_VIEW: { - *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_CALC_VIEW); - break; - } + case OPTION_DISABLE_CALC_VIEW: { + *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_CALC_VIEW); + break; + } - case OPTION_DISABLE_DRAW_OPA: { - *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_DRAW_OPA); - break; - } + case OPTION_DISABLE_DRAW_OPA: { + *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_DRAW_OPA); + break; + } - case OPTION_DISABLE_DRAW_XLU: { - *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_DRAW_XLU); - break; - } + case OPTION_DISABLE_DRAW_XLU: { + *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_DRAW_XLU); + break; + } - case OPTION_DISABLE_UPDATEFRAME: { - *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_UPDATEFRAME); - break; - } + case OPTION_DISABLE_UPDATEFRAME: { + *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_UPDATEFRAME); + break; + } - case OPTION_ENABLE_CULLING: { - *pValue = TestScnObjFlag(SCNOBJFLAG_ENABLE_CULLING); - break; - } + case OPTION_ENABLE_CULLING: { + *pValue = TestScnObjFlag(SCNOBJFLAG_ENABLE_CULLING); + break; + } - default: { - return false; - } + default: { + return false; + } } return true; } -bool ScnObj::SetMtx(ScnObjMtxType type, const math::MTX34* pMtx) { +bool ScnObj::SetMtx(ScnObjMtxType type, const math::MTX34 *pMtx) { if (static_cast(type) < MTX_TYPE_MAX) { if (pMtx != NULL) { if (type == MTX_LOCAL) { @@ -218,7 +215,21 @@ bool ScnObj::SetMtx(ScnObjMtxType type, const math::MTX34* pMtx) { return false; } -bool ScnObj::GetMtx(ScnObjMtxType type, math::MTX34* pMtx) const { +bool ScnObj::SetMtx(ScnObjMtxType type, const math::MTX34 &rMtx) { + if (static_cast(type) < MTX_TYPE_MAX) { + if (type == MTX_LOCAL) { + SetScnObjFlag(SCNOBJFLAG_MTX_LOCAL_IDENTITY, FALSE); + } + + math::MTX34Copy(&mMtxArray[type], &rMtx); + + return true; + } + + return false; +} + +bool ScnObj::GetMtx(ScnObjMtxType type, math::MTX34 *pMtx) const { if (pMtx != NULL && static_cast(type) < MTX_TYPE_MAX) { math::MTX34Copy(pMtx, &mMtxArray[type]); return true; @@ -269,12 +280,25 @@ void ScnObj::EnableScnObjCallbackTiming(Timing timing) { } } +void ScnObj::DisableScnObjCallbackTiming(Timing timing) { + if (timing & CALLBACK_TIMING_A) { + mCallbackTiming &= ~CALLBACK_TIMING_A; + } + + if (timing & CALLBACK_TIMING_B) { + mCallbackTiming &= ~CALLBACK_TIMING_B; + } + + if (timing & CALLBACK_TIMING_C) { + mCallbackTiming &= ~CALLBACK_TIMING_C; + } +} + void ScnObj::EnableScnObjCallbackExecOp(ExecOp op) { mCallbackExecOpMask |= static_cast(op); } -bool ScnObj::SetBoundingVolume(ScnObjBoundingVolumeType type, - const math::AABB* pAABB) { +bool ScnObj::SetBoundingVolume(ScnObjBoundingVolumeType type, const math::AABB *pAABB) { if (pAABB != NULL) { if (type < BOUNDINGVOLUME_MAX) { mAABB[type] = *pAABB; @@ -287,8 +311,7 @@ bool ScnObj::SetBoundingVolume(ScnObjBoundingVolumeType type, return SetScnObjOption(OPTION_ENABLE_CULLING, FALSE); } -bool ScnObj::GetBoundingVolume(ScnObjBoundingVolumeType type, - math::AABB* pAABB) const { +bool ScnObj::GetBoundingVolume(ScnObjBoundingVolumeType type, math::AABB *pAABB) const { if (pAABB != NULL) { if (type < BOUNDINGVOLUME_MAX) { *pAABB = mAABB[type]; @@ -306,50 +329,47 @@ bool ScnObj::GetBoundingVolume(ScnObjBoundingVolumeType type, * ScnLeaf * ******************************************************************************/ -ScnObj::ForEachResult ScnLeaf::ForEach(ForEachFunc pFunc, void* pInfo, - bool postOrder) { +ScnObj::ForEachResult ScnLeaf::ForEach(ForEachFunc pFunc, void *pInfo, bool postOrder) { #pragma unused(postOrder) - return pFunc(this, pInfo) != FOREACHRESULT_CONTINUE - ? FOREACHRESULT_OK - : FOREACHRESULT_CONTINUE; + return pFunc(this, pInfo) != FOREACHRESULT_CONTINUE ? FOREACHRESULT_OK : FOREACHRESULT_CONTINUE; } bool ScnLeaf::SetScnObjOption(u32 option, u32 value) { switch (option) { - case OPTION_DISABLE_DRAW_ALL: { - SetScnObjFlag(SCNOBJFLAG_DISABLE_DRAW, value); - break; - } + case OPTION_DISABLE_DRAW_ALL: { + SetScnObjFlag(SCNOBJFLAG_DISABLE_DRAW, value); + break; + } - default: { - return ScnObj::SetScnObjOption(option, value); - } + default: { + return ScnObj::SetScnObjOption(option, value); + } } return true; } -bool ScnLeaf::GetScnObjOption(u32 option, u32* pValue) const { +bool ScnLeaf::GetScnObjOption(u32 option, u32 *pValue) const { if (pValue == NULL) { return false; } switch (option) { - case OPTION_DISABLE_DRAW_ALL: { - *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_DRAW); - break; - } + case OPTION_DISABLE_DRAW_ALL: { + *pValue = TestScnObjFlag(SCNOBJFLAG_DISABLE_DRAW); + break; + } - default: { - return ScnObj::GetScnObjOption(option, pValue); - } + default: { + return ScnObj::GetScnObjOption(option, pValue); + } } return true; } -void ScnLeaf::CalcWorldMtx(const math::MTX34* pParent, u32* pParam) { +void ScnLeaf::CalcWorldMtx(const math::MTX34 *pParent, u32 *pParam) { if (pParam != NULL && (*pParam & SCNOBJFLAG_DISABLE_CALC_WORLD)) { *pParam &= ~SCNOBJFLAG_DISABLE_CALC_WORLD; return; @@ -359,8 +379,7 @@ void ScnLeaf::CalcWorldMtx(const math::MTX34* pParent, u32* pParam) { math::MTX34Scale(&mMtxArray[MTX_WORLD], &mMtxArray[MTX_WORLD], &mScale); if (TestScnObjFlag(SCNOBJFLAG_ENABLE_CULLING)) { - mAABB[BOUNDINGVOLUME_AABB_WORLD].Set(&mAABB[BOUNDINGVOLUME_AABB_LOCAL], - &mMtxArray[MTX_WORLD]); + mAABB[BOUNDINGVOLUME_AABB_WORLD].Set(&mAABB[BOUNDINGVOLUME_AABB_LOCAL], &mMtxArray[MTX_WORLD]); } } @@ -378,48 +397,48 @@ ScnLeaf::ScaleProperty ScnLeaf::GetScaleProperty() const { return NONUNIFORM_SCALED; } -void ScnLeaf::DefG3dProcScnLeaf(u32 task, u32 param, void* pInfo) { +void ScnLeaf::DefG3dProcScnLeaf(u32 task, u32 param, void *pInfo) { switch (task) { - case G3DPROC_CALC_WORLD: { - CheckCallback_CALC_WORLD(CALLBACK_TIMING_A, param, pInfo); - CalcWorldMtx(static_cast(pInfo), ¶m); - CheckCallback_CALC_WORLD(CALLBACK_TIMING_B, param, pInfo); - CheckCallback_CALC_WORLD(CALLBACK_TIMING_C, param, pInfo); - break; - } + case G3DPROC_CALC_WORLD: { + CheckCallback_CALC_WORLD(CALLBACK_TIMING_A, param, pInfo); + CalcWorldMtx(static_cast(pInfo), ¶m); + CheckCallback_CALC_WORLD(CALLBACK_TIMING_B, param, pInfo); + CheckCallback_CALC_WORLD(CALLBACK_TIMING_C, param, pInfo); + break; + } - case G3DPROC_CALC_MAT: { - CheckCallback_CALC_MAT(CALLBACK_TIMING_A, param, pInfo); - CheckCallback_CALC_MAT(CALLBACK_TIMING_C, param, pInfo); - break; - } + case G3DPROC_CALC_MAT: { + CheckCallback_CALC_MAT(CALLBACK_TIMING_A, param, pInfo); + CheckCallback_CALC_MAT(CALLBACK_TIMING_C, param, pInfo); + break; + } - case G3DPROC_CALC_VIEW: { - CheckCallback_CALC_VIEW(CALLBACK_TIMING_A, param, pInfo); - CalcViewMtx(static_cast(pInfo)); - CheckCallback_CALC_VIEW(CALLBACK_TIMING_B, param, pInfo); - CheckCallback_CALC_VIEW(CALLBACK_TIMING_C, param, pInfo); - break; - } + case G3DPROC_CALC_VIEW: { + CheckCallback_CALC_VIEW(CALLBACK_TIMING_A, param, pInfo); + CalcViewMtx(static_cast(pInfo)); + CheckCallback_CALC_VIEW(CALLBACK_TIMING_B, param, pInfo); + CheckCallback_CALC_VIEW(CALLBACK_TIMING_C, param, pInfo); + break; + } - case G3DPROC_DETACH_PARENT: { - SetParent(NULL); - break; - } + case G3DPROC_DETACH_PARENT: { + SetParent(NULL); + break; + } - case G3DPROC_ATTACH_PARENT: { - SetParent(static_cast(pInfo)); - break; - } + case G3DPROC_ATTACH_PARENT: { + SetParent(static_cast(pInfo)); + break; + } - case G3DPROC_GATHER_SCNOBJ: - case G3DPROC_DRAW_OPA: - case G3DPROC_DRAW_XLU: - case G3DPROC_UPDATEFRAME: - case G3DPROC_CHILD_DETACHED: - case G3DPROC_ZSORT: { - break; - } + case G3DPROC_GATHER_SCNOBJ: + case G3DPROC_DRAW_OPA: + case G3DPROC_DRAW_XLU: + case G3DPROC_UPDATEFRAME: + case G3DPROC_CHILD_DETACHED: + case G3DPROC_ZSORT: { + break; + } } } @@ -428,8 +447,7 @@ void ScnLeaf::DefG3dProcScnLeaf(u32 task, u32 param, void* pInfo) { * ScnGroup * ******************************************************************************/ -ScnObj::ForEachResult ScnGroup::ForEach(ForEachFunc pFunc, void* pInfo, - bool postOrder) { +ScnObj::ForEachResult ScnGroup::ForEach(ForEachFunc pFunc, void *pInfo, bool postOrder) { ForEachResult result; if (postOrder) { @@ -442,8 +460,7 @@ ScnObj::ForEachResult ScnGroup::ForEach(ForEachFunc pFunc, void* pInfo, } result = pFunc(this, pInfo); - return result == FOREACHRESULT_CONTINUE ? FOREACHRESULT_CONTINUE - : FOREACHRESULT_OK; + return result == FOREACHRESULT_CONTINUE ? FOREACHRESULT_CONTINUE : FOREACHRESULT_OK; } else { result = pFunc(this, pInfo); @@ -459,56 +476,48 @@ ScnObj::ForEachResult ScnGroup::ForEach(ForEachFunc pFunc, void* pInfo, return FOREACHRESULT_OK; } - return result == FOREACHRESULT_CONTINUE ? FOREACHRESULT_CONTINUE - : FOREACHRESULT_OK; + return result == FOREACHRESULT_CONTINUE ? FOREACHRESULT_CONTINUE : FOREACHRESULT_OK; } } -void ScnGroup::ScnGroup_G3DPROC_GATHER_SCNOBJ(u32 param, - IScnObjGather* pCollection) { - IScnObjGather::CullingStatus status = - pCollection->Add(this, !TestScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_OPA), - !TestScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_XLU)); +void ScnGroup::ScnGroup_G3DPROC_GATHER_SCNOBJ(u32 param, IScnObjGather *pCollection) { + IScnObjGather::CullingStatus status = pCollection->Add( + this, !TestScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_OPA), !TestScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_XLU) + ); if (status == IScnObjGather::CULLINGSTATUS_INTERSECT) { for (u32 i = 0; i < mNumScnObj; i++) { - mpScnObjArray[i]->G3dProc(G3DPROC_GATHER_SCNOBJ, param, - pCollection); + mpScnObjArray[i]->G3dProc(G3DPROC_GATHER_SCNOBJ, param, pCollection); } } else if (status == IScnObjGather::CULLINGSTATUS_INSIDE) { - const math::FRUSTUM* pTemp = gpCullingFrustum; + const math::FRUSTUM *pTemp = gpCullingFrustum; gpCullingFrustum = NULL; { for (u32 i = 0; i < mNumScnObj; i++) { - mpScnObjArray[i]->G3dProc(G3DPROC_GATHER_SCNOBJ, param, - pCollection); + mpScnObjArray[i]->G3dProc(G3DPROC_GATHER_SCNOBJ, param, pCollection); } } gpCullingFrustum = pTemp; } } -void ScnGroup::ScnGroup_G3DPROC_CALC_WORLD(u32 param, - const math::MTX34* pParent) { - CheckCallback_CALC_WORLD(CALLBACK_TIMING_A, param, - const_cast(pParent)); +void ScnGroup::ScnGroup_G3DPROC_CALC_WORLD(u32 param, const math::MTX34 *pParent) { + CheckCallback_CALC_WORLD(CALLBACK_TIMING_A, param, const_cast(pParent)); CalcWorldMtx(pParent, ¶m); - CheckCallback_CALC_WORLD(CALLBACK_TIMING_B, param, - const_cast(pParent)); + CheckCallback_CALC_WORLD(CALLBACK_TIMING_B, param, const_cast(pParent)); - math::MTX34* pWorldMtx = const_cast(GetMtxPtr(MTX_WORLD)); + math::MTX34 *pWorldMtx = const_cast(GetMtxPtr(MTX_WORLD)); for (u32 i = 0; i < mNumScnObj; i++) { mpScnObjArray[i]->G3dProc(G3DPROC_CALC_WORLD, param, pWorldMtx); } - CheckCallback_CALC_WORLD(CALLBACK_TIMING_C, param, - const_cast(pParent)); + CheckCallback_CALC_WORLD(CALLBACK_TIMING_C, param, const_cast(pParent)); } -void ScnGroup::ScnGroup_G3DPROC_CALC_MAT(u32 param, void* pInfo) { +void ScnGroup::ScnGroup_G3DPROC_CALC_MAT(u32 param, void *pInfo) { CheckCallback_CALC_MAT(CALLBACK_TIMING_A, param, pInfo); for (u32 i = 0; i < mNumScnObj; i++) { @@ -518,26 +527,21 @@ void ScnGroup::ScnGroup_G3DPROC_CALC_MAT(u32 param, void* pInfo) { CheckCallback_CALC_MAT(CALLBACK_TIMING_C, param, pInfo); } -void ScnGroup::ScnGroup_G3DPROC_CALC_VIEW(u32 param, - const math::MTX34* pCamera) { - CheckCallback_CALC_VIEW(CALLBACK_TIMING_A, param, - const_cast(pCamera)); +void ScnGroup::ScnGroup_G3DPROC_CALC_VIEW(u32 param, const math::MTX34 *pCamera) { + CheckCallback_CALC_VIEW(CALLBACK_TIMING_A, param, const_cast(pCamera)); CalcViewMtx(pCamera); - CheckCallback_CALC_VIEW(CALLBACK_TIMING_B, param, - const_cast(pCamera)); + CheckCallback_CALC_VIEW(CALLBACK_TIMING_B, param, const_cast(pCamera)); for (u32 i = 0; i < mNumScnObj; i++) { - mpScnObjArray[i]->G3dProc(G3DPROC_CALC_VIEW, param, - const_cast(pCamera)); + mpScnObjArray[i]->G3dProc(G3DPROC_CALC_VIEW, param, const_cast(pCamera)); } - CheckCallback_CALC_VIEW(CALLBACK_TIMING_C, param, - const_cast(pCamera)); + CheckCallback_CALC_VIEW(CALLBACK_TIMING_C, param, const_cast(pCamera)); } -void ScnGroup::G3dProc(u32 task, u32 param, void* pInfo) { +void ScnGroup::G3dProc(u32 task, u32 param, void *pInfo) { if (IsG3dProcDisabled(task)) { return; } @@ -545,86 +549,78 @@ void ScnGroup::G3dProc(u32 task, u32 param, void* pInfo) { DefG3dProcScnGroup(task, param, pInfo); } -void ScnGroup::DefG3dProcScnGroup(u32 task, u32 param, void* pInfo) { +void ScnGroup::DefG3dProcScnGroup(u32 task, u32 param, void *pInfo) { switch (task) { - case G3DPROC_GATHER_SCNOBJ: { - ScnGroup_G3DPROC_GATHER_SCNOBJ(param, - static_cast(pInfo)); - break; - } - - case G3DPROC_CALC_WORLD: { - ScnGroup_G3DPROC_CALC_WORLD(param, static_cast(pInfo)); - break; - } - - case G3DPROC_CALC_MAT: { - ScnGroup_G3DPROC_CALC_MAT(param, pInfo); - break; - } - - case G3DPROC_CALC_VIEW: { - ScnGroup_G3DPROC_CALC_VIEW(param, static_cast(pInfo)); - break; - } - - case G3DPROC_DRAW_OPA: - case G3DPROC_DRAW_XLU: { - return; - } - - case G3DPROC_CHILD_DETACHED: { - Remove(static_cast(pInfo)); - break; - } - - case G3DPROC_DETACH_PARENT: { - SetParent(NULL); - break; - } - - case G3DPROC_ATTACH_PARENT: { - SetParent(static_cast(pInfo)); - break; - } - - case G3DPROC_UPDATEFRAME: - case G3DPROC_ZSORT: - default: { - for (u32 i = 0; i < mNumScnObj; i++) { - mpScnObjArray[i]->G3dProc(task, param, pInfo); + case G3DPROC_GATHER_SCNOBJ: { + ScnGroup_G3DPROC_GATHER_SCNOBJ(param, static_cast(pInfo)); + break; + } + + case G3DPROC_CALC_WORLD: { + ScnGroup_G3DPROC_CALC_WORLD(param, static_cast(pInfo)); + break; + } + + case G3DPROC_CALC_MAT: { + ScnGroup_G3DPROC_CALC_MAT(param, pInfo); + break; + } + + case G3DPROC_CALC_VIEW: { + ScnGroup_G3DPROC_CALC_VIEW(param, static_cast(pInfo)); + break; + } + + case G3DPROC_DRAW_OPA: + case G3DPROC_DRAW_XLU: { + return; + } + + case G3DPROC_CHILD_DETACHED: { + Remove(static_cast(pInfo)); + break; + } + + case G3DPROC_DETACH_PARENT: { + SetParent(NULL); + break; + } + + case G3DPROC_ATTACH_PARENT: { + SetParent(static_cast(pInfo)); + break; + } + + case G3DPROC_UPDATEFRAME: + case G3DPROC_ZSORT: + default: { + for (u32 i = 0; i < mNumScnObj; i++) { + mpScnObjArray[i]->G3dProc(task, param, pInfo); + } + break; } - break; - } } } -bool ScnGroup::Insert(u32 idx, ScnObj* pObj) { - if (idx <= mNumScnObj && mNumScnObj < mSizeScnObj && pObj != NULL && - pObj->GetParent() == NULL) { - - ScnObj** ppObj = - std::find(mpScnObjArray, mpScnObjArray + mNumScnObj, pObj); - - if (ppObj == mpScnObjArray + mNumScnObj) { - for (u32 i = mNumScnObj; i > idx; i--) { - mpScnObjArray[i] = mpScnObjArray[i - 1]; - } - - mpScnObjArray[idx] = pObj; - pObj->G3dProc(G3DPROC_ATTACH_PARENT, 0, this); - - mNumScnObj++; - return true; +bool ScnGroup::Insert(u32 idx, ScnObj *pObj) { + if (idx <= mNumScnObj && mNumScnObj < mSizeScnObj && pObj != NULL && pObj->GetParent() == NULL) { + for (u32 i = mNumScnObj; i > idx; i--) { + mpScnObjArray[i] = mpScnObjArray[i - 1]; } + + mpScnObjArray[idx] = pObj; + pObj->G3dProc(G3DPROC_ATTACH_PARENT, 0, this); + + mNumScnObj++; + return true; } return false; } -ScnObj* ScnGroup::Remove(u32 idx) { +ScnObj *ScnGroup::Remove(u32 idx) { if (idx < mNumScnObj) { - ScnObj* pObj = mpScnObjArray[idx]; + ScnObj *pObj = mpScnObjArray[idx]; pObj->G3dProc(G3DPROC_DETACH_PARENT, 0, this); for (u32 i = idx; i < mNumScnObj - 1; i++) { @@ -638,8 +634,8 @@ ScnObj* ScnGroup::Remove(u32 idx) { return NULL; } -bool ScnGroup::Remove(ScnObj* pObj) { - ScnObj** ppObj = std::find(mpScnObjArray, mpScnObjArray + mNumScnObj, pObj); +bool ScnGroup::Remove(ScnObj *pObj) { + ScnObj **ppObj = std::find(mpScnObjArray, mpScnObjArray + mNumScnObj, pObj); if (ppObj != mpScnObjArray + mNumScnObj) { return Remove(std::distance(mpScnObjArray, ppObj)) != NULL; @@ -648,12 +644,8 @@ bool ScnGroup::Remove(ScnObj* pObj) { return false; } -ScnGroup::ScnGroup(MEMAllocator* pAllocator, ScnObj** ppObj, u32 capacity) - : ScnObj(pAllocator), - mpScnObjArray(ppObj), - mSizeScnObj(capacity), - mNumScnObj(0) { - +ScnGroup::ScnGroup(MEMAllocator *pAllocator, ScnObj **ppObj, u32 capacity) + : ScnObj(pAllocator), mpScnObjArray(ppObj), mSizeScnObj(capacity), mNumScnObj(0) { SetScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_OPA, TRUE); SetScnObjFlag(SCNOBJFLAG_NOT_GATHER_DRAW_XLU, TRUE); } diff --git a/src/nw4r/g3d/g3d_scnproc.cpp b/src/nw4r/g3d/g3d_scnproc.cpp index 9a3a675d..8e371949 100644 --- a/src/nw4r/g3d/g3d_scnproc.cpp +++ b/src/nw4r/g3d/g3d_scnproc.cpp @@ -1,14 +1,13 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { NW4R_G3D_RTTI_DEF(ScnProc); -ScnProc* ScnProc::Construct(MEMAllocator* pAllocator, u32* pSize, - DrawProc pProc, bool opa, bool xlu, - u32 userDataSize) { - ScnProc* pScnProc = NULL; +ScnProc * +ScnProc::Construct(MEMAllocator *pAllocator, u32 *pSize, DrawProc pProc, bool opa, bool xlu, u32 userDataSize) { + ScnProc *pScnProc = NULL; u32 scnProcSize = sizeof(ScnProc); userDataSize = align4(userDataSize); @@ -20,51 +19,51 @@ ScnProc* ScnProc::Construct(MEMAllocator* pAllocator, u32* pSize, } if (pAllocator != NULL) { - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer != NULL) { - void* pUserData = userDataSize != 0 ? pBuffer + userDataOfs : NULL; + void *pUserData = userDataSize != 0 ? pBuffer + userDataOfs : NULL; - pScnProc = - new (pBuffer) ScnProc(pAllocator, pProc, pUserData, opa, xlu); + pScnProc = new (pBuffer) ScnProc(pAllocator, pProc, pUserData, opa, xlu); } } return pScnProc; } -void ScnProc::G3dProc(u32 task, u32 param, void* pInfo) { +void ScnProc::G3dProc(u32 task, u32 param, void *pInfo) { if (IsG3dProcDisabled(task)) { return; } switch (task) { - case G3DPROC_GATHER_SCNOBJ: { - IScnObjGather* pCollection = static_cast(pInfo); - pCollection->Add(this, (mFlag & SCNPROCFLAG_DRAW_OPA) ? true : false, - (mFlag & SCNPROCFLAG_DRAW_XLU) ? true : false); - break; - } - - case G3DPROC_DRAW_OPA: { - if (mpDrawProc != NULL) { - G3DState::Invalidate(); - mpDrawProc(this, true); + case G3DPROC_GATHER_SCNOBJ: { + IScnObjGather *pCollection = static_cast(pInfo); + pCollection->Add( + this, (mFlag & SCNPROCFLAG_DRAW_OPA) ? true : false, (mFlag & SCNPROCFLAG_DRAW_XLU) ? true : false + ); + break; } - break; - } - case G3DPROC_DRAW_XLU: { - if (mpDrawProc != NULL) { - G3DState::Invalidate(); - mpDrawProc(this, false); + case G3DPROC_DRAW_OPA: { + if (mpDrawProc != NULL) { + G3DState::Invalidate(); + mpDrawProc(this, true); + } + break; } - break; - } - default: { - DefG3dProcScnLeaf(task, param, pInfo); - } + case G3DPROC_DRAW_XLU: { + if (mpDrawProc != NULL) { + G3DState::Invalidate(); + mpDrawProc(this, false); + } + break; + } + + default: { + DefG3dProcScnLeaf(task, param, pInfo); + } } } diff --git a/src/nw4r/g3d/g3d_scnrfl.cpp b/src/nw4r/g3d/g3d_scnrfl.cpp index 47de6bba..a8b421f4 100644 --- a/src/nw4r/g3d/g3d_scnrfl.cpp +++ b/src/nw4r/g3d/g3d_scnrfl.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -33,7 +33,7 @@ bool ScnRfl::SetExpression(RFLExpression expression) { return false; } -bool ScnRfl::GetExpression(RFLExpression* pExpression) { +bool ScnRfl::GetExpression(RFLExpression *pExpression) { if (pExpression != NULL && IsCharModelReady()) { *pExpression = RFLGetExpression(&mCharModel); return true; @@ -42,12 +42,10 @@ bool ScnRfl::GetExpression(RFLExpression* pExpression) { return false; } -bool ScnRfl::SetupCharModel(RFLDataSource src, u16 index, - RFLMiddleDB* pMiddleDB) { +bool ScnRfl::SetupCharModel(RFLDataSource src, u16 index, RFLMiddleDB *pMiddleDB) { ReleaseCharModel(); - mRFLErrCode = RFLInitCharModel(&mCharModel, src, pMiddleDB, index, - mpNglBuffer, mResolution, mExpressionFlag); + mRFLErrCode = RFLInitCharModel(&mCharModel, src, pMiddleDB, index, mpNglBuffer, mResolution, mExpressionFlag); if (mRFLErrCode != RFLErrcode_Success) { return false; @@ -63,10 +61,9 @@ void ScnRfl::ReleaseCharModel() { } } -ScnRfl* ScnRfl::Construct(MEMAllocator* pAllocator, u32* pSize, - RFLResolution resolution, u32 exprFlags, - u32 userDataSize) { - ScnRfl* pScnRfl = NULL; +ScnRfl * +ScnRfl::Construct(MEMAllocator *pAllocator, u32 *pSize, RFLResolution resolution, u32 exprFlags, u32 userDataSize) { + ScnRfl *pScnRfl = NULL; u32 scnRflSize = sizeof(ScnRfl); u32 nglSize = RFLGetModelBufferSize(resolution, exprFlags); @@ -80,7 +77,7 @@ ScnRfl* ScnRfl::Construct(MEMAllocator* pAllocator, u32* pSize, } if (pAllocator != NULL) { - u8* pBuffer = reinterpret_cast(Alloc(pAllocator, size)); + u8 *pBuffer = reinterpret_cast(Alloc(pAllocator, size)); if (pBuffer == NULL) { return NULL; } @@ -98,71 +95,71 @@ ScnRfl* ScnRfl::Construct(MEMAllocator* pAllocator, u32* pSize, return pScnRfl; } -void ScnRfl::G3dProc(u32 task, u32 param, void* pInfo) { +void ScnRfl::G3dProc(u32 task, u32 param, void *pInfo) { if (IsG3dProcDisabled(task)) { return; } switch (task) { - case G3DPROC_GATHER_SCNOBJ: { - IScnObjGather* pCollection = static_cast(pInfo); - pCollection->Add(this, true, true); - break; - } - - case G3DPROC_CALC_WORLD: { - CheckCallback_CALC_WORLD(CALLBACK_TIMING_A, param, pInfo); - CalcWorldMtx(static_cast(pInfo), ¶m); - CheckCallback_CALC_WORLD(CALLBACK_TIMING_B, param, pInfo); - CheckCallback_CALC_WORLD(CALLBACK_TIMING_C, param, pInfo); - break; - } - - case G3DPROC_CALC_VIEW: { - CheckCallback_CALC_VIEW(CALLBACK_TIMING_A, param, pInfo); - CalcViewMtx(static_cast(pInfo)); - CheckCallback_CALC_VIEW(CALLBACK_TIMING_B, param, pInfo); - - math::MTX34 viewMtx; - GetMtx(MTX_VIEW, &viewMtx); - RFLSetMtx(&mCharModel, viewMtx); - - CheckCallback_CALC_VIEW(CALLBACK_TIMING_C, param, pInfo); - break; - } - - case G3DPROC_DRAW_OPA: { - if (!IsCharModelReady()) { + case G3DPROC_GATHER_SCNOBJ: { + IScnObjGather *pCollection = static_cast(pInfo); + pCollection->Add(this, true, true); break; } - if (mpDrawProc == NULL) { - LoadDrawSetting(); - RFLDrawOpa(&mCharModel); - } else { - CallDrawProc(true); - } - break; - } - - case G3DPROC_DRAW_XLU: { - if (!IsCharModelReady()) { + case G3DPROC_CALC_WORLD: { + CheckCallback_CALC_WORLD(CALLBACK_TIMING_A, param, pInfo); + CalcWorldMtx(static_cast(pInfo), ¶m); + CheckCallback_CALC_WORLD(CALLBACK_TIMING_B, param, pInfo); + CheckCallback_CALC_WORLD(CALLBACK_TIMING_C, param, pInfo); break; } - if (mpDrawProc == NULL) { - LoadDrawSetting(); - RFLDrawXlu(&mCharModel); - } else { - CallDrawProc(false); - } - break; - } + case G3DPROC_CALC_VIEW: { + CheckCallback_CALC_VIEW(CALLBACK_TIMING_A, param, pInfo); + CalcViewMtx(static_cast(pInfo)); + CheckCallback_CALC_VIEW(CALLBACK_TIMING_B, param, pInfo); - default: { - DefG3dProcScnLeaf(task, param, pInfo); - break; - } + math::MTX34 viewMtx; + GetMtx(MTX_VIEW, &viewMtx); + RFLSetMtx(&mCharModel, viewMtx); + + CheckCallback_CALC_VIEW(CALLBACK_TIMING_C, param, pInfo); + break; + } + + case G3DPROC_DRAW_OPA: { + if (!IsCharModelReady()) { + break; + } + + if (mpDrawProc == NULL) { + LoadDrawSetting(); + RFLDrawOpa(&mCharModel); + } else { + CallDrawProc(true); + } + break; + } + + case G3DPROC_DRAW_XLU: { + if (!IsCharModelReady()) { + break; + } + + if (mpDrawProc == NULL) { + LoadDrawSetting(); + RFLDrawXlu(&mCharModel); + } else { + CallDrawProc(false); + } + break; + } + + default: { + DefG3dProcScnLeaf(task, param, pInfo); + break; + } } } @@ -179,9 +176,7 @@ void ScnRfl::CallDrawProc(bool opa) { ambColor.b = 0.5f + (lobj.b * mAmbientColor.b) * (1.0f / 255.0f); ambColor.a = 0.5f + (lobj.a * mAmbientColor.a) * (1.0f / 255.0f); - G3DState::Invalidate( - G3DState::INVALIDATE_ALL & - ~(G3DState::INVALIDATE_FOG | G3DState::INVALIDATE_LIGHT)); + G3DState::Invalidate(G3DState::INVALIDATE_ALL & ~(G3DState::INVALIDATE_FOG | G3DState::INVALIDATE_LIGHT)); mpDrawProc(this, &mCharModel, diffMask, specMask, ambColor, opa); } @@ -206,15 +201,12 @@ void ScnRfl::LoadDrawSetting() { setting.ambColor.b = 0.5f + ((lobj.b * mAmbientColor.b) * (1.0f / 255.0f)); setting.ambColor.a = 0.5f + ((lobj.a * mAmbientColor.a) * (1.0f / 255.0f)); - G3DState::Invalidate( - G3DState::INVALIDATE_ALL & - ~(G3DState::INVALIDATE_FOG | G3DState::INVALIDATE_LIGHT)); + G3DState::Invalidate(G3DState::INVALIDATE_ALL & ~(G3DState::INVALIDATE_FOG | G3DState::INVALIDATE_LIGHT)); RFLLoadDrawSetting(&setting); } -ScnRfl::ScnRfl(MEMAllocator* pAllocator, void* pNglBuffer, void* pUserData, - RFLResolution resolution, u32 exprFlag) +ScnRfl::ScnRfl(MEMAllocator *pAllocator, void *pNglBuffer, void *pUserData, RFLResolution resolution, u32 exprFlag) : ScnLeaf(pAllocator), mResolution(resolution), mExpressionFlag(exprFlag), @@ -228,7 +220,6 @@ ScnRfl::ScnRfl(MEMAllocator* pAllocator, void* pNglBuffer, void* pUserData, mRFLErrCode(RFLErrcode_Success), mpDrawProc(NULL), mpUserData(pUserData) { - mAmbientColor.r = mAmbientColor.g = mAmbientColor.b = 64; mAmbientColor.a = 255; } diff --git a/src/nw4r/g3d/g3d_scnroot.cpp b/src/nw4r/g3d/g3d_scnroot.cpp index 692ebd3a..391d90fa 100644 --- a/src/nw4r/g3d/g3d_scnroot.cpp +++ b/src/nw4r/g3d/g3d_scnroot.cpp @@ -1,6 +1,9 @@ -#include +#include "nw4r/g3d/g3d_scnroot.h" -#include +#include "nw4r/g3d.h" // IWYU pragma: export +#include "nw4r/g3d/g3d_scnobj.h" + +#include "rvl/GX.h" // IWYU pragma: export #include #include @@ -99,7 +102,7 @@ void ScnRoot::G3dProc(u32 task, u32 param, void *pInfo) { } Camera ScnRoot::GetCamera(int idx) { - if (idx >= 0 && idx < G3DState::NUM_CAMERA) { + if (0 <= idx && idx < G3DState::NUM_CAMERA) { return Camera(&mCamera[idx]); } @@ -115,7 +118,7 @@ void ScnRoot::SetCurrentCamera(int idx) { } Fog ScnRoot::GetFog(int idx) { - if (idx >= 0 && idx < G3DState::NUM_FOG) { + if (0 <= idx && idx < G3DState::NUM_FOG) { return Fog(&mFog[idx]); } @@ -163,6 +166,7 @@ void ScnRoot::SetGlbSettings() { Fog fog(&mFog[i]); fog.SetNearFar(near, far); + // Enum Comparison mismatch on purpose if (fog.ref().type != GX_PERSPECTIVE) { fog.ref().type = static_cast((fog.ref().type & ~(GX_ORTHOGRAPHIC << 3)) | projOrthoBit); } @@ -446,6 +450,10 @@ void ScnObjGather::DrawXlu(ResMdlDrawMode *pForceMode) { } } +ScnObjGather::CheckStatus ScnObjGather::CheckScnObj(ScnObj *) { + return ScnObjGather::CHECKSTATUS_GATHER_SCNOBJ; +} + ScnObjGather::ScnObjGather(ScnObj **ppBufOpa, ScnObj **ppBufXlu, u32 capacity) : mpArrayOpa(ppBufOpa), mpArrayXlu(ppBufXlu), mSizeScnObj(capacity), mNumScnObjOpa(0), mNumScnObjXlu(0) {} diff --git a/src/nw4r/g3d/g3d_state.cpp b/src/nw4r/g3d/g3d_state.cpp index b2d5c354..a296085d 100644 --- a/src/nw4r/g3d/g3d_state.cpp +++ b/src/nw4r/g3d/g3d_state.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include +#include "nw4r/g3d.h" // IWYU pragma: export #include #include @@ -832,12 +832,7 @@ public: static math::MTX33 m; - if (!math::MTX34InvTranspose(&m, GetViewPosMtxPtr(id))) { - m._00 = m._11 = m._22 = 1.0f; - m._20 = m._21 = 0.0f; - m._10 = m._12 = 0.0f; - m._01 = m._02 = 0.0f; - } + detail::CalcViewNrmMtx(&m, GetViewPosMtxPtr(id)); return &m; } @@ -1392,12 +1387,6 @@ Misc sMisc; * G3DState * ******************************************************************************/ -namespace { - -IndMtxOpStd IndMtxOpDefault; -IndMtxOp *pG3DStateIndMtxOp = &IndMtxOpDefault; - -} // namespace void LoadResMatMisc(const ResMatMisc misc) { if (!misc.IsValid()) { @@ -1746,6 +1735,12 @@ void SetScnDependentTexMtxFunc(u32 id, ScnDependentTexMtxFuncPtr func, ScnDepend bool GetScnDependentTexMtxFunc(u32 id, ScnDependentTexMtxFuncPtr *pFunc, ScnDependentTexMtxFuncType *pType) { return sScnDependentTexMtxFuncTable.GetFunc(id, pFunc, pType); } +namespace { + +IndMtxOpStd IndMtxOpDefault; +IndMtxOp *pG3DStateIndMtxOp = &IndMtxOpDefault; + +} // namespace IndMtxOp *GetIndMtxOp() { return pG3DStateIndMtxOp; @@ -1851,7 +1846,7 @@ void Invalidate(u32 flag) { } if (flag & INVALIDATE_TEXMTX) { - // @bug Missing PreTexMtxState::Invalidate + sPreTexMtxState.Invalidate(); sPostTexMtx.Invalidate(); } @@ -1892,7 +1887,7 @@ IndMtxOpStd::IndMtxOpStd() { void IndMtxOpStd::SetNrmMapMtx( GXIndTexMtxID id, const math::VEC3 *pLightVec, const math::MTX34 *pNrmMtx, ResMatMiscData::IndirectMethod method ) { - if (id >= GX_ITM_0 && id <= GX_ITM_2 && method != ResMatMiscData::WARP) { + if (id >= GX_ITM_0 && id <= GX_ITM_2 && method != ResMatMiscData::WARP && method != ResMatMiscData::FUR) { u32 i = id - GX_ITM_0; mIsValidMtx[i] = true; diff --git a/src/nw4r/g3d/g3d_transform.cpp b/src/nw4r/g3d/g3d_transform.cpp new file mode 100644 index 00000000..451f0d24 --- /dev/null +++ b/src/nw4r/g3d/g3d_transform.cpp @@ -0,0 +1,225 @@ +#include "nw4r/g3d.h" // IWYU pragma: export + +#include "nw4r/math.h" // IWYU pragma: export + +namespace nw4r { +namespace g3d { +namespace detail { + +using nw4r::math::MTX33; +using nw4r::math::MTX34; +using nw4r::math::VEC3; + +const f32 dat_epsilon = 1e-36f; + +// clang-format off +asm bool CalcViewNrmMtx(register math::MTX33 *pOut, const register math::MTX34 *pW) { + nofralloc + psq_l f0, MTX34._00(pW), 1, 0 + psq_l f1, MTX34._01(pW), 0, 0 + psq_l f2, MTX34._10(pW), 1, 0 + ps_merge10 f6, f1, f0 + psq_l f3, MTX34._11(pW), 0, 0 + psq_l f4, MTX34._20(pW), 1, 0 + ps_merge10 f7, f3, f2 + psq_l f5, MTX34._21(pW), 0, 0 + ps_mul f11, f3, f6 + ps_merge10 f8, f5, f4 + ps_mul f13, f5, f7 + ps_msub f11, f1, f7, f11 + ps_mul f12, f1, f8 + ps_msub f13, f3, f8, f13 + lis r12, dat_epsilon@ha + ps_msub f12, f5, f6, f12 + ps_mul f7, f0, f13 + addi r12, r12, dat_epsilon@l + ps_mul f10, f3, f4 + ps_madd f7, f2, f12, f7 + psq_l f6, 0x0(r12), 1, 0 + ps_mul f9, f0, f5 + ps_madd f7, f4, f11, f7 + ps_msub f10, f2, f5, f10 + ps_msub f9, f1, f4, f9 + ps_abs f8, f7 + ps_cmpo0 cr0, f8, f6 + bge _lbl_80442B80 + psq_st f0, MTX33._00(pOut), 1, 0 + psq_st f2, MTX33._10(pOut), 1, 0 + psq_st f4, MTX33._20(pOut), 1, 0 + psq_st f1, MTX33._01(pOut), 0, 0 + psq_st f3, MTX33._11(pOut), 0, 0 + psq_st f5, MTX33._21(pOut), 0, 0 + li r3, 0x0 + blr + +_lbl_80442B80: + fres f5, f7 + ps_mul f8, f1, f2 + ps_sub f6, f6, f6 + ps_add f1, f5, f5 + ps_msub f8, f0, f3, f8 + ps_mul f2, f7, f5 + ps_nmsub f0, f5, f2, f1 + ps_muls0 f13, f13, f0 + ps_muls0 f12, f12, f0 + psq_st f13, MTX33._00(pOut), 0, 0 + ps_muls0 f11, f11, f0 + psq_st f12, MTX33._10(pOut), 0, 0 + ps_muls0 f10, f10, f0 + psq_st f11, MTX33._20(pOut), 0, 0 + ps_muls0 f9, f9, f0 + psq_st f10, MTX33._02(pOut), 1, 0 + ps_muls0 f8, f8, f0 + psq_st f9, MTX33._12(pOut), 1, 0 + psq_st f8, MTX33._22(pOut), 1, 0 + li r3, 0x1 + blr +} + +asm bool CalcViewTexMtx(register math::MTX34 *pOut, const register math::MTX34 *pW) { + nofralloc + psq_l f0, MTX34._00(pW), 1, 0 + psq_l f1, MTX34._01(pW), 0, 0 + psq_l f2, MTX34._10(pW), 1, 0 + ps_merge10 f6, f1, f0 + psq_l f3, MTX34._11(pW), 0, 0 + psq_l f4, MTX34._20(pW), 1, 0 + ps_merge10 f7, f3, f2 + psq_l f5, MTX34._21(pW), 0, 0 + ps_mul f11, f3, f6 + ps_merge10 f8, f5, f4 + ps_mul f13, f5, f7 + ps_msub f11, f1, f7, f11 + ps_mul f12, f1, f8 + ps_msub f13, f3, f8, f13 + lis r12, dat_epsilon@ha + ps_msub f12, f5, f6, f12 + ps_mul f7, f0, f13 + addi r12, r12, dat_epsilon@l + ps_mul f10, f3, f4 + ps_madd f7, f2, f12, f7 + psq_l f6, 0x0(r12), 1, 0 + ps_mul f9, f0, f5 + ps_madd f7, f4, f11, f7 + ps_msub f10, f2, f5, f10 + ps_msub f9, f1, f4, f9 + ps_abs f8, f7 + ps_cmpo0 cr0, f8, f6 + bge _lbl_80442C88 + cmplw pOut, pW + beq _lbl_80442C80 + psq_st f0, MTX34._00(pOut), 1, 0 + psq_st f2, MTX34._10(pOut), 1, 0 + psq_st f4, MTX34._20(pOut), 1, 0 + ps_sub f6, f6, f6 + psq_st f1, MTX34._01(pOut), 0, 0 + psq_st f3, MTX34._11(pOut), 0, 0 + psq_st f5, MTX34._21(pOut), 0, 0 + psq_st f6, MTX34._03(pOut), 1, 0 + psq_st f6, MTX34._13(pOut), 1, 0 + psq_st f6, MTX34._23(pOut), 1, 0 +_lbl_80442C80: + li r3, 0x0 + blr +_lbl_80442C88: + fres f5, f7 + ps_mul f8, f1, f2 + ps_sub f6, f6, f6 + ps_add f1, f5, f5 + ps_msub f8, f0, f3, f8 + psq_st f6, MTX34._03(pOut), 1, 0 + ps_mul f2, f7, f5 + psq_st f6, MTX34._13(pOut), 1, 0 + psq_st f6, MTX34._23(pOut), 1, 0 + ps_nmsub f0, f5, f2, f1 + ps_muls0 f13, f13, f0 + ps_muls0 f12, f12, f0 + psq_st f13, MTX34._00(pOut), 0, 0 + ps_muls0 f11, f11, f0 + psq_st f12, MTX34._10(pOut), 0, 0 + ps_muls0 f10, f10, f0 + psq_st f11, MTX34._20(pOut), 0, 0 + ps_muls0 f9, f9, f0 + psq_st f10, MTX34._02(pOut), 1, 0 + ps_muls0 f8, f8, f0 + psq_st f9, MTX34._12(pOut), 1, 0 + psq_st f8, MTX34._22(pOut), 1, 0 + li r3, 0x1 + blr +} + +asm bool CalcInvWorldMtx(register math::MTX34 *pOut, const register math::MTX34 *pW) { + nofralloc + psq_l f0, MTX34._00(pW), 1, 0 + psq_l f1, MTX34._01(pW), 0, 0 + psq_l f2, MTX34._10(pW), 1, 0 + ps_merge10 f6, f1, f0 + psq_l f3, MTX34._11(pW), 0, 0 + psq_l f4, MTX34._20(pW), 1, 0 + ps_merge10 f7, f3, f2 + psq_l f5, MTX34._21(pW), 0, 0 + ps_mul f11, f3, f6 + ps_merge10 f8, f5, f4 + ps_mul f13, f5, f7 + ps_msub f11, f1, f7, f11 + ps_mul f12, f1, f8 + ps_msub f13, f3, f8, f13 + lis r12, dat_epsilon@ha + ps_msub f12, f5, f6, f12 + ps_mul f7, f0, f13 + addi r12, r12, dat_epsilon@l + ps_mul f10, f3, f4 + ps_madd f7, f2, f12, f7 + psq_l f6, 0x0(r12), 1, 0 + ps_mul f9, f0, f5 + ps_madd f7, f4, f11, f7 + ps_msub f10, f2, f5, f10 + ps_msub f9, f1, f4, f9 + ps_abs f8, f7 + ps_cmpo0 cr0, f8, f6 + bge _lbl_80442D68 + li r3, 0x0 + blr +_lbl_80442D68: + fres f6, f7 + ps_mul f8, f1, f2 + ps_add f5, f6, f6 + ps_mul f4, f7, f6 + ps_msub f8, f0, f3, f8 + ps_nmsub f0, f6, f4, f5 + lfs f1, MTX34._03(pW) + ps_muls0 f13, f13, f0 + lfs f2, MTX34._13(pW) + ps_muls0 f12, f12, f0 + lfs f3, MTX34._23(pW) + ps_muls0 f11, f11, f0 + ps_merge00 f5, f13, f12 + ps_merge11 f4, f13, f12 + ps_mul f6, f13, f1 + psq_st f5, MTX34._00(pOut), 0, 0 + psq_st f4, MTX34._10(pOut), 0, 0 + ps_muls0 f10, f10, f0 + ps_muls0 f9, f9, f0 + ps_madd f6, f12, f2, f6 + psq_st f10, MTX34._20(pOut), 1, 0 + ps_muls0 f8, f8, f0 + ps_nmadd f6, f11, f3, f6 + psq_st f9, MTX34._21(pOut), 1, 0 + ps_mul f7, f10, f1 + ps_merge00 f5, f11, f6 + psq_st f8, MTX34._22(pOut), 1, 0 + ps_madd f7, f9, f2, f7 + ps_merge11 f4, f11, f6 + psq_st f5, MTX34._02(pOut), 0, 0 + ps_nmadd f7, f8, f3, f7 + psq_st f4, MTX34._12(pOut), 0, 0 + psq_st f7, MTX34._23(pOut), 1, 0 + li r3, 0x1 + blr +} + +// clang-format on + +} // namespace detail +} // namespace g3d +} // namespace nw4r diff --git a/src/nw4r/g3d/g3d_workmem.cpp b/src/nw4r/g3d/g3d_workmem.cpp index b23539dd..4e363d15 100644 --- a/src/nw4r/g3d/g3d_workmem.cpp +++ b/src/nw4r/g3d/g3d_workmem.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/src/nw4r/g3d/platform/g3d_cpu.cpp b/src/nw4r/g3d/platform/g3d_cpu.cpp index 011c113b..0851e59c 100644 --- a/src/nw4r/g3d/platform/g3d_cpu.cpp +++ b/src/nw4r/g3d/platform/g3d_cpu.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/src/nw4r/g3d/platform/g3d_gpu.cpp b/src/nw4r/g3d/platform/g3d_gpu.cpp index fb4788e9..cf11a321 100644 --- a/src/nw4r/g3d/platform/g3d_gpu.cpp +++ b/src/nw4r/g3d/platform/g3d_gpu.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { diff --git a/src/nw4r/g3d/platform/g3d_tmem.cpp b/src/nw4r/g3d/platform/g3d_tmem.cpp index f3d2662b..2dc55708 100644 --- a/src/nw4r/g3d/platform/g3d_tmem.cpp +++ b/src/nw4r/g3d/platform/g3d_tmem.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export // TODO: Naming enum TMemCachePlan { diff --git a/src/nw4r/g3d/res/g3d_resanm.cpp b/src/nw4r/g3d/res/g3d_resanm.cpp index 1d454cc8..3184a13d 100644 --- a/src/nw4r/g3d/res/g3d_resanm.cpp +++ b/src/nw4r/g3d/res/g3d_resanm.cpp @@ -1,7 +1,7 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include -#include +#include "nw4r/math.h" // IWYU pragma: export +#include "nw4r/ut.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -24,8 +24,7 @@ inline f32 HermiteInterpolation(f32 v0, f32 t0, f32 v1, f32 t1, f32 p, f32 d) { f32 s = p * invd; // p / d f32 s_1 = s - 1.0f; // (p - d) / d - return v0 + s * (s * ((2.0f * s - 3.0f) * (v0 - v1))) + - p * s_1 * (s_1 * t0 + s * t1); + return v0 + s * (s * ((2.0f * s - 3.0f) * (v0 - v1))) + p * s_1 * (s_1 * t0 + s * t1); } /** @@ -36,14 +35,14 @@ inline f32 HermiteInterpolation(f32 v0, f32 t0, f32 v1, f32 t1, f32 p, f32 d) { * The value returned is f(ratio). */ inline u8 LinearInterpColorElem(u8 a, u8 b, s16 ratio) { - return a + ((b - a) * ratio >> 15); + return a + ((b - a) * ratio >> 0xF); } } // namespace -f32 GetResKeyFrameAnmResult(const ResKeyFrameAnmData* pData, f32 frame) { - const ResKeyFrameData& rFirst = pData->keyFrames[0]; - const ResKeyFrameData& rLast = pData->keyFrames[pData->numKeyFrame - 1]; +f32 GetResKeyFrameAnmResult(const ResKeyFrameAnmData *pData, f32 frame) { + const ResKeyFrameData &rFirst = pData->keyFrames[0]; + const ResKeyFrameData &rLast = pData->keyFrames[pData->numKeyFrame - 1]; if (frame <= rFirst.frame) { return rFirst.value; @@ -59,7 +58,7 @@ f32 GetResKeyFrameAnmResult(const ResKeyFrameAnmData* pData, f32 frame) { f32 fEstimate = frameOffset * numKeyFrame * pData->invKeyFrameRange; u16 iEstimate = math::F32ToU16(fEstimate); - const ResKeyFrameData* pLeft = &pData->keyFrames[iEstimate]; + const ResKeyFrameData *pLeft = &pData->keyFrames[iEstimate]; if (frame < pLeft->frame) { do { @@ -77,16 +76,15 @@ f32 GetResKeyFrameAnmResult(const ResKeyFrameAnmData* pData, f32 frame) { return pLeft->value; } - const ResKeyFrameData* pRight = pLeft + 1; + const ResKeyFrameData *pRight = pLeft + 1; f32 curFrameDelta = frame - pLeft->frame; f32 keyFrameDelta = pRight->frame - pLeft->frame; - return HermiteInterpolation(pLeft->value, pLeft->slope, pRight->value, - pRight->slope, curFrameDelta, keyFrameDelta); + return HermiteInterpolation(pLeft->value, pLeft->slope, pRight->value, pRight->slope, curFrameDelta, keyFrameDelta); } -u32 GetResColorAnmResult(const ResColorAnmFramesData* pData, f32 frame) { - const u32* pColorArray = pData->frameColors; +u32 GetResColorAnmResult(const ResColorAnmFramesData *pData, f32 frame) { + const u32 *pColorArray = pData->frameColors; f32 intPart; f32 fracPart = math::FModf(frame, &intPart); @@ -96,16 +94,16 @@ u32 GetResColorAnmResult(const ResColorAnmFramesData* pData, f32 frame) { return pColorArray[intFrame]; } - ut::Color left(pColorArray[intFrame]); - ut::Color right(pColorArray[intFrame + 1]); + const ut::Color left(pColorArray[intFrame]); + const ut::Color right(pColorArray[intFrame + 1]); f32 biasedRatio = 32768 * fracPart; s16 fpRatio = math::F32ToS16(biasedRatio); - return ut::Color(LinearInterpColorElem(left.r, right.r, fpRatio), - LinearInterpColorElem(left.g, right.g, fpRatio), - LinearInterpColorElem(left.b, right.b, fpRatio), - LinearInterpColorElem(left.a, right.a, fpRatio)); + return ut::Color( + LinearInterpColorElem(left.r, right.r, fpRatio), LinearInterpColorElem(left.g, right.g, fpRatio), + LinearInterpColorElem(left.b, right.b, fpRatio), LinearInterpColorElem(left.a, right.a, fpRatio) + ); } } // namespace detail diff --git a/src/nw4r/g3d/res/g3d_resanmamblight.cpp b/src/nw4r/g3d/res/g3d_resanmamblight.cpp index 071560f3..a1fc09d6 100644 --- a/src/nw4r/g3d/res/g3d_resanmamblight.cpp +++ b/src/nw4r/g3d/res/g3d_resanmamblight.cpp @@ -1,24 +1,21 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void ResAnmAmbLight::GetAnmResult(AmbLightAnmResult* pResult, f32 frame) const { - const ResAnmAmbLightData& r = ref(); +void ResAnmAmbLight::GetAnmResult(AmbLightAnmResult *pResult, f32 frame) const { + const ResAnmAmbLightData &r = ref(); u32 flags = r.flags; bool constant = (flags & ResAnmAmbLightData::FLAG_CONST) != 0; - const ResAnmScnInfoData& rInfoData = - ofs_to_ptr(r.toResAnmScnData)->info; + const ResAnmScnInfoData &rInfoData = ofs_to_ptr(r.toResAnmScnData)->info; f32 clippedFrame = detail::ClipFrame(rInfoData, frame); - pResult->flags = flags & (AmbLightAnmResult::FLAG_COLOR_ENABLE | - AmbLightAnmResult::FLAG_ALPHA_ENABLE); + pResult->flags = flags & (AmbLightAnmResult::FLAG_COLOR_ENABLE | AmbLightAnmResult::FLAG_ALPHA_ENABLE); - pResult->color = - detail::GetResColorAnmResult(&r.color, clippedFrame, constant); + pResult->color = detail::GetResColorAnmResult(&r.color, clippedFrame, constant); } } // namespace g3d diff --git a/src/nw4r/g3d/res/g3d_resanmcamera.cpp b/src/nw4r/g3d/res/g3d_resanmcamera.cpp index 0c3cd46c..57c00a4c 100644 --- a/src/nw4r/g3d/res/g3d_resanmcamera.cpp +++ b/src/nw4r/g3d/res/g3d_resanmcamera.cpp @@ -1,10 +1,10 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void ResAnmCamera::GetAnmResult(CameraAnmResult* pResult, f32 frame) const { - const ResAnmCameraData& r = ref(); +void ResAnmCamera::GetAnmResult(CameraAnmResult *pResult, f32 frame) const { + const ResAnmCameraData &r = ref(); u32 flags = r.flags; bool constantPosX = (flags & ResAnmCameraData::FLAG_POS_X_CONST) != 0; @@ -15,11 +15,9 @@ void ResAnmCamera::GetAnmResult(CameraAnmResult* pResult, f32 frame) const { bool constantNear = (flags & ResAnmCameraData::FLAG_NEAR_CONST) != 0; bool constantFar = (flags & ResAnmCameraData::FLAG_FAR_CONST) != 0; - CameraType type = static_cast( - flags & ResAnmCameraData::FLAG_CAMERA_TYPE_MASK); + CameraType type = static_cast(flags & ResAnmCameraData::FLAG_CAMERA_TYPE_MASK); - pResult->flags = flags & (CameraAnmResult::FLAG_CAMERA_TYPE_MASK | - CameraAnmResult::FLAG_ANM_EXISTS); + pResult->flags = flags & (CameraAnmResult::FLAG_CAMERA_TYPE_MASK | CameraAnmResult::FLAG_ANM_EXISTS); pResult->projType = r.projType; @@ -32,64 +30,53 @@ void ResAnmCamera::GetAnmResult(CameraAnmResult* pResult, f32 frame) const { pResult->far = detail::GetResAnmResult(&r.far, frame, constantFar); switch (type) { - case CAMERATYPE_ROTATE: { - bool constantRotX = (flags & ResAnmCameraData::FLAG_ROT_X_CONST) != 0; - bool constantRotY = (flags & ResAnmCameraData::FLAG_ROT_Y_CONST) != 0; - bool constantRotZ = (flags & ResAnmCameraData::FLAG_ROT_Z_CONST) != 0; + case CAMERATYPE_ROTATE: { + bool constantRotX = (flags & ResAnmCameraData::FLAG_ROT_X_CONST) != 0; + bool constantRotY = (flags & ResAnmCameraData::FLAG_ROT_Y_CONST) != 0; + bool constantRotZ = (flags & ResAnmCameraData::FLAG_ROT_Z_CONST) != 0; - pResult->rotate.rot.x = - detail::GetResAnmResult(&r.rotX, frame, constantRotX); - pResult->rotate.rot.y = - detail::GetResAnmResult(&r.rotY, frame, constantRotY); - pResult->rotate.rot.z = - detail::GetResAnmResult(&r.rotZ, frame, constantRotZ); - break; - } + pResult->rotate.rot.x = detail::GetResAnmResult(&r.rotX, frame, constantRotX); + pResult->rotate.rot.y = detail::GetResAnmResult(&r.rotY, frame, constantRotY); + pResult->rotate.rot.z = detail::GetResAnmResult(&r.rotZ, frame, constantRotZ); + break; + } - case CAMERATYPE_AIM: { - bool constantAimX = (flags & ResAnmCameraData::FLAG_AIM_X_CONST) != 0; - bool constantAimY = (flags & ResAnmCameraData::FLAG_AIM_Y_CONST) != 0; - bool constantAimZ = (flags & ResAnmCameraData::FLAG_AIM_Z_CONST) != 0; - bool constantTwist = (flags & ResAnmCameraData::FLAG_TWIST_CONST) != 0; + case CAMERATYPE_AIM: { + bool constantAimX = (flags & ResAnmCameraData::FLAG_AIM_X_CONST) != 0; + bool constantAimY = (flags & ResAnmCameraData::FLAG_AIM_Y_CONST) != 0; + bool constantAimZ = (flags & ResAnmCameraData::FLAG_AIM_Z_CONST) != 0; + bool constantTwist = (flags & ResAnmCameraData::FLAG_TWIST_CONST) != 0; - pResult->aim.aim.x = - detail::GetResAnmResult(&r.aimX, frame, constantAimX); - pResult->aim.aim.y = - detail::GetResAnmResult(&r.aimY, frame, constantAimY); - pResult->aim.aim.z = - detail::GetResAnmResult(&r.aimZ, frame, constantAimZ); - pResult->aim.twist = - detail::GetResAnmResult(&r.twist, frame, constantTwist); - break; - } + pResult->aim.aim.x = detail::GetResAnmResult(&r.aimX, frame, constantAimX); + pResult->aim.aim.y = detail::GetResAnmResult(&r.aimY, frame, constantAimY); + pResult->aim.aim.z = detail::GetResAnmResult(&r.aimZ, frame, constantAimZ); + pResult->aim.twist = detail::GetResAnmResult(&r.twist, frame, constantTwist); + break; + } - default: { - break; - } + default: { + break; + } } switch (r.projType) { - case GX_PERSPECTIVE: { - bool constantFovy = - (flags & ResAnmCameraData::FLAG_PERSP_FOVY_CONST) != 0; + case GX_PERSPECTIVE: { + bool constantFovy = (flags & ResAnmCameraData::FLAG_PERSP_FOVY_CONST) != 0; - pResult->perspFovy = - detail::GetResAnmResult(&r.perspFovy, frame, constantFovy); - break; - } + pResult->perspFovy = detail::GetResAnmResult(&r.perspFovy, frame, constantFovy); + break; + } - case GX_ORTHOGRAPHIC: { - bool constantHeight = - (flags & ResAnmCameraData::FLAG_ORTHO_HEIGHT_CONST) != 0; + case GX_ORTHOGRAPHIC: { + bool constantHeight = (flags & ResAnmCameraData::FLAG_ORTHO_HEIGHT_CONST) != 0; - pResult->orthoHeight = - detail::GetResAnmResult(&r.orthoHeight, frame, constantHeight); - break; - } + pResult->orthoHeight = detail::GetResAnmResult(&r.orthoHeight, frame, constantHeight); + break; + } - default: { - break; - } + default: { + break; + } } } diff --git a/src/nw4r/g3d/res/g3d_resanmchr.cpp b/src/nw4r/g3d/res/g3d_resanmchr.cpp index 6d155630..58c89563 100644 --- a/src/nw4r/g3d/res/g3d_resanmchr.cpp +++ b/src/nw4r/g3d/res/g3d_resanmchr.cpp @@ -1,6 +1,6 @@ #pragma fp_contract on -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -14,8 +14,13 @@ namespace { inline f32 HermiteInterpolation(f32 v0, f32 t0, f32 v1, f32 t1, f32 s, f32 d) { f32 s_1 = s - 1.0f; - return v0 + s * (s * ((2.0f * s - 3.0f) * (v0 - v1))) + - d * s_1 * (s_1 * t0 + s * t1); + return v0 + s * (s * ((2.0f * s - 3.0f) * (v0 - v1))) + d * s_1 * (s_1 * t0 + s * t1); +} + +inline f32 GetMtx34Scale(const math::MTX34 &rMtx, int col) { + return math::FSqrt( + (rMtx.m[0][col] * rMtx.m[0][col]) + (rMtx.m[1][col] * rMtx.m[1][col]) + (rMtx.m[2][col] * rMtx.m[2][col]) + ); } /****************************************************************************** @@ -23,12 +28,13 @@ inline f32 HermiteInterpolation(f32 v0, f32 t0, f32 v1, f32 t1, f32 s, f32 d) { * Animation keyframe * ******************************************************************************/ -template class CResAnmChrFrmBase { +template +class CResAnmChrFrmBase { protected: - const TData* mPtr; + const TData *mPtr; public: - CResAnmChrFrmBase(const TData* pPtr) : mPtr(pPtr) {} + CResAnmChrFrmBase(const TData *pPtr) : mPtr(pPtr) {} void operator++(int) { mPtr++; @@ -47,10 +53,9 @@ class CResAnmChrFrm : public CResAnmChrFrmBase > {}; template <> class CResAnmChrFrm - : public CResAnmChrFrmBase > { + : public CResAnmChrFrmBase > { public: - CResAnmChrFrm(const ResAnmChrFrm32Data* pPtr) : CResAnmChrFrmBase(pPtr) {} + CResAnmChrFrm(const ResAnmChrFrm32Data *pPtr) : CResAnmChrFrmBase(pPtr) {} u8 GetFrame() const { return mPtr->fvs.frame; @@ -60,10 +65,9 @@ public: return fastcast::U8_0ToF32(&mPtr->fvs.frame); } - f32 GetValue(const ResAnmChrFVSData* pFVSData) const { + f32 GetValue(const ResAnmChrFVSData *pFVSData) const { u16 value = (mPtr->fvsU32 & 0x00FFF000) >> 12; - return pFVSData->fvs32.scale * fastcast::U16_0ToF32(&value) + - pFVSData->fvs48.offset; + return pFVSData->fvs32.scale * fastcast::U16_0ToF32(&value) + pFVSData->fvs48.offset; } f32 GetSlope() const { @@ -74,10 +78,9 @@ public: template <> class CResAnmChrFrm - : public CResAnmChrFrmBase > { + : public CResAnmChrFrmBase > { public: - CResAnmChrFrm(const ResAnmChrFrm48Data* pPtr) : CResAnmChrFrmBase(pPtr) {} + CResAnmChrFrm(const ResAnmChrFrm48Data *pPtr) : CResAnmChrFrmBase(pPtr) {} s16 GetFrame() const { return mPtr->frame; @@ -87,9 +90,8 @@ public: return fastcast::S10_5ToF32(&mPtr->frame); } - f32 GetValue(const ResAnmChrFVSData* pFVSData) const { - return pFVSData->fvs48.scale * fastcast::U16_0ToF32(&mPtr->value) + - pFVSData->fvs48.offset; + f32 GetValue(const ResAnmChrFVSData *pFVSData) const { + return pFVSData->fvs48.scale * fastcast::U16_0ToF32(&mPtr->value) + pFVSData->fvs48.offset; } f32 GetSlope() const { @@ -99,10 +101,9 @@ public: template <> class CResAnmChrFrm - : public CResAnmChrFrmBase > { + : public CResAnmChrFrmBase > { public: - CResAnmChrFrm(const ResAnmChrFrm96Data* pPtr) : CResAnmChrFrmBase(pPtr) {} + CResAnmChrFrm(const ResAnmChrFrm96Data *pPtr) : CResAnmChrFrmBase(pPtr) {} f32 GetFrame() const { return mPtr->frame; @@ -112,7 +113,7 @@ public: return mPtr->frame; } - f32 GetValue(const ResAnmChrFVSData* /* pFVSData */) const { + f32 GetValue(const ResAnmChrFVSData * /* pFVSData */) const { return mPtr->value; } @@ -126,16 +127,17 @@ public: * Animation traits * ******************************************************************************/ -template class CAnmFmtTraits {}; +template +class CAnmFmtTraits {}; -template <> class CAnmFmtTraits { +template <> +class CAnmFmtTraits { public: typedef ResAnmChrFrm32Data TFrmData; typedef u8 TFrame; public: - static CResAnmChrFrm GetKeyFrame(const ResAnmChrFVSData* pFVSData, - int index) { + static CResAnmChrFrm GetKeyFrame(const ResAnmChrFVSData *pFVSData, int index) { return CResAnmChrFrm(&pFVSData->fvs32.frameValues[index]); } @@ -144,14 +146,14 @@ public: } }; -template <> class CAnmFmtTraits { +template <> +class CAnmFmtTraits { public: typedef ResAnmChrFrm48Data TFrmData; typedef s16 TFrame; public: - static CResAnmChrFrm GetKeyFrame(const ResAnmChrFVSData* pFVSData, - int index) { + static CResAnmChrFrm GetKeyFrame(const ResAnmChrFVSData *pFVSData, int index) { return CResAnmChrFrm(&pFVSData->fvs48.frameValues[index]); } @@ -160,14 +162,14 @@ public: } }; -template <> class CAnmFmtTraits { +template <> +class CAnmFmtTraits { public: typedef ResAnmChrFrm96Data TFrmData; typedef f32 TFrame; public: - static CResAnmChrFrm GetKeyFrame(const ResAnmChrFVSData* pFVSData, - int index) { + static CResAnmChrFrm GetKeyFrame(const ResAnmChrFVSData *pFVSData, int index) { return CResAnmChrFrm(&pFVSData->fvs96.frameValues[index]); } @@ -176,26 +178,29 @@ public: } }; -template <> class CAnmFmtTraits { +template <> +class CAnmFmtTraits { public: - static f32 GetAt(const ResAnmChrCVData* pCVData, u16 idx) { - const ResAnmChrCV8Data& rCV8 = pCVData->cv8; + static f32 GetAt(const ResAnmChrCVData *pCVData, u16 idx) { + const ResAnmChrCV8Data &rCV8 = pCVData->cv8; return rCV8.values[idx] * rCV8.scale + rCV8.offset; } }; -template <> class CAnmFmtTraits { +template <> +class CAnmFmtTraits { public: - static f32 GetAt(const ResAnmChrCVData* pCVData, u16 idx) { - const ResAnmChrCV16Data& rCV16 = pCVData->cv16; + static f32 GetAt(const ResAnmChrCVData *pCVData, u16 idx) { + const ResAnmChrCV16Data &rCV16 = pCVData->cv16; return rCV16.values[idx] * rCV16.scale + rCV16.offset; } }; -template <> class CAnmFmtTraits { +template <> +class CAnmFmtTraits { public: - static f32 GetAt(const ResAnmChrCVData* pCVData, u16 idx) { - const ResAnmChrCV32Data& rCV32 = pCVData->cv32; + static f32 GetAt(const ResAnmChrCVData *pCVData, u16 idx) { + const ResAnmChrCV32Data &rCV32 = pCVData->cv32; return rCV32.values[idx]; } }; @@ -206,10 +211,9 @@ public: * ******************************************************************************/ template -f32 CalcAnimationFVS(const ResAnmChrFVSData* pFVSData, f32 frame) { +f32 CalcAnimationFVS(const ResAnmChrFVSData *pFVSData, f32 frame) { CResAnmChrFrm first = TTraits::GetKeyFrame(pFVSData, 0); - CResAnmChrFrm last = - TTraits::GetKeyFrame(pFVSData, pFVSData->numFrameValues - 1); + CResAnmChrFrm last = TTraits::GetKeyFrame(pFVSData, pFVSData->numFrameValues - 1); if (frame <= first.GetFrameF32()) { return first.GetValue(pFVSData); @@ -225,51 +229,41 @@ f32 CalcAnimationFVS(const ResAnmChrFVSData* pFVSData, f32 frame) { f32 f_estimatePos = frameOffset * numKeyFrame * pFVSData->invKeyFrameRange; u16 i_estimatePos = math::F32ToU16(f_estimatePos); - CResAnmChrFrm left = - TTraits::GetKeyFrame(pFVSData, i_estimatePos); + CResAnmChrFrm left = TTraits::GetKeyFrame(pFVSData, i_estimatePos); const TTraits::TFrame quantized = TTraits::QuantizeFrame(frame); if (quantized < left.GetFrame()) { - while (true) { + do { left--; - - if (!(quantized < left.GetFrame())) { - break; - } - } + } while (quantized < left.GetFrame()); } else { - while (true) { + do { left++; - - if (!(left.GetFrame() <= quantized)) { - break; - } - } + } while (left.GetFrame() <= quantized); left--; } if (frame == left.GetFrameF32()) { return left.GetValue(pFVSData); + } else { + CResAnmChrFrm right = left + 1; + + f32 v0 = left.GetValue(pFVSData); + f32 t0 = left.GetSlope(); + f32 v1 = right.GetValue(pFVSData); + f32 t1 = right.GetSlope(); + + f32 f0 = left.GetFrameF32(); + f32 f1 = right.GetFrameF32(); + + f32 frameDelta = frame - f0; + f32 keyFrameDelta = f1 - f0; + f32 keyFrameDeltaInv = math::FInv(keyFrameDelta); + + return HermiteInterpolation(v0, t0, v1, t1, frameDelta * keyFrameDeltaInv, frameDelta); } - - CResAnmChrFrm right = left + 1; - - f32 v0 = left.GetValue(pFVSData); - f32 t0 = left.GetSlope(); - f32 v1 = right.GetValue(pFVSData); - f32 t1 = right.GetSlope(); - - f32 f0 = left.GetFrameF32(); - f32 f1 = right.GetFrameF32(); - - f32 frameDelta = frame - f0; - f32 keyFrameDelta = f1 - f0; - f32 keyFrameDeltaInv = math::FInv(keyFrameDelta); - - return HermiteInterpolation(v0, t0, v1, t1, frameDelta * keyFrameDeltaInv, - frameDelta); } /****************************************************************************** @@ -278,7 +272,7 @@ f32 CalcAnimationFVS(const ResAnmChrFVSData* pFVSData, f32 frame) { * ******************************************************************************/ template -f32 CalcAnimationCV(const ResAnmChrCVData* pCVData, u16 numFrame, f32 frame) { +f32 CalcAnimationCV(const ResAnmChrCVData *pCVData, u16 numFrame, f32 frame) { u16 frame_i = math::F32ToU16(frame); if (frame <= 0.0f) { @@ -306,37 +300,30 @@ f32 CalcAnimationCV(const ResAnmChrCVData* pCVData, u16 numFrame, f32 frame) { * ******************************************************************************/ template -f32 CalcResultFVS(const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, f32 frame, - bool constant) { +f32 CalcResultFVS( + const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, f32 frame, bool constant +) { if (constant) { return pAnmData->constValue; } - const ResAnmChrAnmData* pFVSAnmData = - reinterpret_cast( - ut::AddOffsetToPtr(pNodeData, pAnmData->toResAnmChrAnmData)); + const ResAnmChrAnmData *pFVSAnmData = + reinterpret_cast(ut::AddOffsetToPtr(pNodeData, pAnmData->toResAnmChrAnmData)); return CalcAnimationFVS >(&pFVSAnmData->fvs, frame); } -inline f32 CalcResult32(const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, f32 frame, - bool constant) { - return CalcResultFVS(pNodeData, pAnmData, frame, - constant); +inline f32 +CalcResult32(const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, f32 frame, bool constant) { + return CalcResultFVS(pNodeData, pAnmData, frame, constant); } -inline f32 CalcResult48(const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, f32 frame, - bool constant) { - return CalcResultFVS(pNodeData, pAnmData, frame, - constant); +inline f32 +CalcResult48(const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, f32 frame, bool constant) { + return CalcResultFVS(pNodeData, pAnmData, frame, constant); } -inline f32 CalcResult96(const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, f32 frame, - bool constant) { - return CalcResultFVS(pNodeData, pAnmData, frame, - constant); +inline f32 +CalcResult96(const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, f32 frame, bool constant) { + return CalcResultFVS(pNodeData, pAnmData, frame, constant); } /****************************************************************************** @@ -345,38 +332,37 @@ inline f32 CalcResult96(const ResAnmChrNodeData* pNodeData, * ******************************************************************************/ template -f32 CalcResultCV(const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, u16 numFrame, - f32 frame, bool constant) { - +f32 CalcResultCV( + const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, u16 numFrame, f32 frame, + bool constant +) { if (constant) { return pAnmData->constValue; } - const ResAnmChrAnmData* pCVAnmData = - reinterpret_cast( - ut::AddOffsetToPtr(pNodeData, pAnmData->toResAnmChrAnmData)); + const ResAnmChrAnmData *pCVAnmData = + reinterpret_cast(ut::AddOffsetToPtr(pNodeData, pAnmData->toResAnmChrAnmData)); return CalcAnimationCV >(&pCVAnmData->cv, numFrame, frame); } -inline f32 CalcResultFrm8(const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, - u16 numFrame, f32 frame, bool constant) { - return CalcResultCV(pNodeData, pAnmData, numFrame, frame, - constant); +inline f32 CalcResultFrm8( + const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, u16 numFrame, f32 frame, + bool constant +) { + return CalcResultCV(pNodeData, pAnmData, numFrame, frame, constant); } -inline f32 CalcResultFrm16(const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, - u16 numFrame, f32 frame, bool constant) { - return CalcResultCV(pNodeData, pAnmData, numFrame, frame, - constant); +inline f32 CalcResultFrm16( + const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, u16 numFrame, f32 frame, + bool constant +) { + return CalcResultCV(pNodeData, pAnmData, numFrame, frame, constant); } -inline f32 CalcResultFrm32(const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, - u16 numFrame, f32 frame, bool constant) { - return CalcResultCV(pNodeData, pAnmData, numFrame, frame, - constant); +inline f32 CalcResultFrm32( + const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, u16 numFrame, f32 frame, + bool constant +) { + return CalcResultCV(pNodeData, pAnmData, numFrame, frame, constant); } /****************************************************************************** @@ -384,85 +370,75 @@ inline f32 CalcResultFrm32(const ResAnmChrNodeData* pNodeData, * Get animation component * ******************************************************************************/ -const ResAnmChrNodeData::AnmData* -GetAnmScale(math::VEC3* pResult, const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, f32 frame) { - +const ResAnmChrNodeData::AnmData *GetAnmScale( + math::VEC3 *pResult, const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, f32 frame +) { u32 flags = pNodeData->flags; f32 x, y, z; switch (flags & ResAnmChrNodeData::FLAG_SCALE_FMT_MASK) { - case 0: { - x = pAnmData++->constValue; + case 0: { + x = pAnmData++->constValue; - if (flags & ResAnmChrNodeData::FLAG_SCALE_UNIFORM) { - y = x; - z = x; - } else { - y = pAnmData++->constValue; - z = pAnmData++->constValue; + if (flags & ResAnmChrNodeData::FLAG_SCALE_UNIFORM) { + y = x; + z = x; + } else { + y = pAnmData++->constValue; + z = pAnmData++->constValue; + } + + break; } - break; - } + case ResAnmChrNodeData::FLAG_SCALE_FVS32_FMT: { + x = CalcResult32(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_SCALE_X_CONST); - case ResAnmChrNodeData::FLAG_SCALE_FVS32_FMT: { - x = CalcResult32(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_SCALE_X_CONST); + if (flags & ResAnmChrNodeData::FLAG_SCALE_UNIFORM) { + y = x; + z = x; + } else { + y = CalcResult32(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_SCALE_Y_CONST); + z = CalcResult32(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_SCALE_Z_CONST); + } - if (flags & ResAnmChrNodeData::FLAG_SCALE_UNIFORM) { - y = x; - z = x; - } else { - y = CalcResult32(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_SCALE_Y_CONST); - z = CalcResult32(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_SCALE_Z_CONST); + break; } - break; - } + case ResAnmChrNodeData::FLAG_SCALE_FVS48_FMT: { + x = CalcResult48(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_SCALE_X_CONST); - case ResAnmChrNodeData::FLAG_SCALE_FVS48_FMT: { - x = CalcResult48(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_SCALE_X_CONST); + if (flags & ResAnmChrNodeData::FLAG_SCALE_UNIFORM) { + y = x; + z = x; + } else { + y = CalcResult48(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_SCALE_Y_CONST); + z = CalcResult48(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_SCALE_Z_CONST); + } - if (flags & ResAnmChrNodeData::FLAG_SCALE_UNIFORM) { - y = x; - z = x; - } else { - y = CalcResult48(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_SCALE_Y_CONST); - z = CalcResult48(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_SCALE_Z_CONST); + break; } - break; - } + case ResAnmChrNodeData::FLAG_SCALE_FVS96_FMT: { + x = CalcResult96(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_SCALE_X_CONST); - case ResAnmChrNodeData::FLAG_SCALE_FVS96_FMT: { - x = CalcResult96(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_SCALE_X_CONST); + if (flags & ResAnmChrNodeData::FLAG_SCALE_UNIFORM) { + y = x; + z = x; + } else { + y = CalcResult96(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_SCALE_Y_CONST); + z = CalcResult96(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_SCALE_Z_CONST); + } - if (flags & ResAnmChrNodeData::FLAG_SCALE_UNIFORM) { - y = x; - z = x; - } else { - y = CalcResult96(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_SCALE_Y_CONST); - z = CalcResult96(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_SCALE_Z_CONST); + break; } - break; - } - - default: { - x = 0.0f; - y = 0.0f; - z = 0.0f; - break; - } + default: { + x = 0.0f; + y = 0.0f; + z = 0.0f; + break; + } } pResult->x = x; @@ -472,88 +448,86 @@ GetAnmScale(math::VEC3* pResult, const ResAnmChrNodeData* pNodeData, return pAnmData; } -const ResAnmChrNodeData::AnmData* -GetAnmRotation(math::MTX34* pResult, math::VEC3* pRawResult, - const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, f32 frame) { - +const ResAnmChrNodeData::AnmData *GetAnmRotation( + math::MTX34 *pResult, math::VEC3 *pRawResult, const ResAnmChrInfoData &rInfoData, + const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, f32 frame +) { u32 flags = pNodeData->flags; f32 x, y, z; switch (flags & ResAnmChrNodeData::FLAG_ROT_FMT_MASK) { - case 0: { - x = pAnmData++->constValue; - y = pAnmData++->constValue; - z = pAnmData++->constValue; - break; - } + case 0: { + x = pAnmData++->constValue; + y = pAnmData++->constValue; + z = pAnmData++->constValue; + break; + } - case ResAnmChrNodeData::FLAG_ROT_FVS32_FMT: { - x = CalcResult32(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_ROT_X_CONST); - y = CalcResult32(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST); - z = CalcResult32(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST); - break; - } + case ResAnmChrNodeData::FLAG_ROT_FVS32_FMT: { + x = CalcResult32(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_ROT_X_CONST); + y = CalcResult32(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST); + z = CalcResult32(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST); + break; + } - case ResAnmChrNodeData::FLAG_ROT_FVS48_FMT: { - x = CalcResult48(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_ROT_X_CONST); - y = CalcResult48(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST); - z = CalcResult48(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST); - break; - } + case ResAnmChrNodeData::FLAG_ROT_FVS48_FMT: { + x = CalcResult48(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_ROT_X_CONST); + y = CalcResult48(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST); + z = CalcResult48(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST); + break; + } - case ResAnmChrNodeData::FLAG_ROT_FVS96_FMT: { - x = CalcResult96(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_ROT_X_CONST); - y = CalcResult96(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST); - z = CalcResult96(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST); - break; - } + case ResAnmChrNodeData::FLAG_ROT_FVS96_FMT: { + x = CalcResult96(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_ROT_X_CONST); + y = CalcResult96(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST); + z = CalcResult96(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST); + break; + } - case ResAnmChrNodeData::FLAG_ROT_CV8_FMT: { - x = CalcResultFrm8(pNodeData, pAnmData++, rInfoData.numFrame, frame, - flags & ResAnmChrNodeData::FLAG_ROT_X_CONST); - y = CalcResultFrm8(pNodeData, pAnmData++, rInfoData.numFrame, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST); - z = CalcResultFrm8(pNodeData, pAnmData++, rInfoData.numFrame, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST); - break; - } + case ResAnmChrNodeData::FLAG_ROT_CV8_FMT: { + x = CalcResultFrm8( + pNodeData, pAnmData++, rInfoData.numFrame, frame, flags & ResAnmChrNodeData::FLAG_ROT_X_CONST + ); + y = CalcResultFrm8( + pNodeData, pAnmData++, rInfoData.numFrame, frame, flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST + ); + z = CalcResultFrm8( + pNodeData, pAnmData++, rInfoData.numFrame, frame, flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST + ); + break; + } - case ResAnmChrNodeData::FLAG_ROT_CV16_FMT: { - x = CalcResultFrm16(pNodeData, pAnmData++, rInfoData.numFrame, frame, - flags & ResAnmChrNodeData::FLAG_ROT_X_CONST); - y = CalcResultFrm16(pNodeData, pAnmData++, rInfoData.numFrame, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST); - z = CalcResultFrm16(pNodeData, pAnmData++, rInfoData.numFrame, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST); - break; - } + case ResAnmChrNodeData::FLAG_ROT_CV16_FMT: { + x = CalcResultFrm16( + pNodeData, pAnmData++, rInfoData.numFrame, frame, flags & ResAnmChrNodeData::FLAG_ROT_X_CONST + ); + y = CalcResultFrm16( + pNodeData, pAnmData++, rInfoData.numFrame, frame, flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST + ); + z = CalcResultFrm16( + pNodeData, pAnmData++, rInfoData.numFrame, frame, flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST + ); + break; + } - case ResAnmChrNodeData::FLAG_ROT_CV32_FMT: { - x = CalcResultFrm32(pNodeData, pAnmData++, rInfoData.numFrame, frame, - flags & ResAnmChrNodeData::FLAG_ROT_X_CONST); - y = CalcResultFrm32(pNodeData, pAnmData++, rInfoData.numFrame, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST); - z = CalcResultFrm32(pNodeData, pAnmData++, rInfoData.numFrame, frame, - flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST); - break; - } + case ResAnmChrNodeData::FLAG_ROT_CV32_FMT: { + x = CalcResultFrm32( + pNodeData, pAnmData++, rInfoData.numFrame, frame, flags & ResAnmChrNodeData::FLAG_ROT_X_CONST + ); + y = CalcResultFrm32( + pNodeData, pAnmData++, rInfoData.numFrame, frame, flags & ResAnmChrNodeData::FLAG_ROT_Y_CONST + ); + z = CalcResultFrm32( + pNodeData, pAnmData++, rInfoData.numFrame, frame, flags & ResAnmChrNodeData::FLAG_ROT_Z_CONST + ); + break; + } - default: { - x = 0.0f; - y = 0.0f; - z = 0.0f; - } + default: { + x = 0.0f; + y = 0.0f; + z = 0.0f; + } } math::MTX34RotXYZDeg(pResult, x, y, z); @@ -565,56 +539,46 @@ GetAnmRotation(math::MTX34* pResult, math::VEC3* pRawResult, return pAnmData; } -const ResAnmChrNodeData::AnmData* -GetAnmTranslation(math::VEC3* pTrans, const ResAnmChrNodeData* pNodeData, - const ResAnmChrNodeData::AnmData* pAnmData, f32 frame) { - +const ResAnmChrNodeData::AnmData *GetAnmTranslation( + math::VEC3 *pTrans, const ResAnmChrNodeData *pNodeData, const ResAnmChrNodeData::AnmData *pAnmData, f32 frame +) { u32 flags = pNodeData->flags; f32 x, y, z; switch (flags & ResAnmChrNodeData::FLAG_TRANS_FMT_MASK) { - case 0: { - x = pAnmData++->constValue; - y = pAnmData++->constValue; - z = pAnmData++->constValue; - break; - } + case 0: { + x = pAnmData++->constValue; + y = pAnmData++->constValue; + z = pAnmData++->constValue; + break; + } - case ResAnmChrNodeData::FLAG_TRANS_FVS32_FMT: { - x = CalcResult32(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_TRANS_X_CONST); - y = CalcResult32(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_TRANS_Y_CONST); - z = CalcResult32(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_TRANS_Z_CONST); - break; - } + case ResAnmChrNodeData::FLAG_TRANS_FVS32_FMT: { + x = CalcResult32(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_TRANS_X_CONST); + y = CalcResult32(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_TRANS_Y_CONST); + z = CalcResult32(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_TRANS_Z_CONST); + break; + } - case ResAnmChrNodeData::FLAG_TRANS_FVS48_FMT: { - x = CalcResult48(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_TRANS_X_CONST); - y = CalcResult48(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_TRANS_Y_CONST); - z = CalcResult48(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_TRANS_Z_CONST); - break; - } + case ResAnmChrNodeData::FLAG_TRANS_FVS48_FMT: { + x = CalcResult48(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_TRANS_X_CONST); + y = CalcResult48(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_TRANS_Y_CONST); + z = CalcResult48(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_TRANS_Z_CONST); + break; + } - case ResAnmChrNodeData::FLAG_TRANS_FVS96_FMT: { - x = CalcResult96(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_TRANS_X_CONST); - y = CalcResult96(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_TRANS_Y_CONST); - z = CalcResult96(pNodeData, pAnmData++, frame, - flags & ResAnmChrNodeData::FLAG_TRANS_Z_CONST); - break; - } + case ResAnmChrNodeData::FLAG_TRANS_FVS96_FMT: { + x = CalcResult96(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_TRANS_X_CONST); + y = CalcResult96(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_TRANS_Y_CONST); + z = CalcResult96(pNodeData, pAnmData++, frame, flags & ResAnmChrNodeData::FLAG_TRANS_Z_CONST); + break; + } - default: { - x = 0.0f; - y = 0.0f; - z = 0.0f; - } + default: { + x = 0.0f; + y = 0.0f; + z = 0.0f; + } } pTrans->x = x; @@ -629,26 +593,34 @@ GetAnmTranslation(math::VEC3* pTrans, const ResAnmChrNodeData* pNodeData, * Get animation result * ******************************************************************************/ -void GetAnmResult_(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame); -void GetAnmResult_S(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame); -void GetAnmResult_R(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame); -void GetAnmResult_SR(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame); -void GetAnmResult_T(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame); -void GetAnmResult_ST(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame); -void GetAnmResult_RT(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame); -void GetAnmResult_SRT(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame); +void GetAnmResult_( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +); +void GetAnmResult_S( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +); +void GetAnmResult_R( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +); +void GetAnmResult_SR( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +); +void GetAnmResult_T( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +); +void GetAnmResult_ST( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +); +void GetAnmResult_RT( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +); +void GetAnmResult_SRT( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +); -typedef void (*GetAnmResultFunc)(ChrAnmResult* pResult, - const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame); +typedef void (*GetAnmResultFunc)( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +); const GetAnmResultFunc gGetAnmResultTable[] = { GetAnmResult_, // 0 0 0 @@ -661,8 +633,9 @@ const GetAnmResultFunc gGetAnmResultTable[] = { GetAnmResult_SRT // 1 1 1 }; -void GetAnmResult_(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame) { +void GetAnmResult_( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +) { #pragma unused(rInfoData) #pragma unused(pNodeData) #pragma unused(frame) @@ -673,11 +646,12 @@ void GetAnmResult_(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, math::MTX34Identity(&pResult->rt); } -void GetAnmResult_T(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame) { +void GetAnmResult_T( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +) { #pragma unused(rInfoData) - const ResAnmChrNodeData::AnmData* pAnmData = pNodeData->anms; + const ResAnmChrNodeData::AnmData *pAnmData = pNodeData->anms; math::VEC3 t; pResult->s.x = 1.0f; @@ -691,17 +665,16 @@ void GetAnmResult_T(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, pResult->rt._23 = t.z; } -void GetAnmResult_R(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame) { - - const ResAnmChrNodeData::AnmData* pAnmData = pNodeData->anms; +void GetAnmResult_R( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +) { + const ResAnmChrNodeData::AnmData *pAnmData = pNodeData->anms; pResult->s.x = 1.0f; pResult->s.y = 1.0f; pResult->s.z = 1.0f; - GetAnmRotation(&pResult->rt, &pResult->rawR, rInfoData, pNodeData, pAnmData, - frame); + GetAnmRotation(&pResult->rt, &pResult->rawR, rInfoData, pNodeData, pAnmData, frame); pResult->flags |= ChrAnmResult::FLAG_ROT_RAW_FMT; @@ -710,28 +683,28 @@ void GetAnmResult_R(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, pResult->rt._23 = 0.0f; } -void GetAnmResult_S(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame) { +void GetAnmResult_S( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +) { #pragma unused(rInfoData) - const ResAnmChrNodeData::AnmData* pAnmData = pNodeData->anms; + const ResAnmChrNodeData::AnmData *pAnmData = pNodeData->anms; GetAnmScale(&pResult->s, pNodeData, pAnmData, frame); math::MTX34Identity(&pResult->rt); } -void GetAnmResult_RT(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame) { - - const ResAnmChrNodeData::AnmData* pAnmData = pNodeData->anms; +void GetAnmResult_RT( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +) { + const ResAnmChrNodeData::AnmData *pAnmData = pNodeData->anms; math::VEC3 t; pResult->s.x = 1.0f; pResult->s.y = 1.0f; pResult->s.z = 1.0f; - pAnmData = GetAnmRotation(&pResult->rt, &pResult->rawR, rInfoData, - pNodeData, pAnmData, frame); + pAnmData = GetAnmRotation(&pResult->rt, &pResult->rawR, rInfoData, pNodeData, pAnmData, frame); pResult->flags |= ChrAnmResult::FLAG_ROT_RAW_FMT; @@ -741,15 +714,14 @@ void GetAnmResult_RT(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, pResult->rt._23 = t.z; } -void GetAnmResult_SR(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame) { - - const ResAnmChrNodeData::AnmData* pAnmData = pNodeData->anms; +void GetAnmResult_SR( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +) { + const ResAnmChrNodeData::AnmData *pAnmData = pNodeData->anms; pAnmData = GetAnmScale(&pResult->s, pNodeData, pAnmData, frame); - GetAnmRotation(&pResult->rt, &pResult->rawR, rInfoData, pNodeData, pAnmData, - frame); + GetAnmRotation(&pResult->rt, &pResult->rawR, rInfoData, pNodeData, pAnmData, frame); pResult->flags |= ChrAnmResult::FLAG_ROT_RAW_FMT; @@ -758,11 +730,12 @@ void GetAnmResult_SR(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, pResult->rt._23 = 0.0f; } -void GetAnmResult_ST(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame) { +void GetAnmResult_ST( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +) { #pragma unused(rInfoData) - const ResAnmChrNodeData::AnmData* pAnmData = pNodeData->anms; + const ResAnmChrNodeData::AnmData *pAnmData = pNodeData->anms; math::VEC3 t; pAnmData = GetAnmScale(&pResult->s, pNodeData, pAnmData, frame); @@ -774,15 +747,14 @@ void GetAnmResult_ST(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, pResult->rt._23 = t.z; } -void GetAnmResult_SRT(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, - const ResAnmChrNodeData* pNodeData, f32 frame) { - - const ResAnmChrNodeData::AnmData* pAnmData = pNodeData->anms; +void GetAnmResult_SRT( + ChrAnmResult *pResult, const ResAnmChrInfoData &rInfoData, const ResAnmChrNodeData *pNodeData, f32 frame +) { + const ResAnmChrNodeData::AnmData *pAnmData = pNodeData->anms; math::VEC3 t; pAnmData = GetAnmScale(&pResult->s, pNodeData, pAnmData, frame); - pAnmData = GetAnmRotation(&pResult->rt, &pResult->rawR, rInfoData, - pNodeData, pAnmData, frame); + pAnmData = GetAnmRotation(&pResult->rt, &pResult->rawR, rInfoData, pNodeData, pAnmData, frame); pAnmData = GetAnmTranslation(&t, pNodeData, pAnmData, frame); pResult->flags |= ChrAnmResult::FLAG_ROT_RAW_FMT; @@ -799,20 +771,17 @@ void GetAnmResult_SRT(ChrAnmResult* pResult, const ResAnmChrInfoData& rInfoData, * ResAnmChr * ******************************************************************************/ -void ResAnmChr::GetAnmResult(ChrAnmResult* pResult, u32 idx, f32 frame) const { - const ResAnmChrNodeData* pNodeData = GetNodeAnm(idx); +void ResAnmChr::GetAnmResult(ChrAnmResult *pResult, u32 idx, f32 frame) const { + const ResAnmChrNodeData *pNodeData = GetNodeAnm(idx); u32 flags = pNodeData->flags; pResult->flags = - flags & - (ChrAnmResult::FLAG_ANM_EXISTS | ChrAnmResult::FLAG_MTX_IDENT | - ChrAnmResult::FLAG_ROT_TRANS_ZERO | ChrAnmResult::FLAG_SCALE_ONE | - ChrAnmResult::FLAG_SCALE_UNIFORM | ChrAnmResult::FLAG_ROT_ZERO | - ChrAnmResult::FLAG_TRANS_ZERO | ChrAnmResult::FLAG_PATCH_SCALE | - ChrAnmResult::FLAG_PATCH_ROT | ChrAnmResult::FLAG_PATCH_TRANS | - ChrAnmResult::FLAG_SSC_APPLY | ChrAnmResult::FLAG_SSC_PARENT | - ChrAnmResult::FLAG_XSI_SCALING); + flags & (ChrAnmResult::FLAG_ANM_EXISTS | ChrAnmResult::FLAG_MTX_IDENT | ChrAnmResult::FLAG_ROT_TRANS_ZERO | + ChrAnmResult::FLAG_SCALE_ONE | ChrAnmResult::FLAG_SCALE_UNIFORM | ChrAnmResult::FLAG_ROT_ZERO | + ChrAnmResult::FLAG_TRANS_ZERO | ChrAnmResult::FLAG_PATCH_SCALE | ChrAnmResult::FLAG_PATCH_ROT | + ChrAnmResult::FLAG_PATCH_TRANS | ChrAnmResult::FLAG_SSC_APPLY | ChrAnmResult::FLAG_SSC_PARENT | + ChrAnmResult::FLAG_XSI_SCALING); u32 index = (flags & ResAnmChrNodeData::FLAG_HAS_SRT_MASK) >> 22; gGetAnmResultTable[index](pResult, ref().info, pNodeData, frame); @@ -823,7 +792,7 @@ void ResAnmChr::GetAnmResult(ChrAnmResult* pResult, u32 idx, f32 frame) const { * ChrAnmResult * ******************************************************************************/ -void ChrAnmResult::GetScale(math::VEC3* pScale) const { +void ChrAnmResult::GetScale(math::VEC3 *pScale) const { if (flags & FLAG_SCALE_ONE) { pScale->x = 1.0f; pScale->y = 1.0f; @@ -835,7 +804,7 @@ void ChrAnmResult::GetScale(math::VEC3* pScale) const { } } -bool ChrAnmResult::GetRotateDeg(math::VEC3* pRotate) const { +bool ChrAnmResult::GetRotateDeg(math::VEC3 *pRotate) const { if (flags & FLAG_ROT_ZERO) { pRotate->x = 0.0f; pRotate->y = 0.0f; @@ -866,7 +835,7 @@ bool ChrAnmResult::GetRotateDeg(math::VEC3* pRotate) const { return false; } -void ChrAnmResult::GetTranslate(math::VEC3* pTrans) const { +void ChrAnmResult::GetTranslate(math::VEC3 *pTrans) const { if (flags & FLAG_TRANS_ZERO) { pTrans->x = 0.0f; pTrans->y = 0.0f; @@ -878,7 +847,7 @@ void ChrAnmResult::GetTranslate(math::VEC3* pTrans) const { } } -void ChrAnmResult::GetRotTrans(math::MTX34* pRotTrans) const { +void ChrAnmResult::GetRotTrans(math::MTX34 *pRotTrans) const { if (flags & FLAG_ROT_ZERO) { if (flags & FLAG_TRANS_ZERO) { math::MTX34Identity(pRotTrans); @@ -898,7 +867,14 @@ void ChrAnmResult::GetRotTrans(math::MTX34* pRotTrans) const { } } -void ChrAnmResult::SetScale(const math::VEC3* pScale) { +void ChrAnmResult::GetMtx(math::MTX34 *pMtx) const { + GetRotTrans(pMtx); + if (!(flags & FLAG_SCALE_ONE)) { + math::MTX34Scale(pMtx, pMtx, &s); + } +} + +void ChrAnmResult::SetScale(const math::VEC3 *pScale) { if (pScale->x == 1.0f && pScale->y == 1.0f && pScale->z == 1.0f) { flags |= FLAG_SCALE_ONE | FLAG_SCALE_UNIFORM; @@ -916,15 +892,68 @@ void ChrAnmResult::SetScale(const math::VEC3* pScale) { s = *pScale; } -void ChrAnmResult::SetRotTrans(const math::MTX34* pRotTrans) { - bool rotZero = pRotTrans->_00 == 1.0f && pRotTrans->_01 == 0.0f && - pRotTrans->_02 == 0.0f && pRotTrans->_10 == 0.0f && - pRotTrans->_11 == 1.0f && pRotTrans->_12 == 0.0f && - pRotTrans->_20 == 0.0f && pRotTrans->_21 == 0.0f && - pRotTrans->_22 == 1.0f; +void ChrAnmResult::SetRotateDeg(const math::VEC3 *pRotDeg) { + if (pRotDeg->x == 0.f && pRotDeg->y == 0.f && pRotDeg->z == 0.f) { + u32 flag = FLAG_ROT_ZERO; + if (flags & FLAG_TRANS_ZERO) { + flag |= FLAG_ROT_TRANS_ZERO; - bool transZero = pRotTrans->_03 == 0.0f && pRotTrans->_13 == 0.0f && - pRotTrans->_23 == 0.0f; + if (flags & FLAG_SCALE_ONE) { + flag |= FLAG_MTX_IDENT; + } + } + flags |= flag; + + // clang-format off + rt[0][0] = 1.f; rt[0][1] = 0.f; rt[0][2] = 0.f; + rt[1][0] = 0.f; rt[1][1] = 1.f; rt[1][2] = 0.f; + rt[2][0] = 0.f; rt[2][1] = 0.f; rt[2][2] = 1.f; + // clang-format on + + } else { + // Save Translate + math::VEC3 trans(rt._03, rt._13, rt._23); + + // Rotate + math::MTX34RotXYZDeg(&rt, pRotDeg->x, pRotDeg->y, pRotDeg->z); + + // Restore Translate + rt._03 = trans.x; + rt._13 = trans.y; + rt._23 = trans.z; + + rawR = *pRotDeg; + + flags &= ~(FLAG_ROT_ZERO | FLAG_MTX_IDENT | FLAG_ROT_TRANS_ZERO); + } + flags |= FLAG_ROT_RAW_FMT; +} + +void ChrAnmResult::SetTranslate(const math::VEC3 *pTranslate) { + if (pTranslate->x == 0.f && pTranslate->y == 0.f && pTranslate->z == 0.f) { + u32 flag = FLAG_TRANS_ZERO; + if (flags & FLAG_ROT_ZERO) { + flag |= FLAG_ROT_TRANS_ZERO; + if (flags & FLAG_SCALE_ONE) { + flag |= FLAG_MTX_IDENT; + } + } + flags |= flag; + } else { + flags &= ~(FLAG_TRANS_ZERO | FLAG_MTX_IDENT | FLAG_ROT_TRANS_ZERO); + } + + rt._03 = pTranslate->x; + rt._13 = pTranslate->y; + rt._23 = pTranslate->z; +}; + +void ChrAnmResult::SetRotTrans(const math::MTX34 *pRotTrans) { + bool rotZero = pRotTrans->_00 == 1.0f && pRotTrans->_01 == 0.0f && pRotTrans->_02 == 0.0f && + pRotTrans->_10 == 0.0f && pRotTrans->_11 == 1.0f && pRotTrans->_12 == 0.0f && + pRotTrans->_20 == 0.0f && pRotTrans->_21 == 0.0f && pRotTrans->_22 == 1.0f; + + bool transZero = pRotTrans->_03 == 0.0f && pRotTrans->_13 == 0.0f && pRotTrans->_23 == 0.0f; if (rotZero) { if (transZero) { @@ -941,13 +970,28 @@ void ChrAnmResult::SetRotTrans(const math::MTX34* pRotTrans) { flags |= FLAG_TRANS_ZERO; flags &= ~(FLAG_MTX_IDENT | FLAG_ROT_TRANS_ZERO | FLAG_ROT_ZERO); } else { - flags &= ~(FLAG_MTX_IDENT | FLAG_ROT_TRANS_ZERO | FLAG_ROT_ZERO | - FLAG_TRANS_ZERO); + flags &= ~(FLAG_MTX_IDENT | FLAG_ROT_TRANS_ZERO | FLAG_ROT_ZERO | FLAG_TRANS_ZERO); } math::MTX34Copy(&rt, pRotTrans); flags &= ~FLAG_ROT_RAW_FMT; } +void ChrAnmResult::SetMtx(const math::MTX34 *pMtx) { + math::VEC3 scale(GetMtx34Scale(*pMtx, 0), GetMtx34Scale(*pMtx, 1), GetMtx34Scale(*pMtx, 2)); + + SetScale(&scale); + + if (flags & FLAG_SCALE_ONE) { + math::MTX34Copy(&rt, pMtx); + } else { + math::VEC3 scaleby(math::FInv(scale.x), math::FInv(scale.y), math::FInv(scale.z)); + + math::MTX34Scale(&rt, pMtx, &scaleby); + } + + flags &= ~(FLAG_ROT_RAW_FMT); +} + } // namespace g3d } // namespace nw4r diff --git a/src/nw4r/g3d/res/g3d_resanmclr.cpp b/src/nw4r/g3d/res/g3d_resanmclr.cpp index 174199da..43e57f49 100644 --- a/src/nw4r/g3d/res/g3d_resanmclr.cpp +++ b/src/nw4r/g3d/res/g3d_resanmclr.cpp @@ -1,12 +1,12 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void ResAnmClr::GetAnmResult(ClrAnmResult* pResult, u32 idx, f32 frame) const { - const ResAnmClrMatData* pMatData = GetMatAnm(idx); - const ResAnmClrAnmData* pAnmData = pMatData->anms; - const ResAnmClrInfoData& rInfoData = ref().info; +void ResAnmClr::GetAnmResult(ClrAnmResult *pResult, u32 idx, f32 frame) const { + const ResAnmClrMatData *pMatData = GetMatAnm(idx); + const ResAnmClrAnmData *pAnmData = pMatData->anms; + const ResAnmClrInfoData &rInfoData = ref().info; u32 flags = pMatData->flags; pResult->bRgbaExist = 0; @@ -17,9 +17,7 @@ void ResAnmClr::GetAnmResult(ClrAnmResult* pResult, u32 idx, f32 frame) const { f32 clippedFrame = detail::ClipFrame(rInfoData, frame); - for (int i = 0; i < ClrAnmResult::CLA_MAX; - flags >>= ResAnmClrMatData::NUM_OF_FLAGS, i++) { - + for (int i = 0; i < ClrAnmResult::CLA_MAX; flags >>= ResAnmClrMatData::NUM_OF_FLAGS, i++) { if (!(flags & ResAnmClrMatData::FLAG_ANM_EXISTS)) { continue; } @@ -28,8 +26,7 @@ void ResAnmClr::GetAnmResult(ClrAnmResult* pResult, u32 idx, f32 frame) const { pResult->bRgbaExist |= 1 << i; pResult->rgbaMask[i] = pAnmData->mask; - pResult->rgba[i] = detail::GetResColorAnmResult(&pAnmData->color, - clippedFrame, constant); + pResult->rgba[i] = detail::GetResColorAnmResult(&pAnmData->color, clippedFrame, constant); pAnmData++; } diff --git a/src/nw4r/g3d/res/g3d_resanmfog.cpp b/src/nw4r/g3d/res/g3d_resanmfog.cpp index 72ee5568..1bdde3c6 100644 --- a/src/nw4r/g3d/res/g3d_resanmfog.cpp +++ b/src/nw4r/g3d/res/g3d_resanmfog.cpp @@ -1,14 +1,13 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void ResAnmFog::GetAnmResult(FogAnmResult* pResult, f32 frame) const { - const ResAnmFogData& r = ref(); +void ResAnmFog::GetAnmResult(FogAnmResult *pResult, f32 frame) const { + const ResAnmFogData &r = ref(); u32 flags = r.flags; - const ResAnmScnInfoData& rInfoData = - ofs_to_ptr(r.toResAnmScnData)->info; + const ResAnmScnInfoData &rInfoData = ofs_to_ptr(r.toResAnmScnData)->info; f32 clippedFrame = detail::ClipFrame(rInfoData, frame); @@ -19,8 +18,7 @@ void ResAnmFog::GetAnmResult(FogAnmResult* pResult, f32 frame) const { pResult->type = r.type; pResult->startz = detail::GetResAnmResult(&r.startz, frame, startZConstant); pResult->endz = detail::GetResAnmResult(&r.endz, frame, endZConstant); - pResult->color = - detail::GetResColorAnmResult(&r.color, clippedFrame, colorConstant); + pResult->color = detail::GetResColorAnmResult(&r.color, clippedFrame, colorConstant); } } // namespace g3d diff --git a/src/nw4r/g3d/res/g3d_resanmlight.cpp b/src/nw4r/g3d/res/g3d_resanmlight.cpp index e8bd6828..c32e96ff 100644 --- a/src/nw4r/g3d/res/g3d_resanmlight.cpp +++ b/src/nw4r/g3d/res/g3d_resanmlight.cpp @@ -1,21 +1,18 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void ResAnmLight::GetAnmResult(LightAnmResult* pResult, f32 frame) const { - const ResAnmLightData& r = ref(); +void ResAnmLight::GetAnmResult(LightAnmResult *pResult, f32 frame) const { + const ResAnmLightData &r = ref(); u32 flags = r.flags; - const ResAnmScnInfoData& rInfoData = - ofs_to_ptr(r.toResAnmScnData)->info; + const ResAnmScnInfoData &rInfoData = ofs_to_ptr(r.toResAnmScnData)->info; f32 clippedFrame = detail::ClipFrame(rInfoData, frame); - pResult->flags = flags & (LightAnmResult::FLAG_LIGHT_TYPE_MASK | - LightAnmResult::FLAG_LIGHT_ENABLE | - LightAnmResult::FLAG_SPECULAR_ENABLE | - LightAnmResult::FLAG_COLOR_ENABLE | + pResult->flags = flags & (LightAnmResult::FLAG_LIGHT_TYPE_MASK | LightAnmResult::FLAG_LIGHT_ENABLE | + LightAnmResult::FLAG_SPECULAR_ENABLE | LightAnmResult::FLAG_COLOR_ENABLE | LightAnmResult::FLAG_ALPHA_ENABLE); bool enableConstant = (flags & ResAnmLightData::FLAG_ENABLE_CONST) != 0; @@ -29,8 +26,7 @@ void ResAnmLight::GetAnmResult(LightAnmResult* pResult, f32 frame) const { } if (pResult->flags & ResAnmLightData::FLAG_LIGHT_ENABLE) { - LightType type = static_cast( - flags & ResAnmLightData::FLAG_LIGHT_TYPE_MASK); + LightType type = static_cast(flags & ResAnmLightData::FLAG_LIGHT_TYPE_MASK); bool hasSpecular = (flags & ResAnmLightData::FLAG_SPECULAR_ENABLE) != 0; bool hasAim = type != LIGHTTYPE_POINT || hasSpecular; @@ -43,80 +39,59 @@ void ResAnmLight::GetAnmResult(LightAnmResult* pResult, f32 frame) const { pResult->pos.x = detail::GetResAnmResult(&r.posX, frame, constantPosX); pResult->pos.y = detail::GetResAnmResult(&r.posY, frame, constantPosY); pResult->pos.z = detail::GetResAnmResult(&r.posZ, frame, constantPosZ); - pResult->color = - detail::GetResColorAnmResult(&r.color, clippedFrame, constantColor); + pResult->color = detail::GetResColorAnmResult(&r.color, clippedFrame, constantColor); if (hasAim) { - bool constantAimX = - (flags & ResAnmLightData::FLAG_AIM_X_CONST) != 0; - bool constantAimY = - (flags & ResAnmLightData::FLAG_AIM_Y_CONST) != 0; - bool constantAimZ = - (flags & ResAnmLightData::FLAG_AIM_Z_CONST) != 0; + bool constantAimX = (flags & ResAnmLightData::FLAG_AIM_X_CONST) != 0; + bool constantAimY = (flags & ResAnmLightData::FLAG_AIM_Y_CONST) != 0; + bool constantAimZ = (flags & ResAnmLightData::FLAG_AIM_Z_CONST) != 0; - pResult->aim.x = - detail::GetResAnmResult(&r.aimX, frame, constantAimX); - pResult->aim.y = - detail::GetResAnmResult(&r.aimY, frame, constantAimY); - pResult->aim.z = - detail::GetResAnmResult(&r.aimZ, frame, constantAimZ); + pResult->aim.x = detail::GetResAnmResult(&r.aimX, frame, constantAimX); + pResult->aim.y = detail::GetResAnmResult(&r.aimY, frame, constantAimY); + pResult->aim.z = detail::GetResAnmResult(&r.aimZ, frame, constantAimZ); } switch (type) { - case LIGHTTYPE_POINT: { - bool refDistanceConstant = - (flags & ResAnmLightData::FLAG_REF_DISTANCE_CONST) != 0; - bool refBrightnessConstant = - (flags & ResAnmLightData::FLAG_REF_BRIGHTNESS_CONST) != 0; + case LIGHTTYPE_POINT: { + bool refDistanceConstant = (flags & ResAnmLightData::FLAG_REF_DISTANCE_CONST) != 0; + bool refBrightnessConstant = (flags & ResAnmLightData::FLAG_REF_BRIGHTNESS_CONST) != 0; - pResult->distFunc = r.distFunc; + pResult->distFunc = r.distFunc; - pResult->refDistance = detail::GetResAnmResult( - &r.refDistance, frame, refDistanceConstant); + pResult->refDistance = detail::GetResAnmResult(&r.refDistance, frame, refDistanceConstant); - pResult->refBrightness = detail::GetResAnmResult( - &r.refBrightness, frame, refBrightnessConstant); - break; - } + pResult->refBrightness = detail::GetResAnmResult(&r.refBrightness, frame, refBrightnessConstant); + break; + } - case LIGHTTYPE_DIRECTIONAL: { - break; - } + case LIGHTTYPE_DIRECTIONAL: { + break; + } - case LIGHTTYPE_SPOT: { - bool cutoffConstant = - (flags & ResAnmLightData::FLAG_CUTOFF_CONST) != 0; - bool refDistanceConstant = - (flags & ResAnmLightData::FLAG_REF_DISTANCE_CONST) != 0; - bool refBrightnessConstant = - (flags & ResAnmLightData::FLAG_REF_BRIGHTNESS_CONST) != 0; + case LIGHTTYPE_SPOT: { + bool cutoffConstant = (flags & ResAnmLightData::FLAG_CUTOFF_CONST) != 0; + bool refDistanceConstant = (flags & ResAnmLightData::FLAG_REF_DISTANCE_CONST) != 0; + bool refBrightnessConstant = (flags & ResAnmLightData::FLAG_REF_BRIGHTNESS_CONST) != 0; - pResult->distFunc = r.distFunc; - pResult->spotFunc = r.spotFunc; + pResult->distFunc = r.distFunc; + pResult->spotFunc = r.spotFunc; - pResult->cutoff = - detail::GetResAnmResult(&r.cutoff, frame, cutoffConstant); + pResult->cutoff = detail::GetResAnmResult(&r.cutoff, frame, cutoffConstant); - pResult->refDistance = detail::GetResAnmResult( - &r.refDistance, frame, refDistanceConstant); + pResult->refDistance = detail::GetResAnmResult(&r.refDistance, frame, refDistanceConstant); - pResult->refBrightness = detail::GetResAnmResult( - &r.refBrightness, frame, refBrightnessConstant); - break; - } + pResult->refBrightness = detail::GetResAnmResult(&r.refBrightness, frame, refBrightnessConstant); + break; + } } if (hasSpecular) { - bool specColorConstant = - (flags & ResAnmLightData::FLAG_SPEC_COLOR_CONST) != 0; - bool shininessConstant = - (flags & ResAnmLightData::FLAG_SHININESS_CONST) != 0; + bool specColorConstant = (flags & ResAnmLightData::FLAG_SPEC_COLOR_CONST) != 0; + bool shininessConstant = (flags & ResAnmLightData::FLAG_SHININESS_CONST) != 0; - pResult->specColor = detail::GetResColorAnmResult( - &r.specColor, clippedFrame, specColorConstant); + pResult->specColor = detail::GetResColorAnmResult(&r.specColor, clippedFrame, specColorConstant); - pResult->shininess = - detail::GetResAnmResult(&r.shininess, frame, shininessConstant); + pResult->shininess = detail::GetResAnmResult(&r.shininess, frame, shininessConstant); pResult->specIdx = r.specLightObjIdx; } diff --git a/src/nw4r/g3d/res/g3d_resanmscn.cpp b/src/nw4r/g3d/res/g3d_resanmscn.cpp index aaa69c56..0bde60f8 100644 --- a/src/nw4r/g3d/res/g3d_resanmscn.cpp +++ b/src/nw4r/g3d/res/g3d_resanmscn.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -7,23 +7,21 @@ namespace { NW4R_G3D_RESFILE_NAME_DEF(LightSet, "LightSet(NW4R)"); NW4R_G3D_RESFILE_NAME_DEF(AmbLights, "AmbLights(NW4R)"); NW4R_G3D_RESFILE_NAME_DEF(Lights, "Lights(NW4R)"); +NW4R_G3D_RESFILE_NAME_DEF(Fogs, "Fogs(NW4R)"); +NW4R_G3D_RESFILE_NAME_DEF(Cameras, "Cameras(NW4R)"); } // namespace bool ResAnmScn::HasResAnmAmbLight() const { - return ResDic(ofs_to_obj( - ref().toScnTopLevelDic))[ResName(&ResNameData_AmbLights)] != - NULL; + return ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_AmbLights)] != NULL; } bool ResAnmScn::HasResAnmLight() const { - return ResDic(ofs_to_obj( - ref().toScnTopLevelDic))[ResName(&ResNameData_Lights)] != NULL; + return ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_Lights)] != NULL; } ResLightSet ResAnmScn::GetResLightSet(int idx) const { - void* pResLightSetDicData = ResDic(ofs_to_obj( - ref().toScnTopLevelDic))[ResName(&ResNameData_LightSet)]; + void *pResLightSetDicData = ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_LightSet)]; if (pResLightSetDicData != NULL) { return ResLightSet(ResDic(pResLightSetDicData)[idx]); @@ -37,8 +35,7 @@ ResLightSet ResAnmScn::GetResLightSet(u32 idx) const { } u32 ResAnmScn::GetResLightSetNumEntries() const { - void* pResLightSetDicData = ResDic(ofs_to_obj( - ref().toScnTopLevelDic))[ResName(&ResNameData_LightSet)]; + void *pResLightSetDicData = ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_LightSet)]; if (pResLightSetDicData != NULL) { return ResDic(pResLightSetDicData).GetNumData(); @@ -48,8 +45,7 @@ u32 ResAnmScn::GetResLightSetNumEntries() const { } ResAnmAmbLight ResAnmScn::GetResAnmAmbLight(const ResName name) const { - void* pResAnmAmbLightDicData = ResDic(ofs_to_obj( - ref().toScnTopLevelDic))[ResName(&ResNameData_AmbLights)]; + void *pResAnmAmbLightDicData = ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_AmbLights)]; if (pResAnmAmbLightDicData != NULL) { return ResAnmAmbLight(ResDic(pResAnmAmbLightDicData)[name]); @@ -59,8 +55,7 @@ ResAnmAmbLight ResAnmScn::GetResAnmAmbLight(const ResName name) const { } ResAnmAmbLight ResAnmScn::GetResAnmAmbLight(int idx) const { - void* pResAnmAmbLightDicData = ResDic(ofs_to_obj( - ref().toScnTopLevelDic))[ResName(&ResNameData_AmbLights)]; + void *pResAnmAmbLightDicData = ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_AmbLights)]; if (pResAnmAmbLightDicData != NULL) { return ResAnmAmbLight(ResDic(pResAnmAmbLightDicData)[idx]); @@ -74,8 +69,7 @@ ResAnmAmbLight ResAnmScn::GetResAnmAmbLight(u32 idx) const { } ResAnmLight ResAnmScn::GetResAnmLight(const ResName name) const { - void* pResAnmLightDicData = ResDic(ofs_to_obj( - ref().toScnTopLevelDic))[ResName(&ResNameData_Lights)]; + void *pResAnmLightDicData = ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_Lights)]; if (pResAnmLightDicData != NULL) { return ResAnmLight(ResDic(pResAnmLightDicData)[name]); @@ -85,8 +79,7 @@ ResAnmLight ResAnmScn::GetResAnmLight(const ResName name) const { } ResAnmLight ResAnmScn::GetResAnmLight(int idx) const { - void* pResAnmLightDicData = ResDic(ofs_to_obj( - ref().toScnTopLevelDic))[ResName(&ResNameData_Lights)]; + void *pResAnmLightDicData = ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_Lights)]; if (pResAnmLightDicData != NULL) { return ResAnmLight(ResDic(pResAnmLightDicData)[idx]); @@ -99,85 +92,98 @@ ResAnmLight ResAnmScn::GetResAnmLight(u32 idx) const { return GetResAnmLight(static_cast(idx)); } +ResAnmCamera ResAnmScn::GetResAnmCamera(const ResName name) const { + void *pResAnmCameraDicData = ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_Cameras)]; + + if (pResAnmCameraDicData != NULL) { + return ResAnmCamera(ResDic(pResAnmCameraDicData)[name]); + } + + return ResAnmCamera(NULL); +} + +ResAnmCamera ResAnmScn::GetResAnmCamera(int idx) const { + void *pResAnmCameraDicData = ResDic(ofs_to_obj(ref().toScnTopLevelDic))[ResName(&ResNameData_Cameras)]; + + if (pResAnmCameraDicData != NULL) { + return ResAnmCamera(ResDic(pResAnmCameraDicData)[idx]); + } + + return ResAnmCamera(NULL); +} + +ResAnmCamera ResAnmScn::GetResAnmCamera(u32 idx) const { + return GetResAnmCamera(static_cast(idx)); +} + ResLightSet ResAnmScn::GetResLightSetByRefNumber(u32 refNumber) const { - const ResAnmScnInfoData& rInfoData = ref().info; + const ResAnmScnInfoData &rInfoData = ref().info; if (rInfoData.numResLightSetData <= refNumber) { return ResLightSet(NULL); } - const ResLightSetData* pArray = - ofs_to_ptr(ref().toResLightSetDataArray); + const ResLightSetData *pArray = ofs_to_ptr(ref().toResLightSetDataArray); - ResLightSetData* pTarget = const_cast(&pArray[refNumber]); + ResLightSetData *pTarget = const_cast(&pArray[refNumber]); - return ResLightSet(pTarget->id < rInfoData.numResLightSetData ? pTarget - : NULL); + return ResLightSet(pTarget->id < rInfoData.numResLightSetData ? pTarget : NULL); } ResAnmAmbLight ResAnmScn::GetResAnmAmbLightByRefNumber(u32 refNumber) const { - const ResAnmScnInfoData& rInfoData = ref().info; + const ResAnmScnInfoData &rInfoData = ref().info; if (rInfoData.numResAnmAmbLightData <= refNumber) { return ResAnmAmbLight(NULL); } - const ResAnmAmbLightData* pArray = - ofs_to_ptr(ref().toResAnmAmbLightDataArray); + const ResAnmAmbLightData *pArray = ofs_to_ptr(ref().toResAnmAmbLightDataArray); - ResAnmAmbLightData* pTarget = - const_cast(&pArray[refNumber]); + ResAnmAmbLightData *pTarget = const_cast(&pArray[refNumber]); - return ResAnmAmbLight( - pTarget->id < rInfoData.numResAnmAmbLightData ? pTarget : NULL); + return ResAnmAmbLight(pTarget->id < rInfoData.numResAnmAmbLightData ? pTarget : NULL); } ResAnmLight ResAnmScn::GetResAnmLightByRefNumber(u32 refNumber) const { - const ResAnmScnInfoData& rInfoData = ref().info; + const ResAnmScnInfoData &rInfoData = ref().info; if (rInfoData.numResAnmLightData <= refNumber) { return ResAnmLight(NULL); } - const ResAnmLightData* pArray = - ofs_to_ptr(ref().toResAnmLightDataArray); + const ResAnmLightData *pArray = ofs_to_ptr(ref().toResAnmLightDataArray); - ResAnmLightData* pTarget = const_cast(&pArray[refNumber]); + ResAnmLightData *pTarget = const_cast(&pArray[refNumber]); - return ResAnmLight(pTarget->id < rInfoData.numResAnmLightData ? pTarget - : NULL); + return ResAnmLight(pTarget->id < rInfoData.numResAnmLightData ? pTarget : NULL); } ResAnmFog ResAnmScn::GetResAnmFogByRefNumber(u32 refNumber) const { - const ResAnmScnInfoData& rInfoData = ref().info; + const ResAnmScnInfoData &rInfoData = ref().info; if (rInfoData.numResAnmFogData <= refNumber) { return ResAnmFog(NULL); } - const ResAnmFogData* pArray = - ofs_to_ptr(ref().toResAnmFogDataArray); + const ResAnmFogData *pArray = ofs_to_ptr(ref().toResAnmFogDataArray); - ResAnmFogData* pTarget = const_cast(&pArray[refNumber]); + ResAnmFogData *pTarget = const_cast(&pArray[refNumber]); return ResAnmFog(pTarget->id < rInfoData.numResAnmFogData ? pTarget : NULL); } ResAnmCamera ResAnmScn::GetResAnmCameraByRefNumber(u32 refNumber) const { - const ResAnmScnInfoData& rInfoData = ref().info; + const ResAnmScnInfoData &rInfoData = ref().info; if (rInfoData.numResAnmCameraData <= refNumber) { return ResAnmCamera(NULL); } - const ResAnmCameraData* pArray = - ofs_to_ptr(ref().toResAnmCameraDataArray); + const ResAnmCameraData *pArray = ofs_to_ptr(ref().toResAnmCameraDataArray); - ResAnmCameraData* pTarget = - const_cast(&pArray[refNumber]); + ResAnmCameraData *pTarget = const_cast(&pArray[refNumber]); - return ResAnmCamera(pTarget->id < rInfoData.numResAnmCameraData ? pTarget - : NULL); + return ResAnmCamera(pTarget->id < rInfoData.numResAnmCameraData ? pTarget : NULL); } bool ResAnmScn::Bind(const ResAnmScn scene) { diff --git a/src/nw4r/g3d/res/g3d_resanmshp.cpp b/src/nw4r/g3d/res/g3d_resanmshp.cpp index bff70576..24cdddf0 100644 --- a/src/nw4r/g3d/res/g3d_resanmshp.cpp +++ b/src/nw4r/g3d/res/g3d_resanmshp.cpp @@ -1,14 +1,13 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void ResAnmShp::GetAnmResult(ShpAnmResult* pResult, u32 idx, f32 frame, - const ShpAnmVtxSet* pShapeArray) const { - const ResAnmShpAnmData* pAnmData = GetShapeAnm(idx); +void ResAnmShp::GetAnmResult(ShpAnmResult *pResult, u32 idx, f32 frame, const ShpAnmVtxSet *pShapeArray) const { + const ResAnmShpAnmData *pAnmData = GetShapeAnm(idx); - const u16* pAnmIdxToVtxIdxTable = static_cast( - ut::AddOffsetToPtr(pAnmData, pAnmData->toAnmIdxToVtxIdxTable)); + const u16 *pAnmIdxToVtxIdxTable = + static_cast(ut::AddOffsetToPtr(pAnmData, pAnmData->toAnmIdxToVtxIdxTable)); u32 flags = pAnmData->flags; u32 constFlags = pAnmData->constFlags; @@ -19,13 +18,12 @@ void ResAnmShp::GetAnmResult(ShpAnmResult* pResult, u32 idx, f32 frame, pResult->baseShapeWeight = 1.0f; for (int i = 0; i < pAnmData->numKeyShape; constFlags >>= 1, i++) { - BlendVtx& rShape = pResult->keyShape[i]; + BlendVtx &rShape = pResult->keyShape[i]; bool constant = (constFlags & 1) != 0; int vtxIdx = pAnmIdxToVtxIdxTable[i]; - f32 weight = - detail::GetResAnmResult(&pAnmData->anms[i], frame, constant); + f32 weight = detail::GetResAnmResult(&pAnmData->anms[i], frame, constant); rShape.vtxSet = pShapeArray[vtxIdx]; rShape.weight = weight; diff --git a/src/nw4r/g3d/res/g3d_resanmtexpat.cpp b/src/nw4r/g3d/res/g3d_resanmtexpat.cpp index 3cae607c..9e816d36 100644 --- a/src/nw4r/g3d/res/g3d_resanmtexpat.cpp +++ b/src/nw4r/g3d/res/g3d_resanmtexpat.cpp @@ -1,7 +1,7 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include -#include +#include "nw4r/math.h" // IWYU pragma: export +#include "nw4r/ut.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -12,11 +12,9 @@ ResFile ResAnmTexPat::GetParent() const { namespace { -const ResAnmTexPatFrmData* SearchFrame(const ResAnmTexPatAnmData* pAnmData, - f32 frame) { - const ResAnmTexPatFrmData& rFirst = pAnmData->frameValues[0]; - const ResAnmTexPatFrmData& rLast = - pAnmData->frameValues[pAnmData->numFrameValues - 1]; +const ResAnmTexPatFrmData *SearchFrame(const ResAnmTexPatAnmData *pAnmData, f32 frame) { + const ResAnmTexPatFrmData &rFirst = pAnmData->frameValues[0]; + const ResAnmTexPatFrmData &rLast = pAnmData->frameValues[pAnmData->numFrameValues - 1]; if (frame <= rFirst.frame) { return &rFirst; @@ -32,7 +30,7 @@ const ResAnmTexPatFrmData* SearchFrame(const ResAnmTexPatAnmData* pAnmData, f32 fEstimate = frameOffset * numKeyFrame * pAnmData->invKeyFrameRange; u16 iEstimate = math::F32ToU16(fEstimate); - const ResAnmTexPatFrmData* pFrmData = &pAnmData->frameValues[iEstimate]; + const ResAnmTexPatFrmData *pFrmData = &pAnmData->frameValues[iEstimate]; if (frame < pFrmData->frame) { do { @@ -49,31 +47,28 @@ const ResAnmTexPatFrmData* SearchFrame(const ResAnmTexPatAnmData* pAnmData, return pFrmData; } -inline ResName GetResNameFromOffsetArray(s32* pStringArray, int idx) { +inline ResName GetResNameFromOffsetArray(s32 *pStringArray, int idx) { s32 offset = pStringArray[idx]; return NW4R_G3D_OFS_TO_RESNAME(pStringArray, offset); } } // namespace -void ResAnmTexPat::GetAnmResult(TexPatAnmResult* pResult, u32 idx, - f32 frame) const { +void ResAnmTexPat::GetAnmResult(TexPatAnmResult *pResult, u32 idx, f32 frame) const { (void)GetParent(); // unused - const ResAnmTexPatMatData* pMatData = GetMatAnm(idx); - const ResAnmTexPatMatData::AnmData* pAnmDataImpl = pMatData->anms; + const ResAnmTexPatMatData *pMatData = GetMatAnm(idx); + const ResAnmTexPatMatData::AnmData *pAnmDataImpl = pMatData->anms; u32 flags = pMatData->flags; - const ResAnmTexPatData& r = ref(); - const ResTex* pResTexArray = ofs_to_ptr(r.toResTexArray); - const ResPltt* pResPlttArray = ofs_to_ptr(r.toResPlttArray); + const ResAnmTexPatData &r = ref(); + const ResTex *pResTexArray = ofs_to_ptr(r.toResTexArray); + const ResPltt *pResPlttArray = ofs_to_ptr(r.toResPlttArray); pResult->bTexExist = 0; pResult->bPlttExist = 0; - for (int i = 0; i < TexPatAnmResult::NUM_OF_ANMS; - flags >>= ResAnmTexPatMatData::NUM_OF_FLAGS, i++) { - + for (int i = 0; i < TexPatAnmResult::NUM_OF_ANMS; flags >>= ResAnmTexPatMatData::NUM_OF_FLAGS, i++) { if (!(flags & ResAnmTexPatMatData::FLAG_ANM_EXISTS)) { continue; } @@ -83,11 +78,11 @@ void ResAnmTexPat::GetAnmResult(TexPatAnmResult* pResult, u32 idx, texIndex = pAnmDataImpl->constValue.texIndex; plttIndex = pAnmDataImpl->constValue.plttIndex; } else { - const ResAnmTexPatAnmData* pAnmData = - static_cast(ut::AddOffsetToPtr( - pMatData, pAnmDataImpl->toResAnmTexPatAnmData)); + const ResAnmTexPatAnmData *pAnmData = static_cast( + ut::AddOffsetToPtr(pMatData, pAnmDataImpl->toResAnmTexPatAnmData) + ); - const ResAnmTexPatFrmData* pFrmData = SearchFrame(pAnmData, frame); + const ResAnmTexPatFrmData *pFrmData = SearchFrame(pAnmData, frame); texIndex = pFrmData->texIndex; plttIndex = pFrmData->plttIndex; } @@ -117,15 +112,15 @@ void ResAnmTexPat::GetAnmResult(TexPatAnmResult* pResult, u32 idx, } bool ResAnmTexPat::Bind(const ResFile file) { - const ResAnmTexPatInfoData& rInfoData = ref().info; + const ResAnmTexPatInfoData &rInfoData = ref().info; int numTexture = rInfoData.numTexture; int numPalette = rInfoData.numPalette; - s32* pTexNameArray = ofs_to_ptr(ref().toTexNameArray); - s32* pPlttNameArray = ofs_to_ptr(ref().toPlttNameArray); + s32 *pTexNameArray = ofs_to_ptr(ref().toTexNameArray); + s32 *pPlttNameArray = ofs_to_ptr(ref().toPlttNameArray); - ResTex* pResTexArray = ofs_to_ptr(ref().toResTexArray); - ResPltt* pResPlttArray = ofs_to_ptr(ref().toResPlttArray); + ResTex *pResTexArray = ofs_to_ptr(ref().toResTexArray); + ResPltt *pResPlttArray = ofs_to_ptr(ref().toResPlttArray); int numBound = 0; @@ -135,8 +130,7 @@ bool ResAnmTexPat::Bind(const ResFile file) { if (tex.IsValid()) { numBound++; } else { - ResTex found = - file.GetResTex(GetResNameFromOffsetArray(pTexNameArray, i)); + ResTex found = file.GetResTex(GetResNameFromOffsetArray(pTexNameArray, i)); if (found.IsValid()) { pResTexArray[i] = found; @@ -151,8 +145,7 @@ bool ResAnmTexPat::Bind(const ResFile file) { if (pltt.IsValid()) { numBound++; } else { - ResPltt found = - file.GetResPltt(GetResNameFromOffsetArray(pPlttNameArray, i)); + ResPltt found = file.GetResPltt(GetResNameFromOffsetArray(pPlttNameArray, i)); if (found.IsValid()) { pResPlttArray[i] = found; @@ -165,12 +158,12 @@ bool ResAnmTexPat::Bind(const ResFile file) { } void ResAnmTexPat::Release() { - const ResAnmTexPatInfoData& rInfoData = ref().info; + const ResAnmTexPatInfoData &rInfoData = ref().info; int numTexture = rInfoData.numTexture; int numPalette = rInfoData.numPalette; - ResTex* pResTexArray = ofs_to_ptr(ref().toResTexArray); - ResPltt* pResPlttArray = ofs_to_ptr(ref().toResPlttArray); + ResTex *pResTexArray = ofs_to_ptr(ref().toResTexArray); + ResPltt *pResPlttArray = ofs_to_ptr(ref().toResPlttArray); for (int i = 0; i < numTexture; i++) { pResTexArray[i] = ResTex(NULL); diff --git a/src/nw4r/g3d/res/g3d_resanmtexsrt.cpp b/src/nw4r/g3d/res/g3d_resanmtexsrt.cpp index a05c8ce2..c2b271c6 100644 --- a/src/nw4r/g3d/res/g3d_resanmtexsrt.cpp +++ b/src/nw4r/g3d/res/g3d_resanmtexsrt.cpp @@ -1,31 +1,28 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include -#include +#include "nw4r/math.h" // IWYU pragma: export +#include "nw4r/ut.h" // IWYU pragma: export namespace nw4r { namespace g3d { namespace { -inline u32 MakeResult(TexSrt* pSrt, const ResAnmTexSrtTexData* pTexData, - f32 frame) { +inline u32 MakeResult(TexSrt *pSrt, const ResAnmTexSrtTexData *pTexData, f32 frame) { int anmIdx = 0; u32 flags = pTexData->flags; - TexSrt& rSrt = *pSrt; + TexSrt &rSrt = *pSrt; if (!(flags & ResAnmTexSrtTexData::FLAG_SCALE_ONE)) { bool suConstant = flags & ResAnmTexSrtTexData::FLAG_SCALE_U_CONST; - rSrt.Su = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, - suConstant); + rSrt.Su = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, suConstant); if (flags & ResAnmTexSrtTexData::FLAG_SCALE_UNIFORM) { rSrt.Sv = rSrt.Su; } else { bool svConstant = flags & ResAnmTexSrtTexData::FLAG_SCALE_V_CONST; - rSrt.Sv = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, - svConstant); + rSrt.Sv = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, svConstant); } } else { rSrt.Su = 1.0f; @@ -35,8 +32,7 @@ inline u32 MakeResult(TexSrt* pSrt, const ResAnmTexSrtTexData* pTexData, if (!(flags & ResAnmTexSrtTexData::FLAG_ROT_ZERO)) { bool rConstant = flags & ResAnmTexSrtTexData::FLAG_ROT_CONST; - rSrt.R = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, - rConstant); + rSrt.R = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, rConstant); } else { rSrt.R = 0.0f; } @@ -45,27 +41,22 @@ inline u32 MakeResult(TexSrt* pSrt, const ResAnmTexSrtTexData* pTexData, bool tuConstant = flags & ResAnmTexSrtTexData::FLAG_TRANS_U_CONST; bool tvConstant = flags & ResAnmTexSrtTexData::FLAG_TRANS_V_CONST; - rSrt.Tu = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, - tuConstant); - rSrt.Tv = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, - tvConstant); + rSrt.Tu = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, tuConstant); + rSrt.Tv = detail::GetResAnmResult(&pTexData->anms[anmIdx++], frame, tvConstant); } else { rSrt.Tu = 0.0f; rSrt.Tv = 0.0f; } - return flags & (ResAnmTexSrtTexData::FLAG_ANM_EXISTS | - ResAnmTexSrtTexData::FLAG_SCALE_ONE | - ResAnmTexSrtTexData::FLAG_ROT_ZERO | - ResAnmTexSrtTexData::FLAG_TRANS_ZERO); + return flags & (ResAnmTexSrtTexData::FLAG_ANM_EXISTS | ResAnmTexSrtTexData::FLAG_SCALE_ONE | + ResAnmTexSrtTexData::FLAG_ROT_ZERO | ResAnmTexSrtTexData::FLAG_TRANS_ZERO); } } // namespace -void ResAnmTexSrt::GetAnmResult(TexSrtAnmResult* pResult, u32 idx, - f32 frame) const { - const ResAnmTexSrtMatData* pMatData = GetMatAnm(idx); - const s32* pToTexData = pMatData->toResAnmTexSrtTexData; +void ResAnmTexSrt::GetAnmResult(TexSrtAnmResult *pResult, u32 idx, f32 frame) const { + const ResAnmTexSrtMatData *pMatData = GetMatAnm(idx); + const s32 *pToTexData = pMatData->toResAnmTexSrtTexData; u32 flags = pMatData->flags; u32 indFlags = pMatData->indFlags; @@ -75,35 +66,29 @@ void ResAnmTexSrt::GetAnmResult(TexSrtAnmResult* pResult, u32 idx, int index; - for (index = 0; flags != 0; - flags >>= ResAnmTexSrtMatData::NUM_OF_FLAGS, index++) { - + for (index = 0; flags != 0; flags >>= ResAnmTexSrtMatData::NUM_OF_FLAGS, index++) { if (!(flags & ResAnmTexSrtMatData::FLAG_ANM_EXISTS)) { continue; } int srtIndex = index; - const ResAnmTexSrtTexData* pTexData = - reinterpret_cast( - ut::AddOffsetToPtr(pMatData, *pToTexData++)); + const ResAnmTexSrtTexData *pTexData = + reinterpret_cast(ut::AddOffsetToPtr(pMatData, *pToTexData++)); u32 result = MakeResult(&pResult->srt[srtIndex], pTexData, frame); pResult->flags |= result << (index * TexSrtAnmResult::NUM_OF_FLAGS); } - for (index = 0; indFlags != 0; - indFlags >>= ResAnmTexSrtMatData::NUM_OF_FLAGS, index++) { - + for (index = 0; indFlags != 0; indFlags >>= ResAnmTexSrtMatData::NUM_OF_FLAGS, index++) { if (!(indFlags & ResAnmTexSrtMatData::FLAG_ANM_EXISTS)) { continue; } int srtIndex = index + TexSrtAnmResult::NUM_OF_MAT_TEX_MTX; - const ResAnmTexSrtTexData* pTexData = - reinterpret_cast( - ut::AddOffsetToPtr(pMatData, *pToTexData++)); + const ResAnmTexSrtTexData *pTexData = + reinterpret_cast(ut::AddOffsetToPtr(pMatData, *pToTexData++)); u32 result = MakeResult(&pResult->srt[srtIndex], pTexData, frame); pResult->indFlags |= result << (index * TexSrtAnmResult::NUM_OF_FLAGS); diff --git a/src/nw4r/g3d/res/g3d_resanmvis.cpp b/src/nw4r/g3d/res/g3d_resanmvis.cpp index 671b6fe7..4e411537 100644 --- a/src/nw4r/g3d/res/g3d_resanmvis.cpp +++ b/src/nw4r/g3d/res/g3d_resanmvis.cpp @@ -1,11 +1,11 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { bool ResAnmVis::GetAnmResult(u32 idx, f32 frame) const { - const ResAnmVisAnmData* pAnmData = GetNodeAnm(idx); - const ResAnmVisInfoData& rInfoData = ref().info; + const ResAnmVisAnmData *pAnmData = GetNodeAnm(idx); + const ResAnmVisInfoData &rInfoData = ref().info; if (pAnmData->flags & ResAnmVisAnmData::FLAG_CONST) { return pAnmData->flags & ResAnmVisAnmData::FLAG_ENABLE; @@ -14,8 +14,7 @@ bool ResAnmVis::GetAnmResult(u32 idx, f32 frame) const { f32 fClippedFrame = detail::ClipFrame(rInfoData, frame); int iClippedFrame = static_cast(math::FFloor(fClippedFrame)); - return detail::GetResBoolAnmFramesResult(&pAnmData->visibility, - iClippedFrame); + return detail::GetResBoolAnmFramesResult(&pAnmData->visibility, iClippedFrame); } } // namespace g3d diff --git a/src/nw4r/g3d/res/g3d_rescommon.cpp b/src/nw4r/g3d/res/g3d_rescommon.cpp index 4554f3e9..5bbc8095 100644 --- a/src/nw4r/g3d/res/g3d_rescommon.cpp +++ b/src/nw4r/g3d/res/g3d_rescommon.cpp @@ -1,6 +1,6 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export #include diff --git a/src/nw4r/g3d/res/g3d_resdict.cpp b/src/nw4r/g3d/res/g3d_resdict.cpp index 49b157b6..023c23fc 100644 --- a/src/nw4r/g3d/res/g3d_resdict.cpp +++ b/src/nw4r/g3d/res/g3d_resdict.cpp @@ -1,17 +1,17 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export #include namespace nw4r { namespace g3d { -ResDicNodeData* ResDic::Get(const ResName name) const { +ResDicNodeData *ResDic::Get(const ResName name) const { u32 len = name.GetLength(); - const char* pName = name.GetName(); - const ResDicData& r = ref(); + const char *pName = name.GetName(); + const ResDicData &r = ref(); - const ResDicNodeData* c = &r.data[0]; - const ResDicNodeData* x = &r.data[c->idxLeft]; + const ResDicNodeData *c = &r.data[0]; + const ResDicNodeData *x = &r.data[c->idxLeft]; while (c->ref > x->ref) { c = x; @@ -27,17 +27,17 @@ ResDicNodeData* ResDic::Get(const ResName name) const { } if (name == NW4R_G3D_OFS_TO_RESNAME(&r, x->ofsString)) { - return const_cast(x); + return const_cast(x); } return NULL; } -ResDicNodeData* ResDic::Get(const char* pName, u32 len) const { - const ResDicData& r = ref(); +ResDicNodeData *ResDic::Get(const char *pName, u32 len) const { + const ResDicData &r = ref(); - const ResDicNodeData* c = &r.data[0]; - const ResDicNodeData* x = &r.data[c->idxLeft]; + const ResDicNodeData *c = &r.data[0]; + const ResDicNodeData *x = &r.data[c->idxLeft]; while (c->ref > x->ref) { c = x; @@ -52,32 +52,31 @@ ResDicNodeData* ResDic::Get(const char* pName, u32 len) const { } } - if (x->ofsString != 0 && - std::strcmp(pName, ofs_to_ptr(x->ofsString)) == 0) { - return const_cast(x); + if (x->ofsString != 0 && std::strcmp(pName, ofs_to_ptr(x->ofsString)) == 0) { + return const_cast(x); } return NULL; } -void* ResDic::operator[](const char* pName) const { +void *ResDic::operator[](const char *pName) const { if (IsValid() && pName != NULL) { - ResDicNodeData* pNode = Get(pName, std::strlen(pName)); + ResDicNodeData *pNode = Get(pName, std::strlen(pName)); if (pNode != NULL) { - return const_cast(ofs_to_ptr_raw(pNode->ofsData)); + return const_cast(ofs_to_ptr_raw(pNode->ofsData)); } } return NULL; } -void* ResDic::operator[](const ResName name) const { +void *ResDic::operator[](const ResName name) const { if (IsValid() && name.IsValid()) { - ResDicNodeData* pNode = Get(name); + ResDicNodeData *pNode = Get(name); if (pNode != NULL) { - return const_cast(ofs_to_ptr_raw(pNode->ofsData)); + return const_cast(ofs_to_ptr_raw(pNode->ofsData)); } } @@ -86,7 +85,7 @@ void* ResDic::operator[](const ResName name) const { s32 ResDic::GetIndex(const ResName name) const { if (IsValid() && name.IsValid()) { - ResDicNodeData* pNode = Get(name); + ResDicNodeData *pNode = Get(name); if (pNode != NULL) { return pNode - (ref().data + 1); diff --git a/src/nw4r/g3d/res/g3d_resfile.cpp b/src/nw4r/g3d/res/g3d_resfile.cpp index a597bab4..675396ec 100644 --- a/src/nw4r/g3d/res/g3d_resfile.cpp +++ b/src/nw4r/g3d/res/g3d_resfile.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -47,6 +47,16 @@ ResMdl ResFile::GetResMdl(u32 idx) const { return GetResMdl(static_cast(idx)); } +u32 ResFile::GetResMdlNumEntries() const { + void *pResMdlDicData = ResDic(const_cast(&ref().dict.topLevel))[ResName(&ResNameData_Models)]; + + if (pResMdlDicData != NULL) { + return ResDic(pResMdlDicData).GetNumData(); + } + + return 0; +} + /****************************************************************************** * * ResPltt @@ -337,15 +347,6 @@ ResAnmScn ResFile::GetResAnmScn(u32 idx) const { * Miscellaneous * ******************************************************************************/ -u32 ResFile::GetResMdlNumEntries() const { - void *pResMdlDicData = ResDic(const_cast(&ref().dict.topLevel))[ResName(&ResNameData_Models)]; - - if (pResMdlDicData != NULL) { - return ResDic(pResMdlDicData).GetNumData(); - } - - return 0; -} u32 ResFile::GetResPlttNumEntries() const { void *pResPlttDicData = ResDic(const_cast(&ref().dict.topLevel))[ResName(&ResNameData_Pltts)]; @@ -439,6 +440,16 @@ u32 ResFile::GetResAnmScnNumEntries() const { return 0; } +void *ResFile::GetExternalData(const char *pName) const { + void *pExternalData = ResDic(const_cast(&ref().dict.topLevel))[ResName(&ResNameData_Ext)]; + + if (pExternalData != NULL) { + return ResDic(pExternalData)[pName]; + } + + return NULL; +} + bool ResFile::Bind(const ResFile file) { u32 i; bool success = true; @@ -577,8 +588,3 @@ bool ResFile::CheckRevision() const { } // namespace g3d } // namespace nw4r - -// clang-format off -DECOMP_FORCEACTIVE(g3d_resfile_cpp, - nw4r::g3d::ResNameData_Ext); -// clang-format on diff --git a/src/nw4r/g3d/res/g3d_reslightset.cpp b/src/nw4r/g3d/res/g3d_reslightset.cpp index 2647bfeb..90a49560 100644 --- a/src/nw4r/g3d/res/g3d_reslightset.cpp +++ b/src/nw4r/g3d/res/g3d_reslightset.cpp @@ -1,21 +1,21 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { namespace { -inline void SetBind(u16* pId, u32 id) { +inline void SetBind(u16 *pId, u32 id) { *pId = id; } -inline bool IsBound(const u16* pId) { +inline bool IsBound(const u16 *pId) { return *pId != ResLightSetData::INVALID_ID; } } // namespace bool ResLightSet::Bind(const ResAnmScn scene) { - ResLightSetData& r = ref(); + ResLightSetData &r = ref(); int numAllLight = 0; int numBound = 0; @@ -41,7 +41,7 @@ bool ResLightSet::Bind(const ResAnmScn scene) { numAllLight += numLight; for (u32 i = 0; i < numLight; i++) { - u16* pId = &r.lightId[i]; + u16 *pId = &r.lightId[i]; if (IsBound(pId)) { numBound++; diff --git a/src/nw4r/g3d/res/g3d_resmat.cpp b/src/nw4r/g3d/res/g3d_resmat.cpp index 023fdb8c..be7a96da 100644 --- a/src/nw4r/g3d/res/g3d_resmat.cpp +++ b/src/nw4r/g3d/res/g3d_resmat.cpp @@ -1,4 +1,6 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export + +#include namespace nw4r { namespace g3d { @@ -12,6 +14,10 @@ ResMdl ResMat::GetParent() { return ofs_to_obj(ref().toResMdlData); } +const ResMdl ResMat::GetParent() const { + return ofs_to_obj(ref().toResMdlData); +} + /****************************************************************************** * * DCStore @@ -408,6 +414,16 @@ GXBool ResMatMisc::GXGetZCompLoc() const { return FALSE; } +void ResMatMisc::SetLightSetIdx(int idx) { + if (IsValid()) { + if (idx > (u32)0x7F) { + ptr()->light_set_idx = -1; + } else { + ptr()->light_set_idx = idx; + } + } +} + int ResMatMisc::GetLightSetIdx() const { if (IsValid()) { return ptr()->light_set_idx; @@ -416,6 +432,12 @@ int ResMatMisc::GetLightSetIdx() const { return -1; } +void ResMatMisc::SetFogIdx(int idx) { + if (IsValid()) { + ptr()->fog_idx = idx; + } +} + int ResMatMisc::GetFogIdx() const { if (IsValid()) { return ptr()->fog_idx; @@ -446,6 +468,33 @@ ResMatMisc ResMatMisc::CopyTo(void *pDst) const { return ResMatMisc(pData); } +/****************************************************************************** + * + * ResMatFur + * + ******************************************************************************/ + +f32 ResMatFur::GetLyrRate(u32 idx) const { + 0.f; // For Float Ordering + 1.f; // For Float Ordering + + if (IsValid()) { + u32 layerSize = ref().lyrSize; + switch (ref().lyrInterval) { + case ResMatFurData::UNIFORM: { + return f32(idx + 1) / layerSize; + } break; + case ResMatFurData::TIP: { + return pow(f32(idx + 1) / layerSize, 0.6f); + } break; + default: { + return 0.f; + } break; + } + } + return 0.f; +} + /****************************************************************************** * * ResMatPix @@ -776,19 +825,13 @@ bool ResMatIndMtxAndScale::GXGetIndTexMtx(GXIndTexMtxID id, math::MTX34 *pMtx) c switch (id) { case GX_ITM_0: { pCmd = r.dl.indTexMtx0; - break; - } - + } break; case GX_ITM_1: { pCmd = r.dl.indTexMtx1; - break; - } - + } break; case GX_ITM_2: { pCmd = r.dl.indTexMtx2; - break; - } - + } break; default: { return false; } @@ -850,6 +893,70 @@ bool ResMatIndMtxAndScale::GXGetIndTexMtx(GXIndTexMtxID id, math::MTX34 *pMtx) c return true; } +bool ResMatIndMtxAndScale::GXGetIndTexMtx(GXIndTexMtxID id, math::MTX34 *pMtx, s8 *pScaleExp) const { + s8 scaleExp; + const u8 *pCmd; + const ResIndMtxAndScaleDL &r = ref(); + + switch (id) { + case GX_ITM_0: { + pCmd = r.dl.indTexMtx0; + } break; + case GX_ITM_1: { + pCmd = r.dl.indTexMtx1; + } break; + case GX_ITM_2: { + pCmd = r.dl.indTexMtx2; + } break; + default: { + return false; + } + } + + if (pCmd[0] == 0) { + return false; + } + + u32 regA; + detail::ResReadBPCmd(&pCmd[GX_BP_CMD_SZ * 0], ®A); + + u32 regB; + detail::ResReadBPCmd(&pCmd[GX_BP_CMD_SZ * 1], ®B); + + u32 regC; + detail::ResReadBPCmd(&pCmd[GX_BP_CMD_SZ * 2], ®C); + + u32 scaleExpReg = (regA >> GX_BP_INDMTXA_EXP_SHIFT & GX_BP_INDMTXA_EXP_LMASK) << 0 | + (regB >> GX_BP_INDMTXB_EXP_SHIFT & GX_BP_INDMTXB_EXP_LMASK) << 2 | + (regC >> GX_BP_INDMTXC_EXP_SHIFT & GX_BP_INDMTXC_EXP_LMASK) << 4; + + // Hardware stores as -17 + if (pScaleExp) { + *pScaleExp = static_cast(scaleExpReg - 17); + } + + if (pMtx != NULL) { + // clang-format off + pMtx->_00 = static_cast(static_cast((regA >> GX_BP_INDMTXA_M00_SHIFT & GX_BP_INDMTXA_M00_LMASK) << (32 - GX_BP_INDMTXA_M00_SZ)) >> (32 - GX_BP_INDMTXA_M00_SZ)) * (1.0f / 1024.0f); + pMtx->_01 = static_cast(static_cast((regB >> GX_BP_INDMTXB_M01_SHIFT & GX_BP_INDMTXB_M01_LMASK) << (32 - GX_BP_INDMTXB_M01_SZ)) >> (32 - GX_BP_INDMTXB_M01_SZ)) * (1.0f / 1024.0f); + pMtx->_02 = static_cast(static_cast((regC >> GX_BP_INDMTXC_M02_SHIFT & GX_BP_INDMTXC_M02_LMASK) << (32 - GX_BP_INDMTXC_M02_SZ)) >> (32 - GX_BP_INDMTXC_M02_SZ)) * (1.0f / 1024.0f); + pMtx->_03 = 0.0f; + + pMtx->_10 = static_cast(static_cast((regA >> GX_BP_INDMTXA_M10_SHIFT & GX_BP_INDMTXA_M10_LMASK) << (32 - GX_BP_INDMTXA_M10_SZ)) >> (32 - GX_BP_INDMTXA_M00_SZ)) * (1.0f / 1024.0f); + pMtx->_11 = static_cast(static_cast((regB >> GX_BP_INDMTXB_M11_SHIFT & GX_BP_INDMTXB_M11_LMASK) << (32 - GX_BP_INDMTXB_M11_SZ)) >> (32 - GX_BP_INDMTXB_M11_SZ)) * (1.0f / 1024.0f); + pMtx->_12 = static_cast(static_cast((regC >> GX_BP_INDMTXC_M12_SHIFT & GX_BP_INDMTXC_M12_LMASK) << (32 - GX_BP_INDMTXC_M12_SZ)) >> (32 - GX_BP_INDMTXC_M12_SZ)) * (1.0f / 1024.0f); + pMtx->_13 = 0.0f; + + pMtx->_20 = 0.0f; + pMtx->_21 = 0.0f; + pMtx->_22 = 1.0f; + pMtx->_23 = 0.0f; + // clang-format on + } + + return true; +} + void ResMatIndMtxAndScale::GXSetIndTexMtx(GXIndTexMtxID id, const math::MTX34 &rMtx, s8 scaleExp) { u32 offset; u8 *pCmd; @@ -1383,6 +1490,10 @@ void ResMatTexCoordGen::GXSetTexCoordGen2( // clang-format on } +void ResMatTexCoordGen::Disable(GXTexCoordID coord) { + std::memset(ref().dl.texCoordGen[coord], 0, GX_XF_CMD_SZ * 2); +} + /****************************************************************************** * * ResMat @@ -1415,6 +1526,10 @@ void ResMat::Init() { DC::StoreRangeNoSync(GetResMatDLData(), sizeof(ResMatDLData)); } +bool ResMat::IsOpaque() const { + return GetParent().IsOpaque(GetID()); +} + ResTev ResMat::GetResTev() { return ofs_to_obj(ref().toResTevData); } @@ -1423,6 +1538,14 @@ ResTev ResMat::GetResTev() const { return ofs_to_obj(ref().toResTevData); } +ResMatFur ResMat::GetResMatFur() { + return ofs_to_obj(ref().toResMatFurData); +} + +ResUserData ResMat::GetResUserData() { + return ofs_to_obj(ref().toResUserData); +} + /****************************************************************************** * * ResTexPlttInfo diff --git a/src/nw4r/g3d/res/g3d_resmdl.cpp b/src/nw4r/g3d/res/g3d_resmdl.cpp index 125583f1..1e49d94e 100644 --- a/src/nw4r/g3d/res/g3d_resmdl.cpp +++ b/src/nw4r/g3d/res/g3d_resmdl.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -8,8 +8,8 @@ namespace g3d { * ResByteCode * ******************************************************************************/ -const u8* ResMdl::GetResByteCode(const char* pName) const { - return static_cast(ofs_to_obj(ref().toResByteCodeDic)[pName]); +const u8 *ResMdl::GetResByteCode(const char *pName) const { + return static_cast(ofs_to_obj(ref().toResByteCodeDic)[pName]); } /****************************************************************************** @@ -17,7 +17,7 @@ const u8* ResMdl::GetResByteCode(const char* pName) const { * ResNode * ******************************************************************************/ -ResNode ResMdl::GetResNode(const char* pName) const { +ResNode ResMdl::GetResNode(const char *pName) const { return ResNode(ofs_to_obj(ref().toResNodeDic)[pName]); } @@ -113,12 +113,40 @@ u32 ResMdl::GetResVtxTexCoordNumEntries() const { return ofs_to_obj(ref().toResVtxTexCoordDic).GetNumData(); } +/****************************************************************************** + * + * ResVtxFurPos + * + ******************************************************************************/ + +ResVtxFurPos ResMdl::GetResVtxFurPos(int idx) const { + return ResVtxFurPos(ofs_to_obj(ref().toResVtxFurPosDic)[idx]); +} + +u32 ResMdl::GetResVtxFurPosNumEntries() const { + return ofs_to_obj(ref().toResVtxFurPosDic).GetNumData(); +} + +/****************************************************************************** + * + * ResVtxFurVec + * + ******************************************************************************/ + +ResVtxFurVec ResMdl::GetResVtxFurVec(int idx) const { + return ResVtxFurVec(ofs_to_obj(ref().toResVtxFurVecDic)[idx]); +} + +u32 ResMdl::GetResVtxFurVecNumEntries() const { + return ofs_to_obj(ref().toResVtxFurVecDic).GetNumData(); +} + /****************************************************************************** * * ResMat * ******************************************************************************/ -ResMat ResMdl::GetResMat(const char* pName) const { +ResMat ResMdl::GetResMat(const char *pName) const { return ResMat(ofs_to_obj(ref().toResMatDic)[pName]); } @@ -143,7 +171,7 @@ u32 ResMdl::GetResMatNumEntries() const { * ResShp * ******************************************************************************/ -ResShp ResMdl::GetResShp(const char* pName) const { +ResShp ResMdl::GetResShp(const char *pName) const { return ResShp(ofs_to_obj(ref().toResShpDic)[pName]); } @@ -165,8 +193,7 @@ u32 ResMdl::GetResShpNumEntries() const { * ******************************************************************************/ ResTexPlttInfo ResMdl::GetResTexPlttInfoOffsetFromTexName(int idx) const { - return ResTexPlttInfo( - ofs_to_obj(ref().toResTexNameToTexPlttInfoDic)[idx]); + return ResTexPlttInfo(ofs_to_obj(ref().toResTexNameToTexPlttInfoDic)[idx]); } u32 ResMdl::GetResTexPlttInfoOffsetFromTexNameNumEntries() const { @@ -231,6 +258,16 @@ void ResMdl::Init() { for (i = 0; i < texCoordNum; i++) { GetResVtxTexCoord(i).Init(); } + + u32 vtxFurVecNum = GetResVtxFurVecNumEntries(); + for (i = 0; i < vtxFurVecNum; i++) { + GetResVtxFurVec(i).Init(); + } + + u32 vtxFurPosNum = GetResVtxFurPosNumEntries(); + for (i = 0; i < vtxFurPosNum; i++) { + GetResVtxFurPos(i).Init(); + } } void ResMdl::Terminate() { @@ -242,5 +279,75 @@ void ResMdl::Terminate() { } } +bool ResMdl::IsOpaque(u32 mat) const { + const u8 *drawOpa = GetResByteCode("DrawOpa"); + + if (drawOpa) { + while (drawOpa[0] != 1 /* End of Commands*/) { + // Code 4 -> Draw Polygon + if (drawOpa[0] == 4) { + // First two bytes are the MatId + u32 matID = (drawOpa[1] << 8 | drawOpa[2]); + if (matID == mat) { + return true; + } + drawOpa += 8 /* Size of Draw Polygon Code*/; + } else { + return false; + } + } + } + return false; +} + +ResMdl::DrawEnumerator::DrawEnumerator(const u8 *pDrawOpa, const u8 *pDrawXlu) + : drawOpa(pDrawOpa), drawXlu(pDrawXlu), bOpa(pDrawOpa != NULL) {} + +bool ResMdl::DrawEnumerator::IsValid() const { + if (bOpa) { + return drawOpa && drawOpa[0] == 4; + } else { + return drawXlu && drawXlu[0] == 4; + } +} + +void ResMdl::DrawEnumerator::MoveNext() { + // Draw opaque before transparent + if (bOpa) { + /* Size of Draw Polygon Code*/ + if (*(drawOpa += 8) == 1) { + bOpa = false; + } + + return; + } else { + drawXlu += 8 /* Size of Draw Polygon Code*/; + } +} + +u32 ResMdl::DrawEnumerator::GetMatID() const { + if (bOpa) { + return (drawOpa[1] << 8 | drawOpa[2]); + } else { + return (drawXlu[1] << 8 | drawXlu[2]); + } +} + +u32 ResMdl::DrawEnumerator::GetShpID() const { + if (bOpa) { + return (drawOpa[3] << 8 | drawOpa[4]); + } else { + return (drawXlu[3] << 8 | drawXlu[4]); + } +} + +u32 ResMdl::DrawEnumerator::GetNodeID() const { + if (bOpa) { + return (drawOpa[5] << 8 | drawOpa[6]); + } else { + return (drawXlu[5] << 8 | drawXlu[6]); + } +} + } // namespace g3d } // namespace nw4r diff --git a/src/nw4r/g3d/res/g3d_resnode.cpp b/src/nw4r/g3d/res/g3d_resnode.cpp index 6a0af023..7788c86b 100644 --- a/src/nw4r/g3d/res/g3d_resnode.cpp +++ b/src/nw4r/g3d/res/g3d_resnode.cpp @@ -1,47 +1,63 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "nw4r/math.h" // IWYU pragma: export namespace nw4r { namespace g3d { -void ResNode::PatchChrAnmResult(ChrAnmResult* pResult) const { +void ResNode::PatchChrAnmResult(ChrAnmResult *pResult) const { if (!IsValid()) { return; } - const ResNodeData& r = ref(); + const ResNodeData &r = ref(); u32 flags = pResult->flags; if (flags & ChrAnmResult::FLAG_PATCH_SCALE) { if (r.flags & ResNodeData::FLAG_SCALE_ONE) { - flags |= - ChrAnmResult::FLAG_SCALE_ONE | ChrAnmResult::FLAG_SCALE_UNIFORM; + flags |= ChrAnmResult::FLAG_SCALE_ONE | ChrAnmResult::FLAG_SCALE_UNIFORM; + pResult->s.z = 1.f; + pResult->s.y = 1.f; + pResult->s.x = 1.f; } else { + u32 flag_ = flags & ~ChrAnmResult::FLAG_SCALE_UNIFORM; + if (r.flags & ResNodeData::FLAG_SCALE_UNIFORM) { - flags |= ChrAnmResult::FLAG_SCALE_UNIFORM; + flag_ = flags | ChrAnmResult::FLAG_SCALE_UNIFORM; } - pResult->s = static_cast(r.scale); + flags = flag_ & ~(ChrAnmResult::FLAG_SCALE_ONE | ChrAnmResult::FLAG_MTX_IDENT); + + pResult->s = static_cast(r.scale); } } if (flags & ChrAnmResult::FLAG_PATCH_ROT) { + math::VEC3 trans(pResult->rt[0][3], pResult->rt[1][3], pResult->rt[2][3]); if (r.flags & ResNodeData::FLAG_ROT_ZERO) { + math::MTX34Identity(&pResult->rt); flags |= ChrAnmResult::FLAG_ROT_ZERO; } else { math::MTX34RotXYZDeg(&pResult->rt, r.rot.x, r.rot.y, r.rot.z); - flags &= ~ChrAnmResult::FLAG_ROT_ZERO; + flags &= ~(ChrAnmResult::FLAG_ROT_ZERO | ChrAnmResult::FLAG_ROT_TRANS_ZERO | ChrAnmResult::FLAG_MTX_IDENT); } flags |= ChrAnmResult::FLAG_ROT_RAW_FMT; + pResult->rt._03 = trans.x; + pResult->rt._13 = trans.y; + pResult->rt._23 = trans.z; } if (flags & ChrAnmResult::FLAG_PATCH_TRANS) { if (r.flags & ResNodeData::FLAG_TRANS_ZERO) { flags |= ChrAnmResult::FLAG_TRANS_ZERO; + + pResult->rt._23 = 0.f; + pResult->rt._13 = 0.f; + pResult->rt._03 = 0.f; } else { - flags &= ~ChrAnmResult::FLAG_TRANS_ZERO; + flags &= + ~(ChrAnmResult::FLAG_TRANS_ZERO | ChrAnmResult::FLAG_ROT_TRANS_ZERO | ChrAnmResult::FLAG_MTX_IDENT); pResult->rt._03 = r.translate.x; pResult->rt._13 = r.translate.y; @@ -49,31 +65,27 @@ void ResNode::PatchChrAnmResult(ChrAnmResult* pResult) const { } } - if ((flags & ChrAnmResult::FLAG_ROT_ZERO) && - (flags & ChrAnmResult::FLAG_TRANS_ZERO)) { + if ((flags & ChrAnmResult::FLAG_ROT_ZERO) && (flags & ChrAnmResult::FLAG_TRANS_ZERO)) { flags |= ChrAnmResult::FLAG_ROT_TRANS_ZERO; - if (flags & ChrAnmResult::FLAG_SCALE_ONE) { flags |= ChrAnmResult::FLAG_MTX_IDENT; } } - pResult->flags = flags & ~(ChrAnmResult::FLAG_PATCH_SCALE | - ChrAnmResult::FLAG_PATCH_ROT | - ChrAnmResult::FLAG_PATCH_TRANS); + pResult->flags = + flags & ~(ChrAnmResult::FLAG_PATCH_SCALE | ChrAnmResult::FLAG_PATCH_ROT | ChrAnmResult::FLAG_PATCH_TRANS); } -void ResNode::CalcChrAnmResult(ChrAnmResult* pResult) const { +void ResNode::CalcChrAnmResult(ChrAnmResult *pResult) const { if (!IsValid()) { return; } - const ResNodeData& r = ref(); + const ResNodeData &r = ref(); u32 flags = 0; if (r.flags & ResNodeData::FLAG_SCALE_ONE) { - flags |= - ChrAnmResult::FLAG_SCALE_ONE | ChrAnmResult::FLAG_SCALE_UNIFORM; + flags |= ChrAnmResult::FLAG_SCALE_ONE | ChrAnmResult::FLAG_SCALE_UNIFORM; pResult->s.z = 1.0f; pResult->s.y = 1.0f; @@ -83,7 +95,7 @@ void ResNode::CalcChrAnmResult(ChrAnmResult* pResult) const { flags |= ChrAnmResult::FLAG_SCALE_UNIFORM; } - pResult->s = static_cast(r.scale); + pResult->s = static_cast(r.scale); } if (r.flags & ResNodeData::FLAG_ROT_ZERO) { diff --git a/src/nw4r/g3d/res/g3d_resshp.cpp b/src/nw4r/g3d/res/g3d_resshp.cpp index 27ec86ca..6dca726f 100644 --- a/src/nw4r/g3d/res/g3d_resshp.cpp +++ b/src/nw4r/g3d/res/g3d_resshp.cpp @@ -1,6 +1,6 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include +#include "rvl/GX.h" // IWYU pragma: export #include @@ -193,6 +193,16 @@ ResVtxTexCoord ResShp::GetResVtxTexCoord(u32 idx) const { return ResVtxTexCoord(NULL); } +ResVtxFurPos ResShp::GetResVtxFurPos() const { + const ResShpData &r = ref(); + + if (r.idVtxFurPos != -1) { + return GetParent().GetResVtxFurPos(r.idVtxFurPos); + } + + return ResVtxFurPos(NULL); +} + void ResShp::Init() { const void *pBase; u8 stride; @@ -293,5 +303,15 @@ void ResShpPrePrim::DCStore(bool sync) { } } +void ResShp::DCStore(bool sync) { + ResShpData &r = ref(); + u32 size = r.size; + + if (sync) { + DC::StoreRange(&r, size); + } else { + DC::StoreRangeNoSync(&r, size); + } +} } // namespace g3d } // namespace nw4r diff --git a/src/nw4r/g3d/res/g3d_restev.cpp b/src/nw4r/g3d/res/g3d_restev.cpp index a990e6c1..644450ee 100644 --- a/src/nw4r/g3d/res/g3d_restev.cpp +++ b/src/nw4r/g3d/res/g3d_restev.cpp @@ -1,7 +1,7 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export -#include -#include +#include "rvl/BASE.h" // IWYU pragma: export +#include "rvl/GX.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -128,6 +128,50 @@ bool ResTev::GXGetTevOrder(GXTevStageID stage, GXTexCoordID *pCoord, GXTexMapID return true; } +void ResTev::GXSetTevOrder(GXTevStageID stage, GXTexCoordID coord, GXTexMapID map, GXChannelID channel) { + static u8 c2r[0x10] = {0, 1, 0, 1, 0, 1, 7, 5, 6, 0, 0, 0, 0, 0, 0, 7}; + + GXTexCoordID currCoord; + GXTexMapID currMap; + if (GXGetTevOrder(stage, &currCoord, &currMap, NULL)) { + if (currCoord != GX_TEXCOORD_NULL && currMap != GX_TEXMAP_NULL) { + ref().texCoordToTexMapID[currCoord] = GX_TEXMAP_NULL; + } + } + + if (coord != GX_TEXCOORD_NULL) { + ref().texCoordToTexMapID[coord] = map; + } + + u8 *pCmd = ref().dl.dl.var[stage / TEV_STAGES_PER_DL].dl.tevOrder; + + // Use the shift to determine if Even or Odd + u32 shift = ((stage & 1) ? GX_BP_RAS1_TREF_TEXMAP_ODD_SHIFT : GX_BP_RAS1_TREF_TEXMAP_EVEN_SHIFT); + + // clang-format off + u32 mask = ( + (0xFF << 24) | + ( GX_BP_RAS1_TREF_TEXMAP_EVEN_MASK | + GX_BP_RAS1_TREF_TEXCOORD_EVEN_MASK | + GX_BP_RAS1_TREF_ENABLE_TEX_EVEN_MASK | + GX_BP_RAS1_TREF_COLORCHAN_EVEN_MASK + ) << shift + ); + + u32 cmd = ( + ( ( map & GX_BP_RAS1_TREF_TEXMAP_EVEN_LMASK ) << GX_BP_RAS1_TREF_TEXMAP_EVEN_SHIFT ) | + ( ( coord & GX_BP_RAS1_TREF_TEXCOORD_EVEN_LMASK ) << GX_BP_RAS1_TREF_TEXCOORD_EVEN_SHIFT ) | + ( ( map != GX_TEXMAP_NULL && !(map & GX_TEX_DISABLE) ) << GX_BP_RAS1_TREF_ENABLE_TEX_EVEN_SHIFT ) | + ( ( c2r[channel & 0xF] ) << GX_BP_RAS1_TREF_COLORCHAN_EVEN_SHIFT ) + ); + // clang-format on + + cmd <<= shift; + cmd |= (GX_BP_REG_RAS1_TREF0 + (stage / TEV_STAGES_PER_DL)) << 24; + + detail::ResWriteBPCmd(pCmd, cmd, mask); +} + void ResTev::GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d) { u8 *pCmd = ref().dl.dl.var[stage / TEV_STAGES_PER_DL].dl.tevColorCalc[stage % TEV_STAGES_PER_DL]; @@ -148,6 +192,55 @@ void ResTev::GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg // clang-format on } +bool ResTev::GXGetIndTexOrder(GXIndTexStageID stage, GXTexCoordID *pCoord, GXTexMapID *pMap) const { + const u8 *pCmd = ref().dl.dl.common.dl.indTexOrder[stage / GX_MAX_INDTEXSTAGE]; + + if (pCmd[0] == 0) { + return false; + } + + u32 cmd; + detail::ResReadBPCmd(pCmd, &cmd); + + u32 shift = (stage % GX_MAX_INDTEXSTAGE) * (GX_BP_RAS1_IREF_MAP0_SZ + GX_BP_RAS1_IREF_TXC0_SZ); + + if (pMap) { + *pMap = static_cast(cmd >> (shift + GX_BP_RAS1_IREF_MAP0_SHIFT) & GX_BP_RAS1_IREF_MAP0_LMASK); + } + if (pCoord) { + *pCoord = static_cast(cmd >> (shift + GX_BP_RAS1_IREF_TXC0_SHIFT) & GX_BP_RAS1_IREF_TXC0_LMASK); + } + + return true; +} + +void ResTev::GXSetIndTexOrder(GXIndTexStageID stage, GXTexCoordID coord, GXTexMapID map) { + GXTexCoordID currCoord; + GXTexMapID currMap; + if (GXGetIndTexOrder(stage, &currCoord, &currMap)) { + if (currCoord != GX_TEXCOORD_NULL && currMap != GX_TEXMAP_NULL) { + ref().texCoordToTexMapID[currCoord] = GX_TEXMAP_NULL; + } + } + + if (coord != GX_TEXCOORD_NULL) { + ref().texCoordToTexMapID[coord] = map; + } + + u8 *pCmd = ref().dl.dl.common.dl.indTexOrder[stage / GX_MAX_INDTEXSTAGE]; + + u32 shift = (stage % GX_MAX_INDTEXSTAGE) * (GX_BP_RAS1_IREF_MAP0_SZ + GX_BP_RAS1_IREF_TXC0_SZ); + + u32 reg = ((map & GX_BP_RAS1_IREF_MAP0_LMASK) << (shift + GX_BP_RAS1_IREF_MAP0_SHIFT)) | + ((coord & GX_BP_RAS1_IREF_TXC0_LMASK) << (shift + GX_BP_RAS1_IREF_TXC0_SHIFT)) | + (GX_BP_REG_RAS1_IREF << 24); + + u32 mask = ((GX_BP_RAS1_IREF_MAP0_LMASK) << (shift + GX_BP_RAS1_IREF_MAP0_SHIFT)) | + ((GX_BP_RAS1_IREF_TXC0_LMASK) << (shift + GX_BP_RAS1_IREF_TXC0_SHIFT)); + + detail::ResWriteBPCmd(pCmd, reg, mask); +} + void ResTev::CallDisplayList(bool sync) const { // Variable DL holds data for two GX tev stages static const u32 dlsize[GX_MAX_TEVSTAGE] = { diff --git a/src/nw4r/g3d/res/g3d_restex.cpp b/src/nw4r/g3d/res/g3d_restex.cpp index 716c6167..af72d9f8 100644 --- a/src/nw4r/g3d/res/g3d_restex.cpp +++ b/src/nw4r/g3d/res/g3d_restex.cpp @@ -1,10 +1,10 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { void ResPltt::DCStore(bool sync) { - void* pBase = &ref(); + void *pBase = &ref(); u32 size = ref().header.size; if (sync) { @@ -14,17 +14,17 @@ void ResPltt::DCStore(bool sync) { } } -bool ResTex::GetTexObjParam(void** ppTexData, u16* pWidth, u16* pHeight, - GXTexFmt* pFormat, f32* pMinLod, f32* pMaxLod, - GXBool* pMipMap) const { - const ResTexData& r = ref(); +bool ResTex::GetTexObjParam( + void **ppTexData, u16 *pWidth, u16 *pHeight, GXTexFmt *pFormat, f32 *pMinLod, f32 *pMaxLod, GXBool *pMipMap +) const { + const ResTexData &r = ref(); if (IsCIFmt()) { return false; } if (ppTexData != NULL) { - *ppTexData = const_cast(GetTexData()); + *ppTexData = const_cast(GetTexData()); } if (pWidth != NULL) { @@ -54,17 +54,17 @@ bool ResTex::GetTexObjParam(void** ppTexData, u16* pWidth, u16* pHeight, return true; } -bool ResTex::GetTexObjCIParam(void** ppTexData, u16* pWidth, u16* pHeight, - GXCITexFmt* pFormatCI, f32* pMinLod, f32* pMaxLod, - GXBool* pMipMap) const { - const ResTexData& r = ref(); +bool ResTex::GetTexObjCIParam( + void **ppTexData, u16 *pWidth, u16 *pHeight, GXCITexFmt *pFormatCI, f32 *pMinLod, f32 *pMaxLod, GXBool *pMipMap +) const { + const ResTexData &r = ref(); if (!IsCIFmt()) { return false; } if (ppTexData != NULL) { - *ppTexData = const_cast(GetTexData()); + *ppTexData = const_cast(GetTexData()); } if (pWidth != NULL) { @@ -95,7 +95,7 @@ bool ResTex::GetTexObjCIParam(void** ppTexData, u16* pWidth, u16* pHeight, } void ResTex::Init() { - ResTexData& r = ref(); + ResTexData &r = ref(); DC::FlushRangeNoSync(&r, r.header.size); } diff --git a/src/nw4r/g3d/res/g3d_resvtx.cpp b/src/nw4r/g3d/res/g3d_resvtx.cpp index 70c78472..066bb20e 100644 --- a/src/nw4r/g3d/res/g3d_resvtx.cpp +++ b/src/nw4r/g3d/res/g3d_resvtx.cpp @@ -1,4 +1,4 @@ -#include +#include "nw4r/g3d.h" // IWYU pragma: export namespace nw4r { namespace g3d { @@ -14,7 +14,7 @@ void ResVtxPos::SetArray() { } } -void ResVtxPos::GetArray(const void** ppBase, u8* pStride) const { +void ResVtxPos::GetArray(const void **ppBase, u8 *pStride) const { if (ppBase != NULL) { *ppBase = GetData(); } @@ -24,7 +24,7 @@ void ResVtxPos::GetArray(const void** ppBase, u8* pStride) const { } } -void ResVtxPos::CopyTo(void* pDst) const { +void ResVtxPos::CopyTo(void *pDst) const { if (!IsValid()) { return; } @@ -45,7 +45,7 @@ void ResVtxNrm::SetArray() { } } -void ResVtxNrm::GetArray(const void** ppBase, u8* pStride) const { +void ResVtxNrm::GetArray(const void **ppBase, u8 *pStride) const { if (ppBase != NULL) { *ppBase = GetData(); } @@ -55,7 +55,7 @@ void ResVtxNrm::GetArray(const void** ppBase, u8* pStride) const { } } -void ResVtxNrm::CopyTo(void* pDst) const { +void ResVtxNrm::CopyTo(void *pDst) const { if (!IsValid()) { return; } @@ -76,7 +76,7 @@ void ResVtxClr::SetArray(GXAttr attr) { } } -void ResVtxClr::GetArray(const void** ppBase, u8* pStride) const { +void ResVtxClr::GetArray(const void **ppBase, u8 *pStride) const { if (ppBase != NULL) { *ppBase = GetData(); } @@ -86,7 +86,7 @@ void ResVtxClr::GetArray(const void** ppBase, u8* pStride) const { } } -void ResVtxClr::CopyTo(void* pDst) const { +void ResVtxClr::CopyTo(void *pDst) const { if (!IsValid()) { return; } @@ -101,7 +101,7 @@ void ResVtxClr::CopyTo(void* pDst) const { * ResVtxTexCoord * ******************************************************************************/ -void ResVtxTexCoord::GetArray(const void** ppBase, u8* pStride) const { +void ResVtxTexCoord::GetArray(const void **ppBase, u8 *pStride) const { if (ppBase != NULL) { *ppBase = GetData(); } @@ -111,13 +111,26 @@ void ResVtxTexCoord::GetArray(const void** ppBase, u8* pStride) const { } } +/****************************************************************************** + * + * ResVtxFurPos + * + ******************************************************************************/ + +void ResVtxFurPos::SetArray(u16 idx) { + if (IsValid()) { + void *base_ptr = GetData(idx); + GXSetArray(GX_VA_POS, base_ptr, ref().stride); + } +} + /****************************************************************************** * * DCStore * ******************************************************************************/ void ResVtxPos::DCStore(bool sync) { - void* pBase = &ref(); + void *pBase = &ref(); u32 size = GetSize(); if (sync) { @@ -128,7 +141,7 @@ void ResVtxPos::DCStore(bool sync) { } void ResVtxNrm::DCStore(bool sync) { - void* pBase = &ref(); + void *pBase = &ref(); u32 size = GetSize(); if (sync) { @@ -139,7 +152,7 @@ void ResVtxNrm::DCStore(bool sync) { } void ResVtxClr::DCStore(bool sync) { - void* pBase = &ref(); + void *pBase = &ref(); u32 size = GetSize(); if (sync) { @@ -150,7 +163,29 @@ void ResVtxClr::DCStore(bool sync) { } void ResVtxTexCoord::DCStore(bool sync) { - void* pBase = &ref(); + void *pBase = &ref(); + u32 size = GetSize(); + + if (sync) { + DC::StoreRange(pBase, size); + } else { + DC::StoreRangeNoSync(pBase, size); + } +} + +void ResVtxFurVec::DCStore(bool sync) { + void *pBase = &ref(); + u32 size = GetSize(); + + if (sync) { + DC::StoreRange(pBase, size); + } else { + DC::StoreRangeNoSync(pBase, size); + } +} + +void ResVtxFurPos::DCStore(bool sync) { + void *pBase = &ref(); u32 size = GetSize(); if (sync) {