00001 00013 #ifndef CRENDEROBJ_H 00014 #define CRENDEROBJ_H 00015 00016 00017 // Option constants 00018 00022 #define OPTION_PERSPECTIVE (1 << 0) 00023 00027 #define OPTION_BOUNDINGBOX (1 << 1) 00028 00033 #define OPTION_SIGN (1 << 2) 00034 00038 #define OPTION_OPENGLSPECULAR (1 << 3) 00039 00040 00041 00042 00050 class CRenderObj 00051 { 00052 public: 00053 std::string m_FormulaString; 00055 float m_SignIncrement; 00056 float m_NoSignIncrement; 00057 float m_NoSignPrecision; 00059 float m_Zoom; 00061 CVector3f m_MinVector; 00063 CVector3f m_MaxVector; 00065 CVector3f m_ViewerPos; 00067 CVector3f m_LightDirection; 00069 CColor m_SurfaceAmbientColor; 00070 CColor m_SurfaceDiffuseColor; 00071 CColor m_SurfaceSpecularColor; 00072 float m_SurfaceSpecularExponent; 00074 CColor m_BoxAmbientColor; 00075 CColor m_BoxDiffuseColor; 00076 CColor m_BoxSpecularColor; 00077 float m_BoxSpecularExponent; 00079 CColor m_BackgroundColor; 00081 unsigned char m_Options; 00082 int m_Width; 00083 int m_Height; 00088 CRenderObj(); 00089 00093 CRenderObj(const CRenderObj& obj) 00094 { 00095 m_pFormula = NULL; 00096 m_pFormulaDx = NULL; 00097 m_pFormulaDy = NULL; 00098 m_pFormulaDz = NULL; 00099 Copy(obj); 00100 } 00101 00105 const CRenderObj& operator = (const CRenderObj& obj) 00106 { 00107 if (this != &obj) 00108 Copy(obj); 00109 return *this; 00110 } 00111 00115 const CVectBase& getVectorBase() const { return m_VectorBase; } 00116 00120 void UpdateVectorBase() { m_VectorBase.Update(); } 00121 00126 const CVector3f getCenterPos() const { return m_CenterPos; } 00127 00132 std::string Validate() const; 00133 00137 CColor GetPixelColor(int x, int y) const; 00138 00142 void Update(void); 00143 00144 private: 00145 CVector3f m_CenterPos; 00146 CVectBase m_VectorBase; 00148 CMathExpression *m_pFormula; 00149 CMathExpression *m_pFormulaDx; 00151 CMathExpression *m_pFormulaDy; 00153 CMathExpression *m_pFormulaDz; 00160 CVector3f GetDirection(int x, int y) const; 00161 00166 CVector3f GetStartingPoint(int x, int y) const; 00167 00172 inline bool InBoundingBox(const CVector3f& Pos, 00173 const CVector3f& Dir) const 00174 { 00175 return ( !( 00176 ( (Pos.x < m_MinVector.x) && (Dir.x < 0) ) || 00177 ( (Pos.x > m_MaxVector.x) && (Dir.x > 0) ) || 00178 ( (Pos.y < m_MinVector.y) && (Dir.y < 0) ) || 00179 ( (Pos.y > m_MaxVector.y) && (Dir.y > 0) ) || 00180 ( (Pos.z < m_MinVector.z) && (Dir.z < 0) ) || 00181 ( (Pos.z > m_MaxVector.z) && (Dir.z > 0) ) ) 00182 ); 00183 } 00184 00189 void GetCloseToBoundingBox(CVector3f& StartingPoint, 00190 const CVector3f& Direction) const; 00191 00195 void Copy(const CRenderObj& obj); 00196 }; 00197 00198 #endif // CRENDEROBJ_H 00199
1.5.4