Go to the documentation of this file.00001 #ifndef object_loader_h___
00002 #define object_loader_h___
00003
00004 #include "target_object.h"
00005 #include <iostream>
00006 #include "obj.hpp"
00007
00008 namespace ICR
00009 {
00010 extern std::vector<double*> points_buffer;
00011 extern std::vector<double*> normals_buffer;
00012 extern TargetObject* callback_obj_ptr;
00013 extern bool face_callback_run;
00014 extern Eigen::VectorXi map_normal2vertex;
00015
00016
00037 class ObjectLoader
00038 {
00039 private:
00040
00041 TargetObjectPtr object_;
00042 bool object_loaded_;
00043
00044 static void geometric_vertex_callback(obj::float_type x, obj::float_type y, obj::float_type z);
00045 static void vertex_normal_callback(obj::float_type x, obj::float_type y, obj::float_type z);
00046 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);
00047 static void triangular_face_geometric_vertices_callback(obj::index_type,obj::index_type,obj::index_type);
00048 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& );
00049 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&);
00050 static void quadrilateral_face_geometric_vertices_callback(obj::index_type,obj::index_type,obj::index_type,obj::index_type);
00051 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&);
00052 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&);
00053 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&);
00054 static void polygonal_face_geometric_vertices_begin_callback(obj::index_type,obj::index_type,obj::index_type);
00055 static void polygonal_face_geometric_vertices_vertex_callback(obj::index_type);
00056 static void polygonal_face_geometric_vertices_end_callback();
00057 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&);
00058 static void polygonal_face_geometric_vertices_texture_vertices_vertex_callback(const obj::index_2_tuple_type&);
00059 static void polygonal_face_geometric_vertices_texture_vertices_end_callback();
00060 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&);
00061 static void polygonal_face_geometric_vertices_vertex_normals_vertex_callback(const obj::index_2_tuple_type&);
00062 static void polygonal_face_geometric_vertices_vertex_normals_end_callback();
00063 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&);
00064 static void polygonal_face_geometric_vertices_texture_vertices_vertex_normals_vertex_callback(const obj::index_3_tuple_type&);
00065 static void polygonal_face_geometric_vertices_texture_vertices_vertex_normals_end_callback();
00066
00067 public:
00068
00069 ObjectLoader();
00070 ObjectLoader(ObjectLoader const& src);
00071 ObjectLoader& operator=(ObjectLoader const& src);
00072 friend std::ostream& operator<<(std::ostream& stream, ObjectLoader const& obj_loader);
00073 ~ObjectLoader();
00074
00075 void loadObject(std::string const& file,std::string const& name);
00076 const TargetObjectPtr getObject()const;
00077 TargetObjectPtr getObject();
00078 bool objectLoaded()const;
00079 };
00080
00081
00082 }
00083 #endif