00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __FHSPARSER__H__
00013 #define __FHSPARSER__H__
00014
00015 #include <wx/hashmap.h>
00016 #include "../../scenemanager.h"
00017 #include "../../textparser.h"
00018 #include "../../geometrytriangles.h"
00019 #include "../../module.h"
00020
00021 namespace VRUT
00022 {
00023 class Module;
00024
00026 class FHSParser
00027 {
00028 private:
00030 TextParser * textParser;
00032 SCENE_ID sceneID;
00034 wxString scenePath;
00036 Module * module;
00038 unsigned nodesImported;
00040 unsigned nodesGeomImported;
00042 unsigned materialsImported;
00044 unsigned texturesImported;
00046 unsigned lightsImported;
00047
00048 WX_DECLARE_STRING_HASH_MAP(bool, NodeUidsList);
00050 NodeUidsList nodeUidsList;
00051
00053 enum ERROR_MSG
00054 {
00055 EXPECTED,
00056 UNEXPECTED,
00057 VECTOR,
00058 MATERIAL
00059 };
00065 bool logErrorMsg(ERROR_MSG msg, const wxString & line, const wxChar * expected = NULL);
00067 const wxString getUniqueUid(const wxString & uid);
00068
00070 bool parseScale(const wxString & nodeUid);
00072 bool parseRotate(const wxString & nodeUid);
00074 bool parseIndices(std::vector<GeometryTriangles::Indice> * indices, size_t maxInd);
00076 bool parsePolyPool(GeometryTriangles * geometry);
00078 bool parsePolyBox(GeometryTriangles * geometry);
00079
00081 bool parseCommonAttribs(wxString &nodeUid);
00083 bool parseCommonBody(const wxString & nodeUid);
00084
00086 bool parseMaterialAttribs(Material * material);
00088 bool parseMaterial();
00090 bool parseEnvironmentBody(const wxString & nodeUid);
00092 bool parseEnvironmentAttribs(wxString &nodeUid);
00094 bool parseEnvironment(const wxString & parentUid);
00096 bool parseLightBody(Light * light);
00098 bool parseLightAttribs(wxString &nodeUid);
00100 bool parseLight(const wxString & parentUid);
00102 bool parseGeometryBody(const wxString & nodeUid, GeometryTriangles * geometry, bool &valid);
00104 bool parseGeometryAttribs(wxString &nodeUid, GeometryTriangles * geometry);
00106 bool parseGeometry(const wxString & parentUid);
00108 bool parseSwitchAttribs(wxString &nodeUid);
00110 bool parseSwitch(const wxString & parentUid);
00112 bool parseBillboardAttribs(wxString &nodeUid);
00114 bool parseBillboard(const wxString & parentUid);
00116 bool parseLOD(const wxString & parentUid, const bool active);
00118 bool parseLODAssemblyBody(const wxString & nodeUid);
00120 bool parseLODAssembly(const wxString & parentUid);
00122 bool parseAssemblyBody(const wxString & nodeUid);
00124 bool parseAssemblyAttribs(wxString &nodeUid);
00126 bool parseAssembly(const wxString & parentUid);
00128 bool parseModelAttribs(const wxString & nodeUid);
00131 bool parseModel(const wxString & nodeUid);
00132
00133 public:
00139 FHSParser(wxInputStream * _inputStream, SCENE_ID _sceneID, const wxString _scenePath, Module * _module);
00141 ~FHSParser();
00142
00146 bool Parse(const wxString & rootUid);
00147 };
00148 };
00149
00150
00151 #endif