OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreBspNode.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef _BspNode_H__
29 #define _BspNode_H__
30 
31 #include "OgreBspPrerequisites.h"
32 #include "OgrePlane.h"
33 #include "OgreAxisAlignedBox.h"
34 #include "OgreSceneQuery.h"
35 
36 namespace Ogre {
37 
51  class BspNode : public NodeAlloc
52  {
53  friend class BspLevel;
54 
55  public:
57  BspNode(BspLevel* owner, bool isLeaf);
58 
59  BspNode();
60  ~BspNode();
61 
71  bool isLeaf(void) const;
72 
77  BspNode* getFront(void) const;
78 
83  BspNode* getBack(void) const;
84 
89  Plane::Side getSide (const Vector3& point) const;
90 
96  BspNode* getNextNode(const Vector3& point) const;
97 
98 
103  const Plane& getSplitPlane(void) const;
104 
109  const AxisAlignedBox& getBoundingBox(void) const;
110 
114  int getNumFaceGroups(void) const;
124  int getFaceGroupStart(void) const;
125 
132  bool isLeafVisible(const BspNode* leaf) const;
133 
134  friend std::ostream& operator<< (std::ostream& o, BspNode& n);
135 
137  void _addMovable(const MovableObject* mov);
138 
140  void _removeMovable(const MovableObject* mov);
141 
143  Real getDistance(const Vector3& pos) const;
144 
146 
147  struct Brush
148  {
150  SceneQuery::WorldFragment fragment; // For query reporting
151  };
152  typedef vector<Brush*>::type NodeBrushList; // Main brush memory held on level
153 
157  const NodeBrushList& getSolidBrushes(void) const;
158  protected:
159  BspLevel* mOwner; // Back-reference to containing level
160  bool mIsLeaf;
161 
162  // Node-only members
172 
173  // Leaf-only members
186 
199 
201 
203  public:
204  const IntersectingObjectSet& getObjects(void) const { return mMovables; }
205 
206 
207  };
208 
209 
210 }
211 
212 #endif
Represents part of the world geometry that is a result of a SceneQuery.
bool isLeaf(void) const
Returns true if this node is a leaf (i.e.
float Real
Software floating point type.
Plane mSplitPlane
The plane which splits space in a non-leaf node.
Definition: OgreBspNode.h:167
int mFaceGroupStart
Index to the part of the main leaf facegroup index buffer(held in BspLevel) for this leaf...
Definition: OgreBspNode.h:198
int mVisCluster
The cluster number of this leaf.
Definition: OgreBspNode.h:185
Defines a plane in 3D space.
Definition: OgrePlane.h:61
const AxisAlignedBox & getBoundingBox(void) const
Returns the axis-aligned box which contains this node if it is a leaf.
BspLevel * mOwner
Definition: OgreBspNode.h:159
bool isLeafVisible(const BspNode *leaf) const
Determines if the passed in node (must also be a leaf) is visible from this leaf. ...
BspNode * mFront
Pointer to the node in front of this non-leaf node.
Definition: OgreBspNode.h:169
A 3D box aligned with the x/y/z axes.
BspNode * mBack
Pointer to the node behind this non-leaf node.
Definition: OgreBspNode.h:171
std::list< T, A > type
const IntersectingObjectSet & getObjects(void) const
Definition: OgreBspNode.h:204
Abstract class defining a movable object in a scene.
Real getDistance(const Vector3 &pos) const
Gets the signed distance to the dividing plane.
AxisAlignedBox mBounds
The axis-aligned box which bounds node if it is a leaf.
Definition: OgreBspNode.h:188
friend std::ostream & operator<<(std::ostream &o, BspNode &n)
set< const MovableObject * >::type IntersectingObjectSet
Definition: OgreBspNode.h:145
Side
The "positive side" of the plane is the half space to which the plane normal points.
Definition: OgrePlane.h:80
Plane::Side getSide(const Vector3 &point) const
Determines which side of the splitting plane a worldspace point is.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
int mNumFaceGroups
Number of face groups in this node if it is a leaf.
Definition: OgreBspNode.h:190
BspNode * getBack(void) const
Returns a pointer to a BspNode containing the subspace on the negative side of the splitting plane...
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
int getNumFaceGroups(void) const
Returns the number of faces contained in this leaf node.
Holds all the data associated with a Binary Space Parition (BSP) based indoor level.
Definition: OgreBspLevel.h:56
NodeBrushList mSolidBrushes
Definition: OgreBspNode.h:202
BspNode * getFront(void) const
Returns a pointer to a BspNode containing the subspace on the positive side of the splitting plane...
BspNode * getNextNode(const Vector3 &point) const
Gets the next node down in the tree, with the intention of locating the leaf containing the given poi...
void _removeMovable(const MovableObject *mov)
Internal method for telling the node that a movable no longer intersects it.
const NodeBrushList & getSolidBrushes(void) const
Get the list of solid Brushes for this node.
void _addMovable(const MovableObject *mov)
Internal method for telling the node that a movable intersects it.
SceneQuery::WorldFragment fragment
Definition: OgreBspNode.h:150
const Plane & getSplitPlane(void) const
Returns details of the plane which is used to subdivide the space of his node's children.
Encapsulates a node in a BSP tree.
Definition: OgreBspNode.h:51
vector< Brush * >::type NodeBrushList
Definition: OgreBspNode.h:152
IntersectingObjectSet mMovables
Definition: OgreBspNode.h:200
int getFaceGroupStart(void) const
Returns the index to the face group index list for this leaf node.
list< Plane >::type planes
Definition: OgreBspNode.h:149