00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Jeff Lait 00008 * Side Effects 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: UT_VectorTypes.h (Utility library, C++) 00015 * 00016 * COMMENTS: 00017 * This class prototypes our vector types, such 00018 * as UT_QuaternionR, UT_Vector3R, etc. 00019 */ 00020 00021 #ifndef __UT_VectorTypes__ 00022 #define __UT_VectorTypes__ 00023 00024 #include "UT_API.h" 00025 00026 #include <SYS/SYS_Types.h> 00027 #include <SYS/SYS_TypeTraits.h> 00028 00029 // Define this so that H11 users can use this to determine if they have 00030 // UT_Vector3R, UT_Matrix3R, etc. 00031 #define UT_VECTORTYPES_HAVE_FPREAL 1 00032 00033 template <typename T> class UT_API UT_Vector2T; 00034 typedef UT_Vector2T<fpreal> UT_Vector2R; 00035 typedef UT_Vector2T<fpreal64> UT_Vector2D; 00036 typedef UT_Vector2T<fpreal32> UT_Vector2F; 00037 typedef UT_Vector2T<fpreal16> UT_Vector2H; 00038 typedef UT_Vector2T<float> UT_Vector2; // deprecated 00039 typedef UT_Vector2T<int64> UT_Vector2I; 00040 00041 template <typename T> class UT_API UT_Vector3T; 00042 typedef UT_Vector3T<fpreal> UT_Vector3R; 00043 typedef UT_Vector3T<fpreal64> UT_Vector3D; 00044 typedef UT_Vector3T<fpreal32> UT_Vector3F; 00045 typedef UT_Vector3T<fpreal16> UT_Vector3H; 00046 typedef UT_Vector3T<float> UT_Vector3; // deprecated 00047 typedef UT_Vector3T<int64> UT_Vector3I; 00048 00049 template <typename T> class UT_API UT_Vector4T; 00050 typedef UT_Vector4T<fpreal> UT_Vector4R; 00051 typedef UT_Vector4T<fpreal64> UT_Vector4D; 00052 typedef UT_Vector4T<fpreal32> UT_Vector4F; 00053 typedef UT_Vector4T<fpreal16> UT_Vector4H; 00054 typedef UT_Vector4T<float> UT_Vector4; // deprecated 00055 typedef UT_Vector4T<int64> UT_Vector4I; 00056 00057 class UT_XformOrder; 00058 00059 template <typename T> class UT_API UT_QuaternionT; 00060 typedef UT_QuaternionT<fpreal> UT_QuaternionR; 00061 typedef UT_QuaternionT<fpreal32> UT_QuaternionF; 00062 typedef UT_QuaternionT<fpreal64> UT_QuaternionD; 00063 typedef UT_QuaternionT<float> UT_Quaternion; // deprecated 00064 00065 template <typename T> class UT_API UT_Matrix2T; 00066 typedef UT_Matrix2T<fpreal> UT_Matrix2R; 00067 typedef UT_Matrix2T<fpreal32> UT_Matrix2F; 00068 typedef UT_Matrix2T<fpreal64> UT_Matrix2D; 00069 typedef UT_Matrix2T<float> UT_Matrix2; // deprecated 00070 typedef UT_Matrix2T<double> UT_DMatrix2; // deprecated 00071 00072 template <typename T> class UT_API UT_Matrix3T; 00073 typedef UT_Matrix3T<fpreal> UT_Matrix3R; 00074 typedef UT_Matrix3T<fpreal32> UT_Matrix3F; 00075 typedef UT_Matrix3T<fpreal64> UT_Matrix3D; 00076 typedef UT_Matrix3T<float> UT_Matrix3; // deprecated 00077 typedef UT_Matrix3T<double> UT_DMatrix3; // deprecated 00078 00079 template <typename T> class UT_API UT_Matrix4T; 00080 typedef UT_Matrix4T<fpreal> UT_Matrix4R; 00081 typedef UT_Matrix4T<fpreal32> UT_Matrix4F; 00082 typedef UT_Matrix4T<fpreal64> UT_Matrix4D; 00083 typedef UT_Matrix4T<float> UT_Matrix4; // deprecated 00084 typedef UT_Matrix4T<double> UT_DMatrix4; // deprecated 00085 00086 00087 // 00088 // Declare the following types as POD so that UT_ValArray can be optimized 00089 // 00090 SYS_DECLARE_IS_POD(UT_Vector2F) 00091 SYS_DECLARE_IS_POD(UT_Vector3F) 00092 SYS_DECLARE_IS_POD(UT_Vector4F) 00093 SYS_DECLARE_IS_POD(UT_Vector2D) 00094 SYS_DECLARE_IS_POD(UT_Vector3D) 00095 SYS_DECLARE_IS_POD(UT_Vector4D) 00096 SYS_DECLARE_IS_POD(UT_Vector2I) 00097 SYS_DECLARE_IS_POD(UT_Vector3I) 00098 SYS_DECLARE_IS_POD(UT_Vector4I) 00099 00100 SYS_DECLARE_IS_POD(UT_QuaternionF) 00101 SYS_DECLARE_IS_POD(UT_QuaternionD) 00102 SYS_DECLARE_IS_POD(UT_Matrix2F) 00103 SYS_DECLARE_IS_POD(UT_Matrix2D) 00104 SYS_DECLARE_IS_POD(UT_Matrix3F) 00105 SYS_DECLARE_IS_POD(UT_Matrix3D) 00106 SYS_DECLARE_IS_POD(UT_Matrix4F) 00107 SYS_DECLARE_IS_POD(UT_Matrix4D) 00108 00109 // 00110 // Declare common array types 00111 // 00112 template <typename T> class UT_ValArray; 00113 00114 typedef UT_ValArray<fpreal> UT_FprealArray; 00115 typedef UT_ValArray<fpreal32> UT_Fpreal32Array; 00116 typedef UT_ValArray<fpreal64> UT_Fpreal64Array; 00117 typedef UT_ValArray<float> UT_FloatArray; 00118 typedef UT_ValArray<double> UT_DoubleArray; 00119 typedef UT_ValArray<int> UT_IntArray; 00120 typedef UT_ValArray<int32> UT_Int32Array; 00121 typedef UT_ValArray<int64> UT_Int64Array; 00122 00123 typedef UT_ValArray<UT_Vector2R> UT_Vector2RArray; 00124 typedef UT_ValArray<UT_Vector3R> UT_Vector3RArray; 00125 typedef UT_ValArray<UT_Vector4R> UT_Vector4RArray; 00126 typedef UT_ValArray<UT_Vector2F> UT_Vector2FArray; 00127 typedef UT_ValArray<UT_Vector3F> UT_Vector3FArray; 00128 typedef UT_ValArray<UT_Vector4F> UT_Vector4FArray; 00129 typedef UT_ValArray<UT_Vector2D> UT_Vector2DArray; 00130 typedef UT_ValArray<UT_Vector3D> UT_Vector3DArray; 00131 typedef UT_ValArray<UT_Vector4D> UT_Vector4DArray; 00132 00133 typedef UT_ValArray<UT_Matrix2F> UT_Matrix2FArray; 00134 typedef UT_ValArray<UT_Matrix3F> UT_Matrix3FArray; 00135 typedef UT_ValArray<UT_Matrix4F> UT_Matrix4FArray; 00136 typedef UT_ValArray<UT_Matrix2D> UT_Matrix2DArray; 00137 typedef UT_ValArray<UT_Matrix3D> UT_Matrix3DArray; 00138 typedef UT_ValArray<UT_Matrix4D> UT_Matrix4DArray; 00139 00140 typedef UT_ValArray<UT_Vector2> UT_Vector2Array; // deprecated 00141 typedef UT_ValArray<UT_Vector3> UT_Vector3Array; // deprecated 00142 typedef UT_ValArray<UT_Vector4> UT_Vector4Array; // deprecated 00143 00144 00145 // 00146 // Type Conversion 00147 // 00148 template< typename FT, template<typename> class V > 00149 inline const V<fpreal> 00150 UTconvertToR( 00151 const V<FT>& v 00152 ) 00153 { 00154 return V<fpreal>(v); 00155 } 00156 template< typename FT, template<typename> class V > 00157 inline const V<double> 00158 UTconvertToD( 00159 const V<FT>& v 00160 ) 00161 { 00162 return V<double>(v); 00163 } 00164 template< typename FT, template<typename> class V > 00165 inline const V<float> 00166 UTconvertToF( 00167 const V<FT>& v 00168 ) 00169 { 00170 return V<float>(v); 00171 } 00172 #if (SYS_SIZEOF_FPREAL == 4) 00173 #define UT_R_FROM_D(VAL) UTconvertToR(VAL) 00174 #define UT_R_FROM_F(VAL) (VAL) 00175 #define UT_D_FROM_R(VAL) UTconvertToD(VAL) 00176 #define UT_F_FROM_R(VAL) (VAL) 00177 #elif (SYS_SIZEOF_FPREAL == 8) 00178 #define UT_R_FROM_F(VAL) UTconvertToR(VAL) 00179 #define UT_R_FROM_D(VAL) (VAL) 00180 #define UT_F_FROM_R(VAL) UTconvertToF(VAL) 00181 #define UT_D_FROM_R(VAL) (VAL) 00182 #else 00183 #error Missing FPREAL type 00184 #endif 00185 00186 00187 #endif
1.5.9