13#include "OgreShaderPrecompiledHeaders.h"
15#define FFP_LIB_CLIP_PLANE "FFPLib_ClipPlane"
16#define FFP_FUNC_CLIP_PLANE "FFP_Clip_Plane"
31 Ogre::RTShader::Program* vsProgram = programSet->getCpuProgram(Ogre::GPT_VERTEX_PROGRAM);
32 Ogre::RTShader::Function* vsMain = vsProgram->getEntryPointFunction();
33 Ogre::RTShader::Program* psProgram = programSet->getCpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
34 Ogre::RTShader::Function* psMain = psProgram->getEntryPointFunction();
36 mWorldMatrix = vsProgram->resolveParameter(Ogre::GpuProgramParameters::ACT_WORLD_MATRIX);
39 mVSInPosition = vsMain->resolveInputParameter(Ogre::RTShader::Parameter::SPC_POSITION_OBJECT_SPACE);
40 mVSOutPosition = vsMain->resolveOutputParameter(Ogre::RTShader::Parameter::SPC_POSITION_WORLD_SPACE);
43 mPSInPosition = psMain->resolveInputParameter(mVSOutPosition);
44 mPSClipPlaneRef = psProgram->resolveParameter(Ogre::GCT_FLOAT4,
"slicePlane");
52 Ogre::RTShader::Program* vsProgram = programSet->getCpuProgram(Ogre::GPT_VERTEX_PROGRAM);
53 Ogre::RTShader::Program* psProgram = programSet->getCpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
54 vsProgram->addDependency(FFP_LIB_TRANSFORM);
55 psProgram->addDependency(FFP_LIB_CLIP_PLANE);
66 Ogre::RTShader::Program* vsProgram = programSet->getCpuProgram(Ogre::GPT_VERTEX_PROGRAM);
67 Ogre::RTShader::Function* vsMain = vsProgram->getEntryPointFunction();
68 Ogre::RTShader::Program* psProgram = programSet->getCpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
69 Ogre::RTShader::Function* psMain = psProgram->getEntryPointFunction();
71 vsMain->getStage(Ogre::RTShader::FFP_VS_TRANSFORM).callFunction(FFP_FUNC_TRANSFORM, mWorldMatrix, mVSInPosition, mVSOutPosition);
72 psMain->getStage(Ogre::RTShader::FFP_PS_COLOUR_BEGIN).callFunction(FFP_FUNC_CLIP_PLANE, { Ogre::RTShader::In(mPSClipPlaneRef), Ogre::RTShader::In(mPSInPosition) });
79 return Ogre::RTShader::FFP_ALPHA_TEST;
85 Ogre::Any bindedSPass = srcPass->getUserObjectBindings().getUserAny(
"SPass");
86 if (bindedSPass.has_value())
88 SPass* pass = Ogre::any_cast<SPass*> (bindedSPass);
const Ogre::String & getType() const override
Ogre::RTShader::SubRenderState * createInstanceImpl() override
void updateGpuProgramsParams(Ogre::Renderable *rend, const Ogre::Pass *pass, const Ogre::AutoParamDataSource *source, const Ogre::LightList *pLightList) override
bool resolveParameters(Ogre::RTShader::ProgramSet *programSet) override
int getExecutionOrder() const override
bool preAddToRenderState(const Ogre::RTShader::RenderState *renderState, Ogre::Pass *srcPass, Ogre::Pass *dstPass) override
bool resolveDependencies(Ogre::RTShader::ProgramSet *programSet) override
const Ogre::String & getType() const override
bool addFunctionInvocations(Ogre::RTShader::ProgramSet *programSet) override
void copyFrom(const Ogre::RTShader::SubRenderState &rhs) override
bool GetIgnoreSlicePlane()
STechnique * GetTechnique()
bool GetSlicePlaneState()
static SRoot * getSingletonPtr()
SMaterial * GetParentMaterial()
const Ogre::String SRS_CLIP_PLANE