True Axis Physics SDK 1.2.0.1 Beta Documentation
www.trueaxis.com

MFrame.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------------
00002 // File Name: MFrame.h
00003 // Description: A convenient structure for positioning objects in a 3d world.
00004 //              Contains a 3 by 3 Matrix for the rotation and a Vec3 for the
00005 //              translation. It is assumed that the matrix only contains rotation.
00006 //              This makes inverting much faster.
00009 //
00010 // Copyright (C) 2004 - 2006 True Axis Pty Ltd, Australia. 
00011 // All Rights Reserved.
00012 //
00013 // History:
00014 //      Created File.
00015 //---------------------------------------------------------------------------------
00016 
00017 #ifndef TA_MFRAME_H
00018 #define TA_MFRAME_H
00019 
00020 #ifndef TA_MATRIX_H
00021 #include "Matrix.h"
00022 #endif // TA_MATRIX_H
00023 
00024 TA_OBFUSCATION_SKIP_PASS_2
00025 
00026 struct D3DXMATRIX;
00027 
00028 namespace TA
00029 {
00030 
00031 struct TACOMMON_CLASS MFrame
00032 {
00033 public:
00034     TA_OBFUSCATION_RESERVED_FULL_ON
00035     // m_ here for convenience  
00036     Mat33 m33Rotation;
00037     Vec3 v3Translation;
00038     TA_OBFUSCATION_RESERVED_FULL_OFF
00039 
00040     TA_OBFUSCATION_RESERVED_ON
00042 
00043     MFrame();
00044     //Mat33(const float* );
00045     MFrame(const MFrame& mFrame);
00046     MFrame(const Vec3& v3NewTranslation);
00047     MFrame(const Mat33& m33NewRotation);
00048     MFrame(
00049     const Vec3& v3NewTranslation,
00050     const Mat33& m33NewRotation);
00051     
00052     void Clear();
00053 
00054     // d3d conversion functions
00055     void Initialise(D3DXMATRIX* pD3DMatrix);
00056     void GetAsD3DMatrix(D3DXMATRIX* pD3DMatrix) const;
00058 
00059     // d3d conversion functions
00060     void InitialiseFromOpenGlMatrix(const float* pfMatrix);
00061     void GetOpenGlMatrix(float* pfMatrix) const;
00063 
00064     void Interpolate(MFrame& a, MFrame& b, float fT);
00065 
00067 
00068     MFrame& operator *= (const MFrame& mFrame);
00069     MFrame& operator *= (const Mat33& m33Value);
00070     MFrame& operator /= (const MFrame& mFrameB);
00072 
00074 
00075     MFrame operator * (const MFrame& mFrame) const;
00076     MFrame operator * (const Mat33& m33Value) const;
00077     MFrame operator / (const MFrame& mFrameB) const;
00079 
00080     friend Vec3 operator * (const Vec3& v3A, const MFrame& mFrameB);
00081     friend Vec3 operator / (const Vec3& v3A, const MFrame& mFrameB);
00082     friend Vec3& operator *= (Vec3& v3A, const MFrame& m33B);
00083     friend Vec3& operator /= (Vec3& v3A, const MFrame& m33B);
00084 
00086 
00087     bool operator == (const MFrame& mFrame) const;
00088     bool operator != (const MFrame& mFrame) const;
00090     
00091     // Invert
00092     void Invert();
00093     static MFrame TAC_CALL GetInverse(const MFrame& mFrame);
00094     MFrame GetInverse() const;
00095 
00096     // Vertex transformation
00097     Vec3 GetTransform(const Vec3& v3Value);
00098     Vec3 GetInverseTransform(const Vec3& v3Value);
00099 
00100     void Mirror(const Vec3& v3DirectionToMirror, const Vec3& v3PointToMirrorAbout);
00101     TA_OBFUSCATION_RESERVED_OFF
00102 };
00103 
00104 TA_OBFUSCATION_RESERVED_FULL_ON
00105 const MFrame k_mFrameIdentity(k_v3Zero, k_m33Identity);
00106 TA_OBFUSCATION_RESERVED_FULL_OFF
00107 
00108 }
00109 
00110 #include "MFrame.inl"
00111 
00112 
00113 #endif // TA_MFRAME_H


© Copyright 2004-2006 TRUE AXIS PTY LTD Australia. All rights reserved.