2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 09:07:43 +00:00

New code style refactor

This commit is contained in:
Jack Andersen
2018-12-07 19:30:43 -10:00
parent 41ae32be31
commit 636c82a568
1451 changed files with 171430 additions and 203303 deletions

View File

@@ -8,93 +8,80 @@
#include "hecl/VertexBufferPool.hpp"
#include "hecl/UniformBufferPool.hpp"
namespace urde
{
namespace urde {
class CLineRenderer
{
class CLineRenderer {
public:
enum class EPrimitiveMode
{
Lines,
LineStrip,
LineLoop
};
enum class EPrimitiveMode { Lines, LineStrip, LineLoop };
struct SDrawVertTex
{
zeus::CVector4f pos;
zeus::CColor color;
zeus::CVector2f uv;
};
struct SDrawVertTex {
zeus::CVector4f pos;
zeus::CColor color;
zeus::CVector2f uv;
};
struct SDrawVertNoTex
{
zeus::CVector4f pos;
zeus::CColor color;
};
struct SDrawVertNoTex {
zeus::CVector4f pos;
zeus::CColor color;
};
struct SDrawUniform
{
zeus::CColor moduColor;
};
struct SDrawUniform {
zeus::CColor moduColor;
};
private:
EPrimitiveMode m_mode;
u32 m_maxVerts;
u32 m_nextVert = 0;
bool m_final = false;
bool m_textured;
EPrimitiveMode m_mode;
u32 m_maxVerts;
u32 m_nextVert = 0;
bool m_final = false;
bool m_textured;
zeus::CVector3f m_firstPos;
zeus::CVector3f m_secondPos;
zeus::CVector2f m_firstUV;
zeus::CColor m_firstColor;
float m_firstWidth;
float m_firstW;
zeus::CVector3f m_firstPos;
zeus::CVector3f m_secondPos;
zeus::CVector2f m_firstUV;
zeus::CColor m_firstColor;
float m_firstWidth;
float m_firstW;
zeus::CVector3f m_lastPos;
zeus::CVector3f m_lastPos2;
zeus::CVector2f m_lastUV;
zeus::CColor m_lastColor;
float m_lastWidth;
float m_lastW;
zeus::CVector3f m_lastPos;
zeus::CVector3f m_lastPos2;
zeus::CVector2f m_lastUV;
zeus::CColor m_lastColor;
float m_lastWidth;
float m_lastW;
static rstl::reserved_vector<SDrawVertTex, 1024> g_StaticLineVertsTex;
static rstl::reserved_vector<SDrawVertNoTex, 1024> g_StaticLineVertsNoTex;
static rstl::reserved_vector<SDrawVertTex, 1024> g_StaticLineVertsTex;
static rstl::reserved_vector<SDrawVertNoTex, 1024> g_StaticLineVertsNoTex;
static hecl::VertexBufferPool<SDrawVertTex> s_vertPoolTex;
static hecl::VertexBufferPool<SDrawVertNoTex> s_vertPoolNoTex;
static hecl::UniformBufferPool<SDrawUniform> s_uniformPool;
static hecl::VertexBufferPool<SDrawVertTex> s_vertPoolTex;
static hecl::VertexBufferPool<SDrawVertNoTex> s_vertPoolNoTex;
static hecl::UniformBufferPool<SDrawUniform> s_uniformPool;
public:
hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex;
hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex;
hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
boo::ObjToken<boo::IShaderDataBinding> m_shaderBind;
hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex;
hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex;
hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
boo::ObjToken<boo::IShaderDataBinding> m_shaderBind;
CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken<boo::ITexture>& texture,
bool additive, bool zTest = false, bool zGEqual = false);
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken<boo::ITexture>& texture,
bool additive, bool zTest = false, bool zGEqual = false);
CLineRenderer(CLineRenderer&&) = default;
CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitiveMode mode, u32 maxVerts,
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest = false, bool zGEqual = false);
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken<boo::ITexture>& texture, bool additive,
bool zTest = false, bool zGEqual = false);
CLineRenderer(CLineRenderer&&) = default;
void Reset();
void AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
const zeus::CVector2f& uv=zeus::CVector2f::skZero);
void Render(const zeus::CColor& moduColor=zeus::CColor::skWhite);
void Reset();
void AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
const zeus::CVector2f& uv = zeus::CVector2f::skZero);
void Render(const zeus::CColor& moduColor = zeus::CColor::skWhite);
static void UpdateBuffers()
{
s_vertPoolTex.updateBuffers();
s_vertPoolNoTex.updateBuffers();
s_uniformPool.updateBuffers();
}
static void UpdateBuffers() {
s_vertPoolTex.updateBuffers();
s_vertPoolNoTex.updateBuffers();
s_uniformPool.updateBuffers();
}
static void Initialize();
static void Shutdown();
static void Initialize();
static void Shutdown();
};
}
} // namespace urde