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


C++ Bone::Index方法代码示例

本文整理汇总了C++中Bone::Index方法的典型用法代码示例。如果您正苦于以下问题:C++ Bone::Index方法的具体用法?C++ Bone::Index怎么用?C++ Bone::Index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bone的用法示例。


在下文中一共展示了Bone::Index方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetInterpolatedPose

	void AnimationPlayer::GetInterpolatedPose(float time, SceneNode& sceneNode)
	{
		XMFLOAT4X4 toParentTransform;
		Bone* bone = sceneNode.As<Bone>();
		if (bone != nullptr)
		{
			mCurrentClip->GetInteropolatedTransform(time, *bone, toParentTransform);
		}
		else
		{
			toParentTransform = sceneNode.Transform();
		}

		XMMATRIX toRootTransform = (sceneNode.GetParent() != nullptr ? XMLoadFloat4x4(&toParentTransform) * XMLoadFloat4x4(&(mToRootTransforms.at(sceneNode.GetParent()))) : XMLoadFloat4x4(&toParentTransform));
		XMStoreFloat4x4(&(mToRootTransforms[&sceneNode]), toRootTransform);

		if (bone != nullptr)
		{
			XMStoreFloat4x4(&(mFinalTransforms[bone->Index()]), bone->OffsetTransformMatrix() * toRootTransform * XMLoadFloat4x4(&mInverseRootTransform));
		}

		for (auto& childNode : sceneNode.Children())
		{
			GetInterpolatedPose(time, *childNode);
		}
	}
开发者ID:CalWLee,项目名称:FIEAGraphicsDemo,代码行数:26,代码来源:AnimationPlayer.cpp

示例2: Load

	void Model::Load(std::fstream& fileStream)
	{
		uint_t size;
		
		//read the material data first, since mesh is dependent on material
		ModelDeSerializer::ReadAsBytes(fileStream, size);
		mMaterials.reserve(size);

		for (int i = 0; i < size; i++)
		{
			mMaterials.push_back(new ModelMaterial(*this, fileStream));
		}

		//read the mesh data
		ModelDeSerializer::ReadAsBytes(fileStream, size);
		mMeshes.reserve(size);

		for (int i = 0; i < size; i++)
		{
			mMeshes.push_back(new Mesh(*this, fileStream));
		}

		bool hasSkeleton;
		ModelDeSerializer::ReadAsBytes(fileStream, hasSkeleton);

		if (hasSkeleton)
		{
			ModelDeSerializer::ReadAsBytes(fileStream, size);
			mBones.reserve(size);

			for (int i = 0; i < size; i++)
			{
				Bone* bone = new Bone(*this, fileStream);
				mBones.push_back(bone);
				mBoneIndexMapping[bone->Name()] = bone->Index();
			}

			LoadSkeleton(fileStream, mRootNode);

			ModelDeSerializer::ReadAsBytes(fileStream, size);
			mAnimations.reserve(size);

			for (int i = 0; i < size; i++)
			{
				AnimationClip* clip = new AnimationClip(*this, fileStream);
				mAnimations.push_back(clip);
				mAnimationsByName.insert(std::pair<std::string, AnimationClip*>(clip->Name(), clip));
			}
		}
	}
开发者ID:rsumathijs,项目名称:InuEngine-WIP,代码行数:50,代码来源:Model.cpp

示例3: GetBindPose

	void AnimationPlayer::GetBindPose(SceneNode& sceneNode)
	{
		XMMATRIX toParentTransform = sceneNode.TransformMatrix();
		XMMATRIX toRootTransform = (sceneNode.GetParent() != nullptr ? toParentTransform * XMLoadFloat4x4(&(mToRootTransforms.at(sceneNode.GetParent()))) : toParentTransform);
		XMStoreFloat4x4(&(mToRootTransforms[&sceneNode]), toRootTransform);		

		Bone* bone = sceneNode.As<Bone>();
		if (bone != nullptr)
		{
			XMStoreFloat4x4(&(mFinalTransforms[bone->Index()]), bone->OffsetTransformMatrix() * toRootTransform * XMLoadFloat4x4(&mInverseRootTransform));
		}

		for (auto& childNode : sceneNode.Children())
		{
			GetBindPose(*childNode);
		}
	}
开发者ID:CalWLee,项目名称:FIEAGraphicsDemo,代码行数:17,代码来源:AnimationPlayer.cpp

示例4: GetBindPoseBottomUp

	void AnimationPlayer::GetBindPoseBottomUp(SceneNode& sceneNode)
	{
		XMMATRIX toRootTransform = sceneNode.TransformMatrix();

		SceneNode* parentNode = sceneNode.GetParent();
		while (parentNode != nullptr)
		{
			toRootTransform = toRootTransform * parentNode->TransformMatrix();
			parentNode = parentNode->GetParent();
		}

		Bone* bone = sceneNode.As<Bone>();
		if (bone != nullptr)
		{
			XMStoreFloat4x4(&(mFinalTransforms[bone->Index()]), bone->OffsetTransformMatrix() *  toRootTransform * XMLoadFloat4x4(&mInverseRootTransform));
		}

		for (auto& childNode : sceneNode.Children())
		{
			GetBindPoseBottomUp(*childNode);
		}
	}
开发者ID:CalWLee,项目名称:FIEAGraphicsDemo,代码行数:22,代码来源:AnimationPlayer.cpp


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