00001 #ifndef OBSTACLE_H 00002 #define OBSTACLE_H 00003 00004 #include <ngl/Obj.h> 00005 #include <ngl/TransformStack.h> 00006 00007 //---------------------------------------------------------------------------------------------------------------------- 00017 00018 enum OBSTACLE {NONE, BUNNY, CUBE, HELIX, PYRAMID, SPHERE, TORUS}; 00019 00020 class Obstacle 00021 { 00022 public: 00023 //---------------------------------------------------------------------------------------------------------------------- 00025 //---------------------------------------------------------------------------------------------------------------------- 00026 Obstacle(std::string _objFileName); 00027 //---------------------------------------------------------------------------------------------------------------------- 00029 //---------------------------------------------------------------------------------------------------------------------- 00030 ~Obstacle(); 00031 00032 //---------------------------------------------------------------------------------------------------------------------- 00035 //---------------------------------------------------------------------------------------------------------------------- 00036 void createMesh( 00037 const std::string _objFileName 00038 ); 00039 00040 //---------------------------------------------------------------------------------------------------------------------- 00042 //---------------------------------------------------------------------------------------------------------------------- 00043 void drawMesh(); 00044 //---------------------------------------------------------------------------------------------------------------------- 00047 //---------------------------------------------------------------------------------------------------------------------- 00048 inline ngl::Obj* getMesh() { return m_mesh; } 00049 //---------------------------------------------------------------------------------------------------------------------- 00052 //---------------------------------------------------------------------------------------------------------------------- 00053 inline ngl::Vec3 getPosition() const { return m_position; } 00054 //---------------------------------------------------------------------------------------------------------------------- 00057 //---------------------------------------------------------------------------------------------------------------------- 00058 inline ngl::Vec3 getRotation() const { return m_rotation; } 00059 //---------------------------------------------------------------------------------------------------------------------- 00062 //---------------------------------------------------------------------------------------------------------------------- 00063 inline ngl::Vec3 getScale() const { return m_scale; } 00064 //---------------------------------------------------------------------------------------------------------------------- 00067 //---------------------------------------------------------------------------------------------------------------------- 00068 inline ngl::Transformation* getTransMatrix() { return &m_transMatrix; } 00069 //---------------------------------------------------------------------------------------------------------------------- 00073 //---------------------------------------------------------------------------------------------------------------------- 00074 ngl::Vec3 multTransMatrixAndVertex( 00075 ngl::Vec3 _vertex 00076 ); 00077 00078 //---------------------------------------------------------------------------------------------------------------------- 00081 //---------------------------------------------------------------------------------------------------------------------- 00082 inline void setPosition( 00083 ngl::Vec3 _pos 00084 ) { m_position = _pos; } 00085 //---------------------------------------------------------------------------------------------------------------------- 00090 //---------------------------------------------------------------------------------------------------------------------- 00091 void setPosition( 00092 const float _x, 00093 const float _y, 00094 const float _z 00095 ); 00096 //---------------------------------------------------------------------------------------------------------------------- 00099 //---------------------------------------------------------------------------------------------------------------------- 00100 inline void setRotation( 00101 ngl::Vec3 _rotation 00102 ) { m_rotation = _rotation; } 00103 //---------------------------------------------------------------------------------------------------------------------- 00106 //---------------------------------------------------------------------------------------------------------------------- 00107 inline void setScale( 00108 ngl::Vec3 _scale 00109 ) { m_scale = _scale; } 00110 //---------------------------------------------------------------------------------------------------------------------- 00113 //---------------------------------------------------------------------------------------------------------------------- 00114 inline void setTransMatrix( 00115 ngl::Transformation _matrix 00116 ) { m_transMatrix = _matrix; } 00117 00118 00119 private: 00120 //---------------------------------------------------------------------------------------------------------------------- 00122 //---------------------------------------------------------------------------------------------------------------------- 00123 ngl::Obj *m_mesh; 00124 //---------------------------------------------------------------------------------------------------------------------- 00126 //---------------------------------------------------------------------------------------------------------------------- 00127 ngl::Vec3 m_position; 00128 //---------------------------------------------------------------------------------------------------------------------- 00130 //---------------------------------------------------------------------------------------------------------------------- 00131 ngl::Vec3 m_rotation; 00132 //---------------------------------------------------------------------------------------------------------------------- 00134 //---------------------------------------------------------------------------------------------------------------------- 00135 ngl::Vec3 m_scale; 00136 //---------------------------------------------------------------------------------------------------------------------- 00138 //---------------------------------------------------------------------------------------------------------------------- 00139 ngl::Transformation m_transMatrix; 00140 00141 00142 }; 00143 00144 #endif // OBSTACLE_H