#include "Ogre.h" #ifdef NXOGRE #include "NXOgre.h" using namespace NxOgre; #endif using namespace Ogre; enum SceneScriptSection { SSS_NONE, SSS_MESH, SSS_ENTITY }; struct SceneScriptContext { SceneScriptSection section; size_t lineNo; String filename; SceneManager* sceneManager; String entityName; String meshName; Entity* entity; String pathMapTextureName; SceneNode* sceneNode; std::map meshFiles; std::map pathMapResolutions; #ifdef NXOGRE std::map meshPhysXShapes; std::map meshPhysXShapeParams; //float physXMass; //float physXDensity; //bool physXKinematic; //bool physXStatic; Scene* scene; World* world; Body* physXBody; #endif }; typedef bool (*SCENE_ATTRIBUTE_PARSER)(String& params, SceneScriptContext& context); class SceneSerializer { protected: /// Keyword-mapped attribute parsers. typedef std::map AttribParserList; SceneScriptContext mScriptContext; /** internal method for parsing a material @returns true if it expects the next line to be a { */ bool parseScriptLine(String& line); /** internal method for finding & invoking an attribute parser. */ bool invokeParser(String& line, AttribParserList& parsers); /// Parsers for the root of the material script AttribParserList mRootAttribParsers; /// Parsers for the material section of a script AttribParserList mMeshAttribParsers; /// Parsers for the technique section of a script AttribParserList mEntityAttribParsers; public: SceneSerializer(SceneManager* sm); void parseScript(DataStreamPtr& stream, const String& groupName); void parseEntryPoints(String filename); #ifdef NXOGRE public: void setScene(Scene* scene){mScriptContext.scene = scene;} void setWorld(World* world){mScriptContext.world = world;} #endif };