CWorldTransManager lights and background

This commit is contained in:
Jack Andersen 2016-09-02 12:16:34 -10:00
parent 6d3c4261f2
commit 4fdf84d6b8
5 changed files with 18 additions and 18 deletions

View File

@ -66,7 +66,7 @@ void CActorLights::ActivateLights(CBooModel& model) const
if (!x298_26_ || !x299_26_) if (!x298_26_ || !x299_26_)
{ {
model.ActivateLights(lights); model.ActivateLights(lights);
return; //return;
} }
} }

View File

@ -24,7 +24,7 @@ CModelData::CModelData() {}
CModelData CModelData::CModelDataNull() {return CModelData();} CModelData CModelData::CModelDataNull() {return CModelData();}
CModelData::CModelData(const CStaticRes& res) CModelData::CModelData(const CStaticRes& res)
: x0_particleScale(res.GetScale()) : x0_scale(res.GetScale())
{ {
x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.GetId()}); x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.GetId()});
if (!x1c_normalModel) if (!x1c_normalModel)
@ -33,7 +33,7 @@ CModelData::CModelData(const CStaticRes& res)
} }
CModelData::CModelData(const CAnimRes& res) CModelData::CModelData(const CAnimRes& res)
: x0_particleScale(res.GetScale()) : x0_scale(res.GetScale())
{ {
TToken<CCharacterFactory> factory = g_CharFactoryBuilder->GetFactory(res); TToken<CCharacterFactory> factory = g_CharFactoryBuilder->GetFactory(res);
x10_animData = factory->CreateCharacter(res.GetCharacterNodeId(), res.CanLoop(), factory, res.GetDefaultAnim()); x10_animData = factory->CreateCharacter(res.GetCharacterNodeId(), res.CanLoop(), factory, res.GetDefaultAnim());
@ -185,25 +185,25 @@ void CModelData::AdvanceParticles(const zeus::CTransform& xf, float dt,
{ {
if (!x10_animData) if (!x10_animData)
return; return;
x10_animData->AdvanceParticles(xf, dt, x0_particleScale, stateMgr); x10_animData->AdvanceParticles(xf, dt, x0_scale, stateMgr);
} }
zeus::CAABox CModelData::GetBounds() const zeus::CAABox CModelData::GetBounds() const
{ {
if (x10_animData) if (x10_animData)
{ {
return x10_animData->GetBoundingBox(zeus::CTransform::Scale(x0_particleScale)); return x10_animData->GetBoundingBox(zeus::CTransform::Scale(x0_scale));
} }
else else
{ {
const zeus::CAABox& aabb = x1c_normalModel->GetAABB(); const zeus::CAABox& aabb = x1c_normalModel->GetAABB();
return zeus::CAABox(aabb.min * x0_particleScale, aabb.max * x0_particleScale); return zeus::CAABox(aabb.min * x0_scale, aabb.max * x0_scale);
} }
} }
zeus::CAABox CModelData::GetBounds(const zeus::CTransform& xf) const zeus::CAABox CModelData::GetBounds(const zeus::CTransform& xf) const
{ {
zeus::CTransform xf2 = xf * zeus::CTransform::Scale(x0_particleScale); zeus::CTransform xf2 = xf * zeus::CTransform::Scale(x0_scale);
if (x10_animData) if (x10_animData)
return x10_animData->GetBoundingBox(xf2); return x10_animData->GetBoundingBox(xf2);
else else
@ -214,14 +214,14 @@ zeus::CTransform CModelData::GetScaledLocatorTransformDynamic(const std::string&
const CCharAnimTime* time) const const CCharAnimTime* time) const
{ {
zeus::CTransform xf = GetLocatorTransformDynamic(name, time); zeus::CTransform xf = GetLocatorTransformDynamic(name, time);
xf.origin *= x0_particleScale; xf.origin *= x0_scale;
return xf; return xf;
} }
zeus::CTransform CModelData::GetScaledLocatorTransform(const std::string& name) const zeus::CTransform CModelData::GetScaledLocatorTransform(const std::string& name) const
{ {
zeus::CTransform xf = GetLocatorTransform(name); zeus::CTransform xf = GetLocatorTransform(name);
xf.origin *= x0_particleScale; xf.origin *= x0_scale;
return xf; return xf;
} }
@ -253,7 +253,7 @@ SAdvancementDeltas CModelData::AdvanceAnimationIgnoreParticles(float dt, CRandom
SAdvancementDeltas CModelData::AdvanceAnimation(float dt, CStateManager& stateMgr, TAreaId aid, bool advTree) SAdvancementDeltas CModelData::AdvanceAnimation(float dt, CStateManager& stateMgr, TAreaId aid, bool advTree)
{ {
if (x10_animData) if (x10_animData)
return x10_animData->Advance(dt, x0_particleScale, stateMgr, aid, advTree); return x10_animData->Advance(dt, x0_scale, stateMgr, aid, advTree);
else else
return {}; return {};
} }
@ -295,7 +295,7 @@ void CModelData::Touch(const CStateManager& stateMgr, int shaderIdx)
void CModelData::RenderThermal(const zeus::CTransform& xf, void CModelData::RenderThermal(const zeus::CTransform& xf,
const zeus::CColor& a, const zeus::CColor& b) const zeus::CColor& a, const zeus::CColor& b)
{ {
CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x0_particleScale)); CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x0_scale));
CGraphics::DisableAllLights(); CGraphics::DisableAllLights();
CModelFlags drawFlags; CModelFlags drawFlags;
drawFlags.m_extendedShaderIdx = 3; drawFlags.m_extendedShaderIdx = 3;
@ -323,7 +323,7 @@ void CModelData::RenderUnsortedParts(EWhichModel which, const zeus::CTransform&
return; return;
} }
CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x0_particleScale)); CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x0_scale));
std::unique_ptr<CBooModel>& model = PickStaticModel(which); std::unique_ptr<CBooModel>& model = PickStaticModel(which);
if (lights) if (lights)
@ -347,7 +347,7 @@ void CModelData::Render(EWhichModel which, const zeus::CTransform& xf,
} }
else else
{ {
CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x0_particleScale)); CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x0_scale));
if (x10_animData) if (x10_animData)
{ {

View File

@ -66,7 +66,7 @@ public:
class CModelData class CModelData
{ {
friend class CActor; friend class CActor;
zeus::CVector3f x0_particleScale; zeus::CVector3f x0_scale;
bool xc_ = false; bool xc_ = false;
std::unique_ptr<CAnimData> x10_animData; std::unique_ptr<CAnimData> x10_animData;
union union

View File

@ -39,10 +39,6 @@ class CTexture
void BuildC8(const void* data); void BuildC8(const void* data);
public: public:
~CTexture()
{
printf("");
}
CTexture(std::unique_ptr<u8[]>&& in, u32 length); CTexture(std::unique_ptr<u8[]>&& in, u32 length);
enum class EClampMode enum class EClampMode
{ {

View File

@ -353,6 +353,10 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes,
{ {
x4_modelData->x100_bgModelData[0] = CStaticRes(bgRes, bgScale); x4_modelData->x100_bgModelData[0] = CStaticRes(bgRes, bgScale);
x4_modelData->x100_bgModelData[0].Touch(CModelData::EWhichModel::Normal, 0); x4_modelData->x100_bgModelData[0].Touch(CModelData::EWhichModel::Normal, 0);
x4_modelData->x100_bgModelData[1] = CStaticRes(bgRes, bgScale);
x4_modelData->x100_bgModelData[1].Touch(CModelData::EWhichModel::Normal, 0);
x4_modelData->x100_bgModelData[2] = CStaticRes(bgRes, bgScale);
x4_modelData->x100_bgModelData[2].Touch(CModelData::EWhichModel::Normal, 0);
zeus::CAABox bounds = x4_modelData->x100_bgModelData[0].GetBounds(); zeus::CAABox bounds = x4_modelData->x100_bgModelData[0].GetBounds();
x1c_bgHeight = (bounds.max.z - bounds.min.z) * bgScale.z; x1c_bgHeight = (bounds.max.z - bounds.min.z) * bgScale.z;
} }