2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-20 04:25:23 +00:00

Very, very incomplete integration of hsh/boo2

This commit is contained in:
Jack Andersen
2020-09-28 10:54:40 -10:00
parent 5b4441ac36
commit 3827f35227
179 changed files with 50303 additions and 4995 deletions

View File

@@ -6,15 +6,10 @@
#include "Runtime/rstl.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <hecl/UniformBufferPool.hpp>
#include <hecl/VertexBufferPool.hpp>
#include <zeus/CColor.hpp>
#include <zeus/CVector2f.hpp>
#include <zeus/CVector3f.hpp>
#include <zeus/CVector4f.hpp>
#include "zeus/CColor.hpp"
#include "zeus/CVector2f.hpp"
#include "zeus/CVector3f.hpp"
#include "zeus/CVector4f.hpp"
namespace urde {
@@ -22,19 +17,21 @@ class CLineRenderer {
public:
enum class EPrimitiveMode { Lines, LineStrip, LineLoop };
struct SDrawVertTex {
zeus::CVector4f pos;
zeus::CColor color;
zeus::CVector2f uv;
struct SDrawVertNoTex {
hsh::float4 pos;
hsh::float4 color;
SDrawVertNoTex(hsh::float4 pos, hsh::float4 color) : pos(pos), color(color) {}
};
struct SDrawVertNoTex {
zeus::CVector4f pos;
zeus::CColor color;
struct SDrawVertTex {
hsh::float4 pos;
hsh::float4 color;
hsh::float2 uv;
SDrawVertTex(hsh::float4 pos, hsh::float4 color, hsh::float2 uv) : pos(pos), color(color), uv(uv) {}
};
struct SDrawUniform {
zeus::CColor moduColor;
hsh::float4 moduColor;
CGraphics::CFogState fog;
};
@@ -62,35 +59,19 @@ private:
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;
public:
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;
hsh::dynamic_owner<hsh::vertex_buffer_typeless> m_vertBuf;
hsh::dynamic_owner<hsh::uniform_buffer<SDrawUniform>> m_uniformBuf;
hsh::binding m_shaderBind[2];
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(EPrimitiveMode mode, u32 maxVerts, hsh::texture2d texture, bool additive,
hsh::Compare zComp = hsh::Always);
CLineRenderer(CLineRenderer&&) = default;
void Reset();
void AddVertex(const zeus::CVector3f& position, const zeus::CColor& color, float width,
const zeus::CVector2f& uv = zeus::skZero2f);
void Render(bool alphaWrite = false, const zeus::CColor& moduColor = zeus::skWhite);
static void UpdateBuffers() {
s_vertPoolTex.updateBuffers();
s_vertPoolNoTex.updateBuffers();
s_uniformPool.updateBuffers();
}
static void Initialize();
static void Shutdown();
};
} // namespace urde