本文整理汇总了C++中SubEntity::setCustomParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ SubEntity::setCustomParameter方法的具体用法?C++ SubEntity::setCustomParameter怎么用?C++ SubEntity::setCustomParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubEntity
的用法示例。
在下文中一共展示了SubEntity::setCustomParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createScene
// Just override the mandatory create scene method
void createScene(void)
{
// Check capabilities
const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities();
if (!caps->hasCapability(RSC_VERTEX_PROGRAM) || !(caps->hasCapability(RSC_FRAGMENT_PROGRAM)))
{
OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "Your card does not support vertex and fragment programs, so cannot "
"run this demo. Sorry!",
"CelShading::createScene");
}
// Create a point light
Light* l = mSceneMgr->createLight("MainLight");
// Accept default settings: point light, white diffuse, just set position
// Add light to the scene node
rotNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
rotNode->createChildSceneNode(Vector3(20,40,50))->attachObject(l);
Entity *ent = mSceneMgr->createEntity("head", "ogrehead.mesh");
mCamera->setPosition(20, 0, 100);
mCamera->lookAt(0,0,0);
// Set common material, but define custom parameters to change colours
// See Example-Advanced.material for how these are finally bound to GPU parameters
SubEntity* sub;
// eyes
sub = ent->getSubEntity(0);
sub->setMaterialName("Examples/CelShading");
sub->setCustomParameter(CUSTOM_SHININESS, Vector4(35.0f, 0.0f, 0.0f, 0.0f));
sub->setCustomParameter(CUSTOM_DIFFUSE, Vector4(1.0f, 0.3f, 0.3f, 1.0f));
sub->setCustomParameter(CUSTOM_SPECULAR, Vector4(1.0f, 0.6f, 0.6f, 1.0f));
// skin
sub = ent->getSubEntity(1);
sub->setMaterialName("Examples/CelShading");
sub->setCustomParameter(CUSTOM_SHININESS, Vector4(10.0f, 0.0f, 0.0f, 0.0f));
sub->setCustomParameter(CUSTOM_DIFFUSE, Vector4(0.0f, 0.5f, 0.0f, 1.0f));
sub->setCustomParameter(CUSTOM_SPECULAR, Vector4(0.3f, 0.5f, 0.3f, 1.0f));
// earring
sub = ent->getSubEntity(2);
sub->setMaterialName("Examples/CelShading");
sub->setCustomParameter(CUSTOM_SHININESS, Vector4(25.0f, 0.0f, 0.0f, 0.0f));
sub->setCustomParameter(CUSTOM_DIFFUSE, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
sub->setCustomParameter(CUSTOM_SPECULAR, Vector4(1.0f, 1.0f, 0.7f, 1.0f));
// teeth
sub = ent->getSubEntity(3);
sub->setMaterialName("Examples/CelShading");
sub->setCustomParameter(CUSTOM_SHININESS, Vector4(20.0f, 0.0f, 0.0f, 0.0f));
sub->setCustomParameter(CUSTOM_DIFFUSE, Vector4(1.0f, 1.0f, 0.7f, 1.0f));
sub->setCustomParameter(CUSTOM_SPECULAR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
// Add entity to the root scene node
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
mWindow->getViewport(0)->setBackgroundColour(ColourValue::White);
}