#include "Ogre.h" 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; SceneNode* sceneNode; std::map meshFiles; }; 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); };