# 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 (c) 2000-2005 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         const Plane& getSplitPlane(void) const;
    00101
    00106         const AxisAlignedBox& getBoundingBox(void) const;
    00107
    00111         int getNumFaceGroups(void) const;
    00121         int getFaceGroupStart(void) const;
    00122
    00129         bool isLeafVisible(const BspNode* leaf) const;
    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) const;
    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) const;
    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) const { return mMovables; }
    00202
    00203
    00204     };
    00205
    00206
    00207 }
    00208
    00209 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:42 2006