Public Member Functions | Static Private Member Functions | Private Attributes | Friends
ICR::ObjectLoader Class Reference

Loads object models provided in the Wavefront .obj format and builds a ICR::TargetObject. More...

#include <object_loader.h>

List of all members.

Public Member Functions

const TargetObjectPtr getObject () const
TargetObjectPtr getObject ()
void loadObject (std::string const &file, std::string const &name)
bool objectLoaded () const
 ObjectLoader ()
 ObjectLoader (ObjectLoader const &src)
ObjectLoaderoperator= (ObjectLoader const &src)
 ~ObjectLoader ()

Static Private Member Functions

static void geometric_vertex_callback (obj::float_type x, obj::float_type y, obj::float_type z)
static void polygonal_face_geometric_vertices_begin_callback (obj::index_type, obj::index_type, obj::index_type)
static void polygonal_face_geometric_vertices_end_callback ()
static void 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 void polygonal_face_geometric_vertices_texture_vertices_end_callback ()
static void polygonal_face_geometric_vertices_texture_vertices_vertex_callback (const obj::index_2_tuple_type &)
static void 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 void polygonal_face_geometric_vertices_texture_vertices_vertex_normals_end_callback ()
static void polygonal_face_geometric_vertices_texture_vertices_vertex_normals_vertex_callback (const obj::index_3_tuple_type &)
static void polygonal_face_geometric_vertices_vertex_callback (obj::index_type)
static void 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 void polygonal_face_geometric_vertices_vertex_normals_end_callback ()
static void polygonal_face_geometric_vertices_vertex_normals_vertex_callback (const obj::index_2_tuple_type &)
static void quadrilateral_face_geometric_vertices_callback (obj::index_type, obj::index_type, obj::index_type, obj::index_type)
static void 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 void 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 void 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 void triangular_face_geometric_vertices_callback (obj::index_type, obj::index_type, obj::index_type)
static void 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 void 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 void 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 void vertex_normal_callback (obj::float_type x, obj::float_type y, obj::float_type z)

Private Attributes

TargetObjectPtr object_
bool object_loaded_

Friends

std::ostream & operator<< (std::ostream &stream, ObjectLoader const &obj_loader)

Detailed Description

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.

Warning:
Callbacks handling .obj files with texture information only comprise a dummy-implementation right now.

Definition at line 37 of file object_loader.h.


Constructor & Destructor Documentation

Definition at line 15 of file object_loader.cpp.

Definition at line 17 of file object_loader.cpp.

Definition at line 38 of file object_loader.cpp.


Member Function Documentation

Definition at line 137 of file object_loader.cpp.

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.

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.

Definition at line 230 of file object_loader.cpp.

Definition at line 242 of file object_loader.cpp.

Definition at line 248 of file object_loader.cpp.

Definition at line 260 of file object_loader.cpp.

Definition at line 254 of file object_loader.cpp.

Definition at line 284 of file object_loader.cpp.

Definition at line 296 of file object_loader.cpp.

Definition at line 290 of file object_loader.cpp.

Definition at line 236 of file object_loader.cpp.

Definition at line 266 of file object_loader.cpp.

Definition at line 278 of file object_loader.cpp.

Definition at line 272 of file object_loader.cpp.

Definition at line 206 of file object_loader.cpp.

Definition at line 212 of file object_loader.cpp.

Definition at line 224 of file object_loader.cpp.

Definition at line 218 of file object_loader.cpp.

Definition at line 188 of file object_loader.cpp.

Definition at line 194 of file object_loader.cpp.

Definition at line 200 of file object_loader.cpp.

Definition at line 148 of file object_loader.cpp.

Definition at line 142 of file object_loader.cpp.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
ObjectLoader const &  obj_loader 
) [friend]

Definition at line 29 of file object_loader.cpp.


Member Data Documentation

Definition at line 41 of file object_loader.h.

Definition at line 42 of file object_loader.h.


The documentation for this class was generated from the following files:


libicr
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:34:32