本文整理汇总了C++中ogre::SceneNode::_setDerivedPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::_setDerivedPosition方法的具体用法?C++ SceneNode::_setDerivedPosition怎么用?C++ SceneNode::_setDerivedPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::_setDerivedPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _updateRenderQueue
//-----------------------------------------------------------------------
void EntityRenderer::_updateRenderQueue(Ogre::RenderQueue* queue, ParticlePool* pool)
{
// Always perform this one
ParticleRenderer::_updateRenderQueue(queue, pool);
if (!mVisible)
return;
// Fast check to determine whether there are visual particles
if (pool->isEmpty(Particle::PT_VISUAL))
return;
VisualParticle* particle = static_cast<VisualParticle*>(pool->getFirst(Particle::PT_VISUAL));
while (!pool->end(Particle::PT_VISUAL))
{
if (particle)
{
if (!particle->visualData && !mVisualData.empty())
{
particle->visualData = mVisualData.back();
mVisualData.pop_back();
}
if (particle->visualData)
{
Ogre::SceneNode* node = (static_cast<EntityRendererVisualData*>(particle->visualData))->node;
if (node)
{
node->_setDerivedPosition(particle->position);
if (mEntityOrientationType == ENT_ORIENTED_SHAPE)
{
// Use the orientation of the particle itself
node->setOrientation(particle->orientation);
}
else if (mEntityOrientationType == ENT_ORIENTED_SELF)
{
// Rotate towards the direction
node->setOrientation(Vector3::UNIT_X.getRotationTo(particle->direction));
}
else if (mEntityOrientationType == ENT_ORIENTED_SELF_MIRRORED)
{
// Rotate towards the negative direction
node->setOrientation(Vector3::UNIT_X.getRotationTo(-particle->direction));
}
node->setVisible(true);
node->setScale(particle->width / mBoxWidth, particle->height / mBoxHeight, particle->depth / mBoxDepth);
if (mZRotated)
{
_rotateTexture(particle, static_cast<Ogre::Entity*>(node->getAttachedObject(0))); // We know for sure there is only one and it is an Entity*
}
}
}
}
particle = static_cast<VisualParticle*>(pool->getNext(Particle::PT_VISUAL));
}
}
示例2: _updateRenderQueue
//-----------------------------------------------------------------------
void RibbonTrailRenderer::_updateRenderQueue(Ogre::RenderQueue* queue, ParticlePool* pool)
{
// Always perform this one
ParticleRenderer::_updateRenderQueue(queue, pool);
if (!mVisible)
return;
Particle* particle = static_cast<Particle*>(pool->getFirst());
RibbonTrailRendererVisualData* visualData = 0;
while (!pool->end())
{
if (particle)
{
if (!particle->visualData && !mVisualData.empty())
{
particle->visualData = mVisualData.back();
mVisualData.pop_back();
visualData = static_cast<RibbonTrailRendererVisualData*>(particle->visualData);
}
visualData = static_cast<RibbonTrailRendererVisualData*>(particle->visualData);
if (visualData)
{
Ogre::SceneNode* node = visualData->node;
node->_setDerivedPosition(particle->position);
// Set the width of the trail if required
if (particle->particleType == Particle::PT_VISUAL)
{
VisualParticle* visualParticle = static_cast<VisualParticle*>(particle);
if (visualParticle->ownDimensions)
{
mTrail->setInitialWidth(visualData->index, visualParticle->width);
}
}
visualData->setVisible(true);
}
}
particle = static_cast<Particle*>(pool->getNext());
}
}
示例3: _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);
}
}