6 #ifndef LIB_ALMATH_SCENEGRAPH_MESH_H
7 #define LIB_ALMATH_SCENEGRAPH_MESH_H
9 #include <almath/api.h>
10 #include <boost/optional.hpp>
91 Mesh(
bool withTexCoords =
false);
92 bool withTexCoords()
const;
96 size_t verticesStride()
const;
99 static const size_t positionOffset = 0;
101 static const size_t normalOffset = 1;
103 static const size_t texCoordOffset = 2;
105 const std::vector<float> &positions()
const;
106 size_t positionsNb()
const;
107 float const *positionPtrAt(
size_t index)
const;
109 const std::vector<float> &normals()
const;
110 size_t normalsNb()
const;
111 float const *normalPtrAt(
size_t index)
const;
113 const std::vector<float> &texCoords()
const;
114 size_t texCoordsNb()
const;
115 float const *texCoordPtrAt(
size_t index)
const;
117 const std::vector<size_t> &vertices()
const;
118 size_t verticesNb()
const;
119 size_t const *vertexPtrAt(
size_t index)
const;
121 const std::vector<size_t> &polygonVerticesCounts()
const;
122 size_t polygonsNb()
const;
123 size_t polygonVerticesCountAt(
size_t index)
const;
131 size_t normal(
float x,
float y,
float z);
135 void normal(
size_t index);
140 size_t texCoord(
float u,
float v);
144 void texCoord(
size_t index);
147 size_t position(
float x,
float y,
float z);
152 void begin(
Mode mode);
158 void vertex(
size_t positionIndex);
163 void vertex(
float x,
float y,
float z);
173 std::vector<float> _positions;
174 std::vector<float> _normals;
175 std::vector<float> _texCoords;
176 std::vector<size_t> _vertices;
177 std::vector<size_t> _vcounts;
180 boost::optional<Mode> _currentMode;
182 size_t _currentVcount;
183 size_t _currentNormal;
184 size_t _currentTexCoord;
static const size_t NO_INDEX