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);
00095         void processVisibleLeaf(BspNode* leaf, Camera* cam);
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);
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         virtual AxisAlignedBoxSceneQuery* 
00159             createAABBQuery(const AxisAlignedBox& box, unsigned long mask = 0xFFFFFFFF);
00172         virtual SphereSceneQuery* 
00173             createSphereQuery(const Sphere& sphere, unsigned long mask = 0xFFFFFFFF);
00186         virtual RaySceneQuery* 
00187             createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
00188         //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
00200         virtual IntersectionSceneQuery* 
00201             createIntersectionQuery(unsigned long mask = 0xFFFFFFFF);
00202 
00203     };
00204 
00206     class BspIntersectionSceneQuery : public DefaultIntersectionSceneQuery
00207     {
00208     public:
00209         BspIntersectionSceneQuery(SceneManager* creator);
00210 
00212         void execute(IntersectionSceneQueryListener* listener);
00213 
00214     };
00215 
00216 }
00217 
00218 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:03 2004