2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 16:27: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,8 +1,23 @@
#include "CEnergyBarShader.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
#include "Graphics/CTexture.hpp"
namespace urde
{
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
void CEnergyBarShader::Initialize()
{
s_Pipeline = hecl::conv->convert(Shader_CEnergyBarShader{});
}
void CEnergyBarShader::Shutdown()
{
s_Pipeline.reset();
}
void CEnergyBarShader::updateModelMatrix()
{
m_uniform.m_matrix = CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f();
@@ -24,9 +39,17 @@ void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector<Vertex
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), m_maxVerts);
boo::ObjToken<boo::IGraphicsBuffer> bufs[1];
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ObjToken<boo::ITexture> texs[] = {m_tex->GetBooTexture()};
for (int i=0 ; i<3 ; ++i)
{
m_uniBuf[i] = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
TShader<CEnergyBarShader>::BuildShaderDataBinding(ctx, *this);
bufs[0] = m_uniBuf[i].get();
m_dataBind[i] = ctx.newShaderDataBinding(s_Pipeline,
m_vbo.get(), nullptr, nullptr, 1, bufs, stages,
nullptr, nullptr, 1, texs, nullptr, nullptr);
}
return true;
} BooTrace);
}
@@ -75,6 +98,4 @@ void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector<Vertex
}
}
URDE_SPECIALIZE_SHADER(CEnergyBarShader)
}