Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreBspSceneManager.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://ogre.sourceforge.net/
00006 
00007 Copyright © 2000-2002 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 #ifndef __BspSceneManager_H__
00026 #define __BspSceneManager_H__
00027 
00028 
00029 #include "OgreBspPrerequisites.h"
00030 #include "OgreSceneManager.h"
00031 #include "OgreStaticFaceGroup.h"
00032 #include "OgreRenderOperation.h"
00033 #include <set>
00034 
00035 
00036 namespace Ogre {
00037 
00038     // Forward declaration
00039     class BspIntersectionSceneManager;
00040 
00062     class BspSceneManager : public SceneManager
00063     {
00064         friend class BspIntersectionSceneManager;
00065     protected:
00066 
00067         // Pointer to resource manager just for singleton management
00068         BspResourceManager* mBspResMgr;
00069 
00070         // World geometry
00071         BspLevel* mLevel;
00072 
00073         // State variables for rendering WIP
00074         // Set of face groups (by index) already included
00075         typedef std::set<int> FaceGroupSet;
00076         FaceGroupSet mFaceGroupSet;
00077         // Material -> face group hashmap
00078         typedef std::map<Material*, std::vector<StaticFaceGroup*>, materialLess > MaterialFaceGroupMap;
00079         MaterialFaceGroupMap mMatFaceGroupMap;
00080 
00081         RenderOperation mRenderOp;
00082 
00083         // Debugging features
00084         bool mShowNodeAABs;
00085         RenderOperation mAABGeometry;
00086 
00093         BspNode* walkTree(Camera* camera, bool onlyShadowCasters);
00095         void processVisibleLeaf(BspNode* leaf, Camera* cam, bool onlyShadowCasters);
00096 
00098         unsigned int cacheGeometry(unsigned int* pIndexes, const StaticFaceGroup* faceGroup);
00099 
00101         void freeMemory(void);
00102 
00104         void addBoundingBox(AxisAlignedBox& aab, bool visible);
00105 
00107         void renderStaticGeometry(void);
00108 
00109 
00110         typedef std::set<const MovableObject*> MovablesForRendering;
00111         MovablesForRendering mMovablesForRendering;
00112 
00113     public:
00114         BspSceneManager();
00115         ~BspSceneManager();
00116 
00118         void setWorldGeometry(const String& filename);
00119 
00123         void showNodeBoxes(bool show);
00124 
00126         ViewPoint getSuggestedViewpoint(bool random = false);
00127 
00128         BspLevel* getLevel(void) {return mLevel; }
00129 
00131         void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
00132 
00134         void _renderVisibleObjects(void);
00135 
00137         SceneNode * createSceneNode ( void );
00139         SceneNode * createSceneNode ( const String &name );
00140 
00142         void _notifyObjectMoved(const MovableObject* mov, const Vector3& pos);
00144         void _notifyObjectDetached(const MovableObject* mov);
00145 
00158         /*
00159         virtual AxisAlignedBoxSceneQuery* 
00160             createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
00161         */
00174         /*
00175         virtual SphereSceneQuery* 
00176             createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
00177         */
00190         /*
00191         virtual RaySceneQuery* 
00192             createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
00193         */
00205         virtual IntersectionSceneQuery* 
00206             createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
00207 
00208     };
00209 
00211     class BspIntersectionSceneQuery : public DefaultIntersectionSceneQuery
00212     {
00213     public:
00214         BspIntersectionSceneQuery(SceneManager* creator);
00215 
00217         void execute(IntersectionSceneQueryListener* listener);
00218 
00219     };
00220 
00221 }
00222 
00223 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:16 2004