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 GFX_FUNCS_HH 00014 #define GFX_FUNCS_HH 1 00015 00016 namespace gfx { 00017 00021 00025 00027 INLINE bool CHECK_AXIS( uint axis ) { return axis < 3; } 00028 00030 INLINE uint CYCLE_AXIS( uint axis ) { return (axis + 1) % 3; } 00031 00033 INLINE bool CHECK_MATRIX_IDX( uint idx ) { return (idx & ~15) == 0; } 00034 00038 00039 // Abstraction of the sign of Z axis in eye space. 00040 // Remember to use these to test if a vertex is facing the viewpoint. 00041 // The line-of-sight does extend thru negative Z. 00042 const int Z_FACING = -1; 00043 00044 template<typename T> 00045 bool IF_Z_FACING( T z ) { return z < 0; } 00046 00047 // An eye Z coordinate can be used as distance from viewplane (not viewpoint). 00048 template<typename OUT,typename IN> 00049 OUT Z_TO_DISTANCE( IN z ) { return -z; } 00050 00051 } // namespace gfx 00052 00053 #endif // GFX_FUNCS_HH
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:10 2007