本文整理汇总了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();
}
示例2: fromTransformationMatrix
//-----------------------------------------------------------------------
void DualQuaternion::fromTransformationMatrix (const Matrix4& kTrans)
{
Vector3 pos;
Vector3 scale;
Quaternion rot;
kTrans.decomposition(pos, scale, rot);
fromRotationTranslation(rot, pos);
}
示例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)));
}