2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2016-02-17 18:42:32 -08:00
|
|
|
|
2020-03-17 16:07:24 -07:00
|
|
|
#include <array>
|
|
|
|
|
2019-09-27 19:53:03 -07:00
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/rstl.hpp"
|
|
|
|
#include "Runtime/Graphics/CGraphics.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CColor.hpp>
|
|
|
|
#include <zeus/CVector2f.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
|
|
|
#include <zeus/CVector4f.hpp>
|
2016-02-17 18:42:32 -08:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2016-02-17 18:42:32 -08:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
class CLineRenderer {
|
2016-02-17 18:42:32 -08:00
|
|
|
public:
|
2018-12-07 21:30:43 -08:00
|
|
|
enum class EPrimitiveMode { Lines, LineStrip, LineLoop };
|
|
|
|
|
2016-02-17 23:56:14 -08:00
|
|
|
private:
|
2018-12-07 21:30:43 -08:00
|
|
|
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_lastPos;
|
|
|
|
zeus::CVector3f m_lastPos2;
|
|
|
|
zeus::CVector2f m_lastUV;
|
|
|
|
zeus::CColor m_lastColor;
|
|
|
|
float m_lastWidth;
|
|
|
|
float m_lastW;
|
|
|
|
|
2022-01-31 16:06:54 -08:00
|
|
|
// static rstl::reserved_vector<SDrawVertTex, 1024> g_StaticLineVertsTex;
|
|
|
|
// static rstl::reserved_vector<SDrawVertNoTex, 1024> g_StaticLineVertsNoTex;
|
2018-12-07 21:30:43 -08:00
|
|
|
|
2022-01-31 16:06:54 -08:00
|
|
|
// static hecl::VertexBufferPool<SDrawVertTex> s_vertPoolTex;
|
|
|
|
// static hecl::VertexBufferPool<SDrawVertNoTex> s_vertPoolNoTex;
|
|
|
|
// static hecl::UniformBufferPool<SDrawUniform> s_uniformPool;
|
2017-04-22 14:46:18 -07:00
|
|
|
|
2016-02-17 18:42:32 -08:00
|
|
|
public:
|
2022-01-31 16:06:54 -08:00
|
|
|
// hecl::VertexBufferPool<SDrawVertTex>::Token m_vertBufTex;
|
|
|
|
// hecl::VertexBufferPool<SDrawVertNoTex>::Token m_vertBufNoTex;
|
|
|
|
// hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
|
|
|
|
// std::array<boo::ObjToken<boo::IShaderDataBinding>, 2> m_shaderBind;
|
|
|
|
|
2022-07-29 13:16:55 -07:00
|
|
|
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, u32 texture, bool additive,
|
2018-12-07 21:30:43 -08:00
|
|
|
bool zTest = false, bool zGEqual = false);
|
|
|
|
CLineRenderer(CLineRenderer&&) = default;
|
|
|
|
|
|
|
|
void Reset();
|
|
|
|
void AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
|
2019-02-23 23:15:54 -08:00
|
|
|
const zeus::CVector2f& uv = zeus::skZero2f);
|
2019-03-02 22:19:42 -08:00
|
|
|
void Render(bool alphaWrite = false, const zeus::CColor& moduColor = zeus::skWhite);
|
2018-12-07 21:30:43 -08:00
|
|
|
|
2022-01-31 16:06:54 -08:00
|
|
|
// static void UpdateBuffers() {
|
|
|
|
// s_vertPoolTex.updateBuffers();
|
|
|
|
// s_vertPoolNoTex.updateBuffers();
|
|
|
|
// s_uniformPool.updateBuffers();
|
|
|
|
// }
|
2018-12-07 21:30:43 -08:00
|
|
|
|
|
|
|
static void Initialize();
|
|
|
|
static void Shutdown();
|
2016-02-17 18:42:32 -08:00
|
|
|
};
|
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|