1 // Copyright (C) 2010-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
5 #ifndef __C_SCENE_LOADER_IRR_H_INCLUDED__
6 #define __C_SCENE_LOADER_IRR_H_INCLUDED__
8 #include "ISceneLoader.h"
10 #include "IXMLReader.h"
25 //! Class which can load a scene into the scene manager.
26 class CSceneLoaderIrr : public virtual ISceneLoader
31 CSceneLoaderIrr(ISceneManager *smgr, io::IFileSystem* fs);
34 virtual ~CSceneLoaderIrr();
36 //! Returns true if the class might be able to load this file.
37 virtual bool isALoadableFileExtension(const io::path& filename) const _IRR_OVERRIDE_;
39 //! Returns true if the class might be able to load this file.
40 virtual bool isALoadableFileFormat(io::IReadFile *file) const _IRR_OVERRIDE_;
42 //! Loads the scene into the scene manager.
43 virtual bool loadScene(io::IReadFile* file,
44 ISceneUserDataSerializer* userDataSerializer=0,
45 ISceneNode* rootNode=0) _IRR_OVERRIDE_;
49 //! Recursively reads nodes from the xml file
50 void readSceneNode(io::IXMLReader* reader, ISceneNode* parent,
51 ISceneUserDataSerializer* userDataSerializer);
53 //! read a node's materials
54 void readMaterials(io::IXMLReader* reader, ISceneNode* node);
56 //! read a node's animators
57 void readAnimators(io::IXMLReader* reader, ISceneNode* node);
59 //! read any other data into the user serializer
60 void readUserData(io::IXMLReader* reader, ISceneNode* node,
61 ISceneUserDataSerializer* userDataSerializer);
63 ISceneManager *SceneManager;
64 io::IFileSystem *FileSystem;
66 //! constants for reading and writing XML.
67 //! Not made static due to portability problems.
68 // TODO: move to own header
69 const core::stringw IRR_XML_FORMAT_SCENE;
70 const core::stringw IRR_XML_FORMAT_NODE;
71 const core::stringw IRR_XML_FORMAT_NODE_ATTR_TYPE;
72 const core::stringw IRR_XML_FORMAT_ATTRIBUTES;
73 const core::stringw IRR_XML_FORMAT_MATERIALS;
74 const core::stringw IRR_XML_FORMAT_ANIMATORS;
75 const core::stringw IRR_XML_FORMAT_USERDATA;
79 } // end namespace scene
80 } // end namespace irr