OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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-2014 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 {
51  class OctreeZoneData;
52 
54  {
55  public:
56  OctreeZone( PCZSceneManager *, const String& );
57  virtual ~OctreeZone();
58 
61  virtual void setEnclosureNode(PCZSceneNode *);
62 
68  virtual void _addNode( PCZSceneNode * );
69 
72  virtual void removeNode( PCZSceneNode * );
73 
76  virtual void _clearNodeLists(short nodeListTypes);
77 
81  virtual bool requiresZoneSpecificNodeData(void);
82 
85  virtual void createNodeZoneData(PCZSceneNode *);
86 
89  virtual void _checkNodeAgainstPortals(PCZSceneNode *, Portal * );
90 
93  virtual void _checkLightAgainstPortals(PCZLight *,
94  unsigned long,
95  PCZFrustum *,
96  Portal*);
97 
100  void updatePortalsZoneData(void);
101 
103  void dirtyNodeByMovingPortals(void);
104 
106  virtual PCZone * updateNodeHomeZone(PCZSceneNode * pczsn, bool allowBackTouces);
107 
113  virtual void findVisibleNodes(PCZCamera *,
114  NodeList & visibleNodeList,
115  RenderQueue * queue,
116  VisibleObjectsBoundsInfo* visibleBounds,
117  bool onlyShadowCasters,
118  bool displayNodes,
119  bool showBoundingBoxes);
120 
122  virtual void _findNodes(const AxisAlignedBox &t,
124  PortalList &visitedPortals,
125  bool includeVisitors,
126  bool recurseThruPortals,
127  PCZSceneNode *exclude);
128  virtual void _findNodes(const Sphere &t,
129  PCZSceneNodeList &list,
130  PortalList &visitedPortals,
131  bool includeVisitors,
132  bool recurseThruPortals,
133  PCZSceneNode *exclude );
134  virtual void _findNodes(const PlaneBoundedVolume &t,
135  PCZSceneNodeList &list,
136  PortalList &visitedPortals,
137  bool includeVisitors,
138  bool recurseThruPortals,
139  PCZSceneNode *exclude );
140  virtual void _findNodes(const Ray &t,
141  PCZSceneNodeList &list,
142  PortalList &visitedPortals,
143  bool includeVisitors,
144  bool recurseThruPortals,
145  PCZSceneNode *exclude );
146 
154  virtual bool setOption( const String &, const void * );
155 
159  virtual void notifyCameraCreated( Camera* c );
160 
162  virtual void notifyWorldGeometryRenderQueue(uint8 qid);
163 
165  virtual void notifyBeginRenderScene(void);
166 
168  virtual void setZoneGeometry(const String &filename, PCZSceneNode * parentNode);
169 
171  virtual void getAABB(AxisAlignedBox &);
172 
174  void init(AxisAlignedBox &box, int depth);
176  void resize( const AxisAlignedBox &box );
180  void updateNodeOctant( OctreeZoneData * zoneData );
182  void removeNodeFromOctree( PCZSceneNode * );
185  void addNodeToOctree( PCZSceneNode *, Octree *octree, int depth = 0 );
186 
187 
188  protected:
194  void walkOctree( PCZCamera *,
195  NodeList &,
196  RenderQueue *,
197  Octree *,
198  VisibleObjectsBoundsInfo* visibleBounds,
199  bool foundvisible,
200  bool onlyShadowCasters,
201  bool displayNodes,
202  bool showBoundingBoxes);
203 
204  protected:
211 
212  bool mLoose;
213 
214  };
215 
217  {
218  public:
222  ~OctreeZoneData();
224  void update(void);
225 
229  {
230  return mOctant;
231  };
234  void setOctant( Octree *o )
235  {
236  mOctant = o;
237  };
238  bool _isIn( AxisAlignedBox &box );
239 
240  public:
245  };
246 
249  {
250  public:
252  virtual ~OctreeZoneFactory();
253 
254  bool supportsPCZoneType(const String& zoneType);
255  PCZone* createPCZone(PCZSceneManager * pczsm, const String& zoneName);
256  };
257 
258 }
259 
260 #endif
261 
262 
263 
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:346
bool supportsPCZoneType(const String &zoneType)
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
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
Octree-specific world bounding box (only includes attached objects, not children) ...
#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:51
A sphere primitive, mostly used for bounds checking.
Definition: OgreSphere.h:51
Octree datastructure for managing scene nodes.
Definition: OgreOctree.h:58
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:81
_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:54