2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 11:07:44 +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,6 +1,7 @@
#include "CParticleSwooshShaders.hpp"
#include "Particle/CParticleSwoosh.hpp"
#include "Particle/CSwooshDescription.hpp"
#include "hecl/Pipeline.hpp"
namespace urde
{
@@ -15,7 +16,31 @@ boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexNoZWrite;
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexAdditiveZWrite;
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexAdditiveNoZWrite;
boo::ObjToken<boo::IVertexFormat> CParticleSwooshShaders::m_vtxFormat;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
void CParticleSwooshShaders::Initialize()
{
m_texZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexZWrite{});
m_texNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexNoZWrite{});
m_texAdditiveZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveZWrite{});
m_texAdditiveNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderTexAdditiveNoZWrite{});
m_noTexZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexZWrite{});
m_noTexNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexNoZWrite{});
m_noTexAdditiveZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveZWrite{});
m_noTexAdditiveNoZWrite = hecl::conv->convert(Shader_CParticleSwooshShaderNoTexAdditiveNoZWrite{});
}
void CParticleSwooshShaders::Shutdown()
{
m_texZWrite.reset();
m_texNoZWrite.reset();
m_texAdditiveZWrite.reset();
m_texAdditiveNoZWrite.reset();
m_noTexZWrite.reset();
m_noTexNoZWrite.reset();
m_noTexAdditiveZWrite.reset();
m_noTexAdditiveNoZWrite.reset();
}
CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen)
{
@@ -67,10 +92,13 @@ void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::C
}
}
CParticleSwooshShaders shad(gen, pipeline);
TShader<CParticleSwooshShaders>::BuildShaderDataBinding(ctx, shad);
CUVElement* texr = desc->x3c_TEXR.get();
boo::ObjToken<boo::ITexture> textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
gen.m_dataBind = ctx.newShaderDataBinding(pipeline, gen.m_vertBuf.get(),
nullptr, nullptr, 1, uniforms,
nullptr, texr ? 1 : 0, textures, nullptr, nullptr);
}
URDE_SPECIALIZE_SHADER(CParticleSwooshShaders)
}