PanoramaViewer
 All Classes Namespaces Files Functions Variables Macros Pages
Mesh.h
Go to the documentation of this file.
1 /*
2  * Mesh.h
3  *
4  * Created on: 19 juin 2013
5  * Author: hallison
6  */
7 
8 #ifndef MESH_H_
9 #define MESH_H_
10 
11 #include <jni.h>
12 #include <android/log.h>
13 #include <android/bitmap.h>
14 
15 #include <GLES2/gl2.h>
16 #include <GLES2/gl2ext.h>
17 
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <iostream>
21 #include <string>
22 
23 #include "Texture.h"
24 
25 #define VERTEX_BUFFER 0
26 #define COLOR_BUFFER 1
27 #define TEXTURE_BUFFER 2
28 #define INDICES_BUFFER 3
29 #define MAX_BUFFER 4
30 
31 using namespace std;
32 
33 namespace LayerSceneGraph {
34 
35 //enum MeshBuffer{VERTEX_BUFFER, COLOR_BUFFER, TEXTURE_BUFFER, INDICES_BUFFER, MAX_BUFFER };
36 
37 
38 class Mesh {
39 private:
41  GLuint *indices;
43  GLfloat *normals;
44  GLfloat *colorCoordinates;
45  GLuint numIndices;
46  GLuint numVertices;
48 
49  GLuint bufferObject[MAX_BUFFER];
50 
51 public:
52  Mesh();
53  Mesh(GLfloat *pCoord, GLfloat *texCoord, GLfloat *normals, GLuint *ind,
54  GLuint numIndex, GLuint numVertex, Texture *tex);
55  Mesh(GLfloat *pCoord, GLfloat *texCoord, GLfloat *normals, GLuint *ind,
56  GLuint numIndex, GLuint numVertex, Texture *tex, GLfloat *colors);
57  Mesh(GLfloat *pCoord, GLfloat *colors, GLfloat *normals, GLuint *ind, GLuint numIndex, GLuint numVertex);
58  virtual ~Mesh();
59 
60  void loadMesh(string filename);
61  void draw();
62 
63  Texture *getTexture();
64  void setTexture(Texture *texture);
65 };
66 
67 } /* namespace LayerSceneGraph */
68 #endif /* MESH_H_ */