CParticleGen inheritance fix

This commit is contained in:
Jack Andersen 2016-02-12 19:49:59 -10:00
parent 5f4eee538d
commit acf65c561a
14 changed files with 367 additions and 72 deletions

View File

@ -246,8 +246,6 @@ public:
TLockedToken(const CToken& other) : TToken<T>(other) {m_obj = TToken<T>::GetObj();}
TLockedToken(CToken&& other) : TToken<T>(std::move(other)) {m_obj = TToken<T>::GetObj();}
T* GetObj() {return m_obj;}
template <class U>
U* CastObj() {return static_cast<U*>(m_obj);}
};
}

View File

@ -5,7 +5,7 @@
namespace Retro
{
class CElectricDescription : public IGenDescription
class CElectricDescription
{
};
}

View File

@ -46,7 +46,7 @@ void CElementGen::Initialize()
g_StaticListInitialized = true;
}
CElementGen::CElementGen(const TToken<IGenDescription>& gen) : x1c_genDesc(gen), x230_randState(x74_randomSeed) {}
CElementGen::CElementGen(const TToken<CGenDescription>& gen) : x1c_genDesc(gen), x230_randState(x74_randomSeed) {}
CElementGen::CElementGen(const TToken<CGenDescription>& gen,
EModelOrientationType orientType,
@ -54,7 +54,7 @@ CElementGen::CElementGen(const TToken<CGenDescription>& gen,
: x1c_genDesc(gen), x28_orientType(orientType),
x226_enableOPTS((flags & EOptionalSystemFlags::Two) != EOptionalSystemFlags::None), x230_randState(x74_randomSeed)
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
CIntElement* seedElem = desc->x1c_SEED.get();
if (seedElem)
@ -207,7 +207,7 @@ CElementGen::~CElementGen()
void CElementGen::Update(double t)
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
CIntElement* pswtElem = desc->x10_PSWT.get();
if (pswtElem && !x225_28_warmedUp)
{
@ -228,7 +228,7 @@ void CElementGen::Update(double t)
bool CElementGen::InternalUpdate(double dt)
{
CGlobalRandom gr(x230_randState);
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
double dt1 = 1 / 60.0;
if (fabs(dt - 1 / 60.0) >= 1 / 60000.0)
@ -326,7 +326,7 @@ void CElementGen::AccumulateBounds(Zeus::CVector3f& pos, float size)
void CElementGen::UpdateExistingParticles()
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
x208_activeParticleCount = 0;
CParticleGlobals::SetEmitterTime(x50_curFrame);
@ -469,7 +469,7 @@ void CElementGen::UpdateExistingParticles()
void CElementGen::CreateNewParticles(int count)
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
if (!g_StaticListInitialized)
Initialize();
@ -561,7 +561,7 @@ void CElementGen::CreateNewParticles(int count)
void CElementGen::UpdatePSTranslationAndOrientation()
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
CGlobalRandom gr(x230_randState);
if (x214_PSLT < x50_curFrame)
@ -626,7 +626,7 @@ CElementGen* CElementGen::ConstructChildParticleSystem(const TToken<CGenDescript
void CElementGen::UpdateChildParticleSystems(double dt)
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
CGlobalRandom gr(x230_randState);
SChildGeneratorDesc& icts = desc->x8c_ICTS;
@ -793,7 +793,7 @@ void CElementGen::UpdateChildParticleSystems(double dt)
void CElementGen::UpdateLightParameters()
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
CColorElement* lclr = desc->x104_LCLR.get();
if (lclr)
@ -926,7 +926,7 @@ u32 CElementGen::GetSystemCount()
void CElementGen::Render()
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
x22c_backupLightActive = CGraphics::g_LightActive;
CGraphics::DisableAllLights();
@ -959,7 +959,7 @@ void CElementGen::Render()
void CElementGen::RenderModels()
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
if (x225_29_modelsUseLights)
CGraphics::SetLightState(x22c_backupLightActive);
@ -1153,7 +1153,7 @@ void CElementGen::RenderLines()
void CElementGen::RenderParticles()
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
CGlobalRandom gr(x230_randState);
CUVElement* texr = desc->x54_TEXR.get();
@ -1438,7 +1438,7 @@ void CElementGen::RenderParticles()
void CElementGen::RenderParticlesIndirectTexture()
{
CGenDescription* desc = x1c_genDesc.CastObj<CGenDescription>();
CGenDescription* desc = x1c_genDesc.GetObj();
}
@ -1585,6 +1585,16 @@ const Zeus::CVector3f& CElementGen::GetTranslation() const
return x7c_translation;
}
const Zeus::CTransform& CElementGen::GetGlobalOrientation() const
{
return x1d8_globalOrientation;
}
const Zeus::CVector3f& CElementGen::GetGlobalTranslation() const
{
return x88_globalTranslation;
}
const Zeus::CVector3f& CElementGen::GetGlobalScale() const
{
return xa0_globalScale;
@ -1656,6 +1666,11 @@ CLight CElementGen::GetLight() const
}
}
bool CElementGen::GetParticleEmission() const
{
return x68_particleEmission;
}
void CElementGen::DestroyParticles()
{
for (CParticleListItem& p : x2c_particleLists)
@ -1674,9 +1689,4 @@ void CElementGen::DestroyParticles()
ch->DestroyParticles();
}
void CElementGen::AddModifier(CWarp* mod)
{
x8_modifierList.push_back(mod);
}
}

View File

@ -10,7 +10,7 @@
#include "CLight.hpp"
#include "CGraphics.hpp"
#include "CRandom16.hpp"
#include "CWarp.hpp"
#include "CParticleGen.hpp"
namespace Retro
{
@ -21,7 +21,7 @@ class CGenDescription;
class CParticleSwoosh;
class CParticleElectric;
class CElementGen
class CElementGen : public CParticleGen
{
public:
enum class EModelOrientationType
@ -71,9 +71,9 @@ public:
Zeus::CColor x34_color = {0.f, 0.f, 0.f, 1.f};
};
protected:
CElementGen(const TToken<IGenDescription>& gen);
std::list<CWarp*> x8_modifierList;
TLockedToken<IGenDescription> x1c_genDesc;
CElementGen(const TToken<CGenDescription>& gen);
TLockedToken<CGenDescription> x1c_genDesc;
EModelOrientationType x28_orientType;
std::vector<CParticleListItem> x2c_particleLists;
std::vector<Zeus::CMatrix3f> x3c_parentMatrices;
@ -153,14 +153,14 @@ protected:
public:
CElementGen(const TToken<CGenDescription>& gen, EModelOrientationType orientType, EOptionalSystemFlags flags);
virtual ~CElementGen();
~CElementGen();
virtual const Zeus::CVector3f& GetGlobalTranslation() const
{ return x88_globalTranslation; }
virtual const Zeus::CTransform& GetGlobalOrientation() const
{ return x1d8_globalOrientation; }
virtual bool GetParticleEmission() const
{ return x68_particleEmission; }
static s32 g_FreeIndex;
static bool g_StaticListInitialized;
static int g_ParticleAliveCount;
static int g_ParticleSystemAliveCount;
static bool g_MoveRedToAlphaBuffer;
static void Initialize();
void SetGeneratorRateScalar(float scalar)
{
@ -176,13 +176,6 @@ public:
child->SetGeneratorRateScalar(x78_generatorRate);
}
static s32 g_FreeIndex;
static bool g_StaticListInitialized;
static int g_ParticleAliveCount;
static int g_ParticleSystemAliveCount;
static bool g_MoveRedToAlphaBuffer;
static void Initialize();
void UpdateExistingParticles();
void CreateNewParticles(int);
void UpdatePSTranslationAndOrientation();
@ -194,33 +187,35 @@ public:
u32 GetParticleCountAllInternal() const;
u32 GetParticleCountAll() const {return x20c_recursiveParticleCount;}
bool InternalUpdate(double);
void RenderModels();
void RenderLines();
void RenderParticles();
void RenderParticlesIndirectTexture();
virtual void Update(double);
bool InternalUpdate(double);
virtual void Render();
virtual void SetOrientation(const Zeus::CTransform&);
virtual void SetTranslation(const Zeus::CVector3f&);
virtual void SetGlobalOrientation(const Zeus::CTransform&);
virtual void SetGlobalTranslation(const Zeus::CVector3f&);
virtual void SetGlobalScale(const Zeus::CVector3f&);
virtual void SetLocalScale(const Zeus::CVector3f&);
virtual void SetParticleEmission(bool);
virtual void SetModulationColor(const Zeus::CColor&);
virtual const Zeus::CTransform& GetOrientation() const;
virtual const Zeus::CVector3f& GetTranslation() const;
virtual const Zeus::CVector3f& GetGlobalScale() const;
virtual const Zeus::CColor& GetModulationColor() const;
virtual bool IsSystemDeletable() const;
virtual std::pair<Zeus::CAABox, bool> GetBounds() const;
virtual u32 GetParticleCount() const;
virtual bool SystemHasLight() const;
virtual CLight GetLight() const;
virtual void DestroyParticles();
virtual void AddModifier(CWarp*);
void Update(double);
void Render();
void SetOrientation(const Zeus::CTransform&);
void SetTranslation(const Zeus::CVector3f&);
void SetGlobalOrientation(const Zeus::CTransform&);
void SetGlobalTranslation(const Zeus::CVector3f&);
void SetGlobalScale(const Zeus::CVector3f&);
void SetLocalScale(const Zeus::CVector3f&);
void SetParticleEmission(bool);
void SetModulationColor(const Zeus::CColor&);
const Zeus::CTransform& GetOrientation() const;
const Zeus::CVector3f& GetTranslation() const;
const Zeus::CTransform& GetGlobalOrientation() const;
const Zeus::CVector3f& GetGlobalTranslation() const;
const Zeus::CVector3f& GetGlobalScale() const;
const Zeus::CColor& GetModulationColor() const;
bool IsSystemDeletable() const;
std::pair<Zeus::CAABox, bool> GetBounds() const;
u32 GetParticleCount() const;
bool SystemHasLight() const;
CLight GetLight() const;
bool GetParticleEmission() const;
void DestroyParticles();
};
ENABLE_BITWISE_ENUM(CElementGen::EOptionalSystemFlags)

View File

@ -15,7 +15,7 @@
namespace Retro
{
class CGenDescription : public IGenDescription
class CGenDescription
{
public:
std::unique_ptr<CVectorElement> x0_PSIV;

View File

@ -19,6 +19,7 @@ add_library(RuntimeCommonParticle
CParticleSwoosh.hpp CParticleSwoosh.cpp
CParticleElectricDataFactory.hpp CParticleElectricDataFactory.cpp
CParticleElectric.hpp CParticleElectric.cpp
CParticleGen.hpp CParticleGen.cpp
CDecalManager.hpp CDecalManager.cpp
CSpawnSystemKeyframeData.hpp CSpawnSystemKeyframeData.cpp
CWarp.hpp CWarp.cpp

View File

@ -22,8 +22,6 @@ class CVectorElement;
class CRealElement;
class CIntElement;
class IGenDescription {};
struct SParticleModel
{
TLockedToken<CModel> m_model;

View File

@ -4,7 +4,98 @@ namespace Retro
{
CParticleElectric::CParticleElectric(const TToken<CElectricDescription>& desc)
: CElementGen(desc)
{
}
void CParticleElectric::Update(double)
{
}
void CParticleElectric::Render()
{
}
void CParticleElectric::SetOrientation(const Zeus::CTransform&)
{
}
void CParticleElectric::SetTranslation(const Zeus::CVector3f&)
{
}
void CParticleElectric::SetGlobalOrientation(const Zeus::CTransform&)
{
}
void CParticleElectric::SetGlobalTranslation(const Zeus::CVector3f&)
{
}
void CParticleElectric::SetGlobalScale(const Zeus::CVector3f&)
{
}
void CParticleElectric::SetLocalScale(const Zeus::CVector3f&)
{
}
void CParticleElectric::SetParticleEmission(bool)
{
}
void CParticleElectric::SetModulationColor(const Zeus::CColor&)
{
}
const Zeus::CTransform& CParticleElectric::GetOrientation() const
{
}
const Zeus::CVector3f& CParticleElectric::GetTranslation() const
{
}
const Zeus::CTransform& CParticleElectric::GetGlobalOrientation() const
{
}
const Zeus::CVector3f& CParticleElectric::GetGlobalTranslation() const
{
}
const Zeus::CVector3f& CParticleElectric::GetGlobalScale() const
{
}
const Zeus::CColor& CParticleElectric::GetModulationColor() const
{
}
bool CParticleElectric::IsSystemDeletable() const
{
}
std::pair<Zeus::CAABox, bool> CParticleElectric::GetBounds() const
{
}
u32 CParticleElectric::GetParticleCount() const
{
}
bool CParticleElectric::SystemHasLight() const
{
}
CLight CParticleElectric::GetLight() const
{
}
bool CParticleElectric::GetParticleEmission() const
{
}
void CParticleElectric::DestroyParticles()
{
}

View File

@ -1,16 +1,41 @@
#ifndef __RETRO_CPARTICLEELECTRIC_HPP__
#define __RETRO_CPARTICLEELECTRIC_HPP__
#include "CElementGen.hpp"
#include "CParticleGen.hpp"
#include "CToken.hpp"
namespace Retro
{
class CElectricDescription;
class CParticleElectric : public CElementGen
class CParticleElectric : public CParticleGen
{
public:
CParticleElectric(const TToken<CElectricDescription>& desc);
void Update(double);
void Render();
void SetOrientation(const Zeus::CTransform&);
void SetTranslation(const Zeus::CVector3f&);
void SetGlobalOrientation(const Zeus::CTransform&);
void SetGlobalTranslation(const Zeus::CVector3f&);
void SetGlobalScale(const Zeus::CVector3f&);
void SetLocalScale(const Zeus::CVector3f&);
void SetParticleEmission(bool);
void SetModulationColor(const Zeus::CColor&);
const Zeus::CTransform& GetOrientation() const;
const Zeus::CVector3f& GetTranslation() const;
const Zeus::CTransform& GetGlobalOrientation() const;
const Zeus::CVector3f& GetGlobalTranslation() const;
const Zeus::CVector3f& GetGlobalScale() const;
const Zeus::CColor& GetModulationColor() const;
bool IsSystemDeletable() const;
std::pair<Zeus::CAABox, bool> GetBounds() const;
u32 GetParticleCount() const;
bool SystemHasLight() const;
CLight GetLight() const;
bool GetParticleEmission() const;
void DestroyParticles();
};
}

View File

@ -0,0 +1,11 @@
#include "CParticleGen.hpp"
namespace Retro
{
void CParticleGen::AddModifier(CWarp* mod)
{
x8_modifierList.push_back(mod);
}
}

View File

@ -0,0 +1,51 @@
#ifndef __RETRO_CPARTICLEGEN_HPP__
#define __RETRO_CPARTICLEGEN_HPP__
#include "RetroTypes.hpp"
#include "CLight.hpp"
#include "CWarp.hpp"
#include "CColor.hpp"
#include "CVector3f.hpp"
#include "CTransform.hpp"
#include "CAABox.hpp"
#include <list>
namespace Retro
{
class CParticleGen
{
std::list<CWarp*> x8_modifierList;
public:
virtual ~CParticleGen() = default;
virtual void Update(double)=0;
virtual void Render()=0;
virtual void SetOrientation(const Zeus::CTransform&)=0;
virtual void SetTranslation(const Zeus::CVector3f&)=0;
virtual void SetGlobalOrientation(const Zeus::CTransform&)=0;
virtual void SetGlobalTranslation(const Zeus::CVector3f&)=0;
virtual void SetGlobalScale(const Zeus::CVector3f&)=0;
virtual void SetLocalScale(const Zeus::CVector3f&)=0;
virtual void SetParticleEmission(bool)=0;
virtual void SetModulationColor(const Zeus::CColor&)=0;
virtual const Zeus::CTransform& GetOrientation() const=0;
virtual const Zeus::CVector3f& GetTranslation() const=0;
virtual const Zeus::CTransform& GetGlobalOrientation() const=0;
virtual const Zeus::CVector3f& GetGlobalTranslation() const=0;
virtual const Zeus::CVector3f& GetGlobalScale() const=0;
virtual const Zeus::CColor& GetModulationColor() const=0;
virtual bool IsSystemDeletable() const=0;
virtual std::pair<Zeus::CAABox, bool> GetBounds() const=0;
virtual u32 GetParticleCount() const=0;
virtual bool SystemHasLight() const=0;
virtual CLight GetLight() const=0;
virtual bool GetParticleEmission() const=0;
virtual void DestroyParticles()=0;
virtual void AddModifier(CWarp* mod);
};
}
#endif // __RETRO_CPARTICLEGEN_HPP__

View File

@ -4,7 +4,98 @@ namespace Retro
{
CParticleSwoosh::CParticleSwoosh(const TToken<CSwooshDescription>& desc, int)
: CElementGen(desc)
{
}
void CParticleSwoosh::Update(double)
{
}
void CParticleSwoosh::Render()
{
}
void CParticleSwoosh::SetOrientation(const Zeus::CTransform&)
{
}
void CParticleSwoosh::SetTranslation(const Zeus::CVector3f&)
{
}
void CParticleSwoosh::SetGlobalOrientation(const Zeus::CTransform&)
{
}
void CParticleSwoosh::SetGlobalTranslation(const Zeus::CVector3f&)
{
}
void CParticleSwoosh::SetGlobalScale(const Zeus::CVector3f&)
{
}
void CParticleSwoosh::SetLocalScale(const Zeus::CVector3f&)
{
}
void CParticleSwoosh::SetParticleEmission(bool)
{
}
void CParticleSwoosh::SetModulationColor(const Zeus::CColor&)
{
}
const Zeus::CTransform& CParticleSwoosh::GetOrientation() const
{
}
const Zeus::CVector3f& CParticleSwoosh::GetTranslation() const
{
}
const Zeus::CTransform& CParticleSwoosh::GetGlobalOrientation() const
{
}
const Zeus::CVector3f& CParticleSwoosh::GetGlobalTranslation() const
{
}
const Zeus::CVector3f& CParticleSwoosh::GetGlobalScale() const
{
}
const Zeus::CColor& CParticleSwoosh::GetModulationColor() const
{
}
bool CParticleSwoosh::IsSystemDeletable() const
{
}
std::pair<Zeus::CAABox, bool> CParticleSwoosh::GetBounds() const
{
}
u32 CParticleSwoosh::GetParticleCount() const
{
}
bool CParticleSwoosh::SystemHasLight() const
{
}
CLight CParticleSwoosh::GetLight() const
{
}
bool CParticleSwoosh::GetParticleEmission() const
{
}
void CParticleSwoosh::DestroyParticles()
{
}

View File

@ -1,17 +1,41 @@
#ifndef __RETRO_CPARTICLESWOOSH_HPP__
#define __RETRO_CPARTICLESWOOSH_HPP__
#include "CElementGen.hpp"
#include "CParticleGen.hpp"
#include "CToken.hpp"
namespace Retro
{
class CSwooshDescription;
class CParticleSwoosh : public CElementGen
class CParticleSwoosh : public CParticleGen
{
public:
CParticleSwoosh(const TToken<CSwooshDescription>& desc, int);
void Update(double);
void Render();
void SetOrientation(const Zeus::CTransform&);
void SetTranslation(const Zeus::CVector3f&);
void SetGlobalOrientation(const Zeus::CTransform&);
void SetGlobalTranslation(const Zeus::CVector3f&);
void SetGlobalScale(const Zeus::CVector3f&);
void SetLocalScale(const Zeus::CVector3f&);
void SetParticleEmission(bool);
void SetModulationColor(const Zeus::CColor&);
const Zeus::CTransform& GetOrientation() const;
const Zeus::CVector3f& GetTranslation() const;
const Zeus::CTransform& GetGlobalOrientation() const;
const Zeus::CVector3f& GetGlobalTranslation() const;
const Zeus::CVector3f& GetGlobalScale() const;
const Zeus::CColor& GetModulationColor() const;
bool IsSystemDeletable() const;
std::pair<Zeus::CAABox, bool> GetBounds() const;
u32 GetParticleCount() const;
bool SystemHasLight() const;
CLight GetLight() const;
bool GetParticleEmission() const;
void DestroyParticles();
};
}

View File

@ -5,7 +5,7 @@
namespace Retro
{
class CSwooshDescription : public IGenDescription
class CSwooshDescription
{
};
}