SimpleNGL 1.0
|
00001 #ifndef GRID_H 00002 #define GRID_H 00003 00004 #include "OpenEXR/ImathVec.h" 00005 #include "ngl/Types.h" 00006 00008 00012 class Grid 00013 { 00014 public: 00016 Grid(); 00017 00022 Grid(int _w, int _h, const float &_spacing); 00023 00025 ~Grid(); 00026 00029 void init(bool _terrain = false); 00030 00032 void drawOriginal(); 00033 00035 void drawDeformed(); 00036 00038 void updateBuffers(); 00039 00043 inline void set(int _w, int _h) 00044 { 00045 m_width = _w; 00046 m_width = _h; 00047 m_size = _w*_h; 00048 } 00049 00051 int getSize()const{return m_size;} 00052 00054 inline Imath::V3f* getDeformedVertsPtr(){return m_deformedVerts ;} 00055 00057 inline Imath::V3f* getVertsPtr(){return m_verts;} 00058 00059 private: 00061 void draw(GLuint _vao); 00062 00064 int m_width; 00066 int m_height; 00068 int m_size; 00069 00071 float m_spacing; 00072 00074 GLuint m_VAO, m_posVBO, m_normalVBO; 00075 00077 GLuint m_deformedVAO, m_deformedPosVBO, m_deformedNormalVBO; 00078 00080 Imath::V3f *m_verts; 00081 00083 Imath::V3f *m_deformedVerts; 00084 }; 00085 00086 #endif // GRID_H