本文整理汇总了C++中ogre::SceneNode::setDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::setDirection方法的具体用法?C++ SceneNode::setDirection怎么用?C++ SceneNode::setDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::setDirection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setUpQuaternion
void GameState::setUpQuaternion()
{
//设置跑道标准开始方向
Ogre::SceneNode* sn = mSceneMgr->getRootSceneNode()->createChildSceneNode();
Ogre::Vector3 dir = mSceneMgr->getSceneNode("R1PS")->_getDerivedPosition() - mSceneMgr->getSceneNode("R1P1")->_getDerivedPosition();
sn->setDirection(dir);
mStdQuaternion = sn->getOrientation();
}
示例2:
Ring::Ring(Ogre::String name, RingFlier* flier):flier(flier)
{
check=true;
ringName=name;
position.x=(rand()%5000);
position.z=(rand()%5000);
position.y=(rand()%700)+flier->getTerrainHeightAt(position.x,position.z)+100.0f;
Ogre::SceneNode* sn = flier->getSceneManager()->getRootSceneNode()->createChildSceneNode("sn"+name);
Ogre::Entity* ring = flier->getSceneManager()->createEntity(name,"Torus.mesh");
sn->attachObject(ring);
sn->scale(Ogre::Vector3(015.10f,015.10f,015.10f));
sn->setPosition(position);
sn->setVisible(true);
sn->setOrientation(Ogre::Quaternion(Ogre::Radian(30.0f), Ogre::Vector3::UNIT_Z));
sn->setDirection(rand()%10,rand()%10,rand()%10,Ogre::Node::TransformSpace::TS_LOCAL,Ogre::Vector3::NEGATIVE_UNIT_Z);
Ogre::ParticleSystem* pSysRing = flier->getSceneManager()->createParticleSystem(ringName+'p',"PEExamples/ringShimmer");
flier->getSceneManager()->getSceneNode("sn"+ringName)->attachObject(pSysRing);
}
示例3: appFrameStarted
//.........这里部分代码省略.........
// Check for object type.
if (std::string::npos != s.rfind("box"))
{
outputString += " box";
type = OBJECT_TYPE_BOX;
makeObject = true;
}
else if (std::string::npos != s.rfind("sphere"))
{
outputString += " sphere";
type = OBJECT_TYPE_SPHERE;
makeObject = true;
}
else if (std::string::npos != s.rfind("wall"))
{
outputString += " wall";
type = OBJECT_TYPE_WALL;
makeObject = true;
}
else if (std::string::npos != s.rfind("tower"))
{
outputString += " tower";
type = OBJECT_TYPE_TOWER;
makeObject = true;
}
else if (std::string::npos != s.rfind("character"))
{
outputString += " character";
type = OBJECT_TYPE_RAGDOLL;
makeObject = true;
}
if (makeObject)
{
voce::synthesize(outputString);
createObject(material, type);
}
}
// Update the grasping spring line.
if (mPhysicalCamera->isGrasping())
{
Ogre::Entity* pickingSphere =
mSceneMgr->getEntity("pickingSphere");
if (!pickingSphere->isVisible())
{
pickingSphere->setVisible(true);
}
Ogre::Entity* springLine =
mSceneMgr->getEntity("springLine");
if (!springLine->isVisible())
{
springLine->setVisible(true);
}
opal::Point3r desiredPos =
mPhysicalCamera->getGraspGlobalPos();
Ogre::Vector3 point0(desiredPos[0], desiredPos[1], desiredPos[2]);
opal::Point3r attachPos = mPhysicalCamera->getAttachGlobalPos();
Ogre::Vector3 point1(attachPos[0], attachPos[1], attachPos[2]);
pickingSphere->getParentSceneNode()->setPosition(point1);
Ogre::Vector3 lineVec = point0 - point1;
if (!lineVec.isZeroLength())
{
Ogre::SceneNode* springLineNode =
springLine->getParentSceneNode();
springLineNode->setPosition(0.5 * (point0 + point1));
springLineNode->setDirection(lineVec);
springLineNode->setScale(0.1, 0.1, lineVec.length());
}
else
{
springLine->setVisible(false);
}
}
else
{
Ogre::Entity* pickingSphere =
mSceneMgr->getEntity("pickingSphere");
if (pickingSphere->isVisible())
{
pickingSphere->setVisible(false);
}
Ogre::Entity* springLine =
mSceneMgr->getEntity("springLine");
if (springLine->isVisible())
{
springLine->setVisible(false);
}
}
// Return true to continue looping.
return keepLooping;
}
示例4: _processParticle
//-----------------------------------------------------------------------
// void LightRenderer::_updateRenderQueue(Ogre::RenderQueue* queue, ParticlePool* pool)
// {
// ParticleRenderer::_updateRenderQueue(queue, pool);
// }
//-----------------------------------------------------------------------
void LightRenderer::_processParticle(ParticleTechnique* particleTechnique,
Particle* particle,
Real timeElapsed,
bool firstParticle)
{
if (!mVisible)
return;
VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
LightRendererVisualData* visualData = static_cast<LightRendererVisualData*>(particle->visualData);
// Check whether the particle has visual data
if (!visualData && !mVisualData.empty())
{
visualParticle->visualData = mVisualData.back();
mVisualData.pop_back();
}
visualData = static_cast<LightRendererVisualData*>(particle->visualData);
if (!visualData)
return;
// Update the node
Ogre::SceneNode* node = visualData->node;
if (!node)
return;
node->_setDerivedPosition(visualParticle->position);
node->setDirection(visualParticle->direction, Ogre::Node::TS_WORLD); // Needed for direction of spotlight
Ogre::Light* light = visualData->light;
if (!light)
return;
// Update the light: The light gets the diffuse colour from the particle, so Colour Affectors etc. can be used.
light->setDiffuseColour(visualParticle->colour.r, visualParticle->colour.g, visualParticle->colour.b);
// Update the counters (if needed)
if (mFlashFrequency > 0.0f)
{
visualData->flashFrequencyCount += timeElapsed;
if (visualData->flashFrequencyCount > mFlashFrequency)
{
visualData->flashFrequencyCount -= mFlashFrequency;
// Update the light
if (mFlashRandom)
{
if (Math::UnitRandom() > 0.5f)
{
light->setVisible(!light->isVisible());
}
}
else
{
light->setVisible(true);
visualData->flashLengthCount = 0.0f;
}
}
if (!mFlashRandom && light->isVisible())
{
visualData->flashLengthCount += timeElapsed;
if (visualData->flashLengthCount > mFlashLength)
{
light->setVisible(false);
visualData->flashLengthCount -= mFlashLength;
}
}
}
else
{
light->setVisible(true);
}
}
示例5: appFrameStarted
bool PlaypenApp::appFrameStarted(opal::real dt)
{
// Do per-frame application-specific things here.
// Update the grasping spring line.
if (mPhysicalCamera->isGrasping())
{
Ogre::Entity* pickingSphere =
mSceneMgr->getEntity("pickingSphere");
if (!pickingSphere->isVisible())
{
pickingSphere->setVisible(true);
}
Ogre::Entity* springLine =
mSceneMgr->getEntity("springLine");
if (!springLine->isVisible())
{
springLine->setVisible(true);
}
opal::Point3r desiredPos =
mPhysicalCamera->getGraspGlobalPos();
Ogre::Vector3 point0(desiredPos[0], desiredPos[1], desiredPos[2]);
opal::Point3r attachPos = mPhysicalCamera->getAttachGlobalPos();
Ogre::Vector3 point1(attachPos[0], attachPos[1], attachPos[2]);
pickingSphere->getParentSceneNode()->setPosition(point1);
Ogre::Vector3 lineVec = point0 - point1;
if (!lineVec.isZeroLength())
{
Ogre::SceneNode* springLineNode =
springLine->getParentSceneNode();
springLineNode->setPosition(0.5 * (point0 + point1));
springLineNode->setDirection(lineVec, Ogre::Node::TS_WORLD);
springLineNode->setScale(0.1, 0.1, lineVec.length());
}
else
{
springLine->setVisible(false);
}
}
else
{
Ogre::Entity* pickingSphere =
mSceneMgr->getEntity("pickingSphere");
if (pickingSphere->isVisible())
{
pickingSphere->setVisible(false);
}
Ogre::Entity* springLine =
mSceneMgr->getEntity("springLine");
if (springLine->isVisible())
{
springLine->setVisible(false);
}
}
// Return true to continue looping.
return true;
}