#include "Runtime/Graphics/Shaders/CParticleSwooshShaders.hpp" #include #include "Runtime/Particle/CParticleSwoosh.hpp" #include "Runtime/Particle/CSwooshDescription.hpp" #include "CParticleSwooshShaders.cpp.hshhead" namespace urde { using namespace hsh::pipeline; template struct CParticleSwooshShadersTexPipeline : pipeline, std::conditional_t, BlendAttachment>, depth_compare, depth_write> { CParticleSwooshShadersTexPipeline(hsh::vertex_buffer vbo, hsh::uniform_buffer uniBuf, hsh::texture2d tex) { this->position = uniBuf->m_xf * hsh::float4(vbo->m_pos, 1.f); this->color_out[0] = vbo->m_color * tex.sample(vbo->m_uv); } }; template struct CParticleSwooshShadersTexPipeline; template struct CParticleSwooshShadersTexPipeline; template struct CParticleSwooshShadersNoTexPipeline : pipeline, std::conditional_t, BlendAttachment>, depth_compare, depth_write> { CParticleSwooshShadersNoTexPipeline(hsh::vertex_buffer vbo, hsh::uniform_buffer uniBuf) { this->position = uniBuf->m_xf * hsh::float4(vbo->m_pos, 1.f); this->color_out[0] = vbo->m_color; } }; template struct CParticleSwooshShadersNoTexPipeline; template struct CParticleSwooshShadersNoTexPipeline; CParticleSwooshShaders::EShaderClass CParticleSwooshShaders::GetShaderClass(CParticleSwoosh& gen) { return gen.GetDesc()->x3c_TEXR ? EShaderClass::Tex : EShaderClass::NoTex; } void CParticleSwooshShaders::BuildShaderDataBinding(CParticleSwoosh& gen) { auto* desc = gen.GetDesc(); switch (GetShaderClass(gen)) { case EShaderClass::Tex: { hsh::texture2d tex = desc->x3c_TEXR->GetValueTexture(0)->GetBooTexture(); gen.m_dataBind[0].hsh_tex_noalphawrite_bind( CParticleSwooshShadersTexPipelinex44_31_AALP, false, desc->x45_24_ZBUF>(gen.m_vertBuf.get(), gen.m_uniformBuf.get(), tex)); gen.m_dataBind[1].hsh_tex_alphawrite_bind( CParticleSwooshShadersTexPipelinex44_31_AALP, true, desc->x45_24_ZBUF>(gen.m_vertBuf.get(), gen.m_uniformBuf.get(), tex)); break; } case EShaderClass::NoTex: { gen.m_dataBind[0].hsh_notex_noalphawrite_bind( CParticleSwooshShadersNoTexPipelinex44_31_AALP, false, desc->x45_24_ZBUF>(gen.m_vertBuf.get(), gen.m_uniformBuf.get())); gen.m_dataBind[1].hsh_notex_alphawrite_bind( CParticleSwooshShadersNoTexPipelinex44_31_AALP, true, desc->x45_24_ZBUF>(gen.m_vertBuf.get(), gen.m_uniformBuf.get())); break; } } } } // namespace urde