Main Page   Class Hierarchy   Compound List   File List   Compound Members  

VRMLParser.h

00001 // Mesh Algorithms: a library of algorithms to manipulate 3D meshes
00002 // Copyright (C) 2001 Tim Garthwaite and Jason Reposa
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 #ifndef VRML_PARSER_H
00019 #define VRML_PARSER_H
00020 
00021 #include <string>
00022 #include <fstream>
00023 #include "Scene.h"
00024 
00026 class VRMLParser {
00027   std::ifstream in;
00028   std::ofstream out;
00029   std::vector <Vertex *> parseVertices();
00030   std::vector <GLint> parseCoordIndex();
00031   std::vector <Color *> parseColor();
00032   std::vector <Color *> setColor(Color * c);
00033 
00034   std::vector <Vertex *> vertices;
00035   std::vector <GLint> coordIndex;
00036   std::vector <Color *> colors;
00037 
00038   /*
00039     Helper variables that help parsing
00040   */
00041   GLvoid addModelToScene(Scene * s);
00042   Color * diffuseColor;
00043   Vector translate;
00044   bool clockwise;
00045   std::vector <Vertex *> vertexList;
00046   bool verticesFinished;
00047   bool coordIndexFinished;
00048   bool colorsFinished;
00049   bool diffuseColorFinished;
00050   bool normalsFinished;
00051   bool normalIndexFinished;
00052   bool foundTranslation;
00053 
00054   GLint numVertex;
00055 
00056   public:
00057 
00059     VRMLParser();
00060 
00062 
00070     Scene * parse(std::string filename);
00071 
00073 
00079     bool write(Scene * scene, std::string filename);
00080 };
00081 
00082 #endif

Generated on Fri Dec 21 00:16:49 2001 for Mesh Decimation by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001