本文整理汇总了C++中osg::Matrix::makeIdentity方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::makeIdentity方法的具体用法?C++ Matrix::makeIdentity怎么用?C++ Matrix::makeIdentity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Matrix
的用法示例。
在下文中一共展示了Matrix::makeIdentity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readRotationElement
void readRotationElement(KFbxTypedProperty<fbxDouble3>& prop,
ERotationOrder fbxRotOrder,
bool quatInterpolate,
osgAnimation::UpdateMatrixTransform* pUpdate,
osg::Matrix& staticTransform)
{
if (prop.GetKFCurve(KFCURVENODE_R_X) ||
prop.GetKFCurve(KFCURVENODE_R_Y) ||
prop.GetKFCurve(KFCURVENODE_R_Z))
{
if (quatInterpolate)
{
if (!staticTransform.isIdentity())
{
pUpdate->getStackedTransforms().push_back(
new osgAnimation::StackedMatrixElement(staticTransform));
staticTransform.makeIdentity();
}
pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedQuaternionElement(
"quaternion", makeQuat(prop.Get(), fbxRotOrder)));
}
else
{
char* curveNames[3] = {KFCURVENODE_R_X, KFCURVENODE_R_Y, KFCURVENODE_R_Z};
osg::Vec3 axes[3] = {osg::Vec3(1,0,0), osg::Vec3(0,1,0), osg::Vec3(0,0,1)};
fbxDouble3 fbxPropValue = prop.Get();
fbxPropValue[0] = osg::DegreesToRadians(fbxPropValue[0]);
fbxPropValue[1] = osg::DegreesToRadians(fbxPropValue[1]);
fbxPropValue[2] = osg::DegreesToRadians(fbxPropValue[2]);
int order[3] = {0, 1, 2};
getRotationOrder(fbxRotOrder, order);
for (int i = 0; i < 3; ++i)
{
int j = order[2-i];
if (prop.GetKFCurve(curveNames[j]))
{
if (!staticTransform.isIdentity())
{
pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedMatrixElement(staticTransform));
staticTransform.makeIdentity();
}
pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement(
std::string("rotate") + curveNames[j], axes[j], fbxPropValue[j]));
}
else
{
staticTransform.preMultRotate(osg::Quat(fbxPropValue[j], axes[j]));
}
}
}
}
else
{
staticTransform.preMultRotate(makeQuat(prop.Get(), fbxRotOrder));
}
}
示例2: readScaleElement
void readScaleElement(FbxPropertyT<FbxDouble3>& prop,
osgAnimation::UpdateMatrixTransform* pUpdate,
osg::Matrix& staticTransform,
FbxScene& fbxScene)
{
FbxDouble3 fbxPropValue = prop.Get();
osg::Vec3d val(
fbxPropValue[0],
fbxPropValue[1],
fbxPropValue[2]);
if (isAnimated(prop, fbxScene))
{
if (!staticTransform.isIdentity())
{
pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedMatrixElement(staticTransform));
staticTransform.makeIdentity();
}
pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedScaleElement("scale", val));
}
else
{
staticTransform.preMultScale(val);
}
}
示例3: readScaleElement
void readScaleElement(KFbxTypedProperty<fbxDouble3>& prop,
osgAnimation::UpdateMatrixTransform* pUpdate,
osg::Matrix& staticTransform)
{
fbxDouble3 fbxPropValue = prop.Get();
osg::Vec3d val(
fbxPropValue[0],
fbxPropValue[1],
fbxPropValue[2]);
if (prop.GetKFCurve(KFCURVENODE_S_X) ||
prop.GetKFCurve(KFCURVENODE_S_Y) ||
prop.GetKFCurve(KFCURVENODE_S_Z))
{
if (!staticTransform.isIdentity())
{
pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedMatrixElement(staticTransform));
staticTransform.makeIdentity();
}
pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedScaleElement("scale", val));
}
else
{
staticTransform.preMultScale(val);
}
}
示例4: calculate_world_matrix
void Node::calculate_world_matrix(osg::Matrix& trans, int frame_num) {
Node* node = this;
trans.makeIdentity();
while (node != NULL) {
trans = trans * osg::Matrix::rotate(node->quat_arr.at(frame_num))
* osg::Matrix::translate(
node->offset + node->froset->at(frame_num));
node = node->parent;
}
}
示例5: get_parent_to_bone_end_matrix
void Node::get_parent_to_bone_end_matrix(int frame_num, osg::Matrix& m) {
m.makeIdentity();
if (parent == NULL) {
return;
}
//Calculate the transformation from the parent
//to the end of this bone end position
m = osg::Matrix::translate(local_end)
* osg::Matrix::rotate(quat_arr.at(frame_num))
* osg::Matrix::translate(parent->local_end)
* osg::Matrix::rotate(parent->quat_arr.at(frame_num));
}