1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 | #ifndef _BspLevelManager_H__
|
---|
26 | #define _BspLevelManager_H__
|
---|
27 |
|
---|
28 | #include "OgreBspPrerequisites.h"
|
---|
29 | #include "OgreResourceManager.h"
|
---|
30 | #include "OgreSingleton.h"
|
---|
31 |
|
---|
32 | namespace Ogre {
|
---|
33 |
|
---|
34 | /** Manages the locating and loading of BSP-based indoor levels.
|
---|
35 | Like other ResourceManager specialisations it manages the location and loading
|
---|
36 | of a specific type of resource, in this case files containing Binary
|
---|
37 | Space Partition (BSP) based level files e.g. Quake3 levels.</p>
|
---|
38 | However, note that unlike other ResourceManager implementations,
|
---|
39 | only 1 BspLevel resource is allowed to be loaded at one time. Loading
|
---|
40 | another automatically unloads the currently loaded level if any.
|
---|
41 | */
|
---|
42 | class BspResourceManager : public ResourceManager, public Singleton<BspResourceManager>
|
---|
43 | {
|
---|
44 | public:
|
---|
45 | BspResourceManager();
|
---|
46 | ~BspResourceManager();
|
---|
47 |
|
---|
48 | /** Loads a BSP-based level from the named file.
|
---|
49 | Currently only supports loading of Quake3 .bsp files.
|
---|
50 | */
|
---|
51 | ResourcePtr load(const String& name,
|
---|
52 | const String& group, bool isManual = false,
|
---|
53 | ManualResourceLoader* loader = 0, const NameValuePairList* loadParams = 0);
|
---|
54 |
|
---|
55 |
|
---|
56 | /** Override standard Singleton retrieval.
|
---|
57 | @remarks
|
---|
58 | Why do we do this? Well, it's because the Singleton
|
---|
59 | implementation is in a .h file, which means it gets compiled
|
---|
60 | into anybody who includes it. This is needed for the
|
---|
61 | Singleton template to work, but we actually only want it
|
---|
62 | compiled into the implementation of the class based on the
|
---|
63 | Singleton, not all of them. If we don't change this, we get
|
---|
64 | link errors when trying to use the Singleton-based class from
|
---|
65 | an outside dll.
|
---|
66 | @par
|
---|
67 | This method just delegates to the template version anyway,
|
---|
68 | but the implementation stays in this single compilation unit,
|
---|
69 | preventing link errors.
|
---|
70 | */
|
---|
71 | static BspResourceManager& getSingleton(void);
|
---|
72 | /** Override standard Singleton retrieval.
|
---|
73 | @remarks
|
---|
74 | Why do we do this? Well, it's because the Singleton
|
---|
75 | implementation is in a .h file, which means it gets compiled
|
---|
76 | into anybody who includes it. This is needed for the
|
---|
77 | Singleton template to work, but we actually only want it
|
---|
78 | compiled into the implementation of the class based on the
|
---|
79 | Singleton, not all of them. If we don't change this, we get
|
---|
80 | link errors when trying to use the Singleton-based class from
|
---|
81 | an outside dll.
|
---|
82 | @par
|
---|
83 | This method just delegates to the template version anyway,
|
---|
84 | but the implementation stays in this single compilation unit,
|
---|
85 | preventing link errors.
|
---|
86 | */
|
---|
87 | static BspResourceManager* getSingletonPtr(void);
|
---|
88 |
|
---|
89 |
|
---|
90 | protected:
|
---|
91 | /** @copydoc ResourceManager::createImpl. */
|
---|
92 | Resource* createImpl(const String& name, ResourceHandle handle,
|
---|
93 | const String& group, bool isManual, ManualResourceLoader* loader,
|
---|
94 | const NameValuePairList* createParams);
|
---|
95 |
|
---|
96 | // Singleton managed by this class
|
---|
97 | Quake3ShaderManager *mShaderMgr;
|
---|
98 |
|
---|
99 | };
|
---|
100 |
|
---|
101 | }
|
---|
102 |
|
---|
103 | #endif
|
---|