Implement IWeaponRenderer, can't link yet due to vtable shenanigans

Former-commit-id: ba035cfa44
This commit is contained in:
Phillip Stephens 2022-08-11 02:24:45 -07:00
parent d1768a3076
commit 70b617a99f
3 changed files with 9 additions and 20 deletions

View File

@ -12,7 +12,7 @@ class CParticleGen {
public: public:
virtual ~CParticleGen() = 0; virtual ~CParticleGen() = 0;
virtual void Update(double) = 0; virtual void Update(double) = 0;
virtual void Render() = 0; virtual void Render() const = 0;
virtual void SetOrientation(const CTransform4f& orientation) = 0; virtual void SetOrientation(const CTransform4f& orientation) = 0;
virtual void SetTranslation(const CVector3f& translation) = 0; virtual void SetTranslation(const CVector3f& translation) = 0;
virtual void SetGlobalOrientation(const CTransform4f& orientation) = 0; virtual void SetGlobalOrientation(const CTransform4f& orientation) = 0;

View File

@ -1,22 +1,22 @@
#ifndef __IWEAPONRENDERER_HPP__ #ifndef __IWEAPONRENDERER_HPP__
#define __IWEAPONRENDERER_HPP__ #define __IWEAPONRENDERER_HPP__
class CParticleGen; #include "Kyoto/Alloc/CMemory.hpp"
#include "Kyoto/Particles/CParticleGen.hpp"
class IWeaponRenderer { class IWeaponRenderer {
public: public:
virtual ~IWeaponRenderer() {} virtual ~IWeaponRenderer() {};
virtual void AddParticleGen(const CParticleGen& gen) = 0; virtual void AddParticleGen(const CParticleGen& gen) = 0;
static void SetRenderer(IWeaponRenderer* renderer) { sWeaponRenderer = renderer; } static void SetRenderer(IWeaponRenderer* renderer) { sWeaponRenderer = renderer; }
private: private:
static IWeaponRenderer* sWeaponRenderer; static IWeaponRenderer* sWeaponRenderer;
}; };
class CDefaultWeaponRenderer : public IWeaponRenderer {
class CDefaultRenderer : public IWeaponRenderer {
public: public:
~CDefaultRenderer(); virtual ~CDefaultWeaponRenderer() {};
void AddParticleGen(const CParticleGen& gen); void AddParticleGen(const CParticleGen& gen) { gen.Render(); }
}; };
#endif //__IWEAPONRENDERER_HPP__ #endif //__IWEAPONRENDERER_HPP__

View File

@ -1,15 +1,4 @@
#include "Weapons/IWeaponRenderer.hpp" #include "Weapons/IWeaponRenderer.hpp"
#include "Kyoto/Particles/CParticleGen.hpp" static CDefaultWeaponRenderer sDefaultRenderer;
#include "Kyoto/Alloc/CMemory.hpp"
static CDefaultRenderer sDefaultRenderer = CDefaultRenderer();
IWeaponRenderer* IWeaponRenderer::sWeaponRenderer = &sDefaultRenderer; IWeaponRenderer* IWeaponRenderer::sWeaponRenderer = &sDefaultRenderer;
CDefaultRenderer::~CDefaultRenderer() {
}
void CDefaultRenderer::AddParticleGen(const CParticleGen& gen) {
const_cast<CParticleGen&>(gen).Render();
}