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

Huge shader refactor

This commit is contained in:
Jack Andersen
2018-10-06 16:59:17 -10:00
parent 0a0a581f2d
commit c307e354ca
184 changed files with 8777 additions and 14295 deletions

View File

@@ -1,16 +1,36 @@
#include "CAABoxShader.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
namespace urde
{
CAABoxShader::CAABoxShader(bool zOnly)
: m_zOnly(zOnly)
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
static boo::ObjToken<boo::IShaderPipeline> s_zOnlyPipeline;
void CAABoxShader::Initialize()
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
s_Pipeline = hecl::conv->convert(Shader_CAABoxShader{});
s_zOnlyPipeline = hecl::conv->convert(Shader_CAABoxShaderZOnly{});
}
void CAABoxShader::Shutdown()
{
s_Pipeline.reset();
s_zOnlyPipeline.reset();
}
CAABoxShader::CAABoxShader(bool zOnly)
{
CGraphics::CommitResources([this, zOnly](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector3f), 34);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
m_dataBind = TShader<CAABoxShader>::BuildShaderDataBinding(ctx, *this);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
m_dataBind = ctx.newShaderDataBinding(zOnly ? s_zOnlyPipeline : s_Pipeline,
m_vbo.get(), nullptr, nullptr, 1, bufs, stages,
nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return true;
} BooTrace);
}
@@ -73,6 +93,4 @@ void CAABoxShader::draw(const zeus::CColor& color)
CGraphics::DrawArray(0, 34);
}
URDE_SPECIALIZE_SHADER(CAABoxShader)
}