Parts of ModelEx

This commit is contained in:
robojumper
2025-03-16 18:55:59 +01:00
parent 82939548fb
commit 540abd8cd1
4 changed files with 148 additions and 11 deletions
+3 -1
View File
@@ -2174,7 +2174,7 @@ egg/gfx/eggPalette.cpp:
egg/gfx/eggTexture.cpp:
.text start:0x8049CB50 end:0x8049CFE4
egg/gfx/eggUnk1.cpp:
egg/gfx/eggAnalizeDL.cpp:
.text start:0x8049CFF0 end:0x8049D7C0
egg/gfx/eggCapTexture.cpp:
@@ -2260,6 +2260,8 @@ egg/gfx/eggLightTextureMgr.cpp:
egg/gfx/eggModelEx.cpp:
.text start:0x804AE650 end:0x804AEC20
.data start:0x8056F110 end:0x8056F120
.sdata start:0x80574F48 end:0x80574F60
egg/gfx/eggPostEffectBase.cpp:
.text start:0x804AEC20 end:0x804AF4B4
+8 -8
View File
@@ -26538,7 +26538,7 @@ CopyToG3D__Q23EGG10FogManagerCFPQ34nw4r3g3d7ScnRoot = .text:0x804A5B90; // type:
SetBinaryInner__Q23EGG10FogManagerFRCQ33EGG27IBinary<Q23EGG10FogManager>3Bin = .text:0x804A5C20; // type:function size:0x9C
SetBinaryInner__Q23EGG10FogManagerFRCQ33EGG27IBinary<Q23EGG10FogManager>3BinRCQ33EGG27IBinary<Q23EGG10FogManager>3Binf = .text:0x804A5CC0; // type:function size:0xA4
GetBinaryInner__Q23EGG10FogManagerCFPQ33EGG27IBinary<Q23EGG10FogManager>3Bin = .text:0x804A5D70; // type:function size:0x80
GetBinarySize__Q23EGG10FogManagerFv = .text:0x804A5DF0; // type:function size:0x14
GetBinarySize__Q23EGG10FogManagerCFv = .text:0x804A5DF0; // type:function size:0x14
GetBinary__Q23EGG19IBinary<Q23EGG3Fog>CFPv = .text:0x804A5E10; // type:function size:0x140
SetBinaryBlend__Q23EGG19IBinary<Q23EGG3Fog>FPCvPCvf = .text:0x804A5F50; // type:function size:0x10
__ct__Q23EGG7FrustumFQ33EGG7Frustum14ProjectionTypeRCQ34nw4r4math4VEC2ffQ33EGG7Frustum10CanvasMode = .text:0x804A5F60; // type:function size:0x64
@@ -26684,10 +26684,10 @@ SetBinaryInner__Q23EGG36IBinary<Q23EGG19LightTextureManager>FRCQ33EGG36IBinary<Q
SetBinary__Q23EGG29IBinary<Q23EGG12LightTexture>FPCv = .text:0x804AE420; // type:function size:0x10
GetBinary__Q23EGG29IBinary<Q23EGG12LightTexture>CFPv = .text:0x804AE430; // type:function size:0x214
__ct__Q23EGG7ModelExFPQ34nw4r3g3d6ScnObj = .text:0x804AE650; // type:function size:0x1C8
EGG__ModelEx__getShapeMinMax = .text:0x804AE820; // type:function size:0x228
EGG__ModelEx__calcWorld = .text:0x804AEA50; // type:function size:0xF0
EGG__ModelEx__getResMdl = .text:0x804AEB40; // type:function size:0x48
EGG__ModelEx__getResShp = .text:0x804AEB90; // type:function size:0x90
getShapeMinMax__Q23EGG7ModelExFUsPQ34nw4r4math4VEC3PQ34nw4r4math4VEC3b = .text:0x804AE820; // type:function size:0x228
calcWorld__Q23EGG7ModelExCFPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34 = .text:0x804AEA50; // type:function size:0xF0
getResMdl__Q23EGG7ModelExCFUs = .text:0x804AEB40; // type:function size:0x48
getResShp__Q23EGG7ModelExCFUs = .text:0x804AEB90; // type:function size:0x90
__ct__Q23EGG14PostEffectBaseFv = .text:0x804AEC20; // type:function size:0x5C
draw__Q23EGG14PostEffectBaseFff = .text:0x804AEC80; // type:function size:0x94
fn_804AED20__Q23EGG14PostEffectBaseFv = .text:0x804AED20; // type:function size:0x60
@@ -29127,7 +29127,7 @@ 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__Q34nw4r3g3d14ScnMdl1Mat1Shp = .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
@@ -39832,9 +39832,9 @@ lbl_80574F30 = .sdata:0x80574F30; // type:object size:0x8
sTextureSize__Q23EGG12LightTexture = .sdata:0x80574F38; // type:object size:0x2 data:2byte
lbl_80574F3A = .sdata:0x80574F3A; // type:object size:0x1 data:byte
lbl_80574F3C = .sdata:0x80574F3C; // type:object size:0xC
lbl_80574F48 = .sdata:0x80574F48; // type:object size:0x8 data:4byte
sByteCodeCalcStr__Q23EGG7ModelEx = .sdata:0x80574F48; // type:object size:0x8 data:4byte
lbl_80574F50 = .sdata:0x80574F50; // type:object size:0x8 data:string
lbl_80574F58 = .sdata:0x80574F58; // type:object size:0x8 data:4byte
sByteCodeMixStr__Q23EGG7ModelEx = .sdata:0x80574F58; // type:object size:0x8 data:4byte
lbl_80574F60 = .sdata:0x80574F60; // type:object size:0x4 data:4byte
lbl_80574F64 = .sdata:0x80574F64; // type:object size:0x4 data:4byte
sAudioRmtSpeakerWpadVolume__Q23EGG18AudioRmtSpeakerMgr = .sdata:0x80574F68; // type:object size:0x1 data:byte
+60 -1
View File
@@ -1,6 +1,65 @@
#ifndef EGG_MODEL_EX_H
#define EGG_MODEL_EX_H
namespace EGG {} // namespace EGG
#include "common.h"
#include "egg/egg_types.h"
#include "nw4r/g3d/g3d_scnobj.h"
#include "nw4r/g3d/res/g3d_resmdl.h"
namespace EGG {
class ModelEx {
public:
enum EType {
cType_ScnMdlSimple,
cType_ScnMdl,
cType_ScnMdl1Mat1Shp,
cType_ScnProcModel,
cType_ScnRfl,
cType_None
};
enum EFlag {
cFlag_HasOriginalBV = (1 << 0)
};
enum EDrawShape {
cDrawShape_None = (1 << 0)
};
private:
nw4r::g3d::ScnObj *mScnObj; // at 0x0
EType mType; // at 0x4
u16 mFlag; // at 0x8
ModelBoundingInfo *mpBoundingInfo; // at 0xC
static u32 sDrawFlag;
static const char *sByteCodeCalcStr;
static const char *sByteCodeMixStr;
public:
ModelEx(nw4r::g3d::ScnObj *);
void getShapeMinMax(u16, nw4r::math::VEC3 *, nw4r::math::VEC3 *, bool);
void calcWorld(nw4r::math::MTX34 *, const nw4r::math::MTX34 *worldMtx) const;
nw4r::g3d::ResMdl getResMdl(u16) const;
nw4r::g3d::ResShp getResShp(u16) const;
nw4r::g3d::ScnMdl *getScnMdl() const {
return (mType == cType_ScnMdl) ? (nw4r::g3d::ScnMdl *)mScnObj : NULL;
}
nw4r::g3d::ScnMdlSimple *getScnMdlSimple() const {
return (mType == cType_ScnMdlSimple || mType == cType_ScnMdl) ? (nw4r::g3d::ScnMdlSimple *)mScnObj : NULL;
}
nw4r::g3d::ScnMdl1Mat1Shp *getScnMdl1Mat1Shp() const {
return (mType == cType_ScnMdl1Mat1Shp) ? (nw4r::g3d::ScnMdl1Mat1Shp *)mScnObj : NULL;
}
void getMtxType0(nw4r::math::MTX34 *pMtx) const {
nw4r::math::MTX34Copy(pMtx, mScnObj->GetMtxPtr(nw4r::g3d::ScnObj::MTX_LOCAL));
}
};
} // namespace EGG
#endif
+77 -1
View File
@@ -1,3 +1,79 @@
#include "egg/gfx/eggModelEx.h"
namespace EGG {} // namespace EGG
#include "common.h"
#include "nw4r/g3d/g3d_calcworld.h"
#include "nw4r/g3d/g3d_scnmdl.h"
#include "nw4r/g3d/g3d_scnmdl1mat1shp.h"
#include "nw4r/g3d/g3d_scnmdlsmpl.h"
#include "nw4r/g3d/res/g3d_resmdl.h"
namespace EGG {
using namespace nw4r;
const char *ModelEx::sByteCodeCalcStr = "NodeTree";
const char *ModelEx::sByteCodeMixStr = "NodeMix";
ModelEx::ModelEx(g3d::ScnObj *obj)
: mType(cType_None), mScnObj(g3d::G3dObj::DynamicCast<g3d::ScnLeaf>(obj)), mFlag(0), mpBoundingInfo(nullptr) {
if (g3d::G3dObj::DynamicCast<g3d::ScnMdl>(mScnObj) != nullptr) {
mType = cType_ScnMdl;
} else if (g3d::G3dObj::DynamicCast<g3d::ScnMdlSimple>(mScnObj) != nullptr) {
mType = cType_ScnMdlSimple;
} else if (g3d::G3dObj::DynamicCast<g3d::ScnMdl1Mat1Shp>(mScnObj) != nullptr) {
mType = cType_ScnMdl1Mat1Shp;
}
}
void ModelEx::getShapeMinMax(u16 shapeIndex, math::VEC3 *pMin, math::VEC3 *pMax, bool doCalcWorld) {}
void ModelEx::calcWorld(math::MTX34 *pWorldMtxArray, const math::MTX34 *worldMtx) const {
switch (mType) {
case cType_ScnMdlSimple:
case cType_ScnMdl: {
g3d::ScnMdlSimple *pMdl = (g3d::ScnMdlSimple *)mScnObj;
// cast for regalloc
u32 *wldAttrib = (u32 *)pMdl->GetWldMtxAttribArray();
g3d::ResMdl mdl = pMdl->GetResMdl();
const math::MTX34 *worldMtx2 = worldMtx == nullptr ? pMdl->GetMtxPtr(g3d::ScnObj::MTX_WORLD) : worldMtx;
g3d::CalcWorld(
pWorldMtxArray, wldAttrib, mdl.GetResByteCode(sByteCodeCalcStr), worldMtx2, mdl, nullptr, nullptr
);
if (mdl.GetResByteCode(sByteCodeMixStr) != nullptr) {
g3d::CalcSkinning(pWorldMtxArray, wldAttrib, mdl, mdl.GetResByteCode(sByteCodeMixStr));
}
} break;
case cType_ScnMdl1Mat1Shp:
case cType_ScnProcModel:
case cType_ScnRfl: getMtxType0(pWorldMtxArray); break;
case cType_None:
default: break;
}
}
g3d::ResMdl ModelEx::getResMdl(u16) const {
g3d::ScnMdlSimple *mdl = getScnMdlSimple();
if (mdl != nullptr) {
return mdl->GetResMdl();
}
return g3d::ResMdl(nullptr);
}
g3d::ResShp ModelEx::getResShp(u16 shapeIndex) const {
g3d::ScnMdlSimple *mdl = getScnMdlSimple();
if (mdl != nullptr) {
return mdl->GetResMdl().GetResShp(shapeIndex);
}
g3d::ScnMdl1Mat1Shp *mdl1 = getScnMdl1Mat1Shp();
if (mdl1 != nullptr) {
return mdl1->GetResShp();
}
return g3d::ResShp(nullptr);
}
} // namespace EGG