Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre/Tests/PlayPen/include/StaticPluginLoader.h @ 66

Last change on this file since 66 was 5, checked in by anonymous, 17 years ago

=hoffentlich gehts jetzt

File size: 3.5 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-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10You may use this sample code for anything you like, it is not covered by the
11LGPL like the rest of the engine.
12-----------------------------------------------------------------------------
13*/
14/*
15-----------------------------------------------------------------------------
16Filename:    StaticPluginLoader.h
17Description: Utility class to load plugins statically
18-----------------------------------------------------------------------------
19*/
20
21#ifndef __StaticPluginLoader_H__
22#define __StaticPluginLoader_H__
23
24#include "Ogre.h"
25#include "OgreConfigFile.h"
26// Static plugin headers
27#ifdef ENABLE_PLUGIN_CgProgramManager
28#  include "OgreCgPlugin.h"
29#endif
30#ifdef ENABLE_PLUGIN_OctreeSceneManager
31#  include "OgreOctreePlugin.h"
32#endif
33#ifdef ENABLE_PLUGIN_ParticleFX
34#  include "OgreParticleFXPlugin.h"
35#endif
36#ifdef ENABLE_PLUGIN_BSPSceneManager
37#  include "OgreBspSceneManagerPlugin.h"
38#endif
39#ifdef ENABLE_PLUGIN_GL
40#  include "OgreGLPlugin.h"
41#endif
42#ifdef ENABLE_PLUGIN_Direct3D9
43#  include "OgreD3D9Plugin.h"
44#endif
45
46namespace Ogre
47{
48        /** Utility class for loading some plugins statically.
49        @remarks
50                When loading plugins statically, you are limited to loading plugins
51                that are known about at compile time. You should define preprocessor
52                symbols depending on which plugins you want to load - the symbol being
53                ENABLE_PLUGIN_<pluginname>, with pluginname being the usual name of the
54                plugin DLL (no file extension, no debug suffix, and without the Plugin_
55                or RenderSystem_ prefix.)
56        */
57        class StaticPluginLoader
58        {
59        protected:
60#ifdef ENABLE_PLUGIN_CgProgramManager
61                CgPlugin* mCgPlugin;
62#endif
63#ifdef ENABLE_PLUGIN_OctreeSceneManager
64                OctreePlugin* mOctreePlugin;
65#endif
66#ifdef ENABLE_PLUGIN_ParticleFX
67                ParticleFXPlugin* mParticleFXPlugin;
68#endif
69#ifdef ENABLE_PLUGIN_BSPSceneManager
70                BspSceneManagerPlugin* mBSPPlugin;
71#endif
72#ifdef ENABLE_PLUGIN_GL
73                GLPlugin* mGLPlugin;
74#endif
75#ifdef ENABLE_PLUGIN_Direct3D9
76                D3D9Plugin* mD3D9Plugin;
77#endif
78        public:
79                StaticPluginLoader() {}
80
81                /** Load all the enabled plugins against the passed in root object. */
82                void load(Root& root)
83                {
84#ifdef ENABLE_PLUGIN_GL
85                        mGLPlugin = new GLPlugin();
86                        root.installPlugin(mGLPlugin);
87#endif
88#ifdef ENABLE_PLUGIN_Direct3D9
89                        mD3D9Plugin = new D3D9Plugin();
90                        root.installPlugin(mD3D9Plugin);
91#endif
92#ifdef ENABLE_PLUGIN_CgProgramManager
93                        mCgPlugin = new CgPlugin();
94                        root.installPlugin(mCgPlugin);
95#endif
96#ifdef ENABLE_PLUGIN_OctreeSceneManager
97                        mOctreePlugin = new OctreePlugin();
98                        root.installPlugin(mOctreePlugin);
99#endif
100#ifdef ENABLE_PLUGIN_ParticleFX
101                        mParticleFXPlugin = new ParticleFXPlugin();
102                        root.installPlugin(mParticleFXPlugin);
103#endif
104#ifdef ENABLE_PLUGIN_BSPSceneManager
105                        mBSPPlugin = new BspSceneManagerPlugin();
106                        root.installPlugin(mBSPPlugin);
107#endif
108                }
109
110                void unload()
111                {
112                        // don't unload plugins, since Root will have done that. Destroy here.
113#ifdef ENABLE_PLUGIN_BSPSceneManager
114                        delete mBSPPlugin;
115#endif
116#ifdef ENABLE_PLUGIN_ParticleFX
117                        delete mParticleFXPlugin;
118#endif
119#ifdef ENABLE_PLUGIN_OctreeSceneManager
120                        delete mOctreePlugin;
121#endif
122#ifdef ENABLE_PLUGIN_CgProgramManager
123                        delete mCgPlugin;
124#endif
125#ifdef ENABLE_PLUGIN_Direct3D9
126                        delete mD3D9Plugin;
127#endif
128#ifdef ENABLE_PLUGIN_GL
129                        delete mGLPlugin;
130#endif
131
132                }
133
134
135
136        };
137
138}
139
140
141#endif
142
Note: See TracBrowser for help on using the repository browser.