Loads object models provided in the Wavefront .obj format and builds a ICR::TargetObject. More...
#include <object_loader.h>
Loads object models provided in the Wavefront .obj format and builds a ICR::TargetObject.
Note that the .obj models need to contain unique vertex normals for each vertex of the mesh, i.e., smoothing groups are not allowed. This class uses libobj-0.1 for reading the .obj files and implements the necessary callbacks. Note that this class is not thread-safe, sice it uses following global variables: ICR::points_buffer (used to temporally store the mesh-vertices read by ICR::ObjectLoader::geometric_vertex_callback), ICR::normals_buffer (used to temporally store the vertex-normals read by ICR::ObjectLoader::vertex_normal_callback), ICR::face_callback_run (used by ICR::ObjectLoader::triangular_face_geometric_vertices_vertex_normals_callback), ICR::callback_obj_ptr (used by ICR::ObjectLoader::triangular_face_geometric_vertices_vertex_normals_callback in order to access the ICR::TargetObject::object_ member variable) and ICR::map_normal2vertex which is necessary to correlate the vertices to their respective normals. In .obj files, this correlation is contained in the facet definition and cannot be known a priori.
Definition at line 37 of file object_loader.h.
Definition at line 15 of file object_loader.cpp.
ICR::ObjectLoader::ObjectLoader | ( | ObjectLoader const & | src | ) |
Definition at line 17 of file object_loader.cpp.
Definition at line 38 of file object_loader.cpp.
void ICR::ObjectLoader::geometric_vertex_callback | ( | obj::float_type | x, |
obj::float_type | y, | ||
obj::float_type | z | ||
) | [static, private] |
Definition at line 137 of file object_loader.cpp.
const TargetObjectPtr ICR::ObjectLoader::getObject | ( | ) | const |
Definition at line 40 of file object_loader.cpp.
Definition at line 42 of file object_loader.cpp.
void ICR::ObjectLoader::loadObject | ( | std::string const & | file, |
std::string const & | name | ||
) |
Definition at line 46 of file object_loader.cpp.
bool ICR::ObjectLoader::objectLoaded | ( | ) | const |
Definition at line 44 of file object_loader.cpp.
ObjectLoader & ICR::ObjectLoader::operator= | ( | ObjectLoader const & | src | ) |
Definition at line 19 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_begin_callback | ( | obj::index_type | , |
obj::index_type | , | ||
obj::index_type | |||
) | [static, private] |
Definition at line 230 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_end_callback | ( | ) | [static, private] |
Definition at line 242 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_texture_vertices_begin_callback | ( | const obj::index_2_tuple_type & | , |
const obj::index_2_tuple_type & | , | ||
const obj::index_2_tuple_type & | |||
) | [static, private] |
Definition at line 248 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_texture_vertices_end_callback | ( | ) | [static, private] |
Definition at line 260 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_texture_vertices_vertex_callback | ( | const obj::index_2_tuple_type & | ) | [static, private] |
Definition at line 254 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_texture_vertices_vertex_normals_begin_callback | ( | const obj::index_3_tuple_type & | , |
const obj::index_3_tuple_type & | , | ||
const obj::index_3_tuple_type & | |||
) | [static, private] |
Definition at line 284 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_texture_vertices_vertex_normals_end_callback | ( | ) | [static, private] |
Definition at line 296 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_texture_vertices_vertex_normals_vertex_callback | ( | const obj::index_3_tuple_type & | ) | [static, private] |
Definition at line 290 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_vertex_callback | ( | obj::index_type | ) | [static, private] |
Definition at line 236 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_vertex_normals_begin_callback | ( | const obj::index_2_tuple_type & | , |
const obj::index_2_tuple_type & | , | ||
const obj::index_2_tuple_type & | |||
) | [static, private] |
Definition at line 266 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_vertex_normals_end_callback | ( | ) | [static, private] |
Definition at line 278 of file object_loader.cpp.
void ICR::ObjectLoader::polygonal_face_geometric_vertices_vertex_normals_vertex_callback | ( | const obj::index_2_tuple_type & | ) | [static, private] |
Definition at line 272 of file object_loader.cpp.
void ICR::ObjectLoader::quadrilateral_face_geometric_vertices_callback | ( | obj::index_type | , |
obj::index_type | , | ||
obj::index_type | , | ||
obj::index_type | |||
) | [static, private] |
Definition at line 206 of file object_loader.cpp.
void ICR::ObjectLoader::quadrilateral_face_geometric_vertices_texture_vertices_callback | ( | const obj::index_2_tuple_type & | , |
const obj::index_2_tuple_type & | , | ||
const obj::index_2_tuple_type & | , | ||
const obj::index_2_tuple_type & | |||
) | [static, private] |
Definition at line 212 of file object_loader.cpp.
void ICR::ObjectLoader::quadrilateral_face_geometric_vertices_texture_vertices_vertex_normals_callback | ( | const obj::index_3_tuple_type & | , |
const obj::index_3_tuple_type & | , | ||
const obj::index_3_tuple_type & | , | ||
const obj::index_3_tuple_type & | |||
) | [static, private] |
Definition at line 224 of file object_loader.cpp.
void ICR::ObjectLoader::quadrilateral_face_geometric_vertices_vertex_normals_callback | ( | const obj::index_2_tuple_type & | , |
const obj::index_2_tuple_type & | , | ||
const obj::index_2_tuple_type & | , | ||
const obj::index_2_tuple_type & | |||
) | [static, private] |
Definition at line 218 of file object_loader.cpp.
void ICR::ObjectLoader::triangular_face_geometric_vertices_callback | ( | obj::index_type | , |
obj::index_type | , | ||
obj::index_type | |||
) | [static, private] |
Definition at line 188 of file object_loader.cpp.
void ICR::ObjectLoader::triangular_face_geometric_vertices_texture_vertices_callback | ( | const obj::index_2_tuple_type & | , |
const obj::index_2_tuple_type & | , | ||
const obj::index_2_tuple_type & | |||
) | [static, private] |
Definition at line 194 of file object_loader.cpp.
void ICR::ObjectLoader::triangular_face_geometric_vertices_texture_vertices_vertex_normals_callback | ( | const obj::index_3_tuple_type & | , |
const obj::index_3_tuple_type & | , | ||
const obj::index_3_tuple_type & | |||
) | [static, private] |
Definition at line 200 of file object_loader.cpp.
void ICR::ObjectLoader::triangular_face_geometric_vertices_vertex_normals_callback | ( | const obj::index_2_tuple_type & | t_1, |
const obj::index_2_tuple_type & | t_2, | ||
const obj::index_2_tuple_type & | t_3 | ||
) | [static, private] |
Definition at line 148 of file object_loader.cpp.
void ICR::ObjectLoader::vertex_normal_callback | ( | obj::float_type | x, |
obj::float_type | y, | ||
obj::float_type | z | ||
) | [static, private] |
Definition at line 142 of file object_loader.cpp.
std::ostream& operator<< | ( | std::ostream & | stream, |
ObjectLoader const & | obj_loader | ||
) | [friend] |
Definition at line 29 of file object_loader.cpp.
TargetObjectPtr ICR::ObjectLoader::object_ [private] |
Definition at line 41 of file object_loader.h.
bool ICR::ObjectLoader::object_loaded_ [private] |
Definition at line 42 of file object_loader.h.