本文整理汇总了C++中ogre::GpuProgramParametersSharedPtr::_findNamedConstantDefinition方法的典型用法代码示例。如果您正苦于以下问题:C++ GpuProgramParametersSharedPtr::_findNamedConstantDefinition方法的具体用法?C++ GpuProgramParametersSharedPtr::_findNamedConstantDefinition怎么用?C++ GpuProgramParametersSharedPtr::_findNamedConstantDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::GpuProgramParametersSharedPtr
的用法示例。
在下文中一共展示了GpuProgramParametersSharedPtr::_findNamedConstantDefinition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateFromCamera
//-----------------------------------------------------------------------
void DLight::updateFromCamera(Ogre::Camera* camera)
{
//Set shader params
const Ogre::MaterialPtr& mat = getMaterial();
if(!mat->isLoaded())
{
mat->load();
}
Ogre::Technique* tech = mat->getBestTechnique();
// tech = mat->getTechnique(0);//без этого бест техника почемуто возвращает хрень
Ogre::Vector3 farCorner = camera->getViewMatrix(true) * camera->getWorldSpaceCorners()[4];
for(unsigned short i = 0; i < tech->getNumPasses(); ++i)
{
Ogre::Pass* pass = tech->getPass(i);
// get the vertex shader parameters
Ogre::GpuProgramParametersSharedPtr params = pass->getVertexProgramParameters();
// set the camera's far-top-right corner
if(params->_findNamedConstantDefinition("farCorner"))
{
params->setNamedConstant("farCorner", farCorner);
}
params = pass->getFragmentProgramParameters();
if(params->_findNamedConstantDefinition("farCorner"))
{
params->setNamedConstant("farCorner", farCorner);
}
//If inside light geometry, render back faces with CMPF_GREATER, otherwise normally
if(mParentLight->getType() == Ogre::Light::LT_DIRECTIONAL)
{
pass->setCullingMode(Ogre::CULL_CLOCKWISE);
pass->setDepthCheckEnabled(false);
}
else
{
pass->setDepthCheckEnabled(true);
if(isCameraInsideLight(camera))
{
pass->setCullingMode(Ogre::CULL_ANTICLOCKWISE);
pass->setDepthFunction(Ogre::CMPF_GREATER_EQUAL);
}
else
{
pass->setCullingMode(Ogre::CULL_CLOCKWISE);
pass->setDepthFunction(Ogre::CMPF_LESS_EQUAL);
}
}
Camera shadowCam("ShadowCameraSetupCam", 0);
shadowCam._notifyViewport(camera->getViewport());
SceneManager* sm = mParentLight->_getManager();
sm->getShadowCameraSetup()->getShadowCamera(sm,
camera, camera->getViewport(), mParentLight, &shadowCam, 0);
//Get the shadow camera position
if(params->_findNamedConstantDefinition("shadowCamPos"))
{
params->setNamedConstant("shadowCamPos", shadowCam.getPosition());
}
if(params->_findNamedConstantDefinition("shadowFarClip"))
{
params->setNamedConstant("shadowFarClip", shadowCam.getFarClipDistance());
}
}
}