GeometryData.h
Go to the documentation of this file.
1 #ifndef B_GEOMETRY_DATA_H
2 #define B_GEOMETRY_DATA_H
3 
4 #include <vector>
5 #include "Renderer_GL.h"
6 #include "vmmlib/vector.hpp"
7 #include "MaterialData.h"
8 #include "Texture.h"
9 
10 struct IndexData
11 {
12  GLushort vertexIndex;
13  GLushort texCoordsIndex;
14  GLushort normalIndex;
15 
17  : vertexIndex(0)
18  , texCoordsIndex(0)
19  , normalIndex(0)
20  {}
21 
22  IndexData(GLushort vIndex, GLushort tIndex, GLushort nIndex)
23  : vertexIndex(vIndex)
24  , texCoordsIndex(tIndex)
25  , normalIndex(nIndex)
26  {}
27 };
28 
29 struct TexCoord
30 {
31  GLfloat s;
32  GLfloat t;
33 };
34 
35 struct Color
36 {
37  GLubyte r;
38  GLubyte g;
39  GLubyte b;
40  GLubyte a;
41 };
42 
43 struct Point3
44 {
45  GLfloat x;
46  GLfloat y;
47  GLfloat z;
48 };
49 
50 struct Vector3
51 {
52  GLfloat x;
53  GLfloat y;
54  GLfloat z;
55 };
56 
57 struct Vertex
58 {
60  {
61  position.x = 0.0f;
62  position.y = 0.0f;
63  position.z = 0.0f;
64  normal.x = 0.0f;
65  normal.y = 0.0f;
66  normal.z = 0.0f;
67  tangent.x = 0.0f;
68  tangent.y = 0.0f;
69  tangent.z = 0.0f;
70  bitangent.x = 0.0f;
71  bitangent.y = 0.0f;
72  bitangent.z = 0.0f;
73  texCoord.s = 0.0f;
74  texCoord.t = 0.0f;
75  }
76 
77  Vertex(GLfloat pX, GLfloat pY, GLfloat pZ, GLfloat tS, GLfloat tT)
78  {
79  position.x = pX;
80  position.y = pY;
81  position.z = pZ;
82  normal.x = 0.0f;
83  normal.y = 0.0f;
84  normal.z = 0.0f;
85  tangent.x = 0.0f;
86  tangent.y = 0.0f;
87  tangent.z = 0.0f;
88  bitangent.x = 0.0f;
89  bitangent.y = 0.0f;
90  bitangent.z = 0.0f;
91  texCoord.s = tS;
92  texCoord.t = tT;
93  }
94 
95  Vertex(GLfloat pX, GLfloat pY, GLfloat pZ, GLfloat nX, GLfloat nY, GLfloat nZ, GLfloat tX, GLfloat tY, GLfloat tZ, GLfloat bX, GLfloat bY, GLfloat bZ, GLfloat tS, GLfloat tT)
96  {
97  position.x = pX;
98  position.y = pY;
99  position.z = pZ;
100  normal.x = nX;
101  normal.y = nY;
102  normal.z = nZ;
103  tangent.x = tX;
104  tangent.y = tY;
105  tangent.z = tZ;
106  bitangent.x = bX;
107  bitangent.y = bY;
108  bitangent.z = bZ;
109  texCoord.s = tS;
110  texCoord.t = tT;
111  }
112 
118 };
119 
120 typedef GLushort Index;
121 
126 {
127  typedef std::vector< Vertex > VboVertices;
128  typedef std::vector< GLushort > VboIndices;
129 
130  std::vector< IndexData > indices;
131 
132  VboVertices vboVertices;
133  VboIndices vboIndices;
134 
136 };
137 
138 typedef std::shared_ptr< GeometryData > GeometryDataPtr;
139 
140 #endif /* defined(B_GEOMETRY_DATA_H) */
GLfloat t
Definition: GeometryData.h:32
Definition: GeometryData.h:43
Vertex(GLfloat pX, GLfloat pY, GLfloat pZ, GLfloat nX, GLfloat nY, GLfloat nZ, GLfloat tX, GLfloat tY, GLfloat tZ, GLfloat bX, GLfloat bY, GLfloat bZ, GLfloat tS, GLfloat tT)
Definition: GeometryData.h:95
Vector3 tangent
Definition: GeometryData.h:115
std::vector< GLushort > VboIndices
Definition: GeometryData.h:128
MaterialData materialData
Definition: GeometryData.h:135
Vector3 bitangent
Definition: GeometryData.h:116
Point3 position
Definition: GeometryData.h:113
GLubyte b
Definition: GeometryData.h:39
Definition: GeometryData.h:35
Vector3 normal
Definition: GeometryData.h:114
Definition: GeometryData.h:10
GLfloat y
Definition: GeometryData.h:46
GLfloat z
Definition: GeometryData.h:47
std::vector< Vertex > VboVertices
Definition: GeometryData.h:127
GLfloat y
Definition: GeometryData.h:53
Definition: GeometryData.h:50
IndexData()
Definition: GeometryData.h:16
IndexData(GLushort vIndex, GLushort tIndex, GLushort nIndex)
Definition: GeometryData.h:22
VboVertices vboVertices
Definition: GeometryData.h:132
std::shared_ptr< GeometryData > GeometryDataPtr
Definition: GeometryData.h:138
GLubyte r
Definition: GeometryData.h:37
VboIndices vboIndices
Definition: GeometryData.h:133
GLushort texCoordsIndex
Definition: GeometryData.h:13
Definition: GeometryData.h:57
GLubyte g
Definition: GeometryData.h:38
GLfloat x
Definition: GeometryData.h:52
Definition: GeometryData.h:29
GLfloat x
Definition: GeometryData.h:45
GLfloat s
Definition: GeometryData.h:31
GLubyte a
Definition: GeometryData.h:40
GLushort normalIndex
Definition: GeometryData.h:14
GLushort vertexIndex
Definition: GeometryData.h:12
The underlying data of a geometry object.
Definition: GeometryData.h:125
The underlying data of a material.
Definition: MaterialData.h:10
Vertex(GLfloat pX, GLfloat pY, GLfloat pZ, GLfloat tS, GLfloat tT)
Definition: GeometryData.h:77
GLfloat z
Definition: GeometryData.h:54
TexCoord texCoord
Definition: GeometryData.h:117
GLushort Index
Definition: GeometryData.h:120
std::vector< IndexData > indices
Definition: GeometryData.h:130
Vertex()
Definition: GeometryData.h:59