Link CHUDBillboardEffect

Former-commit-id: 9c6c51e496102b1adeb6b6bf85fcbebe3fb60e15
This commit is contained in:
Luke Street 2023-10-13 00:49:09 -04:00
parent 45681935ec
commit 3fdf9c7c66
11 changed files with 50 additions and 39 deletions

View File

@ -18762,7 +18762,7 @@ __vt__8CMVEWind = .data:0x803EDCC8; // type:object size:0x10 scope:global
__vt__11CMVEGravity = .data:0x803EDCD8; // type:object size:0x10 scope:global __vt__11CMVEGravity = .data:0x803EDCD8; // type:object size:0x10 scope:global
__vt__16CMVEFastConstant = .data:0x803EDCE8; // type:object size:0x10 scope:global __vt__16CMVEFastConstant = .data:0x803EDCE8; // type:object size:0x10 scope:global
__vt__12CMVEConstant = .data:0x803EDCF8; // type:object size:0x10 scope:global __vt__12CMVEConstant = .data:0x803EDCF8; // type:object size:0x10 scope:global
__vt__12CParticleGen = .data:0x803EDD08; // type:object size:0x78 scope:global __vt__12CParticleGen = .data:0x803EDD08; // type:object size:0x78 scope:weak
__vt__15CParticleSwoosh = .data:0x803EDD80; // type:object size:0x78 scope:global __vt__15CParticleSwoosh = .data:0x803EDD80; // type:object size:0x78 scope:global
__vt__46TObjOwnerDerivedFromIObj<18CSwooshDescription> = .data:0x803EDDF8; // type:object size:0x10 scope:global __vt__46TObjOwnerDerivedFromIObj<18CSwooshDescription> = .data:0x803EDDF8; // type:object size:0x10 scope:global
__vt__15CREIntTimesReal = .data:0x803EDE08; // type:object size:0x14 scope:global __vt__15CREIntTimesReal = .data:0x803EDE08; // type:object size:0x14 scope:global

View File

