mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 09:47:43 +00:00
New code style refactor
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
#include "Particle/CSwooshDescription.hpp"
|
||||
#include "hecl/Pipeline.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texZWrite;
|
||||
boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_texNoZWrite;
|
||||
@@ -18,87 +17,73 @@ boo::ObjToken<boo::IShaderPipeline> CParticleSwooshShaders::m_noTexAdditiveNoZWr
|
||||
|
||||
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::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();
|
||||
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)
|
||||
{
|
||||
CSwooshDescription* desc = gen.GetDesc();
|
||||
CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen) {
|
||||
CSwooshDescription* desc = gen.GetDesc();
|
||||
|
||||
if (desc->x3c_TEXR)
|
||||
return EShaderClass::Tex;
|
||||
else
|
||||
return EShaderClass::NoTex;
|
||||
if (desc->x3c_TEXR)
|
||||
return EShaderClass::Tex;
|
||||
else
|
||||
return EShaderClass::NoTex;
|
||||
}
|
||||
|
||||
void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CParticleSwoosh& gen)
|
||||
{
|
||||
CSwooshDescription* desc = gen.GetDesc();
|
||||
boo::ObjToken<boo::IShaderPipeline> pipeline;
|
||||
void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CParticleSwoosh& gen) {
|
||||
CSwooshDescription* desc = gen.GetDesc();
|
||||
boo::ObjToken<boo::IShaderPipeline> pipeline;
|
||||
|
||||
if (desc->x3c_TEXR)
|
||||
{
|
||||
if (desc->x44_31_AALP)
|
||||
{
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_texAdditiveZWrite;
|
||||
else
|
||||
pipeline = m_texAdditiveNoZWrite;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_texZWrite;
|
||||
else
|
||||
pipeline = m_texNoZWrite;
|
||||
}
|
||||
if (desc->x3c_TEXR) {
|
||||
if (desc->x44_31_AALP) {
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_texAdditiveZWrite;
|
||||
else
|
||||
pipeline = m_texAdditiveNoZWrite;
|
||||
} else {
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_texZWrite;
|
||||
else
|
||||
pipeline = m_texNoZWrite;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (desc->x44_31_AALP)
|
||||
{
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_noTexAdditiveZWrite;
|
||||
else
|
||||
pipeline = m_noTexAdditiveNoZWrite;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_noTexZWrite;
|
||||
else
|
||||
pipeline = m_noTexNoZWrite;
|
||||
}
|
||||
} else {
|
||||
if (desc->x44_31_AALP) {
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_noTexAdditiveZWrite;
|
||||
else
|
||||
pipeline = m_noTexAdditiveNoZWrite;
|
||||
} else {
|
||||
if (desc->x45_24_ZBUF)
|
||||
pipeline = m_noTexZWrite;
|
||||
else
|
||||
pipeline = m_noTexNoZWrite;
|
||||
}
|
||||
}
|
||||
|
||||
CUVElement* texr = desc->x3c_TEXR.get();
|
||||
boo::ObjToken<boo::ITexture> textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace urde
|
||||
|
||||
Reference in New Issue
Block a user