MeshLoaderPLY.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  MeshLoaderPLY
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Spring 2008
00006    
00007    @brief
00008       Loads PLY meshes from an external source ('.ply' file extension).
00009    Wrapper around ply-parser-0.1
00010    <!-------------------------------------------------------------------->**/
00011 
00012 #ifndef MESH_LOADER_PLY_H_
00013 #define MESH_LOADER_PLY_H_
00014 
00015 #include <loaders/MeshLoader.h>
00016 
00017 #include <istream>
00018 #include <tr1/functional>
00019 #include <third-party/plyparser/ply.h>
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #  include <third-party/plyparser/ply/config.hpp>
00023 #endif
00024 
00025 using namespace std::tr1::placeholders;
00026 
00027 class MeshLoaderPLY : public MeshLoader {
00028    public:
00029       inline MeshLoaderPLY(MeshData &outData)
00030          : _data(outData)
00031       { }
00032    
00033    protected:
00034       virtual bool _load(std::istream &istream, MeshData &outData);
00035       
00036    private:
00037       void info_callback(const std::string& filename, std::size_t line_number, const std::string& message);
00038       void warning_callback(const std::string& filename, std::size_t line_number, const std::string& message);
00039       void error_callback(const std::string& filename, std::size_t line_number, const std::string& message);
00040       
00041       std::tr1::tuple<std::tr1::function<void()>, std::tr1::function<void()> > element_definition_callback(const std::string& element_name, std::size_t count);
00042       
00043       std::tr1::function<void (ply::float32)> scalar_property_definition_callback(const std::string& element_name, const std::string& property_name);
00044       
00045       std::tr1::tuple<std::tr1::function<void (ply::uint8)>, std::tr1::function<void (ply::int32)>, std::tr1::function<void ()> > list_property_definition_callback(const std::string& element_name, const std::string& property_name);
00046       
00047       void vertex_begin();
00048       void vertex_x(ply::float32 x);
00049       void vertex_y(ply::float32 y);
00050       void vertex_z(ply::float32 z);
00051       void vertex_end();
00052       void face_begin();
00053       void face_vertex_indices_begin(ply::uint8 size);
00054       void face_vertex_indices_element(ply::int32 vertex_index);
00055       void face_vertex_indices_end();
00056       void face_end();
00057       
00058    protected:
00059       MeshData &_data;
00060       
00061       real_t m_x, m_y, m_z;
00062       unsigned m_faceIndex, m_prevFaceIndex, m_firstFaceIndex;
00063 };
00064 
00065 #endif // MESH_LOADER_PLY_H_
00066 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6