source: GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspResourceManager.h @ 1812

Revision 1812, 4.5 KB checked in by gumbau, 18 years ago (diff)
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://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
32namespace 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        /** Loads a BSP-based level from a stream.
56            Currently only supports loading of Quake3 .bsp files.
57        */
58        ResourcePtr load(DataStreamPtr& stream, const String& group);
59
60        /** Override standard Singleton retrieval.
61        @remarks
62        Why do we do this? Well, it's because the Singleton
63        implementation is in a .h file, which means it gets compiled
64        into anybody who includes it. This is needed for the
65        Singleton template to work, but we actually only want it
66        compiled into the implementation of the class based on the
67        Singleton, not all of them. If we don't change this, we get
68        link errors when trying to use the Singleton-based class from
69        an outside dll.
70        @par
71        This method just delegates to the template version anyway,
72        but the implementation stays in this single compilation unit,
73        preventing link errors.
74        */
75        static BspResourceManager& getSingleton(void);
76        /** Override standard Singleton retrieval.
77        @remarks
78        Why do we do this? Well, it's because the Singleton
79        implementation is in a .h file, which means it gets compiled
80        into anybody who includes it. This is needed for the
81        Singleton template to work, but we actually only want it
82        compiled into the implementation of the class based on the
83        Singleton, not all of them. If we don't change this, we get
84        link errors when trying to use the Singleton-based class from
85        an outside dll.
86        @par
87        This method just delegates to the template version anyway,
88        but the implementation stays in this single compilation unit,
89        preventing link errors.
90        */
91        static BspResourceManager* getSingletonPtr(void);
92
93
94    protected:
95        /** @copydoc ResourceManager::createImpl. */
96        Resource* createImpl(const String& name, ResourceHandle handle,
97            const String& group, bool isManual, ManualResourceLoader* loader,
98            const NameValuePairList* createParams);
99
100        // Singleton managed by this class
101        Quake3ShaderManager *mShaderMgr;
102
103    };
104
105}
106
107#endif
Note: See TracBrowser for help on using the repository browser.