Пример #1
0
Undo::CommandPtr Transform::ComputeObjectComponents()
{
    Undo::CommandPtr command = ResetTransform();

    Math::Scale scale;
    Math::EulerAngles rotate;
    Math::Vector3 translate;
    if (GetInheritTransform())
    {
        // compute the new object space transform from our global transform and our parent's inverse
        Matrix4 objectTransform = (m_GlobalTransform * m_Parent->GetTransform()->GetInverseGlobalTransform());

        // decompose into the new set of components
        objectTransform.Decompose(scale, rotate, translate);
    }
    else
    {
        // we are not inheriting our parent's transform, use the global transform for our components
        m_GlobalTransform.Decompose(scale, rotate, translate);
    }

    m_Scale = scale;
    m_Rotate = rotate;
    m_Translate = translate;

    return command;
}
Пример #2
0
 //----------------------------------------------------------------
 /// Set Local Transform
 ///
 /// This will overwrite any local previous transformations
 ///
 /// @param Objects transformation matrix
 //----------------------------------------------------------------
 void Transform::SetLocalTransform(const Matrix4& inmatTransform)
 {
     inmatTransform.Decompose(mvPosition, mvScale, mqOrientation);
     
     mmatTransform = inmatTransform;
     
     OnTransformChanged();
     
     mbIsTransformCacheValid = false;
 }
Пример #3
0
 //----------------------------------------------------------------
 /// Set World Transform
 ///
 /// This will overwrite any parent or previous transformations
 ///
 /// @param Objects transformation matrix
 //----------------------------------------------------------------
 void Transform::SetWorldTransform(const Matrix4& inmatTransform)
 {
     inmatTransform.Decompose(mvWorldPosition, mvWorldScale, mqWorldOrientation);
     
     mmatWorldTransform = inmatTransform;
     
     OnTransformChanged();
     
     mbIsTransformCacheValid = true;
     mbIsParentTransformCacheValid = true;
 }
Пример #4
0
void Transform::SetObjectTransform( const Matrix4& transform )
{
    Scale scale;
    EulerAngles rotate;
    Vector3 translate;
    transform.Decompose( scale, rotate, translate );

    m_Scale = scale;
    m_Rotate = rotate;
    m_Translate = translate;
    m_ObjectTransform = transform;
}