void clsHull::Transform() { LPVECTOR3D v; MATRIX3D mTransScalePos(true), mLocalScale(true), mLocalRot(true); size_t vertCount = getVerticesCount(); flushVertices(); GetLocalScaleMatrix(mLocalScale); GetRotationMatrix(mLocalRot); GetMoveMatrix(mTransScalePos); GetScaleMatrix(mTransScalePos); v = cache.data(); for ( size_t i = 0; i < vertCount; i++ ) { Matrix3DTransformNormal( mLocalScale, *(v + i), *(v + i) ); Matrix3DTransformNormal( mLocalRot, *(v + i), *(v + i) ); Matrix3DTransformCoord( mTransScalePos, *(v + i), *(v + i) ); } }
/** * Get matrix representation of the transformation. * * @return Transformation matrix */ Matrix<4,4,float> TransformationNode::GetTransformationMatrix() { // get the rotation from the quaternion Matrix<4,4,float> m = rotation.GetMatrix().GetExpanded(); m.Transpose(); // write in the positional information m(3,0) = position[0]; m(3,1) = position[1]; m(3,2) = position[2]; return GetScaleMatrix() * m; }
void TransformObject::GetWorldTransform(Matrix4f & outM) const { Matrix4f posM, rotM, scaleM; GetTranslationMatrix(posM); GetRotationMatrix(rotM); GetScaleMatrix(scaleM); Matrix4f ret = Matrix4f::Multiply(posM, rotM, scaleM); outM.SetValues(&ret); }
void TransformObject::GetWorldTransform(Matrix4f & outM) const { //TODO: Figure out the math for making one matrix instead of multiplying the pos, rot, and scale matrices. Matrix4f posM, rotM, scaleM; GetTranslationMatrix(posM); GetRotationMatrix(rotM); GetScaleMatrix(scaleM); Matrix4f ret = Matrix4f::Multiply(posM, rotM, scaleM); outM.Set(ret); }
bool PODNode::TryGetMatrix( float frame,Matrix4& outMatrix ) const { outMatrix.LoadIdentity(); RETURN_FALSE_IF(frame<0.f); uint frameIndex=(uint)frame; float frameBlend=frame-(float)frameIndex; outMatrix=Matrix4::Identity; if (!AnimationMatrixes.IsEmpty()) { GetMatrix(frameIndex,outMatrix); } else { GetScaleMatrix(frameIndex,frameBlend,outMatrix); GetRotateMatrix(frameIndex,frameBlend,outMatrix); GetTranslateMatrix(frameIndex,frameBlend,outMatrix); } return true; }
a2de::Matrix3x3 Matrix3x3::GetScaleMatrix(const Vector2D& scale) { return GetScaleMatrix(scale.GetX(), scale.GetY()); }