Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Parser.h

Go to the documentation of this file.
00001 //
00002 // File:   Parser.h
00003 // Author: Steve Kilthau
00004 // Date:   August, 1999
00005 // 
00006 
00007 // Modified by Steven Bergner, Aug 2001
00008 
00009 // This file defines a parser class.  The parser is
00010 // used to read scene-files describing objects in a
00011 // given scene.
00012 //
00013 
00014 #ifndef _PARSER_H_
00015 #define _PARSER_H_
00016 
00017 #include "vuVector.h"
00018 #include "Material.h"
00019 #include "vuPerspectiveCamera.h"
00020 #include "spectral.h"
00021 #include "Util.h"
00022 
00023 namespace ns_vu1112112 {
00024 using namespace ns_vu1112112;
00025 
00026 typedef enum{cLight, cColour, cBackground} ColourUsage;
00027 
00034 class Parser
00035 {
00036 public:
00037     Parser();    
00038     ~Parser();   
00039 
00043     bool Parse(const char* filename, vu1112112& scene);
00044 
00045 private:
00046 
00050     void CheckError(void);
00051 
00052 private:
00053 
00055     bool ReadString(char* s);
00056 
00058     bool ReadString(char* prefix, char* s);
00059 
00061     bool ReadNumber(char* prefix, float& t);
00062 
00065     bool ReadVector3(char* prefix, vuVector& v);
00066 
00069     bool ReadvuVector(char* prefix, vuVector& v);
00070 
00073     bool ReadRGB(char* prefix, vuColourRGBa& r);
00074 
00077     bool ReadvuColourRGBa(char* prefix, vuColourRGBa& r);
00078 
00079     /* Try to read a vuColour31a prefixed by "prefix" from the buffer.
00080        Do not read the alpha channel. */
00081     bool ReadSpectrum31(char* prefix, vuColour31a& s);
00082 
00085     bool ReadvuColour31a(char* prefix, vuColour31a& s);
00086 
00089     bool ReadSpectrum7(char* prefix, vuColour7a& s);
00090 
00093     bool ReadvuColour7a(char* prefix, vuColour7a& s);
00094 
00097     bool ReadSpectrum9(char* prefix, vuColour9a& s);
00098 
00101     bool ReadvuColour9a(char* prefix, vuColour9a& s);
00102 
00105     bool ReadColourType(char* prefix, ColourType& c, ColourUsage u);
00106 
00108     bool ReadMaterial(vu1112112& r);
00109 
00111     bool ReadGeneral(vu1112112& s);
00112 
00114     bool ReadTarga(vu1112112& s);
00115 
00117     bool ReadLight(vu1112112& scene);
00118 
00119 private:
00120     void FixName(char* str);    
00121 
00122 private:
00127     vuColour31a m_Ambient;
00128     bool        m_ReadAmbient;  
00129 
00130 private:
00131     char* m_Buffer;     
00132     int   m_Pos;        
00133 };
00134 
00135 } // end of namespace
00136 #endif

Generated on Wed Dec 15 21:20:30 2004 for vuVolume by  doxygen 1.3.9.1