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

Revision 1812, 5.0 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 _OgreExternalTextureSourceManager_H
26#define _OgreExternalTextureSourceManager_H
27
28/***************************************************************************
29OgreExternalTextureSourceManager.h  - 
30        Handles the registering / unregistering of texture modifier plugins
31
32-------------------
33date                 : Jan 1 2004
34email                : pjcast@yahoo.com
35***************************************************************************/
36#include "OgreSingleton.h"
37#include "OgreString.h"
38#include "OgreResourceGroupManager.h"
39#include "OgreExternalTextureSource.h"
40
41namespace Ogre
42{
43        /**
44        Singleton Class which handles the registering and control of texture plugins. The plugins
45        will be mostly controlled via a string interface. */
46        class _OgreExport ExternalTextureSourceManager : public Singleton<ExternalTextureSourceManager>
47        {
48        public:
49                /** Constructor */
50                ExternalTextureSourceManager();
51                /** Destructor */
52                ~ExternalTextureSourceManager();
53
54                /** Sets active plugin (ie. "video", "effect", "generic", etc..) */
55                void setCurrentPlugIn( const String& sTexturePlugInType );
56
57                /** Returns currently selected plugin, may be null if none selected */
58                ExternalTextureSource* getCurrentPlugIn( void ) const { return mpCurrExternalTextureSource; }
59       
60                /** Calls the destroy method of all registered plugins...
61                Only the owner plugin should perform the destroy action. */
62                void destroyAdvancedTexture( const String& sTextureName,
63                        const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
64
65                /** Returns the plugin which reistered itself with a specific name
66                (eg. "video"), or null if specified plugin not found */
67                ExternalTextureSource* getExternalTextureSource( const String& sTexturePlugInType );
68
69                /** Called from plugin to register itself */
70                void setExternalTextureSource( const String& sTexturePlugInType, ExternalTextureSource* pTextureSystem );
71
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 ExternalTextureSourceManager& getSingleton(void);
88        /** Override standard Singleton retrieval.
89        @remarks
90        Why do we do this? Well, it's because the Singleton
91        implementation is in a .h file, which means it gets compiled
92        into anybody who includes it. This is needed for the
93        Singleton template to work, but we actually only want it
94        compiled into the implementation of the class based on the
95        Singleton, not all of them. If we don't change this, we get
96        link errors when trying to use the Singleton-based class from
97        an outside dll.
98        @par
99        This method just delegates to the template version anyway,
100        but the implementation stays in this single compilation unit,
101        preventing link errors.
102        */
103        static ExternalTextureSourceManager* getSingletonPtr(void);
104        protected:
105                //The current texture controller selected
106                ExternalTextureSource* mpCurrExternalTextureSource;
107               
108        // Collection of loaded texture System PlugIns, keyed by registered type
109        typedef std::map< String, ExternalTextureSource*> TextureSystemList;
110        TextureSystemList mTextureSystems;
111    };
112}
113#endif
Note: See TracBrowser for help on using the repository browser.