13 #ifndef OGLPLUS_SHAPES_OBJ_MESH_1304161247_HPP
14 #define OGLPLUS_SHAPES_OBJ_MESH_1304161247_HPP
21 #include <oglplus/detail/any_iter.hpp>
36 :
public DrawingInstructionWriter
40 struct _loading_options
48 _loading_options(
bool load_all =
true)
53 _loading_options&
All(
bool load_all =
true)
55 load_normals = load_all;
56 load_tangents = load_all;
57 load_bitangents = load_all;
58 load_texcoords = load_all;
59 load_materials = load_all;
63 _loading_options& Nothing(
void)
68 _loading_options&
Normals(
bool load =
true)
74 _loading_options&
Tangents(
bool load =
true)
82 load_bitangents = load;
86 _loading_options& TexCoords(
bool load =
true)
88 load_texcoords = load;
92 _loading_options& Materials(
bool load =
true)
94 load_materials = load;
100 std::vector<double> _pos_data;
102 std::vector<double> _nml_data;
104 std::vector<double> _tgt_data;
106 std::vector<double> _btg_data;
108 std::vector<double> _tex_data;
110 std::vector<GLuint> _mtl_data;
112 std::vector<std::string> _mtl_names;
130 std::vector<std::string> _mesh_names;
131 std::vector<GLuint> _mesh_offsets;
132 std::vector<GLuint> _mesh_counts;
137 std::string::const_iterator& i,
138 std::string::const_iterator& e
142 _vert_indices& indices,
143 const _vert_indices& counts,
144 std::string::const_iterator& i,
145 std::string::const_iterator& e
149 const _loading_options& opts,
150 aux::AnyInputIter<const char*> names_begin,
151 aux::AnyInputIter<const char*> names_end,
155 void _call_load_meshes(
157 aux::AnyInputIter<const char*> names_begin,
158 aux::AnyInputIter<const char*> names_end,
159 _loading_options opts
162 typedef _loading_options LoadingOptions;
166 LoadingOptions opts = LoadingOptions()
169 const char** p =
nullptr;
170 _call_load_meshes(input, p, p, opts);
173 template <
typename NameStr, std::
size_t NN>
176 const std::array<NameStr, NN>& names,
177 LoadingOptions opts = LoadingOptions()
194 typedef GLuint (
ObjMesh::*VertexAttribFunc)(std::vector<GLfloat>&)
const;
197 template <
typename T>
201 dest.insert(dest.begin(), _pos_data.begin(), _pos_data.end());
206 template <
typename T>
210 dest.insert(dest.begin(), _nml_data.begin(), _nml_data.end());
215 template <
typename T>
219 dest.insert(dest.begin(), _tgt_data.begin(), _tgt_data.end());
224 template <
typename T>
228 dest.insert(dest.begin(), _btg_data.begin(), _btg_data.end());
233 template <
typename T>
237 dest.insert(dest.begin(), _tex_data.begin(), _tex_data.end());
242 template <
typename T>
246 dest.insert(dest.begin(), _mtl_data.begin(), _mtl_data.end());
253 return _mtl_names[mat_num];
257 bool QueryMeshIndex(
const std::string& name, GLuint& index)
const;
262 #if OGLPLUS_DOCUMENTATION_ONLY
274 typedef VertexAttribsInfo<
281 VertexTexCoordinatesTag,
282 VertexMaterialNumbersTag
287 Spheref MakeBoundingSphere(
void)
const;
290 template <
typename T>
318 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
319 #include <oglplus/shapes/obj_mesh.ipp>
320 #endif // OGLPLUS_LINK_LIBRARY
322 #endif // include guard
Implementation of shape draw instructions.
IndexArray Indices(Default=Default()) const
Returns element indices that are used with the drawing instructions.
Definition: obj_mesh.hpp:300
GLuint GetMeshIndex(const std::string &name) const
Gets the index of the mesh with the specified name, throws on error.
DrawingInstructions Instructions(Default=Default()) const
Returns the instructions for rendering of faces.
Definition: obj_mesh.hpp:309
VertexAttribsInfo< ObjMesh > VertexAttribs
Vertex attribute information for this shape builder.
Definition: obj_mesh.hpp:272
GLuint Bitangents(std::vector< T > &dest) const
Makes the vertex bi-tangents and returns the number of values per vertex.
Definition: obj_mesh.hpp:225
PrimitiveType
Primitive type enumeration.
Definition: primitive_type.hpp:29
FaceOrientation FaceWinding(void) const
Returns the winding direction of faces.
Definition: obj_mesh.hpp:189
GLuint Tangents(std::vector< T > &dest) const
Makes the vertex tangents and returns the number of values per vertex.
Definition: obj_mesh.hpp:216
GLuint Positions(std::vector< T > &dest) const
Makes the vertex positions and returns the number of values per vertex.
Definition: obj_mesh.hpp:198
Class providing attributes and instructions for drawing of mesh loaded from obj.
Definition: obj_mesh.hpp:35
void BoundingSphere(oglplus::Sphere< T > &bounding_sphere) const
Queries the bounding sphere coordinates and dimensions.
Definition: obj_mesh.hpp:291
GLuint TexCoordinates(std::vector< T > &dest) const
Makes the texture coordinates returns the number of values per vertex.
Definition: obj_mesh.hpp:234
FaceOrientation
Face orientation enumeration.
Definition: face_mode.hpp:62
OpenGL face type-related enumeration.
bool QueryMeshIndex(const std::string &name, GLuint &index) const
Queries the index of the mesh with the specified name.
const std::string & MaterialName(GLuint mat_num) const
Returns the name of the i-th material.
Definition: obj_mesh.hpp:251
DrawingInstructions Instructions(PrimitiveType primitive) const
Returns the instructions for rendering of faces.
Classes providing additional information about the shape builders.
Class encapsulating the instructions for drawing of a shape.
Definition: draw.hpp:219
std::vector< GLuint > IndexArray
The type of the index container returned by Indices()
Definition: obj_mesh.hpp:297
GLuint MaterialNumbers(std::vector< T > &dest) const
Makes the material numbers returns the number of values per vertex.
Definition: obj_mesh.hpp:243
GLuint Normals(std::vector< T > &dest) const
Makes the vertex normals and returns the number of values per vertex.
Definition: obj_mesh.hpp:207