source: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilitySceneManagerDll.cpp @ 2353

Revision 2353, 4.2 KB checked in by mattausch, 18 years ago (diff)

cleaned up project files

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 © 2000-2002 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
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
41GtpVisibility::VisibilityEnvironment *visEnv;
42GtpVisibility::VisibilityManager *visManager;
43
44namespace Ogre {
45
46
47OcclusionCullingSceneManagerFactory *occlusionCullingFactory;
48KdTreeSceneManagerFactory *kdTreeFactory;
49KdTerrainSceneManagerFactory *kdTerrainFactory;
50BiTerrainSceneManagerFactory *biTerrainFactory;
51BiHierarchySceneManagerFactory *biHierarchyFactory;
52
53//-----------------------------------------------------------------------
54extern "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//-----------------------------------------------------------------------
81extern "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//-----------------------------------------------------------------------
95extern "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
Note: See TracBrowser for help on using the repository browser.