@ -428,7 +428,7 @@ config.libs = [
Object(NonMatching, "MetroidPrime/CFluidPlane.cpp"), Object(NonMatching, "MetroidPrime/CFluidPlane.cpp"),
Object(NonMatching, "MetroidPrime/CFluidPlaneManager.cpp"), Object(NonMatching, "MetroidPrime/CFluidPlaneManager.cpp"),
Object(Matching, "MetroidPrime/ScriptObjects/CScriptGrapplePoint.cpp"), Object(Matching, "MetroidPrime/ScriptObjects/CScriptGrapplePoint.cpp"),
Object(NonMatching, "MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp"), Object(Matching, "MetroidPrime/ScriptObjects/CHUDBillboardEffect.cpp"),
Object(NonMatching, "MetroidPrime/Enemies/CFlickerBat.cpp"), Object(NonMatching, "MetroidPrime/Enemies/CFlickerBat.cpp"),
Object(NonMatching, "MetroidPrime/BodyState/CBodyStateCmdMgr.cpp", cflags=[*cflags_retro, "-inline auto"]), Object(NonMatching, "MetroidPrime/BodyState/CBodyStateCmdMgr.cpp", cflags=[*cflags_retro, "-inline auto"]),
Object(NonMatching, "MetroidPrime/BodyState/CBodyStateInfo.cpp"), Object(NonMatching, "MetroidPrime/BodyState/CBodyStateInfo.cpp"),

View File

@ -4,6 +4,9 @@
#include "types.h" #include "types.h"
#include "Kyoto/CRandom16.hpp" #include "Kyoto/CRandom16.hpp"
#include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/Graphics/CLight.hpp"
#include "Kyoto/Math/CAABox.hpp"
#include "Kyoto/Math/CMatrix3f.hpp" #include "Kyoto/Math/CMatrix3f.hpp"
#include "Kyoto/Math/CTransform4f.hpp" #include "Kyoto/Math/CTransform4f.hpp"
#include "Kyoto/Math/CVector3f.hpp" #include "Kyoto/Math/CVector3f.hpp"
@ -64,7 +67,7 @@ public:
virtual bool GetParticleEmission() const override; virtual bool GetParticleEmission() const override;
virtual CColor GetModulationColor() const override; virtual CColor GetModulationColor() const override;
virtual bool IsSystemDeletable() const override; virtual bool IsSystemDeletable() const override;
virtual rstl::optional_object<CAABox> GetBounds() const override; virtual rstl::optional_object< CAABox > GetBounds() const override;
virtual int GetParticleCount() const override; virtual int GetParticleCount() const override;
virtual bool SystemHasLight() const override; virtual bool SystemHasLight() const override;
virtual CLight GetLight() override; virtual CLight GetLight() override;

View File

@ -3,13 +3,14 @@
#include "Kyoto/Particles/CParticleGen.hpp" #include "Kyoto/Particles/CParticleGen.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/TToken.hpp" #include "Kyoto/TToken.hpp"
class CElectricDescription; class CElectricDescription;
class CParticleElectric : public CParticleGen { class CParticleElectric : public CParticleGen {
public: public:
explicit CParticleElectric(TToken<CElectricDescription> desc); explicit CParticleElectric(TToken< CElectricDescription > desc);
~CParticleElectric() override; ~CParticleElectric() override;
void Update(double) override; void Update(double) override;
@ -31,7 +32,7 @@ public:
bool GetParticleEmission() const override; bool GetParticleEmission() const override;
CColor GetModulationColor() const override; CColor GetModulationColor() const override;
bool IsSystemDeletable() const override; bool IsSystemDeletable() const override;
rstl::optional_object<CAABox> GetBounds() const override; rstl::optional_object< CAABox > GetBounds() const override;
int GetParticleCount() const override; int GetParticleCount() const override;
bool SystemHasLight() const override; bool SystemHasLight() const override;
CLight GetLight() override; CLight GetLight() override;
@ -39,7 +40,6 @@ public:
void AddModifier(CWarp*) override; void AddModifier(CWarp*) override;
uint Get4CharId() const override; uint Get4CharId() const override;
void SetOverrideIPos(const CVector3f& vec) { x178_overrideIPos = vec; } void SetOverrideIPos(const CVector3f& vec) { x178_overrideIPos = vec; }
void SetOverrideIVel(const CVector3f& vec) { x188_overrideIVel = vec; } void SetOverrideIVel(const CVector3f& vec) { x188_overrideIVel = vec; }
void SetOverrideFPos(const CVector3f& vec) { x198_overrideFPos = vec; } void SetOverrideFPos(const CVector3f& vec) { x198_overrideFPos = vec; }
@ -47,10 +47,10 @@ public:
private: private:
uchar x1c_pad[0x15c]; uchar x1c_pad[0x15c];
rstl::optional_object<CVector3f> x178_overrideIPos; rstl::optional_object< CVector3f > x178_overrideIPos;
rstl::optional_object<CVector3f> x188_overrideIVel; rstl::optional_object< CVector3f > x188_overrideIVel;
rstl::optional_object<CVector3f> x198_overrideFPos; rstl::optional_object< CVector3f > x198_overrideFPos;
rstl::optional_object<CVector3f> x1a8_overrideFVel; rstl::optional_object< CVector3f > x1a8_overrideFVel;
uchar x1b8_pad[0x2a0]; uchar x1b8_pad[0x2a0];
}; };
CHECK_SIZEOF(CParticleElectric, 0x458) CHECK_SIZEOF(CParticleElectric, 0x458)

View File

@ -1,22 +1,20 @@
#ifndef _CPARTICLEGEN #ifndef _CPARTICLEGEN
#define _CPARTICLEGEN #define _CPARTICLEGEN
#include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/Graphics/CLight.hpp"
#include "Kyoto/Math/CAABox.hpp"
#include "Kyoto/Math/CTransform4f.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/Particles/CWarp.hpp"
#include "rstl/list.hpp" #include "rstl/list.hpp"
#include "rstl/pair.hpp"
#include "rstl/optional_object.hpp" #include "rstl/optional_object.hpp"
#include "rstl/pair.hpp"
class CAABox;
class CColor;
class CLight;
class CTransform4f;
class CVector3f;
class CWarp; class CWarp;
class CParticleGen { class CParticleGen {
public: public:
virtual ~CParticleGen() {}; virtual ~CParticleGen() = 0;
virtual void Update(double) = 0; virtual void Update(double) = 0;
virtual void Render() const = 0; virtual void Render() const = 0;
virtual void SetOrientation(const CTransform4f& orientation) = 0; virtual void SetOrientation(const CTransform4f& orientation) = 0;
@ -37,16 +35,18 @@ public:
virtual CColor GetModulationColor() const = 0; virtual CColor GetModulationColor() const = 0;
virtual float GetGeneratorRate() const { return 1.f; } virtual float GetGeneratorRate() const { return 1.f; }
virtual bool IsSystemDeletable() const = 0; virtual bool IsSystemDeletable() const = 0;
virtual rstl::optional_object<CAABox> GetBounds() const = 0; virtual rstl::optional_object< CAABox > GetBounds() const = 0;
virtual int GetParticleCount() const = 0; virtual int GetParticleCount() const = 0;
virtual bool SystemHasLight() const = 0; virtual bool SystemHasLight() const = 0;
virtual CLight GetLight() = 0; virtual CLight GetLight() = 0;
virtual void DestroyParticles() = 0; virtual void DestroyParticles() = 0;
virtual void AddModifier(CWarp*) = 0; virtual void AddModifier(CWarp*);
virtual uint Get4CharId() const = 0; virtual uint Get4CharId() const = 0;
private: private:
rstl::list< CWarp* > x4_modifiersList; rstl::list< CWarp* > x4_modifiersList;
}; };
inline CParticleGen::~CParticleGen() {}
#endif // _CPARTICLEGEN #endif // _CPARTICLEGEN

View File

@ -90,7 +90,7 @@ public:
void SetGXRegister1Color() override; void SetGXRegister1Color() override;
void SetWorldLightFadeLevel() override; void SetWorldLightFadeLevel() override;
void Something() override; void Something() override;
void PrepareDynamicLights(const rstl::vector<CLight>& lights) override; void PrepareDynamicLights(const rstl::vector< CLight >& lights) override;
void AllocatePhazonSuitMaskTexture(); void AllocatePhazonSuitMaskTexture();

View File

@ -34,14 +34,14 @@ public:
void CalculateRenderBounds() override; void CalculateRenderBounds() override;
TUniqueId GetExplosionLightId() const { return xec_explosionLight; } TUniqueId GetExplosionLightId() const { return xec_explosionLight; }
uint GetSourceId() const { return xf0_sourceId; } CAssetId GetSourceId() const { return xf0_sourceId; }
public: public:
rstl::single_ptr< CParticleGen > xe8_particleGen; rstl::single_ptr< CParticleGen > xe8_particleGen;
TUniqueId xec_explosionLight; TUniqueId xec_explosionLight;
uint xf0_sourceId; CAssetId xf0_sourceId;
bool xf4_24_renderThermalHot : 1; bool xf4_24_renderThermalHot : 1;
bool xf4_25_ : 1; bool xf4_25_hasRenderBounds : 1;
bool xf4_26_renderXray : 1; bool xf4_26_renderXray : 1;
float xf8_time; float xf8_time;
}; };

