当前位置: 首页>>代码示例>>C++>>正文


C++ ogre::Bone类代码示例

本文整理汇总了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);
		}
	}
}
开发者ID:Draion,项目名称:Gamekit,代码行数:26,代码来源:gkOgreSkeletonLoader.cpp

示例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());
}
开发者ID:282114790,项目名称:ogrekinect,代码行数:29,代码来源:AxisLines.cpp

示例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);
	
}
开发者ID:whztt07,项目名称:OgreRTC,代码行数:7,代码来源:MyLink.cpp

示例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);
    }
}
开发者ID:whztt07,项目名称:Mermelin,代码行数:35,代码来源:PhysicsComponent.cpp

示例5: setBoneLocalOrientation

	void CAnimatedEntity::setBoneLocalOrientation(std::string boneName, Quaternion localQuat)
	{
		Ogre::Bone* bone = _entity->getSkeleton()->getBone(boneName);

		bone->setManuallyControlled(true);

		bone->setOrientation(localQuat);
	}
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:8,代码来源:AnimatedEntity.cpp

示例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;
}
开发者ID:monwarez-grit,项目名称:grit-engine,代码行数:8,代码来源:gfx_body.cpp

示例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()));
    }
}
开发者ID:bwrsandman,项目名称:openmw,代码行数:57,代码来源:creatureanimation.cpp

示例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);
	}
}
开发者ID:whztt07,项目名称:OgreRTC,代码行数:9,代码来源:MyLink.cpp

示例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));
	}
}
开发者ID:whztt07,项目名称:OgreRTC,代码行数:9,代码来源:MyLink.cpp

示例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);
	}
}
开发者ID:whztt07,项目名称:OgreRTC,代码行数:9,代码来源:MyLink.cpp

示例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);
}
开发者ID:fire-archive,项目名称:llcoi,代码行数:11,代码来源:bone_bind.cpp

示例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);
	}
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:11,代码来源:AnimatedEntity.cpp

示例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;
	}
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:12,代码来源:AnimatedEntity.cpp

示例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;
	}
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:12,代码来源:AnimatedEntity.cpp

示例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;
	}
开发者ID:Ybalrid,项目名称:LeapRift,代码行数:13,代码来源:HandObject.hpp


注:本文中的ogre::Bone类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。