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

Revision 2186, 1.4 KB checked in by szirmay, 17 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        String pathMapTextureName;
22        SceneNode* sceneNode;
23        std::map<String, String> meshFiles;     
24        std::map<String, unsigned int> pathMapResolutions;     
25};
26
27typedef bool (*SCENE_ATTRIBUTE_PARSER)(String& params, SceneScriptContext& context);
28
29class SceneSerializer
30{
31protected:
32        /// Keyword-mapped attribute parsers.
33    typedef std::map<String, SCENE_ATTRIBUTE_PARSER> AttribParserList;
34
35        SceneScriptContext mScriptContext;
36        /** internal method for parsing a material
37       @returns true if it expects the next line to be a {
38    */
39    bool parseScriptLine(String& line);
40        /** internal method for finding & invoking an attribute parser. */
41    bool invokeParser(String& line, AttribParserList& parsers);
42
43        /// Parsers for the root of the material script
44    AttribParserList mRootAttribParsers;
45    /// Parsers for the material section of a script
46    AttribParserList mMeshAttribParsers;
47    /// Parsers for the technique section of a script
48    AttribParserList mEntityAttribParsers;
49
50public:
51
52        SceneSerializer(SceneManager* sm);
53        void parseScript(DataStreamPtr& stream, const String& groupName);
54        void parseEntryPoints(String filename);
55
56};
Note: See TracBrowser for help on using the repository browser.