GlobeEngine
Mesh.h
Go to the documentation of this file.
1 //
2 // Polyline.h
3 // GlobeEngine
4 //
5 // Created by Mathias Thöny on 27.12.11.
6 // Copyright (c) 2011 University of Zurich. All rights reserved.
7 //
8 
9 #ifndef GlobeEngine_Mesh_h
10 #define GlobeEngine_Mesh_h
11 
12 #include "DrawableComponent.h"
13 #include "OpenGL_Includes.h"
14 #include "Common.h"
15 
16 #include "PLYObject.h"
17 #include "TinyOBJ.h"
18 
19 namespace geData {
20 
21  class Mesh : public ge::DrawableComponent
22  {
23  enum MeshFormat { NONE = 0, OBJ, PLY};
24 
25  public:
26  Mesh() {clear(); };
27  ~Mesh() {destroy(); };
28  void clear();
29  void destroy();
30 
31  void load(std::string _path);
32  void loadOBJ(std::string _path);
33  void loadPLY(std::string _path);
34 
35  void update();
36  void draw(std::shared_ptr<ge::Camera> _cam);
37 
38  /* access the list of positions for this mesh */
39  void addPosition(vmml::Vector3d _pos);
40 
41  private:
42  void create() {};
43  void createVAO();
44  void setVertexCount();
45  void createPositionBuffer(unsigned int _bufferlayer);
46  void createColorBuffer(unsigned int _bufferlayer);
47  void createNormalBuffer(unsigned int _bufferlayer);
48  void createIndexBuffer();
49  void setIndexCount();
50 
51  std::string filepath;
52  std::string mtl_path;
53 
54  PLYObject plyfile;
55 
56  /* obj properties */
57  std::vector<tinyobj::shape_t> objshapes;
58  MeshFormat format;
59 
60  /* Simple List of the same mesh */
61  //std::vector< vmml::Vector3d > positionList;
62  };
63 }
64 #endif
Definition: DrawableComponent.h:25
~Mesh()
Definition: Mesh.h:27
void loadOBJ(std::string _path)
Definition: Mesh.cpp:19
Definition: AvalancheTrainingSimulationEngine.h:39
Mesh()
Definition: Mesh.h:26
void addPosition(vmml::Vector3d _pos)
Definition: Mesh.cpp:320
Definition: Mesh.h:21
void destroy()
Definition: Mesh.cpp:10
void load(std::string _path)
Definition: Mesh.cpp:15
void loadPLY(std::string _path)
Definition: Mesh.cpp:43
void update()
Definition: Mesh.cpp:315
void clear()
Definition: Mesh.cpp:5
void draw(std::shared_ptr< ge::Camera > _cam)
Definition: Mesh.cpp:281