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:
virtual ~CParticleGen() = 0;
virtual void Update(double) = 0;
virtual void Render() = 0;
virtual void Render() const = 0;
virtual void SetOrientation(const CTransform4f& orientation) = 0;
virtual void SetTranslation(const CVector3f& translation) = 0;
virtual void SetGlobalOrientation(const CTransform4f& orientation) = 0;

View File

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

View File

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