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