mirror of
https://github.com/zeldaret/tww.git
synced 2026-06-18 07:05:27 -04:00
c_bg_w work
This commit is contained in:
@@ -24,23 +24,25 @@ public:
|
||||
void SetMax(const cXyz&);
|
||||
const cXyz* GetMaxP(void) const { return &mMax; }
|
||||
const cXyz* GetMinP(void) const { return &mMin; }
|
||||
cXyz* GetMaxP(void) { return &mMax; }
|
||||
cXyz* GetMinP(void) { return &mMin; }
|
||||
const f32 GetMaxX(void) const { return mMax.x; }
|
||||
const f32 GetMaxY(void) const { return mMax.y; }
|
||||
const f32 GetMaxZ(void) const { return mMax.z; }
|
||||
const f32 GetMinX(void) const { return mMin.x; }
|
||||
const f32 GetMinY(void) const { return mMin.y; }
|
||||
const f32 GetMinZ(void) const { return mMin.z; }
|
||||
bool Cross(const cM3dGAab *param_1) {
|
||||
return cM3d_Cross_AabAab(this, param_1);
|
||||
bool Cross(const cM3dGAab *aab) {
|
||||
return cM3d_Cross_AabAab(this, aab);
|
||||
}
|
||||
bool Cross(const cM3dGCyl *param_1) {
|
||||
return cM3d_Cross_AabCyl(this, param_1);
|
||||
bool Cross(const cM3dGCyl *cyl) {
|
||||
return cM3d_Cross_AabCyl(this, cyl);
|
||||
}
|
||||
bool Cross(const cM3dGSph *param_1) {
|
||||
return cM3d_Cross_AabSph(this, param_1);
|
||||
bool Cross(const cM3dGSph *sph) {
|
||||
return cM3d_Cross_AabSph(this, sph);
|
||||
}
|
||||
bool Cross(const cM3dGLin *param_1) {
|
||||
return cM3d_Cross_MinMaxBoxLine(GetMinP(), GetMaxP(), param_1->GetStartP(), param_1->GetEndP());
|
||||
bool Cross(const cM3dGLin *lin) {
|
||||
return cM3d_Cross_MinMaxBoxLine(GetMinP(), GetMaxP(), lin->GetStartP(), lin->GetEndP());
|
||||
}
|
||||
void CalcCenter(cXyz* pOut) const {
|
||||
VECAdd(&mMin, &mMax, pOut);
|
||||
|
||||
@@ -204,42 +204,43 @@ void cBgW::MakeBlckBnd(int, cXyz*, cXyz*) {
|
||||
|
||||
/* 80247E48-80247F4C .text MakeNodeTreeRp__4cBgWFi */
|
||||
void cBgW::MakeNodeTreeRp(int i) {
|
||||
/* Nonmatching */
|
||||
const cBgD_Tree_t* tree = &pm_bgd->m_tree_tbl[i];
|
||||
if (tree->mFlag & 1) {
|
||||
// leaf
|
||||
if (tree->mBlock != 0xFFFF) {
|
||||
MakeBlckBnd(tree->mBlock, &pm_node_tree[i].mMin, &pm_node_tree[i].mMax);
|
||||
s32 block = tree->mBlock;
|
||||
if (block != 0xFFFF) {
|
||||
MakeBlckBnd(tree->mBlock, pm_node_tree[i].GetMinP(), pm_node_tree[i].GetMaxP());
|
||||
}
|
||||
} else {
|
||||
// branch
|
||||
pm_node_tree[i].ClearForMinMax();
|
||||
for (s32 j = 0; j < 8; j++) {
|
||||
u16 child = tree->mChild[j];
|
||||
s32 child = tree->mChild[j];
|
||||
if (child == 0xFFFF)
|
||||
continue;
|
||||
MakeNodeTreeRp(child);
|
||||
pm_node_tree[j].SetMinMax(pm_node_tree[child].mMin);
|
||||
pm_node_tree[j].SetMinMax(pm_node_tree[child].mMax);
|
||||
pm_node_tree[i].SetMinMax(*pm_node_tree[child].GetMinP());
|
||||
pm_node_tree[i].SetMinMax(*pm_node_tree[child].GetMaxP());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 80247F4C-80248078 .text MakeNodeTreeGrpRp__4cBgWFi */
|
||||
void cBgW::MakeNodeTreeGrpRp(int grp_idx) {
|
||||
/* Nonmatching */
|
||||
u32 tree_idx = pm_bgd->m_g_tbl[grp_idx].m_tree_idx;
|
||||
if (tree_idx != 0xFFFF) {
|
||||
MakeNodeTreeRp(tree_idx);
|
||||
pm_grp[grp_idx].aab.SetMin(pm_node_tree[pm_bgd->m_g_tbl[grp_idx].m_tree_idx].mMin);
|
||||
pm_grp[grp_idx].aab.SetMax(pm_node_tree[pm_bgd->m_g_tbl[grp_idx].m_tree_idx].mMax);
|
||||
pm_grp[grp_idx].aab.SetMin(*pm_node_tree[pm_bgd->m_g_tbl[grp_idx].m_tree_idx].GetMinP());
|
||||
pm_grp[grp_idx].aab.SetMax(*pm_node_tree[pm_bgd->m_g_tbl[grp_idx].m_tree_idx].GetMaxP());
|
||||
}
|
||||
|
||||
u32 child_idx = pm_bgd->m_g_tbl[grp_idx].m_first_child;
|
||||
s32 child_idx = pm_bgd->m_g_tbl[grp_idx].m_first_child;
|
||||
while (true) {
|
||||
if (child_idx == 0xFFFF)
|
||||
break;
|
||||
MakeNodeTreeGrpRp(child_idx);
|
||||
pm_grp[grp_idx].aab.SetMin(pm_grp[child_idx].aab.mMin);
|
||||
pm_grp[grp_idx].aab.SetMax(pm_grp[child_idx].aab.mMax);
|
||||
pm_grp[grp_idx].aab.SetMin(*pm_grp[child_idx].aab.GetMinP());
|
||||
pm_grp[grp_idx].aab.SetMax(*pm_grp[child_idx].aab.GetMaxP());
|
||||
child_idx = pm_bgd->m_g_tbl[child_idx].m_next_sibling;
|
||||
}
|
||||
}
|
||||
@@ -502,7 +503,6 @@ void cBgW::ShdwDrawRp(cBgS_ShdwDraw* shdw, int i) {
|
||||
|
||||
/* 80249840-80249904 .text ShdwDrawGrpRp__4cBgWFP13cBgS_ShdwDrawi */
|
||||
void cBgW::ShdwDrawGrpRp(cBgS_ShdwDraw* shdw, int grp_idx) {
|
||||
/* Nonmatching */
|
||||
if (!pm_grp[grp_idx].aab.Cross(shdw->GetBndP()))
|
||||
return;
|
||||
|
||||
@@ -511,14 +511,13 @@ void cBgW::ShdwDrawGrpRp(cBgS_ShdwDraw* shdw, int grp_idx) {
|
||||
ShdwDrawRp(shdw, tree_idx);
|
||||
}
|
||||
|
||||
u32 child_idx = pm_bgd->m_g_tbl[grp_idx].m_first_child;
|
||||
s32 child_idx = pm_bgd->m_g_tbl[grp_idx].m_first_child;
|
||||
while (true) {
|
||||
if (child_idx == 0xFFFF)
|
||||
break;
|
||||
ShdwDrawGrpRp(shdw, child_idx);
|
||||
child_idx = pm_bgd->m_g_tbl[child_idx].m_next_sibling;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* 80249904-8024990C .text ChkPolyThrough__4cBgWFiP16cBgS_PolyPassChk */
|
||||
|
||||
Reference in New Issue
Block a user