1 | /** |
---|
2 | * This source file is part of OgreColladaPlugin |
---|
3 | * an addon for OGRE (Object-oriented Graphics Rendering Engine) |
---|
4 | * For the latest info, see http://www.ogre3d.org/ |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or modify it under |
---|
7 | * the terms of the GNU Lesser General Public License as published by the Free Software |
---|
8 | * Foundation; either version 2 of the License, or (at your option) any later |
---|
9 | * version. |
---|
10 | |
---|
11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
---|
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
13 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
14 | |
---|
15 | * You should have received a copy of the GNU Lesser General Public License along with |
---|
16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
17 | * Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
18 | * http://www.gnu.org/copyleft/lesser.txt. |
---|
19 | * |
---|
20 | * @authors Philipp Hartl, Jeff Doyle (nfz) |
---|
21 | * @see README |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef __ColladaManager_H__ |
---|
25 | #define __ColladaManager_H__ |
---|
26 | |
---|
27 | #include "OgreSingleton.h" |
---|
28 | #include "OgreResourceManager.h" |
---|
29 | #include "OgreColladaPrerequisites.h" |
---|
30 | #include "OgreColladaDocument.h" |
---|
31 | |
---|
32 | namespace Ogre { |
---|
33 | |
---|
34 | /** Class for managing Collada Documents for Ogre. |
---|
35 | @remarks |
---|
36 | @par |
---|
37 | When loaded from a XML Document, Collada objects are in an 'unloaded' state and only stores the settings |
---|
38 | required. It does not at that stage load any Ogre resources. This is because the Collada Documents may be |
---|
39 | loaded 'en masse', but only a subset will actually be required. |
---|
40 | @par |
---|
41 | Because this is a subclass of ResourceManager, any files loaded will be searched for in any path or |
---|
42 | archive added to the resource paths/archives. See ResourceManager for details. |
---|
43 | @par |
---|
44 | For a definition of the Collada Document format, see . |
---|
45 | */ |
---|
46 | class _OgreColladaExport ColladaManager : public ResourceManager, public Singleton<ColladaManager> |
---|
47 | { |
---|
48 | public: |
---|
49 | ColladaManager(void); |
---|
50 | virtual ~ColladaManager(void); |
---|
51 | |
---|
52 | /** Override standard Singleton retrieval. |
---|
53 | @remarks |
---|
54 | Why do we do this? Well, it's because the Singleton |
---|
55 | implementation is in a .h file, which means it gets compiled |
---|
56 | into anybody who includes it. This is needed for the |
---|
57 | Singleton template to work, but we actually only want it |
---|
58 | compiled into the implementation of the class based on the |
---|
59 | Singleton, not all of them. If we don't change this, we get |
---|
60 | link errors when trying to use the Singleton-based class from |
---|
61 | an outside dll. |
---|
62 | @par |
---|
63 | This method just delegates to the template version anyway, |
---|
64 | but the implementation stays in this single compilation unit, |
---|
65 | preventing link errors. |
---|
66 | */ |
---|
67 | static ColladaManager& getSingleton(void); |
---|
68 | /** Override standard Singleton retrieval. |
---|
69 | @remarks |
---|
70 | Why do we do this? Well, it's because the Singleton |
---|
71 | implementation is in a .h file, which means it gets compiled |
---|
72 | into anybody who includes it. This is needed for the |
---|
73 | Singleton template to work, but we actually only want it |
---|
74 | compiled into the implementation of the class based on the |
---|
75 | Singleton, not all of them. If we don't change this, we get |
---|
76 | link errors when trying to use the Singleton-based class from |
---|
77 | an outside dll. |
---|
78 | @par |
---|
79 | This method just delegates to the template version anyway, |
---|
80 | but the implementation stays in this single compilation unit, |
---|
81 | preventing link errors. |
---|
82 | */ |
---|
83 | static ColladaManager* getSingletonPtr(void); |
---|
84 | |
---|
85 | /** Load a Collada dae resource. This is a conveniance method that allows the caller to set |
---|
86 | * the scenemanager to be used by the document and pass settings to be used when loading. |
---|
87 | * @param daeFileName is the name of the dae file to be loaded. |
---|
88 | * @param sceneMgr is the Ogre scenemanager that that will be used when converting |
---|
89 | * Collada resources to Ogre resource. Defaults to NULL. |
---|
90 | * |
---|
91 | * @param loadParams is a list of parameters used to configure how the dae document is to be loaded. |
---|
92 | * Currently not implemented. Defaults to no parameters being passed. |
---|
93 | * @param group is the resource group to load the resource from. It defaults to DEFAULT_RESOURCE_GROUP_NAME. |
---|
94 | */ |
---|
95 | ColladaDocumentPtr load(const String& daeFileName, SceneManager* sceneMgr = 0, |
---|
96 | NameValuePairList* loadParams = 0, |
---|
97 | const String& group = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME |
---|
98 | ); |
---|
99 | |
---|
100 | |
---|
101 | protected: |
---|
102 | /// version number of the plugin |
---|
103 | String mVersion; |
---|
104 | /// Overridden from ResourceManager |
---|
105 | |
---|
106 | Resource* createImpl(const String& name, ResourceHandle handle, |
---|
107 | const String& group, bool isManual, ManualResourceLoader* loader, |
---|
108 | const NameValuePairList* params); |
---|
109 | }; |
---|
110 | } |
---|
111 | |
---|
112 | |
---|
113 | #endif |
---|
114 | |
---|
115 | |
---|