View File

@ -2,7 +2,8 @@
#define _IWEAPONRENDERER #define _IWEAPONRENDERER
#include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/Alloc/CMemory.hpp"
#include "Kyoto/Particles/CParticleGen.hpp"
class CParticleGen;
class IWeaponRenderer { class IWeaponRenderer {
public: public:
@ -16,10 +17,4 @@ private:
inline IWeaponRenderer::~IWeaponRenderer() {} inline IWeaponRenderer::~IWeaponRenderer() {}
class CDefaultWeaponRenderer : public IWeaponRenderer {
public:
~CDefaultWeaponRenderer() {}
void AddParticleGen(const CParticleGen& gen) { gen.Render(); }
};
#endif // _IWEAPONRENDERER #endif // _IWEAPONRENDERER

View File

@ -21,7 +21,7 @@ CExplosion::CExplosion(const TLockedToken< CGenDescription >& particle, TUniqueI
, xec_explosionLight(kInvalidUniqueId) , xec_explosionLight(kInvalidUniqueId)
, xf0_sourceId(CToken(particle).GetTag().id) , xf0_sourceId(CToken(particle).GetTag().id)
, xf4_24_renderThermalHot(flags & 0x4) , xf4_24_renderThermalHot(flags & 0x4)
, xf4_25_(true) , xf4_25_hasRenderBounds(true)
, xf4_26_renderXray(flags & 0x8) , xf4_26_renderXray(flags & 0x8)
, xf8_time(0.0f) { , xf8_time(0.0f) {
SetThermalFlags(flags & 0x1 ? kTF_Cold : kTF_Hot); SetThermalFlags(flags & 0x1 ? kTF_Cold : kTF_Hot);
@ -40,9 +40,11 @@ CExplosion::CExplosion(const TLockedToken< CElectricDescription >& electric, TUn
, xec_explosionLight(kInvalidUniqueId) , xec_explosionLight(kInvalidUniqueId)
, xf0_sourceId(CToken(electric).GetTag().id) , xf0_sourceId(CToken(electric).GetTag().id)
, xf4_24_renderThermalHot(flags & 0x4) , xf4_24_renderThermalHot(flags & 0x4)
, xf4_25_(true) , xf4_25_hasRenderBounds(true)
, xf4_26_renderXray(flags & 0x8) , xf4_26_renderXray(flags & 0x8)
// , xf8_time(0.0f) #if NONMATCHING
, xf8_time(0.0f)
#endif
{ {
SetThermalFlags(flags & 0x1 ? kTF_Cold : kTF_Hot); SetThermalFlags(flags & 0x1 ? kTF_Cold : kTF_Hot);
xe8_particleGen->SetGlobalTranslation(xf.GetTranslation()); xe8_particleGen->SetGlobalTranslation(xf.GetTranslation());
@ -68,7 +70,7 @@ void CExplosion::AddToRenderer(const CFrustumPlanes& frustum, const CStateManage
void CExplosion::PreRender(CStateManager& mgr, const CFrustumPlanes& frustum) { void CExplosion::PreRender(CStateManager& mgr, const CFrustumPlanes& frustum) {
CActor::PreRender(mgr, frustum); CActor::PreRender(mgr, frustum);
SetPreRenderClipped(!xf4_25_ || !frustum.BoxInFrustumPlanes(GetRenderBoundsCached())); SetPreRenderClipped(!xf4_25_hasRenderBounds || !frustum.BoxInFrustumPlanes(GetRenderBoundsCached()));
} }
void CExplosion::Think(float dt, CStateManager& mgr) { void CExplosion::Think(float dt, CStateManager& mgr) {
@ -128,9 +130,9 @@ void CExplosion::CalculateRenderBounds() {
rstl::optional_object< CAABox > bounds = xe8_particleGen->GetBounds(); rstl::optional_object< CAABox > bounds = xe8_particleGen->GetBounds();
if (bounds) { if (bounds) {
SetRenderBounds(*bounds); SetRenderBounds(*bounds);
xf4_25_ = true; xf4_25_hasRenderBounds = true;
} else { } else {
xf4_25_ = false; xf4_25_hasRenderBounds = false;
CVector3f pos = GetTransform().GetTranslation(); CVector3f pos = GetTransform().GetTranslation();
SetRenderBounds(CAABox(pos, pos)); SetRenderBounds(CAABox(pos, pos));
} }

View File

@ -4,6 +4,7 @@
#include "MetroidPrime/CStateManager.hpp" #include "MetroidPrime/CStateManager.hpp"
#include "Kyoto/Math/CQuaternion.hpp" #include "Kyoto/Math/CQuaternion.hpp"
#include "Kyoto/Particles/CParticleGen.hpp"
#include "MetaRender/CCubeRenderer.hpp" #include "MetaRender/CCubeRenderer.hpp"
CParticleGenInfoGeneric::CParticleGenInfoGeneric(const SObjectTag& part, CParticleGenInfoGeneric::CParticleGenInfoGeneric(const SObjectTag& part,
@ -125,6 +126,8 @@ bool CParticleGenInfoGeneric::HasActiveParticles() const {
return x84_system->GetParticleCount() > 0; return x84_system->GetParticleCount() > 0;
} }
rstl::optional_object<CAABox> CParticleGenInfoGeneric::GetBounds() const { return x84_system->GetBounds(); } rstl::optional_object< CAABox > CParticleGenInfoGeneric::GetBounds() const {
return x84_system->GetBounds();
}
bool CParticleGenInfoGeneric::IsSystemDeletable() const { return x84_system->IsSystemDeletable(); } bool CParticleGenInfoGeneric::IsSystemDeletable() const { return x84_system->IsSystemDeletable(); }

View File

@ -1,4 +1,12 @@
#include "Weapons/IWeaponRenderer.hpp" #include "Weapons/IWeaponRenderer.hpp"
#include "Kyoto/Particles/CParticleGen.hpp"
class CDefaultWeaponRenderer : public IWeaponRenderer {
public:
~CDefaultWeaponRenderer() {}
void AddParticleGen(const CParticleGen& gen) { gen.Render(); }
};
static CDefaultWeaponRenderer sDefaultRenderer; static CDefaultWeaponRenderer sDefaultRenderer;
IWeaponRenderer* IWeaponRenderer::sWeaponRenderer = &sDefaultRenderer; IWeaponRenderer* IWeaponRenderer::sWeaponRenderer = &sDefaultRenderer;