2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-06-06 14:33:27 +00:00
metaforce/Runtime/Graphics/Shaders/CEnvFxShaders.cpp
Lioncash 902f4fb5c5 Graphics/Shaders: Use forward declarations where applicable
Now, with all of the headers normalized, we can safely convert some
headers into forward declarations without needing to worry about
potentially breaking code in other headers or source files.
2019-11-09 20:22:09 -05:00

41 lines
1.9 KiB
C++

#include "Runtime/Graphics/Shaders/CEnvFxShaders.hpp"
#include "Runtime/World/CEnvFxManager.hpp"
#include <hecl/Pipeline.hpp>
namespace urde {
boo::ObjToken<boo::IShaderPipeline> CEnvFxShaders::m_snowPipeline;
boo::ObjToken<boo::IShaderPipeline> CEnvFxShaders::m_underwaterPipeline;
void CEnvFxShaders::Initialize() {
m_snowPipeline = hecl::conv->convert(Shader_CEnvFxSnowShader{});
m_underwaterPipeline = hecl::conv->convert(Shader_CEnvFxUnderwaterShader{});
}
void CEnvFxShaders::Shutdown() {
m_snowPipeline.reset();
m_underwaterPipeline.reset();
}
void CEnvFxShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CEnvFxManager& fxMgr,
CEnvFxManagerGrid& grid) {
auto uBufInfo = grid.m_uniformBuf.getBufferInfo();
auto iBufInfo = grid.m_instBuf.getBufferInfo();
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {uBufInfo.first.get(), fxMgr.m_fogUniformBuf.get()};
size_t ubufOffsets[] = {size_t(uBufInfo.second), 0};
size_t ubufSizes[] = {sizeof(CEnvFxShaders::Uniform), sizeof(CGraphics::g_Fog)};
boo::PipelineStage uniformStages[] = {boo::PipelineStage::Vertex, boo::PipelineStage::Fragment};
boo::ObjToken<boo::ITexture> textures[] = {fxMgr.xb74_txtrSnowFlake->GetBooTexture(),
fxMgr.x40_txtrEnvGradient->GetBooTexture()};
grid.m_snowBinding =
ctx.newShaderDataBinding(m_snowPipeline, nullptr, iBufInfo.first.get(), nullptr, 2, uniforms, uniformStages,
ubufOffsets, ubufSizes, 2, textures, nullptr, nullptr, 0, iBufInfo.second);
textures[0] = fxMgr.xc48_underwaterFlake->GetBooTexture();
grid.m_underwaterBinding =
ctx.newShaderDataBinding(m_underwaterPipeline, nullptr, iBufInfo.first.get(), nullptr, 2, uniforms, uniformStages,
ubufOffsets, ubufSizes, 2, textures, nullptr, nullptr, 0, iBufInfo.second);
}
} // namespace urde