#include "Runtime/Graphics/Shaders/CEnvFxShaders.hpp" #include "Runtime/World/CEnvFxManager.hpp" #include "CEnvFxShaders.cpp.hshhead" namespace urde { using namespace hsh::pipeline; template struct CEnvFxShadersPipeline // FIXME replace MultiplyAttachment with ERglBlendFactor One:One equivalent : pipeline, std::conditional_t, MultiplyAttachment>, depth_compare, depth_write> { CEnvFxShadersPipeline(hsh::vertex_buffer vbo, hsh::uniform_buffer envFxUniBuf, hsh::uniform_buffer fogUniBuf, hsh::texture2d texFlake, hsh::texture2d texEnv) { hsh::float4 posIn = hsh::float4(vbo->positions[this->vertex_id], 1.f); hsh::float4 flakeTexel = texFlake.sample(vbo->uvs[this->vertex_id]); hsh::float4 envTexel = texEnv.sample( (envFxUniBuf->envMtx * posIn).xy(), // FIXME hsh bug: this appears to be completely ignored hsh::sampler{hsh::Linear, hsh::Linear, hsh::Linear, hsh::ClampToEdge, hsh::ClampToEdge, hsh::ClampToEdge}); hsh::float4 color = vbo->color * envFxUniBuf->moduColor * flakeTexel * envTexel; this->position = envFxUniBuf->proj * (envFxUniBuf->mv * posIn); FOG_SHADER_UNIFORM(fogUniBuf) // FIXME: hsh binds fog uniform to fragment stage // only because of m_color reference in here. can/should we avoid that? FOG_OUT_UNIFORM(this->color_out[0], fogUniBuf, color) } }; template struct CEnvFxShadersPipeline; template struct CEnvFxShadersPipeline; void CEnvFxShaders::BuildShaderDataBinding(CEnvFxManager& fxMgr, CEnvFxManagerGrid& grid) { hsh::texture2d texFlake = fxMgr.xb74_txtrSnowFlake->GetBooTexture(); hsh::texture2d texEnv = fxMgr.x40_txtrEnvGradient->GetBooTexture(); hsh::vertex_buffer vboBuf = grid.m_instBuf.get(); hsh::uniform_buffer envFxUniBuf = grid.m_uniformBuf.get(); hsh::uniform_buffer fogUniBuf = fxMgr.m_fogUniformBuf.get(); // FIXME hsh bug: can't bind all constant values bool isUnderwater = false; grid.m_snowBinding.hsh_snow_bind( CEnvFxShadersPipeline(vboBuf, envFxUniBuf, fogUniBuf, texFlake, texEnv)); isUnderwater = true; grid.m_underwaterBinding.hsh_underwater_bind( CEnvFxShadersPipeline(vboBuf, envFxUniBuf, fogUniBuf, texFlake, texEnv)); } } // namespace urde