本文整理汇总了C++中ogre::Skeleton::setBlendMode方法的典型用法代码示例。如果您正苦于以下问题:C++ Skeleton::setBlendMode方法的具体用法?C++ Skeleton::setBlendMode怎么用?C++ Skeleton::setBlendMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Skeleton
的用法示例。
在下文中一共展示了Skeleton::setBlendMode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTimer
void CBlendingAnimationsView::OnTimer(UINT_PTR nIDEvent)
{
CEngine *Engine = ((CBlendingAnimationsApp*)AfxGetApp())->m_Engine;
Ogre::Root *Root = Engine->GetRoot();
Ogre::SceneNode *RobotNode = Root->getSceneManager("Walking")->getSceneNode("Robot");
Ogre::Entity *RobotEntity = Root->getSceneManager("Walking")->getEntity("Robot");
Ogre::Skeleton *Skeleton = RobotEntity->getSkeleton();
if (m_WeightDlg->m_IsAverage)
{
Skeleton->setBlendMode(Ogre::SkeletonAnimationBlendMode::ANIMBLEND_AVERAGE);
}
else
{
Skeleton->setBlendMode(Ogre::SkeletonAnimationBlendMode::ANIMBLEND_CUMULATIVE);
}
double WalkWeight;
double SlumpWeight;
switch(nIDEvent)
{
case 1:
WalkWeight = m_WeightDlg->m_WalkWeight.GetPos() / 10.0;
SlumpWeight = m_WeightDlg->m_SlumpWeight.GetPos() / 10.0;
m_WalkAnimation->setWeight(WalkWeight);
m_SlumpAnimation->setWeight(SlumpWeight);
m_WalkAnimation->addTime(0.01);
m_SlumpAnimation->addTime(0.01);
break;
case 2:
m_WalkAnimation->addTime(0.01);
break;
case 3:
m_SlumpAnimation->addTime(0.01);
break;
}
Root->renderOneFrame();
CView::OnTimer(nIDEvent);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:52,代码来源:BlendingAnimationsView.cpp
示例2: ExampleAnimationSystem
AnimationSystem::AnimationSystem( Ogre::Entity* entity )
: ExampleAnimationSystem()
, m_animations( NULL )
{
assert( entity );
m_animations = entity->getAllAnimationStates();
bool entityIsAnimated = ( entity->getAllAnimationStates() != NULL );
assert( entityIsAnimated );
Ogre::Skeleton* skeleton = entity->getSkeleton();
skeleton->setBlendMode( Ogre::ANIMBLEND_CUMULATIVE );
}
示例3: OgreContainer
//!
//! Create new scene.
//! \return True if the scene was successfully created, otherwise False.
//!
bool Model2SceneNode::createEntity(QString name, QString fileName)
{
// destroy the entity through its scene manager
Ogre::SceneManager *sceneManager = OgreManager::getSceneManager();
// create a new OGRE entity for each vertex
m_entity = sceneManager->createEntity(name.toStdString(), fileName.toStdString());
if (m_entity) {
// set cumulative blend mode instead of Ogre::ANIMBLEND_AVERAGE which is default
if (m_entity->hasSkeleton()) {
Ogre::Skeleton *skeleton = m_entity->getSkeleton();
skeleton->setBlendMode(Ogre::ANIMBLEND_CUMULATIVE);
}
}
// create a container for the entity
m_entityContainer = new OgreContainer(m_entity);
m_entity->setUserAny(Ogre::Any(m_entityContainer));
return true;
}
示例4: while
//!
//! Clones an Ogre::MovableObject.
//!
//! Is needed because OGRE does not provide clone functions for cameras and
//! lights.
//!
//! \param movableObject The object to clone.
//! \param name The name to use for the object.
//! \param sceneManager The scene manager to use for creating the object.
//! \return The cloned object.
//!
Ogre::MovableObject * OgreTools::cloneMovableObject ( Ogre::MovableObject *movableObject, const QString &name, Ogre::SceneManager *sceneManager /* = 0 */ )
{
// make sure the given object is valid
if (!movableObject) {
Log::error("The given movable object is invalid.", "OgreTools::cloneMovableObject");
return 0;
}
// make sure a valid scene manager is available
if (!sceneManager)
sceneManager = movableObject->_getManager();
if (!sceneManager) {
Log::error("No valid scene manager available.", "OgreTools::cloneMovableObject");
return 0;
}
Ogre::MovableObject *result = 0;
Ogre::String typeName = movableObject->getMovableType();
if (typeName == "Entity") {
// clone entity
Ogre::Entity *entity = dynamic_cast<Ogre::Entity *>(movableObject);
//movableObjectCopy = entity->clone(name.toStdString());
Ogre::Entity *entityCopy = sceneManager->createEntity(name.toStdString(), entity->getMesh()->getName());
Ogre::AnimationStateSet *animationStateSet = entity->getAllAnimationStates();
Ogre::AnimationStateSet *animationStateSetCopy = entityCopy->getAllAnimationStates();
// set the same blend mode on entity copy
if (entity && entityCopy) {
if (entity->hasSkeleton() && entityCopy->hasSkeleton()) {
Ogre::Skeleton *skeleton = entity->getSkeleton();
Ogre::Skeleton *skeletonCopy = entityCopy->getSkeleton();
skeletonCopy->setBlendMode(skeleton->getBlendMode());
}
}
// copy all animation states
if (animationStateSet && animationStateSetCopy) {
Ogre::AnimationStateIterator animationStateIter = animationStateSet->getAnimationStateIterator();
Ogre::AnimationStateIterator animationStateCopyIter = animationStateSetCopy->getAnimationStateIterator();
while (animationStateIter.hasMoreElements()) {
if (!animationStateCopyIter.hasMoreElements())
break;
Ogre::AnimationState *animationState = animationStateIter.getNext();
Ogre::AnimationState *animationStateCopy = animationStateCopyIter.getNext();
animationStateCopy->setLoop(animationState->getLoop());
//bool enabled = animationState->getEnabled();
//animationStateCopy->setEnabled(animationState->getEnabled());
animationStateCopy->setEnabled(true);
animationStateCopy->setTimePosition(animationState->getTimePosition());
}
}
// create a new container for the cloned entity
OgreContainer *entityCopyContainer = new OgreContainer(entityCopy);
entityCopy->setUserAny(Ogre::Any(entityCopyContainer));
if (!entity->getUserAny().isEmpty()) {
OgreContainer *entityContainer = Ogre::any_cast<OgreContainer *>(entity->getUserAny());
if (entityContainer) {
QObject::connect(entityContainer, SIGNAL(animationStateUpdated(const QString &, double)), entityCopyContainer, SLOT(updateAnimationState(const QString &, double)));
QObject::connect(entityContainer, SIGNAL(boneTransformUpdated(const QString &, double, double, double, double, double, double)), entityCopyContainer, SLOT(updateBoneTransform(const QString &, double, double, double, double, double, double)));
}
}
result = dynamic_cast<Ogre::MovableObject *>(entityCopy);
} else if (typeName == "Light") {
// clone light
Ogre::Light *light = dynamic_cast<Ogre::Light *>(movableObject);
Ogre::Light *lightCopy = sceneManager->createLight(name.toStdString());
lightCopy->setType(light->getType());
lightCopy->setDiffuseColour(light->getDiffuseColour());
lightCopy->setSpecularColour(light->getSpecularColour());
lightCopy->setAttenuation(light->getAttenuationRange(), light->getAttenuationConstant(), light->getAttenuationLinear(), light->getAttenuationQuadric());
lightCopy->setPosition(light->getPosition());
lightCopy->setDirection(light->getDirection());
if (lightCopy->getType() == Ogre::Light::LT_SPOTLIGHT)
lightCopy->setSpotlightRange(light->getSpotlightInnerAngle(), light->getSpotlightOuterAngle(), light->getSpotlightFalloff());
lightCopy->setPowerScale(light->getPowerScale());
lightCopy->setCastShadows(light->getCastShadows());
// create a new container for the cloned light
OgreContainer *lightCopyContainer = new OgreContainer(lightCopy);
lightCopy->setUserAny(Ogre::Any(lightCopyContainer));
if (!light->getUserAny().isEmpty()) {
OgreContainer *lightContainer = Ogre::any_cast<OgreContainer *>(light->getUserAny());
if (lightContainer)
QObject::connect(lightContainer, SIGNAL(sceneNodeUpdated()), lightCopyContainer, SLOT(updateLight()));
}
result = dynamic_cast<Ogre::MovableObject *>(lightCopy);
} else if (typeName == "Camera") {
// clone camera
Ogre::Camera *camera = dynamic_cast<Ogre::Camera *>(movableObject);
Ogre::Camera *cameraCopy = sceneManager->createCamera(name.toStdString());
//.........这里部分代码省略.........
示例5: skeleton_set_blend_mode
//void setBlendMode(SkeletonAnimationBlendMode state);
void skeleton_set_blend_mode(SkeletonHandle handle, skeleton_animation_blend_mode state)
{
Ogre::Skeleton* skeleton = static_cast<Ogre::Skeleton*>(handle);
Ogre::SkeletonAnimationBlendMode mode = llcoi_skeleton_blend_mode_to_ogre(state);
skeleton->setBlendMode(mode);
}