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


C++ Matrix4::decomposition方法代码示例

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


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

示例1: update

	void CAnimation::update()
	{
		const bool isRunning = SceneManager::instance().isRunning();
		if(!isRunning && !mPreviewMode)
		{
			// Make sure attached CBone components match the position of the skeleton bones even when the component is not
			// otherwise running.

			HRenderable animatedRenderable = SO()->getComponent<CRenderable>();
			if(animatedRenderable)
			{
				HMesh mesh = animatedRenderable->getMesh();
				if(mesh.isLoaded())
				{
					const SPtr<Skeleton>& skeleton = mesh->getSkeleton();
					if(skeleton)
					{
						for (auto& entry : mMappingInfos)
						{
							if(!entry.isMappedToBone)
								continue;

							const UINT32 numBones = skeleton->getNumBones();
							for (UINT32 j = 0; j < numBones; j++)
							{
								if (skeleton->getBoneInfo(j).name == entry.bone->getBoneName())
								{
									Matrix4 bindPose = skeleton->getInvBindPose(j).inverseAffine();
									bindPose = SO()->getTransform().getMatrix() * bindPose;

									Vector3 position, scale;
									Quaternion rotation;
									bindPose.decomposition(position, rotation, scale);

									entry.sceneObject->setWorldPosition(position);
									entry.sceneObject->setWorldRotation(rotation);
									entry.sceneObject->setWorldScale(scale);

									break;
								}
							}
						}
					}
				}
			}
		}

		if (mInternal == nullptr || !isRunning)
			return;

		HAnimationClip newPrimaryClip = mInternal->getClip(0);
		if (newPrimaryClip != mPrimaryPlayingClip)
			_refreshClipMappings();

		if (_scriptUpdateFloatProperties)
			_scriptUpdateFloatProperties();
	}
开发者ID:lysannschlegel,项目名称:bsf,代码行数:57,代码来源:BsCAnimation.cpp

示例2: fromTransformationMatrix

	//-----------------------------------------------------------------------
	void DualQuaternion::fromTransformationMatrix (const Matrix4& kTrans)
	{
		Vector3 pos;
		Vector3 scale;
		Quaternion rot;

		kTrans.decomposition(pos, scale, rot);
		fromRotationTranslation(rot, pos);
	}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:10,代码来源:OgreDualQuaternion.cpp

示例3: testMatrix

void DualQuaternionTests::testMatrix()
{
	Matrix4 transform;
	Vector3 translation(10, 4, 0);
	Vector3 scale = Vector3::UNIT_SCALE;
	Quaternion rotation;
	rotation.FromAngleAxis(Radian(Math::PI), Vector3::UNIT_Z);
	transform.makeTransform(translation, scale, rotation);

	DualQuaternion dQuat;
	dQuat.fromTransformationMatrix(transform);
	Matrix4 transformResult;
	dQuat.toTransformationMatrix(transformResult);

	Vector3 translationResult;
	Vector3 scaleResult;
	Quaternion rotationResult;
	transformResult.decomposition(translationResult, scaleResult, rotationResult);

	CPPUNIT_ASSERT(translationResult.positionEquals(translation));
	CPPUNIT_ASSERT(scaleResult.positionEquals(scale));
	CPPUNIT_ASSERT(rotationResult.equals(rotation, Radian(0.001)));
}
开发者ID:j-rivero,项目名称:ogre-acornacorn,代码行数:23,代码来源:DualQuaternionTests.cpp


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