2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-18 09:25:33 +00:00

Changes to support boo object tracker API

This commit is contained in:
Jack Andersen
2017-11-04 20:17:12 -10:00
parent d301491bd6
commit 3894749675
138 changed files with 1679 additions and 1243 deletions

View File

@@ -39,19 +39,19 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipelines[4] = {};
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipelines[4];
struct CFogVolumePlaneShaderMetalDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumePlaneShader& filter)
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumePlaneShader& filter)
{
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
for (int i=0 ; i<4 ; ++i)
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 0, nullptr,
filter.m_vbo.get(), nullptr, nullptr, 0, nullptr,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return filter.m_dataBinds[0];
}
@@ -65,19 +65,33 @@ CFogVolumePlaneShader::Initialize(boo::MetalDataFactory::Context& ctx)
{nullptr, nullptr, boo::VertexSemantic::Position4}
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_Pipelines[0] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
s_Pipelines[0] = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::LEqual, true, false, false, boo::CullMode::Frontface);
s_Pipelines[1] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
s_Pipelines[1] = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::None, false, false, false, boo::CullMode::Frontface);
s_Pipelines[2] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
s_Pipelines[2] = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::LEqual, true, false, false, boo::CullMode::Backface);
s_Pipelines[3] = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
s_Pipelines[3] = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
boo::ZTest::Greater, false, false, false, boo::CullMode::Backface);
return new CFogVolumePlaneShaderMetalDataBindingFactory;
}
template <>
void CFogVolumePlaneShader::Shutdown<boo::MetalDataFactory>()
{
s_VtxFmt.reset();
s_Pipelines[0].reset();
s_Pipelines[1].reset();
s_Pipelines[2].reset();
s_Pipelines[3].reset();
}
}