mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-01 01:08:48 -04:00
shadow fix
This commit is contained in:
@@ -7,11 +7,7 @@
|
||||
#include "SSystem/SComponent/c_bg_s_poly_pass_chk.h"
|
||||
#include "dusk/endian.h"
|
||||
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
struct cBgD_Vtx_t : public BE(Vec) {};
|
||||
#else
|
||||
struct cBgD_Vtx_t : public Vec {};
|
||||
#endif
|
||||
|
||||
class cBgS_Chk {
|
||||
public:
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
virtual ~cM3dGTri() {}
|
||||
bool cross(const cM3dGCyl*, Vec*) const;
|
||||
void setPos(const Vec*, const Vec*, const Vec*);
|
||||
void setBg(const BE(Vec)*, const BE(Vec)*, const BE(Vec)*, const cM3dGPla*);
|
||||
void setBg(const Vec*, const Vec*, const Vec*, const cM3dGPla*);
|
||||
void set(const Vec*, const Vec*, const Vec*, const Vec*);
|
||||
bool Cross(cM3dGCps const& cps, cXyz* xyz) const { return cM3d_Cross_CpsTri(cps, *this, xyz); }
|
||||
bool Cross(cM3dGCyl const& cyl, cXyz* xyz) const { return this->cross(&cyl, xyz); }
|
||||
|
||||
@@ -20,7 +20,7 @@ void cM3dGTri::setPos(const Vec* vtx_a, const Vec* vtx_b, const Vec* vtx_c) {
|
||||
JUT_ASSERT(99, !cM3d_IsZero(GetNP()->x) || !cM3d_IsZero(GetNP()->y) || !cM3d_IsZero(GetNP()->z));
|
||||
}
|
||||
|
||||
void cM3dGTri::setBg(const BE(Vec)* vtx_a, const BE(Vec)* vtx_b, const BE(Vec)* vtx_c, const cM3dGPla* plane) {
|
||||
void cM3dGTri::setBg(const Vec* vtx_a, const Vec* vtx_b, const Vec* vtx_c, const cM3dGPla* plane) {
|
||||
mA.x = vtx_a->x;
|
||||
mA.y = vtx_a->y;
|
||||
mA.z = vtx_a->z;
|
||||
|
||||
+17
-38
@@ -138,46 +138,18 @@ f32 cBgS::GroundCross(cBgS_GndChk* p_gnd) {
|
||||
return p_gnd->GetNowY();
|
||||
}
|
||||
|
||||
// this is identical to cBgD_t except using u32's for the table offsets.
|
||||
// u32 is needed to match in ConvDzb ?
|
||||
struct cBgD_t_ {
|
||||
// Vertex Info
|
||||
/* 0x00 */ BE(int) m_v_num;
|
||||
/* 0x04 */ OFFSET_PTR_RAW m_v_tbl;
|
||||
|
||||
// Triangle Info
|
||||
/* 0x08 */ BE(int) m_t_num;
|
||||
/* 0x0C */ OFFSET_PTR_RAW m_t_tbl;
|
||||
|
||||
// Spatial List Info
|
||||
/* 0x10 */ BE(int) m_b_num;
|
||||
/* 0x14 */ OFFSET_PTR_RAW m_b_tbl;
|
||||
|
||||
// Face Group Data Info
|
||||
/* 0x18 */ BE(int) m_tree_num;
|
||||
/* 0x1C */ OFFSET_PTR_RAW m_tree_tbl;
|
||||
|
||||
// String Group Info
|
||||
/* 0x20 */ BE(int) m_g_num;
|
||||
/* 0x24 */ OFFSET_PTR_RAW m_g_tbl;
|
||||
|
||||
// Surface Property Info
|
||||
/* 0x28 */ BE(int) m_ti_num;
|
||||
/* 0x2C */ OFFSET_PTR_RAW m_ti_tbl;
|
||||
|
||||
/* 0x30 */ u32 m_flags;
|
||||
}; // Size: 0x34
|
||||
|
||||
struct cBgD_Grp_t_ {
|
||||
OFFSET_PTR_RAW strOffset;
|
||||
u8 data[0x30];
|
||||
};
|
||||
template <>
|
||||
void be_swap(cBgD_Vtx_t& val) {
|
||||
be_swap(val.x);
|
||||
be_swap(val.y);
|
||||
be_swap(val.z);
|
||||
}
|
||||
|
||||
void* cBgS::ConvDzb(void* p_dzb) {
|
||||
cBgD_t_* pbgd = (cBgD_t_*)p_dzb;
|
||||
cBgD_t* pbgd = (cBgD_t*)p_dzb;
|
||||
|
||||
if (((pbgd->m_flags & 0x80000000) == 0)) {
|
||||
pbgd->m_flags |= 0x80000000;
|
||||
if (((pbgd->mFlags & 0x80000000) == 0)) {
|
||||
pbgd->mFlags |= 0x80000000;
|
||||
} else {
|
||||
return p_dzb;
|
||||
}
|
||||
@@ -191,8 +163,15 @@ void* cBgS::ConvDzb(void* p_dzb) {
|
||||
pbgd->m_ti_tbl.setBase(p_dzb);
|
||||
|
||||
for (int i = 0; i < pbgd->m_g_num; i++) {
|
||||
((cBgD_Grp_t_*)pbgd->m_g_tbl)[i].strOffset.setBase(p_dzb);
|
||||
((cBgD_Grp_t*)pbgd->m_g_tbl)[i].m_name.setBase(p_dzb);
|
||||
}
|
||||
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
for (int i = 0; i < pbgd->m_v_num; i++) {
|
||||
be_swap(pbgd->m_v_tbl[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
if (pbgd->m_v_tbl != 0) {
|
||||
pbgd->m_v_tbl += (uintptr_t)p_dzb;
|
||||
|
||||
+2
-15
@@ -60,25 +60,12 @@ void cBgW::GlobalVtx() {
|
||||
if (pm_base != NULL) {
|
||||
if (!mNeedsFullTransform) {
|
||||
for (int i = 0; i < pm_bgd->m_v_num; i++) {
|
||||
BE(Vec)* vtx = &pm_vtx_tbl[i];
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
Vec copy = *vtx;
|
||||
VECAdd(©, &mTransVel, ©);
|
||||
*vtx = copy;
|
||||
#else
|
||||
Vec* vtx = &pm_vtx_tbl[i];
|
||||
VECAdd(vtx, &mTransVel, vtx);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < pm_bgd->m_v_num; i++) {
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
Vec copy1 = pm_bgd->m_v_tbl[i];
|
||||
Vec copy2;
|
||||
MTXMultVec(pm_base, ©1, ©2);
|
||||
*(BE(Vec)*)&pm_vtx_tbl[i] = copy2;
|
||||
#else
|
||||
MTXMultVec(pm_base, &pm_bgd->m_v_tbl[i], &pm_vtx_tbl[i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,7 +200,7 @@ void cBgW::MakeBlckTransMinMax(cXyz* i_min, cXyz* i_max) {
|
||||
}
|
||||
|
||||
void cBgW::MakeBlckMinMax(int vtx_index, cXyz* i_min, cXyz* i_max) {
|
||||
BE(Vec)* vtx = &pm_vtx_tbl[vtx_index];
|
||||
cBgD_Vtx_t* vtx = &pm_vtx_tbl[vtx_index];
|
||||
|
||||
if (i_min->x > vtx->x) {
|
||||
i_min->x = vtx->x;
|
||||
|
||||
Reference in New Issue
Block a user