MeshLoaderOBJ.h
Go to the documentation of this file.00001 /**<!--------------------------------------------------------------------> 00002 @class MeshLoaderOBJ 00003 @author Travis Fischer (fisch0920@gmail.com) 00004 @author Matthew Jacobs (jacobs.mh@gmail.com) 00005 @date Spring 2008 00006 00007 @brief 00008 Loads OBJ meshes from an external source ('.obj' file extension). 00009 Wrapper around obj-parser-0.1 00010 <!-------------------------------------------------------------------->**/ 00011 00012 #ifndef MESH_LOADER_OBJ_H_ 00013 #define MESH_LOADER_OBJ_H_ 00014 00015 #include <loaders/MeshLoader.h> 00016 00017 #include <istream> 00018 #include <tr1/functional> 00019 #include <third-party/objparser/obj.h> 00020 00021 #ifdef HAVE_CONFIG_H 00022 # include <third-party/objparser/obj/config.hpp> 00023 #endif 00024 00025 class MeshLoaderOBJ : public MeshLoader { 00026 public: 00027 inline MeshLoaderOBJ(MeshData &outData) 00028 : _data(outData) 00029 { } 00030 00031 protected: 00032 virtual bool _load(std::istream &istream, MeshData &outData); 00033 00034 private: 00035 void info_callback(const std::string& filename, std::size_t line_number, const std::string& message); 00036 void warning_callback(const std::string& filename, std::size_t line_number, const std::string& message); 00037 void error_callback(const std::string& filename, std::size_t line_number, const std::string& message); 00038 void geometric_vertex_callback(obj::float_type x, obj::float_type y, obj::float_type z); 00039 void texture_vertex_callback(obj::float_type u, obj::float_type v); 00040 void vertex_normal_callback(obj::float_type x, obj::float_type y, obj::float_type z); 00041 void triangular_face_geometric_vertices_callback(obj::index_type v1, obj::index_type v2, obj::index_type v3); 00042 void triangular_face_geometric_vertices_texture_vertices_callback(const obj::index_2_tuple_type& v1_vt1, const obj::index_2_tuple_type& v2_vt2, const obj::index_2_tuple_type& v3_vt3); 00043 void triangular_face_geometric_vertices_vertex_normals_callback(const obj::index_2_tuple_type& v1_vn1, const obj::index_2_tuple_type& v2_vn2, const obj::index_2_tuple_type& v3_vn3); 00044 void triangular_face_geometric_vertices_texture_vertices_vertex_normals_callback(const obj::index_3_tuple_type& v1_vt1_vn1, const obj::index_3_tuple_type& v2_vt2_vn2, const obj::index_3_tuple_type& v3_vt3_vn3); 00045 00046 protected: 00047 MeshData &_data; 00048 }; 00049 00050 #endif // MESH_LOADER_OBJ_H_ 00051
Generated on 28 Feb 2009 for Milton by
1.5.6