MeshLoader.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  MeshLoader
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Spring 2008
00006    
00007    @brief
00008       static class which loads mesh data from external files in either OBJ 
00009    or PLY formats (file extensions '.obj' and '.ply' respectively)
00010    <!-------------------------------------------------------------------->**/
00011 
00012 #ifndef MESH_LOADER_H_
00013 #define MESH_LOADER_H_
00014 
00015 #include <common/common.h>
00016 #include <istream>
00017 
00018 class  Mesh;
00019 struct MeshData;
00020 
00021 class MeshLoader {
00022    public:
00023       /**
00024        * @brief
00025        *    Attempts to parse and initialize a Mesh from the given file, 
00026        * inferring its file format from the filename's extension
00027        * 
00028        * @returns NULL on error or a valid Mesh otherwise
00029        */
00030       static Mesh *load(const std::string &fileName);
00031       
00032       /**
00033        * @brief
00034        *    Attempts to save the given mesh in OBJ format to the file given
00035        * 
00036        * @returns whether or not mesh was successfully written out to the file
00037        */
00038       static bool save(Mesh *mesh, const std::string &fileName);
00039       
00040       /**
00041        * @brief
00042        *    Format-specific mesh loading from a file which defers actual 
00043        * parsing to _load
00044        * 
00045        * @returns true on success with loaded data in outData, false otherwise
00046        */
00047       virtual bool load(const std::string &fileName, MeshData &outData);
00048       
00049    protected:
00050       /**
00051        * @brief
00052        *    Format-specific mesh loading from an ifstream (input file stream)
00053        * 
00054        * @returns true on success with loaded data in outData, false otherwise
00055        */
00056       virtual bool _load(std::istream &fileStream, MeshData &outData) = 0;
00057 };
00058 
00059 #endif // MESH_LOADER_H_
00060 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6