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

# OgreBspNode.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://www.ogre3d.org/
    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 _BspNode_H__
    00026 #define _BspNode_H__
    00027
    00028 #include "OgreBspPrerequisites.h"
    00029 #include "OgrePlane.h"
    00030 #include "OgreAxisAlignedBox.h"
    00031 #include "OgreSceneQuery.h"
    00032
    00033 namespace Ogre {
    00034
    00048     class BspNode
    00049     {
    00050         friend class BspLevel;
    00051
    00052     public:
    00054         BspNode(BspLevel* owner, bool isLeaf);
    00055
    00056         BspNode();
    00057         ~BspNode();
    00058
    00068         bool isLeaf(void) const;
    00069
    00074         BspNode* getFront(void) const;
    00075
    00080         BspNode* getBack(void) const;
    00081
    00086         Plane::Side getSide (const Vector3& point) const;
    00087
    00093         BspNode* getNextNode(const Vector3& point) const;
    00094
    00095
    00100         Plane getSplitPlane(void);
    00101
    00106         AxisAlignedBox& getBoundingBox(void);
    00107
    00111         int getNumFaceGroups(void);
    00121         int getFaceGroupStart(void);
    00122
    00129         bool isLeafVisible(const BspNode* leaf);
    00130
    00131         friend std::ostream& operator<< (std::ostream& o, BspNode& n);
    00132
    00134         void _addMovable(const MovableObject* mov);
    00135
    00137         void _removeMovable(const MovableObject* mov);
    00138
    00140         Real getDistance(const Vector3& pos);
    00141
    00142         typedef std::set<const MovableObject*> IntersectingObjectSet;
    00143
    00144         struct Brush
    00145         {
    00146             std::list<Plane> planes;
    00147             SceneQuery::WorldFragment fragment; // For query reporting
    00148         };
    00149         typedef std::vector<Brush*> NodeBrushList; // Main brush memory held on level
    00150
    00154         const NodeBrushList& getSolidBrushes(void);
    00155     protected:
    00156         BspLevel* mOwner; // Back-reference to containing level
    00157         bool mIsLeaf;
    00158
    00159         // Node-only members
    00164         Plane mSplitPlane;
    00166         BspNode* mFront;
    00168         BspNode* mBack;
    00169
    00170         // Leaf-only members
    00182         int mVisCluster;
    00183
    00185         AxisAlignedBox mBounds;
    00187         int mNumFaceGroups;
    00195         int mFaceGroupStart;
    00196
    00197         IntersectingObjectSet mMovables;
    00198
    00199         NodeBrushList mSolidBrushes;
    00200     public:
    00201         const IntersectingObjectSet& getObjects(void) { return mMovables; }
    00202
    00203
    00204     };
    00205
    00206
    00207 }
    00208
    00209 #endif

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