00001 /* $Id: MayaParser.h,v 1.3 2002/12/05 15:05:47 cvs Exp $ */ 00002 00003 #ifndef __MAYA_PARSER_H 00004 #define __MAYA_PARSER_H 00005 00006 #include <esg/SceneGraphObject.h> 00007 #include <esg/spacesorting/SDS.h> 00008 #include <esg/parser/Parser.h> 00009 #include <esg/parser/glm.h> 00010 #include <esg/Definitions.h> 00011 #include <esg/Material.h> 00012 #include <esg/geometry/Surface.h> 00013 #include <esg/AutoArray.h> 00014 00015 00016 /* 00017 * Maya .OBJ file parser. 00018 * MayaSharedInfo structure returned by 00019 * getSharedInfo() method is shared by _all_ triangles of model, not 00020 * just by each individual groups of triangles (objects). 00021 * 00022 * Typical call sequence is: 00023 * MayaParser parser(..); 00024 * while (parser.parseObject()) parser.getObject(); 00025 */ 00026 00027 namespace esg { 00028 00029 #define VERT_NORMAL_DEGREE_TRESHOLD 60 00030 00031 class MayaParser : public Parser { 00032 protected: 00033 GLMmodel * _pGLMModel; // model created by glm.h 00034 GLMgroup * _pGLMGroup; // actual group during parsing; 00035 AutoArray<Vertex3> * _pAutoVertices; // global array of vertices 00036 AutoArray<Vertex3> * _pAutoNormals; // global array of normals 00037 AutoArray<Vertex2> * _pAutoTexCoords;// global array of texture coords 00038 bool _fastMesh; 00039 00040 protected: 00041 void _set_material (const GLMmaterial& glmMat); 00042 bool _parse_triangle (Surface*, GLMtriangle*); 00043 void _init_model (bool) const; 00044 00045 public: 00046 MayaParser (const char* /* path to model */, 00047 const SDS& proto /* */, 00048 SceneGraphObject::OID firstOID = 1 /* */, 00049 Parser::Statistics* pStat = NULL /* statistics */, 00050 bool unitize = true /* unitize model? */, 00051 bool fastMesh = true /* */); 00052 00053 virtual ~MayaParser(); 00054 00055 virtual bool parseObject (void); 00056 }; 00057 00058 }; // namespace 00059 00060 #endif // __MAYA_PARSER_H