00001 00019 namespace Ovgl 00020 { 00021 #define OvglPi (3.14159265358979323846) 00022 00023 extern "C" 00024 { 00025 class Matrix33; 00026 class Matrix44; 00027 class Vector2; 00028 class Vector3; 00029 class Vector4; 00030 00031 class __declspec(dllexport) Vector2 00032 { 00033 public: 00034 00035 float x, y; 00036 float& operator[](size_t index); 00037 }; 00038 00039 class __declspec(dllexport) Vector3 00040 { 00041 public: 00042 float x, y, z; 00043 float& operator[](size_t index); 00044 Vector3 operator - ( const Vector3& ) const; 00045 Vector3 operator + ( const Vector3& ) const; 00046 Vector3 operator / ( const Vector3& ) const; 00047 Vector3 operator * ( const Vector3& ) const; 00048 Vector3 operator / ( const float& ) const; 00049 Vector3 operator * ( const float& ) const; 00050 void toDoubles( double* data ); 00051 void fromDoubles( double* data ); 00052 }; 00053 00054 class __declspec(dllexport) Vector4 00055 { 00056 public: 00057 float x, y, z, w; 00058 float& operator[](size_t index); 00059 Vector4 operator - ( const Vector4& ) const; 00060 Vector4 operator + ( const Vector4& ) const; 00061 Vector4 operator / ( const Vector4& ) const; 00062 Vector4 operator * ( const Vector4& ) const; 00063 Vector4 operator / ( const float& ) const; 00064 Vector4 operator * ( const float& ) const; 00065 void toDoubles( double* data ); 00066 void fromDoubles( double* data ); 00067 }; 00068 00069 class __declspec(dllexport) Matrix33 00070 { 00071 public: 00072 float _11, _12, _13; 00073 float _21, _22, _23; 00074 float _31, _32, _33; 00075 Vector3& operator[](size_t index); 00076 Matrix33 operator * ( const Matrix33& ) const; 00077 Matrix44 to4x4(); 00078 void toDoubles( double* data ); 00079 void fromDoubles( double* data ); 00080 }; 00081 00082 class __declspec(dllexport) Matrix44 00083 { 00084 public: 00085 float _11, _12, _13, _14; 00086 float _21, _22, _23, _24; 00087 float _31, _32, _33, _34; 00088 float _41, _42, _43, _44; 00089 Vector4& operator[](size_t index); 00090 Matrix44 operator * ( const Matrix44& ) const; 00091 Matrix33 to3x3(); 00092 void toDoubles( double* data ); 00093 void fromDoubles( double* data ); 00094 }; 00095 00096 __declspec(dllexport) Matrix44 MatrixIdentity(); 00097 __declspec(dllexport) Matrix44 MatrixInverse( Vector4* in_vec, Matrix44* in_mat ); 00098 __declspec(dllexport) Matrix44 MatrixScaling( float x, float y, float z ); 00099 __declspec(dllexport) Matrix44 MatrixTranslation( float x, float y, float z ); 00100 __declspec(dllexport) Matrix44 MatrixRotationX( float angle ); 00101 __declspec(dllexport) Matrix44 MatrixRotationY( float angle ); 00102 __declspec(dllexport) Matrix44 MatrixRotationZ( float angle ); 00103 __declspec(dllexport) Matrix44 MatrixRotationEuler( float yaw, float pitch, float roll ); 00104 __declspec(dllexport) Matrix44 MatrixRotationAxis( Vector3* axis, float angle ); 00105 __declspec(dllexport) Matrix44 MatrixRotationQuaternion(Vector4* q); 00106 __declspec(dllexport) Matrix44 MatrixPerspectiveLH( float ViewWidth, float ViewHeight, float NearZ, float FarZ ); 00107 __declspec(dllexport) Vector4 QuaternionRotationMatrix( Matrix44* matrix ); 00108 __declspec(dllexport) Vector4 QuaternionRotationAxis( Vector3* axis, float angle ); 00109 __declspec(dllexport) Vector4 QuaternionRotationEuler( float yaw, float pitch, float roll ); 00110 __declspec(dllexport) Vector4 Vector4Set( float w, float x, float y, float z ); 00111 __declspec(dllexport) Vector4 Vector4Lerp( Vector4& vec1, Vector4& vec2, float u); 00112 __declspec(dllexport) Vector3 Vector3Set( float x, float y, float z ); 00113 __declspec(dllexport) Vector3 Vector3Cross( Vector3* vec1, Vector3* vec2 ); 00114 __declspec(dllexport) Vector3 Vector3Transform( Vector3* vector, Matrix44* matrix ); 00115 __declspec(dllexport) Vector3 Vector3Normalize( Vector3* vector ); 00116 __declspec(dllexport) Vector3 Vector3Center( std::vector<Vector3>& vertices ); 00117 __declspec(dllexport) Vector2 Vector2Set( float x, float y ); 00118 __declspec(dllexport) float Distance( Vector3* vector1, Vector3* vector2); 00119 __declspec(dllexport) float Vector3Dot( Vector3* vec1, Vector3* vec2 ); 00120 __declspec(dllexport) float Lerp( float vec1, float vec2, float u); 00121 __declspec(dllexport) float DegToRad( float degree); 00122 }; 00123 };