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 © 2000-2002 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 |
|
---|
26 | #include "OgreOcclusionCullingSceneManager.h"
|
---|
27 | #include "OgreKdTreeSceneManager.h"
|
---|
28 | #include "OgreKdTerrainSceneManager.h"
|
---|
29 | #include "OgreBiTerrainSceneManager.h"
|
---|
30 | #include <OgreRoot.h>
|
---|
31 | #include <OgreLogManager.h>
|
---|
32 | #include <fstream>
|
---|
33 |
|
---|
34 | #include "OgreBvHierarchySceneManager.h"
|
---|
35 | #include "OgreBiHierarchySceneManager.h"
|
---|
36 | #include "VisibilityManager.h"
|
---|
37 | #include "VisibilityEnvironment.h"
|
---|
38 | #include "CullingManager.h"
|
---|
39 |
|
---|
40 |
|
---|
41 | GtpVisibility::VisibilityEnvironment *visEnv;
|
---|
42 | GtpVisibility::VisibilityManager *visManager;
|
---|
43 |
|
---|
44 | namespace Ogre {
|
---|
45 |
|
---|
46 |
|
---|
47 | OcclusionCullingSceneManagerFactory *occlusionCullingFactory;
|
---|
48 | KdTreeSceneManagerFactory *kdTreeFactory;
|
---|
49 | KdTerrainSceneManagerFactory *kdTerrainFactory;
|
---|
50 | BiTerrainSceneManagerFactory *biTerrainFactory;
|
---|
51 | BiHierarchySceneManagerFactory *biHierarchyFactory;
|
---|
52 |
|
---|
53 | //-----------------------------------------------------------------------
|
---|
54 | extern "C" void __declspec(dllexport) dllStartPlugin(void)
|
---|
55 | {
|
---|
56 | // load visibility environment
|
---|
57 | visEnv = new GtpVisibility::VisibilityEnvironment();
|
---|
58 | visManager = new GtpVisibility::VisibilityManager(visEnv);
|
---|
59 |
|
---|
60 | // Create new scene manager
|
---|
61 | occlusionCullingFactory = new OcclusionCullingSceneManagerFactory(visManager);
|
---|
62 | kdTreeFactory = new KdTreeSceneManagerFactory(visManager);
|
---|
63 | kdTerrainFactory = new KdTerrainSceneManagerFactory(visManager);
|
---|
64 | biTerrainFactory = new BiTerrainSceneManagerFactory(visManager);
|
---|
65 | biHierarchyFactory = new BiHierarchySceneManagerFactory(visManager);
|
---|
66 |
|
---|
67 |
|
---|
68 | // Construct listener manager singleton
|
---|
69 | new TerrainPageSourceListenerManager();
|
---|
70 | new KdTerrainPageSourceListenerManager();
|
---|
71 | new BiTerrainPageSourceListenerManager();
|
---|
72 |
|
---|
73 | // Register
|
---|
74 | Root::getSingleton().addSceneManagerFactory(occlusionCullingFactory);
|
---|
75 | Root::getSingleton().addSceneManagerFactory(kdTreeFactory);
|
---|
76 | Root::getSingleton().addSceneManagerFactory(kdTerrainFactory);
|
---|
77 | Root::getSingleton().addSceneManagerFactory(biTerrainFactory);
|
---|
78 | Root::getSingleton().addSceneManagerFactory(biHierarchyFactory);
|
---|
79 | }
|
---|
80 | //-----------------------------------------------------------------------
|
---|
81 | extern "C" void __declspec(dllexport) dllShutdownPlugin()
|
---|
82 | {
|
---|
83 | Root::getSingleton().removeSceneManagerFactory(occlusionCullingFactory);
|
---|
84 | Root::getSingleton().removeSceneManagerFactory(kdTreeFactory);
|
---|
85 | Root::getSingleton().removeSceneManagerFactory(kdTerrainFactory);
|
---|
86 | Root::getSingleton().removeSceneManagerFactory(biTerrainFactory);
|
---|
87 | Root::getSingleton().removeSceneManagerFactory(biHierarchyFactory);
|
---|
88 |
|
---|
89 | // destroy listener manager
|
---|
90 | delete TerrainPageSourceListenerManager::getSingletonPtr();
|
---|
91 | delete KdTerrainPageSourceListenerManager::getSingletonPtr();
|
---|
92 | delete BiTerrainPageSourceListenerManager::getSingletonPtr();
|
---|
93 | }
|
---|
94 | //-----------------------------------------------------------------------
|
---|
95 | extern "C" void __declspec(dllexport) dllStopPlugin()
|
---|
96 | {
|
---|
97 | //delete heightmapTerrainPageSource;
|
---|
98 | // BUG: crashes on delete!!!! FIX this
|
---|
99 | delete occlusionCullingFactory;
|
---|
100 | delete kdTreeFactory;
|
---|
101 | delete kdTerrainFactory;
|
---|
102 | delete biTerrainFactory;
|
---|
103 | delete biHierarchyFactory;
|
---|
104 |
|
---|
105 | delete visManager;
|
---|
106 | delete visEnv;
|
---|
107 | }
|
---|
108 |
|
---|
109 |
|
---|
110 |
|
---|
111 | } //namespace Ogre
|
---|