00001 /* 00008 * LEGAL: COPYRIGHT (C) 2004 JIM E. BROOKS 00009 * THIS SOURCE CODE IS RELEASED UNDER THE TERMS 00010 * OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2). 00011 *****************************************************************************/ 00012 00013 #ifndef ENG_TYPES_HH 00014 #define ENG_TYPES_HH 1 00015 00016 namespace eng { 00017 00018 // Whether an Object was attached in World (past tense has more meaning than true/false). 00019 enum eAttached { eAttached_WAS_NOT_ATTACHED, eAttached_WAS_ATTACHED }; 00020 00024 class Int3 00025 { 00026 public: 00027 Int3( void ) { mInt[XX] = mInt[YY] = mInt[ZZ] = 0; } 00028 Int3( int x, int y, int z ) { mInt[XX] = x; 00029 mInt[YY] = y; 00030 mInt[ZZ] = z; } 00031 int& operator[]( uint i ) { ASSERT(i<3); return mInt[i]; } 00032 const int& operator[]( uint i ) const { ASSERT(i<3); return mInt[i]; } 00033 friend bool operator==( const Int3& a, const Int3& b ) 00034 { 00035 return a[0] == b[0] 00036 && a[1] == b[1] 00037 && a[2] == b[2]; 00038 } 00039 friend bool operator!=( const Int3& a, const Int3& b ) 00040 { 00041 return not (a == b); 00042 } 00043 00044 private: 00045 int mInt[3]; 00046 }; 00047 00053 template<typename OBJECT> // OBJECT can be anything 00054 class SortableDistance 00055 { 00056 public: 00057 SortableDistance( SafePtr<OBJECT> object, fp distance ) 00058 : mObject(object), mDistance(distance) { } 00059 00060 friend bool operator<( const SortableDistance& a, const SortableDistance& b ) 00061 { 00062 return a.mDistance > b.mDistance; // greater than (furthest will be first element) 00063 } 00064 00065 public: 00066 SafePtr<OBJECT> mObject; 00067 fp mDistance; 00068 }; 00069 00070 } // namespace eng 00071 00072 #endif // ENG_TYPES_HH
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:09 2007