Go to the documentation of this file.00001 #ifndef MYOBJECT_H
00002 #define MYOBJECT_H
00003
00004
00005 #include "Cloth.h"
00006 #include "ngl/VertexArrayObject.h"
00007 #include <boost/array.hpp>
00008 #include <boost/multi_array.hpp>
00009 #include <QStringList>
00010
00011
00017
00021
00022 class ListOfFacesIndexes
00023 {
00024 public:
00025
00027 std::vector <unsigned int> m_listOfFacesIndexes;
00028 };
00029
00030
00031 class VAOData
00032 {
00033 public:
00035 std::vector <ngl::Vector> verts;
00037 std::vector <bool> m_isVertexInHash;
00039 std::vector <ListOfFacesIndexes> m_listOfListOfFaces;
00041 std::vector <ngl::Face> faces;
00043 std::vector <ngl::Vector> tex;
00045 std::vector <ngl::Vector> normalsFront;
00047 ngl::VertexArrayObject* m_vaoMeshFront;
00048 };
00049
00050 class ObjObject
00051 {
00052 public:
00065 ObjObject(float clothSize,
00066 int _massesNum,
00067 float _damping,
00068 float _springDamping,
00069 float _timeStep,
00070 float _gravity,
00071 float _stiffeness,
00072 float _criticalDistance,
00073 float _friction,
00074 float _bumpiness,
00075 ngl::TransformStack *_transform);
00076
00079 ObjObject(ngl::TransformStack *_transform);
00080
00082 ~ObjObject();
00083
00084
00087 void loadModel(std::string _fileName);
00088
00091 void loadAnimation(QStringList _listOfFiles);
00092
00095 void drawObject(int regime);
00096
00099 void calculateNormalsFront(int _currentVAONum);
00100
00103 void calculateNormalsBack(int _currentVAONum);
00104
00107 void updateVerts(int _currentVAONum);
00108
00111 inline void setObjectVelocity(ngl::Vector _velocity)
00112 {
00113 m_objectVelocity = _velocity;
00114 }
00115
00118 inline void setObjectName(std::string _objectName)
00119 {
00120 m_objectName = _objectName;
00121 }
00122
00125 inline ngl::Vector getObjectVelocity()
00126 {
00127 return m_objectVelocity;
00128 }
00129
00132 inline std::string getObjectName()
00133 {
00134 return m_objectName;
00135 }
00136
00138 ngl::Vector oldControlVertexPosition;
00139
00141 std::vector <ngl::Vector> normalsBack;
00142
00143
00145 ngl::VertexArrayObject* m_vaoMeshBack;
00146
00148 std::vector<VAOData> VAOsList;
00149
00151 bool m_isCloth;
00152
00154 bool m_isAnimation;
00155
00157 Cloth * m_cloth;
00158
00160 VAOData* currentVAO;
00161
00163 int currentVAONum;
00164
00166 std::string m_objectName;
00167
00169 std::string m_FilePath;
00170
00171 private:
00172
00175 void createVAOBack(int _currentVAONum);
00176
00177
00180 void createVAOFront(int _currentVAONum);
00181
00183 void calculateObjectVelocity();
00184
00186 int m_animationTimer;
00187
00189 ngl::Vector m_objectVelocity;
00190
00191
00192 protected:
00193
00195
00196 ngl::TransformStack *m_transform;
00197
00198 };
00199
00200 #endif // MYOBJECT_H