本文整理汇总了C++中Matrix3::getCol2方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3::getCol2方法的具体用法?C++ Matrix3::getCol2怎么用?C++ Matrix3::getCol2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3
的用法示例。
在下文中一共展示了Matrix3::getCol2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: length
void Magic3D::Object::applyMatrix(Matrix4 matrix)
{
Vector3 tmpPos = matrix.getTranslation();
Matrix3 mRot = matrix.getUpper3x3();
Vector3 tmpScale = Vector3(length(mRot.getCol0()), length(mRot.getCol1()), length(mRot.getCol2()));
mRot.setCol0(normalize(mRot.getCol0()));
mRot.setCol1(normalize(mRot.getCol1()));
mRot.setCol2(normalize(mRot.getCol2()));
setPosition(tmpPos);
setRotation(Quaternion(mRot));
setScale(tmpScale);
}
示例2: getMatrix
Magic3D::Matrix4 Magic3D::Object::getMatrixFromParent()
{
Matrix4 m = getMatrix();
if (getParent())
{
m = getParent()->getMatrixFromParent();
if (getParentBone())
{
m = m * getParentBone()->getMatrixFromParent();
}
if (isParentPosition() && isParentRotation() && isParentScale())
{
m = m * getMatrix();
}
else
{
Vector3 tmpPos = m.getTranslation();
Matrix3 mRot = m.getUpper3x3();
Vector3 tmpScale = Vector3(length(mRot.getCol0()), length(mRot.getCol1()), length(mRot.getCol2()));
mRot.setCol0(normalize(mRot.getCol0()));
mRot.setCol1(normalize(mRot.getCol1()));
mRot.setCol2(normalize(mRot.getCol2()));
m = Matrix4::identity();
if (isParentRotation())
{
m = m * Matrix4(mRot, Vector3(0.0f, 0.0f, 0.0f));
}
if (isParentPosition())
{
m.setTranslation(tmpPos);
}
if (isParentScale())
{
m = appendScale(m, tmpScale); // Faster than creating and multiplying a scale transformation matrix.
}
m = m * getMatrix();
}
}
if (billboard != eBILLBOARD_NONE)
{
Camera* camera = Renderer::getInstance()->getCurrentViewPort()->getPerspective();
Matrix3 view = camera->getView().getUpper3x3();
Matrix3 bb = Matrix3::identity();
switch (billboard)
{
case eBILLBOARD_HORIZONTAL:
{
Vector3 v1 = Vector3(1.0f, 0.0f, 0.0f);
Vector3 v2 = view.getCol0();
float angle = Math::angle(v1, v2, Vector3(0.0f, 1.0f, 0.0f));
bb = Matrix3::rotationY(angle);
break;
}
case eBILLBOARD_VERTICAL:
{
Vector3 v1 = Vector3(0.0f, 1.0f, 0.0f);
Vector3 v2 = view.getCol1();
float angle = Math::angle(v1, v2, Vector3(1.0f, 0.0f, 0.0f));
bb = Matrix3::rotationX(angle);
break;
}
default:
{
bb = view;
break;
}
}
bb = inverse(m.getUpper3x3()) * inverse(bb);
m = m * Matrix4(bb, Vector3(0.0f, 0.0f, 0.0f));
}
return m;
}