2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 06: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,25 @@
#include "CWorldShadowShader.hpp"
#include "hecl/Pipeline.hpp"
#include "Graphics/CGraphics.hpp"
namespace urde
{
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
static boo::ObjToken<boo::IShaderPipeline> s_ZPipeline;
void CWorldShadowShader::Initialize()
{
s_Pipeline = hecl::conv->convert(Shader_CWorldShadowShader{});
s_ZPipeline = hecl::conv->convert(Shader_CWorldShadowShaderZ{});
}
void CWorldShadowShader::Shutdown()
{
s_Pipeline.reset();
s_ZPipeline.reset();
}
CWorldShadowShader::CWorldShadowShader(u32 w, u32 h)
: m_w(w), m_h(h)
{
@@ -10,7 +27,12 @@ CWorldShadowShader::CWorldShadowShader(u32 w, u32 h)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 16, 4);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
TShader<CWorldShadowShader>::BuildShaderDataBinding(ctx, *this);
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
m_dataBind = ctx.newShaderDataBinding(s_Pipeline, m_vbo.get(), nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
m_zDataBind = ctx.newShaderDataBinding(s_ZPipeline, m_vbo.get(), nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
m_tex = ctx.newRenderTexture(m_w, m_h, boo::TextureClampMode::ClampToWhite, 1, 0);
return true;
} BooTrace);
@@ -58,6 +80,4 @@ void CWorldShadowShader::resolveTexture()
CGraphics::g_BooMainCommandQueue->resolveBindTexture(m_tex, rect, false, 0, true, false, true);
}
URDE_SPECIALIZE_SHADER(CWorldShadowShader)
}