OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreOctreeZone.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 OctreeZone.h - Portal Connected Zone (OctreeZone) header file.
28 
29 OctreeZones are a type of PCZone. Octree Zones partition their space into
30 Octants. For details on Zones in general, see PCZone.h/cpp.
31 -----------------------------------------------------------------------------
32 begin : Mon Apr 16 2007
33 author : Eric Cha
34 email : ericc@xenopi.com
35 Code Style Update :
36 -----------------------------------------------------------------------------
37 */
38 
39 #ifndef OCTREEZONE_H
40 #define OCTREEZONE_H
41 
43 #include "OgrePCZone.h"
44 #include "OgrePCZoneFactory.h"
45 #include "OgreOctreeZoneOctree.h"
46 
47 namespace Ogre
48 {
52  class OctreeZoneData;
53 
55  {
56  public:
57  OctreeZone( PCZSceneManager *, const String& );
58  virtual ~OctreeZone();
59 
62  virtual void setEnclosureNode(PCZSceneNode *);
63 
69  virtual void _addNode( PCZSceneNode * );
70 
73  virtual void removeNode( PCZSceneNode * );
74 
77  virtual void _clearNodeLists(short nodeListTypes);
78 
82  virtual bool requiresZoneSpecificNodeData(void);
83 
86  virtual void createNodeZoneData(PCZSceneNode *);
87 
90  virtual void _checkNodeAgainstPortals(PCZSceneNode *, Portal * );
91 
94  virtual void _checkLightAgainstPortals(PCZLight *,
95  unsigned long,
96  PCZFrustum *,
97  Portal*);
98 
99  /* Update the zone data for each portal
100  */
101  void updatePortalsZoneData(void);
102 
104  void dirtyNodeByMovingPortals(void);
105 
106  /* Update a node's home zone */
107  virtual PCZone * updateNodeHomeZone(PCZSceneNode * pczsn, bool allowBackTouces);
108 
114  virtual void findVisibleNodes(PCZCamera *,
115  NodeList & visibleNodeList,
116  RenderQueue * queue,
117  VisibleObjectsBoundsInfo* visibleBounds,
118  bool onlyShadowCasters,
119  bool displayNodes,
120  bool showBoundingBoxes);
121 
122  /* Functions for finding Nodes that intersect various shapes */
123  virtual void _findNodes(const AxisAlignedBox &t,
125  PortalList &visitedPortals,
126  bool includeVisitors,
127  bool recurseThruPortals,
128  PCZSceneNode *exclude);
129  virtual void _findNodes(const Sphere &t,
130  PCZSceneNodeList &list,
131  PortalList &visitedPortals,
132  bool includeVisitors,
133  bool recurseThruPortals,
134  PCZSceneNode *exclude );
135  virtual void _findNodes(const PlaneBoundedVolume &t,
136  PCZSceneNodeList &list,
137  PortalList &visitedPortals,
138  bool includeVisitors,
139  bool recurseThruPortals,
140  PCZSceneNode *exclude );
141  virtual void _findNodes(const Ray &t,
142  PCZSceneNodeList &list,
143  PortalList &visitedPortals,
144  bool includeVisitors,
145  bool recurseThruPortals,
146  PCZSceneNode *exclude );
147 
155  virtual bool setOption( const String &, const void * );
156 
160  virtual void notifyCameraCreated( Camera* c );
161 
162  /* called by PCZSM during setWorldGeometryRenderQueue() */
163  virtual void notifyWorldGeometryRenderQueue(uint8 qid);
164 
165  /* Called when a _renderScene is called in the SceneManager */
166  virtual void notifyBeginRenderScene(void);
167 
168  /* called by PCZSM during setZoneGeometry() */
169  virtual void setZoneGeometry(const String &filename, PCZSceneNode * parentNode);
170 
171  /* get the world coordinate aabb of the zone */
172  virtual void getAABB(AxisAlignedBox &);
173 
174  // Init function carried over from OctreeSceneManager
175  void init(AxisAlignedBox &box, int depth);
177  void resize( const AxisAlignedBox &box );
181  void updateNodeOctant( OctreeZoneData * zoneData );
183  void removeNodeFromOctree( PCZSceneNode * );
186  void addNodeToOctree( PCZSceneNode *, Octree *octree, int depth = 0 );
187 
188 
189  protected:
195  void walkOctree( PCZCamera *,
196  NodeList &,
197  RenderQueue *,
198  Octree *,
199  VisibleObjectsBoundsInfo* visibleBounds,
200  bool foundvisible,
201  bool onlyShadowCasters,
202  bool displayNodes,
203  bool showBoundingBoxes);
204 
205  protected:
212 
213  bool mLoose;
214 
215  };
216 
218  {
219  public:
223  ~OctreeZoneData();
225  void update(void);
226 
230  {
231  return mOctant;
232  };
235  void setOctant( Octree *o )
236  {
237  mOctant = o;
238  };
239  bool _isIn( AxisAlignedBox &box );
240 
241  public:
244  // octree-specific world bounding box (only includes attached objects, not children)
246  };
247 
250  {
251  public:
253  virtual ~OctreeZoneFactory();
254 
255  bool supportsPCZoneType(const String& zoneType);
256  PCZone* createPCZone(PCZSceneManager * pczsm, const String& zoneName);
257  };
258 
259 }
260 
261 #endif
262 
263 
264 
vector< SceneNode * >::type NodeList
Definition: OgrePCZone.h:74
Representation of a ray in space, i.e.
Definition: OgreRay.h:46
unsigned char uint8
Definition: OgrePlatform.h:248
bool supportsPCZoneType(const String &zoneType)
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:85
Factory for PCZones.
set< PCZSceneNode * >::type PCZSceneNodeList
Specialized frustum shaped culling volume that has culling planes created from portals.
AxisAlignedBox mBox
Size of the octree.
A 3D box aligned with the x/y/z axes.
AxisAlignedBox mOctreeWorldAABB
#define _OgreOctreeZonePluginExport
Portal datastructure for connecting zones.
Definition: OgrePortal.h:51
Octree * getOctant()
Returns the Octree in which this OctreeNode resides.
Octree * mOctant
Octree this node is attached to.
Specialized version of Ogre::Light which caches which zones the light affects.
Definition: OgrePCZLight.h:52
A sphere primitive, mostly used for bounds checking.
Definition: OgreSphere.h:51
Octree datastructure for managing scene nodes.
Definition: OgreOctree.h:59
Octree * mOctree
The root octree.
Represents a convex volume bounded by planes.
list< Portal * >::type PortalList
Definition: OgrePCZone.h:71
PCZone * createPCZone(PCZSceneManager *pczsm, const String &zoneName)
Class to manage the scene object rendering queue.
Factory for OctreeZone.
Portal-Connected Zone datastructure for managing scene nodes.
Definition: OgrePCZone.h:82
_StringBase String
int mMaxDepth
Max depth for the tree.
Structure collecting together information about the visible objects that have been discovered in a sc...
void setOctant(Octree *o)
Sets the Octree in which this OctreeNode resides.
Specialized SceneManager that uses Portal-Connected-Zones to divide the scene spatially.
Specialized viewpoint from which an PCZone Scene can be rendered.
Definition: OgrePCZCamera.h:56