Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgrePlugin.h @ 148

Last change on this file since 148 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 6.1 KB
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-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __OGREPLUGIN_H__
29#define __OGREPLUGIN_H__
30
31#include "OgrePrerequisites.h"
32
33namespace Ogre
34{
35        /** \addtogroup Core
36        *  @{
37        */
38        /** \addtogroup General
39        *  @{
40        */
41        /** Class defining a generic OGRE plugin.
42        @remarks
43                OGRE is very plugin-oriented and you can customise much of its behaviour
44                by registering new plugins, dynamically if you are using dynamic linking.
45                This class abstracts the generic interface that all plugins must support.
46                Within the implementations of this interface, the plugin must call other
47                OGRE classes in order to register the detailed customisations it is
48                providing, e.g. registering a new SceneManagerFactory, a new
49                MovableObjectFactory, or a new RenderSystem.
50        @par
51                Plugins can be linked statically or dynamically. If they are linked
52                dynamically (ie the plugin is in a DLL or Shared Object file), then you
53                load the plugin by calling the Root::loadPlugin method (or some other
54                mechanism which leads to that call, e.g. plugins.cfg), passing the name of
55                the DLL. OGRE will then call a global init function on that DLL, and it
56                will be expected to register one or more Plugin implementations using
57                Root::installPlugin. The procedure is very similar if you use a static
58                linked plugin, except that you simply instantiate the Plugin implementation
59                yourself and pass it to Root::installPlugin.
60        @note
61                Lifecycle of a Plugin instance is very important. The Plugin instance must
62                remain valid until the Plugin is uninstalled. Here are the things you
63                must bear in  mind:
64                <ul><li>If your plugin is in a DLL:
65                <ul><li>Create the Plugin instance and call Root::installPlugin in dllStartPlugin</li>
66                <li>Call Root::uninstallPlugin, then delete it in dllStopPlugin</li></ul>
67                <li>If your plugin is statically linked in your app:
68                <ul><li>Create the Plugin anytime you like</li>
69                <li>Call Root::installPlugin any time whilst Root is valid</li>
70                <li>Call Root::uninstallPlugin if you like so long as Root is valid. However,
71                        it will be done for you when Root is destroyed, so the Plugin instance must
72                        still be valid at that point if you haven't manually uninstalled it.</li></ul>
73                </ul>
74                The install and uninstall methods will be called when the plugin is
75                installed or uninstalled. The initialise and shutdown will be called when
76                there is a system initialisation or shutdown, e.g. when Root::initialise
77                or Root::shutdown are called.
78        */
79        class _OgreExport Plugin : public PluginAlloc
80        {
81        public:
82                Plugin() {}
83                virtual ~Plugin() {}
84
85                /** Get the name of the plugin.
86                @remarks An implementation must be supplied for this method to uniquely
87                        identify the plugin.
88                */
89                virtual const String& getName() const = 0;
90
91                /** Perform the plugin initial installation sequence.
92                @remarks An implementation must be supplied for this method. It must perform
93                the startup tasks necessary to install any rendersystem customisations
94                or anything else that is not dependent on system initialisation, ie
95                only dependent on the core of Ogre. It must not perform any
96                operations that would create rendersystem-specific objects at this stage,
97                that should be done in initialise().
98                */
99                virtual void install() = 0;
100
101                /** Perform any tasks the plugin needs to perform on full system
102                        initialisation.
103                @remarks An implementation must be supplied for this method. It is called
104                        just after the system is fully initialised (either after Root::initialise
105                        if a window is created then, or after the first window is created)
106                        and therefore all rendersystem functionality is available at this
107                        time. You can use this hook to create any resources which are
108                        dependent on a rendersystem or have rendersystem-specific implementations.
109                */
110                virtual void initialise() = 0;
111
112                /** Perform any tasks the plugin needs to perform when the system is shut down.
113                @remarks An implementation must be supplied for this method.
114                This method is called just before key parts of the system are unloaded,
115                such as rendersystems being shut down. You should use this hook to free up
116                resources and decouple custom objects from the OGRE system, whilst all the
117                instances of other plugins (e.g. rendersystems) still exist.
118                */
119                virtual void shutdown() = 0;
120
121                /** Perform the final plugin uninstallation sequence.
122                @remarks An implementation must be supplied for this method. It must perform
123                the cleanup tasks which haven't already been performed in shutdown()
124                (e.g. final deletion of custom instances, if you kept them around incase
125                the system was reinitialised). At this stage you cannot be sure what other
126                plugins are still loaded or active. It must therefore not perform any
127                operations that would reference any rendersystem-specific objects - those
128                should have been sorted out in the 'shutdown' method.
129                */
130                virtual void uninstall() = 0;
131        };
132        /** @} */
133        /** @} */
134
135}
136
137#endif
138
139
Note: See TracBrowser for help on using the repository browser.