source: GTP/trunk/App/Demos/Illum/Ogre/src/Common/include/SceneSerializer.h @ 1079

Revision 1079, 1.3 KB checked in by szirmay, 18 years ago (diff)
Line 
1#include "Ogre.h"
2
3using namespace Ogre;
4
5enum SceneScriptSection
6{
7        SSS_NONE,
8        SSS_MESH,
9        SSS_ENTITY             
10};
11
12struct SceneScriptContext
13{
14        SceneScriptSection section;
15        size_t lineNo;
16        String filename;
17        SceneManager* sceneManager;
18        String entityName;
19        String meshName;
20        Entity* entity;
21        SceneNode* sceneNode;
22        std::map<String, String> meshFiles;     
23};
24
25typedef bool (*SCENE_ATTRIBUTE_PARSER)(String& params, SceneScriptContext& context);
26
27class SceneSerializer
28{
29protected:
30        /// Keyword-mapped attribute parsers.
31    typedef std::map<String, SCENE_ATTRIBUTE_PARSER> AttribParserList;
32
33        SceneScriptContext mScriptContext;
34        /** internal method for parsing a material
35       @returns true if it expects the next line to be a {
36    */
37    bool parseScriptLine(String& line);
38        /** internal method for finding & invoking an attribute parser. */
39    bool invokeParser(String& line, AttribParserList& parsers);
40
41        /// Parsers for the root of the material script
42    AttribParserList mRootAttribParsers;
43    /// Parsers for the material section of a script
44    AttribParserList mMeshAttribParsers;
45    /// Parsers for the technique section of a script
46    AttribParserList mEntityAttribParsers;
47
48public:
49
50        SceneSerializer(SceneManager* sm);
51        void parseScript(DataStreamPtr& stream, const String& groupName);
52
53};
Note: See TracBrowser for help on using the repository browser.