本文整理汇总了C++中ogre::Bone类的典型用法代码示例。如果您正苦于以下问题:C++ Bone类的具体用法?C++ Bone怎么用?C++ Bone使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bone类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeManual
void gkSkeletonLoader::makeManual(gkEntity* ent)
{
Ogre::Entity* oent = ent->getEntity();
if (!oent || !oent->hasSkeleton())
return;
Ogre::SkeletonInstance* inst = oent->getSkeleton();
gkBone::BoneList::Iterator it = m_skeleton->getBoneList().iterator();
while (it.hasMoreElements())
{
gkBone* bone = it.getNext();
if (inst->hasBone(bone->getName()))
{
Ogre::Bone* obone = inst->getBone(bone->getName());
bone->_setOgreBone(obone);
obone->setManuallyControlled(true);
}
}
}
示例2: initAxis
//-------------------------------------------------------------------------------------
void AxisLines::initAxis(Ogre::String boneName, Ogre::Entity* entity, Ogre::SceneManager* mSceneManager)
{
if(isXVisible) /* red */
{
xLine = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
entity->attachObjectToBone(boneName, xLine);
xLine->setMaterial(color1);
}
if(isYVisible) /* green */
{
yLine = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
entity->attachObjectToBone(boneName, yLine);
yLine->setMaterial(color2);
}
if(isZVisible) /* blue */
{
zLine = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
entity->attachObjectToBone(boneName, zLine);
zLine->setMaterial(color3);
}
Ogre::Bone* bone = entity->getSkeleton()->getBone(boneName);
Ogre::Quaternion q = bone->getOrientation();
this->updateLines(q.xAxis(), q.yAxis(), q.zAxis());
}
示例3: SetBornPosition
void MyLink::SetBornPosition( int name, float x, float y, float z)
{
Ogre::Bone *bone = mEntity->getSkeleton()->getBone(name);
bone->setManuallyControlled(true);
bone->setPosition(x,y,z);
}
示例4: receiveEvent
void PhysicsComponent::receiveEvent(Event* event)
{
if (event->getType() == Event::PHYSICS_UPDATE) {
btTransform transform;
transform.setIdentity();
Ogre::Vector3 position = parent->getNode()->_getDerivedPosition();
Ogre::Quaternion orientation = parent->getNode()->_getDerivedOrientation();
if (this->getParent()->getGraphicComponent()->isAnimated() && false) {
Ogre::Bone* bone = parent->getOgreEntity()->getSkeleton()->getBone(0);
Ogre::Vector3 bone_converted_pos = parent->getNode()
->convertLocalToWorldPosition(bone->_getDerivedPosition());
Ogre::Quaternion bone_converted_or = parent->getNode()
->convertLocalToWorldOrientation(bone->_getDerivedOrientation());
Ogre::Vector3 bonePos =
parent->getNode()->_getDerivedPosition() +
parent->getNode()->_getDerivedOrientation() *
bone_converted_pos;
Ogre::Quaternion boneRot = parent->getNode()->_getDerivedOrientation() * (bone
->getInitialOrientation().Inverse() * bone->_getDerivedOrientation());
position = bone_converted_pos;
orientation = boneRot;
}
transform.setOrigin(BtOgre::Convert::toBullet(position));
transform.setRotation(BtOgre::Convert::toBullet(orientation));
state->setKinematicPos(transform);
}
}
示例5: setBoneLocalOrientation
void CAnimatedEntity::setBoneLocalOrientation(std::string boneName, Quaternion localQuat)
{
Ogre::Bone* bone = _entity->getSkeleton()->getBone(boneName);
bone->setManuallyControlled(true);
bone->setOrientation(localQuat);
}
示例6: getBoneWorldTransform
Transform GfxBody::getBoneWorldTransform (unsigned n)
{
checkBone(n);
Ogre::Bone *bone = skeleton->getBone(n);
Transform t(from_ogre(bone->_getDerivedPosition()), from_ogre(bone->_getDerivedOrientation()), from_ogre(bone->_getDerivedScale()));
updateWorldTransform();
return worldTransform * t;
}
示例7: updatePart
void CreatureWeaponAnimation::updatePart(NifOgre::ObjectScenePtr& scene, int slot)
{
MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
MWWorld::ContainerStoreIterator it = inv.getSlot(slot);
if (it == inv.end())
{
scene.setNull();
return;
}
MWWorld::Ptr item = *it;
std::string bonename;
if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
bonename = "Weapon Bone";
else
bonename = "Shield Bone";
scene = NifOgre::Loader::createObjects(mSkelBase, bonename, mInsert, item.getClass().getModel(item));
Ogre::Vector3 glowColor = getEnchantmentColor(item);
setRenderProperties(scene, RV_Actors, RQG_Main, RQG_Alpha, 0,
!item.getClass().getEnchantment(item).empty(), &glowColor);
if(scene->mSkelBase)
{
Ogre::SkeletonInstance *skel = scene->mSkelBase->getSkeleton();
if(scene->mSkelBase->isParentTagPoint())
{
Ogre::Node *root = scene->mSkelBase->getParentNode();
if(skel->hasBone("BoneOffset"))
{
Ogre::Bone *offset = skel->getBone("BoneOffset");
root->translate(offset->getPosition());
// It appears that the BoneOffset rotation is completely bogus, at least for light models.
//root->rotate(offset->getOrientation());
root->pitch(Ogre::Degree(-90.0f));
root->scale(offset->getScale());
root->setInitialState();
}
}
updateSkeletonInstance(mSkelBase->getSkeleton(), skel);
}
// TODO:
// type == ESM::PRT_Weapon should get an animation source based on the current offset
// of the weapon attack animation (from its beginning, or start marker?)
std::vector<Ogre::Controller<Ogre::Real> >::iterator ctrl(scene->mControllers.begin());
for(;ctrl != scene->mControllers.end();ctrl++)
{
if(ctrl->getSource().isNull())
ctrl->setSource(Ogre::SharedPtr<NullAnimationTime>(new NullAnimationTime()));
}
}
示例8: SetBornScale
void MyLink::SetBornScale( const char*name, float sx, float sy, float sz)
{
if(mEntity->getSkeleton()->hasBone(name) == true)
{
Ogre::Bone *bone = mEntity->getSkeleton()->getBone(name);
bone->setManuallyControlled(true);
bone->setScale(sx,sy,sz);
}
}
示例9: SetBornYaw
void MyLink::SetBornYaw( const char*name, float ang)
{
if(mEntity->getSkeleton()->hasBone(name) == true)
{
Ogre::Bone *bone = mEntity->getSkeleton()->getBone(name);
bone->setManuallyControlled(true);
bone->yaw(Ogre::Degree(ang));
}
}
示例10: SetBornOrientation
void MyLink::SetBornOrientation( const char*name, float w, float x, float y, float z)
{
if(mEntity->getSkeleton()->hasBone(name) == true)
{
Ogre::Bone *bone = mEntity->getSkeleton()->getBone(name);
bone->setManuallyControlled(true);
bone->setOrientation(w,x,y,z);
}
}
示例11: bone_create_child
//Bone* createChild(unsigned short handle, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
BoneHandle bone_create_child(BoneHandle obj, unsigned short handle, const coiVector3* t, const coiQuaternion* r)
{
Ogre::Bone* bone = static_cast<Ogre::Bone*>(obj);
const Ogre::Vector3 translate(t->x, t->y, t->z);
const Ogre::Quaternion rotate(r->w, r->x, r->y, r->z);
Ogre::Bone* child = bone->createChild(handle, translate, rotate);
return static_cast<BoneHandle>(child);
}
示例12: setBoneWorldOrientation
void CAnimatedEntity::setBoneWorldOrientation(std::string boneName, Quaternion worldQuat)
{
Ogre::Bone* bone = _entity->getSkeleton()->getBone(boneName);
bone->setManuallyControlled(true);
Ogre::Quaternion parentQuat = _entityNode->_getDerivedOrientation();
Ogre::Quaternion boneQuat = worldQuat.Inverse() * parentQuat;
bone->_setDerivedOrientation(boneQuat);
}
示例13: getBoneWorldOrientation
Quaternion CAnimatedEntity::getBoneWorldOrientation(std::string boneName)
{
Ogre::Bone* bone = _entity->getSkeleton()->getBone(boneName);
Ogre::SceneNode *parent = _entityNode; /*node of the entity that has the skeleton*/;
Ogre::Quaternion parentQuat = _entityNode->_getDerivedOrientation();
Ogre::Quaternion boneQuat = bone->_getDerivedOrientation();
Ogre::Quaternion worldQuat = boneQuat * parentQuat; // actually, it might be parentQuat * boneQuat, I forgot
return worldQuat;
}
示例14: getBoneWorldPosition
Vector3 CAnimatedEntity::getBoneWorldPosition(std::string boneName)
{
Ogre::Bone* bone = _entity->getSkeleton()->getBone(boneName);
Ogre::Quaternion parentQuat = _entityNode->_getDerivedOrientation();
Ogre::Vector3 parentPos = _entityNode->_getDerivedPosition();
Ogre::Vector3 bonePos = bone->_getDerivedPosition();
Ogre::Vector3 worldPos = parentQuat * bonePos + parentPos;
return worldPos;
}
示例15: getWristOrientation
///Get the orientation of the wrist bone
Ogre::Quaternion getWristOrientation()
{
Ogre::Entity* hand = this->Entity();
assert(hand);
Ogre::SkeletonInstance* ske;
Ogre::Bone* wrist;
if(ske = hand->getSkeleton())
if(wrist = ske->getBone("Wrist"))
return wrist->getOrientation();
return Ogre::Quaternion::IDENTITY;
}