]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CSceneLoaderIrr.h
Set includes and libs on object targets
[irrlicht.git] / source / Irrlicht / CSceneLoaderIrr.h
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
4
5 #ifndef __C_SCENE_LOADER_IRR_H_INCLUDED__
6 #define __C_SCENE_LOADER_IRR_H_INCLUDED__
7
8 #include "ISceneLoader.h"
9
10 #include "IXMLReader.h"
11
12 namespace irr
13 {
14
15 namespace io
16 {
17         class IFileSystem;
18 }
19
20 namespace scene
21 {
22
23 class ISceneManager;
24
25 //! Class which can load a scene into the scene manager.
26 class CSceneLoaderIrr : public virtual ISceneLoader
27 {
28 public:
29
30         //! Constructor
31         CSceneLoaderIrr(ISceneManager *smgr, io::IFileSystem* fs);
32
33         //! Destructor
34         virtual ~CSceneLoaderIrr();
35
36         //! Returns true if the class might be able to load this file.
37         virtual bool isALoadableFileExtension(const io::path& filename) const _IRR_OVERRIDE_;
38
39         //! Returns true if the class might be able to load this file.
40         virtual bool isALoadableFileFormat(io::IReadFile *file) const _IRR_OVERRIDE_;
41
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_;
46
47 private:
48
49         //! Recursively reads nodes from the xml file
50         void readSceneNode(io::IXMLReader* reader, ISceneNode* parent,
51                 ISceneUserDataSerializer* userDataSerializer);
52
53         //! read a node's materials
54         void readMaterials(io::IXMLReader* reader, ISceneNode* node);
55
56         //! read a node's animators
57         void readAnimators(io::IXMLReader* reader, ISceneNode* node);
58
59         //! read any other data into the user serializer
60         void readUserData(io::IXMLReader* reader, ISceneNode* node,
61                 ISceneUserDataSerializer* userDataSerializer);
62
63         ISceneManager   *SceneManager;
64         io::IFileSystem *FileSystem;
65
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;
76 };
77
78
79 } // end namespace scene
80 } // end namespace irr
81
82 #endif
83