00001
00002
00003
00004
00005
00006
00007 #include <vector>
00008 #include <map>
00009 #include <string>
00010 #include <libxml/parser.h>
00011 #include <libxml/tree.h>
00012 #include <sigc++/sigc++.h>
00013
00014 #include "scene.h"
00015
00016 typedef sigc::signal<Renderable *, Scene *, xmlNode *> nodehandler_t ;
00017
00020 class SceneParser : public sigc::trackable {
00021 private:
00023 void register_default_handlers();
00024
00029 Renderable * parse_light_sources(Scene * scene, xmlNode * node);
00033 Renderable * parse_objects(Scene * scene, xmlNode * node);
00037 Renderable * parse_meta(Scene * scene, xmlNode * node);
00041 Renderable * parse_camera(Scene * scene, xmlNode * node);
00045 Renderable * parse_bumpmaps(Scene * scene, xmlNode * node);
00049 Renderable * noop(Scene * scene, xmlNode * node);
00050
00055 Renderable * parse_colors(Scene * scene, xmlNode * node);
00059 Renderable * parse_materials(Scene * scene, xmlNode * node);
00060
00061
00062 protected:
00064 std::map<std::string, nodehandler_t> m_node_handlers;
00065
00068 std::string m_scene_filename;
00069
00070 public:
00075 SceneParser(std::string scene_file_name);
00076
00077
00078
00082 void parse(xmlNode * root);
00083 };