/usr/include/OGRE/Plugins/OctreeSceneManager/OgreOctreeSceneManager.h is in libogre-dev 1.7.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | /***************************************************************************
octreescenemanager.h - description
-------------------
begin : Fri Sep 27 2002
copyright : (C) 2002 by Jon Anderson
email : janders@users.sf.net
***************************************************************************/
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2011 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef OCTREESCENEMANAGER_H
#define OCTREESCENEMANAGER_H
#include "OgreTerrainPrerequisites.h"
#include "OgreSceneManager.h"
#include "OgreRenderOperation.h"
#include "OgreSphere.h"
#include <list>
#include <algorithm>
#include "OgreOctree.h"
namespace Ogre
{
class OctreeNode;
class OctreeCamera;
class OctreeIntersectionSceneQuery;
class OctreeRaySceneQuery;
class OctreeSphereSceneQuery;
class OctreeAxisAlignedBoxSceneQuery;
class OctreePlaneBoundedVolumeListSceneQuery;
typedef list< WireBoundingBox * >::type BoxList;
typedef list< unsigned long >::type ColorList;
//typedef list< SceneNode * >::type SceneNodeList;
/** Specialized SceneManager that divides the geometry into an octree in order to facilitate spatial queries.
@remarks
*/
class _OgreOctreePluginExport OctreeSceneManager : public SceneManager
{
friend class OctreeIntersectionSceneQuery;
friend class OctreeRaySceneQuery;
friend class OctreeSphereSceneQuery;
friend class OctreeAxisAlignedBoxSceneQuery;
friend class OctreePlaneBoundedVolumeListSceneQuery;
public:
static int intersect_call;
/** Standard Constructor. Initializes the octree to -10000,-10000,-10000 to 10000,10000,10000 with a depth of 8. */
OctreeSceneManager(const String& name);
/** Standard Constructor */
OctreeSceneManager(const String& name, AxisAlignedBox &box, int max_depth );
/** Standard destructor */
~OctreeSceneManager();
/// @copydoc SceneManager::getTypeName
const String& getTypeName(void) const;
/** Initializes the manager to the given box and depth.
*/
void init( AxisAlignedBox &box, int d );
/** Creates a specialized OctreeNode */
virtual SceneNode * createSceneNodeImpl ( void );
/** Creates a specialized OctreeNode */
virtual SceneNode * createSceneNodeImpl ( const String &name );
/** Creates a specialized OctreeCamera */
virtual Camera * createCamera( const String &name );
/** Deletes a scene node */
virtual void destroySceneNode( const String &name );
/** Does nothing more */
virtual void _updateSceneGraph( Camera * cam );
/** Recurses through the octree determining which nodes are visible. */
virtual void _findVisibleObjects ( Camera * cam,
VisibleObjectsBoundsInfo* visibleBounds, bool onlyShadowCasters );
/** Alerts each unculled object, notifying it that it will be drawn.
* Useful for doing calculations only on nodes that will be drawn, prior
* to drawing them...
*/
virtual void _alertVisibleObjects( void );
/** Walks through the octree, adding any visible objects to the render queue.
@remarks
If any octant in the octree if completely within the view frustum,
all subchildren are automatically added with no visibility tests.
*/
void walkOctree( OctreeCamera *, RenderQueue *, Octree *,
VisibleObjectsBoundsInfo* visibleBounds, bool foundvisible,
bool onlyShadowCasters);
/** Checks the given OctreeNode, and determines if it needs to be moved
* to a different octant.
*/
void _updateOctreeNode( OctreeNode * );
/** Removes the given octree node */
void _removeOctreeNode( OctreeNode * );
/** Adds the Octree Node, starting at the given octree, and recursing at max to the specified depth.
*/
void _addOctreeNode( OctreeNode *, Octree *octree, int depth = 0 );
/** Recurses the octree, adding any nodes intersecting with the box into the given list.
It ignores the exclude scene node.
*/
void findNodesIn( const AxisAlignedBox &box, list< SceneNode * >::type &list, SceneNode *exclude = 0 );
/** Recurses the octree, adding any nodes intersecting with the sphere into the given list.
It ignores the exclude scene node.
*/
void findNodesIn( const Sphere &sphere, list< SceneNode * >::type &list, SceneNode *exclude = 0 );
/** Recurses the octree, adding any nodes intersecting with the volume into the given list.
It ignores the exclude scene node.
*/
void findNodesIn( const PlaneBoundedVolume &volume, list< SceneNode * >::type &list, SceneNode *exclude=0 );
/** Recurses the octree, adding any nodes intersecting with the ray into the given list.
It ignores the exclude scene node.
*/
void findNodesIn( const Ray &ray, list< SceneNode * >::type &list, SceneNode *exclude=0 );
/** Sets the box visibility flag */
void setShowBoxes( bool b )
{
mShowBoxes = b;
};
void setLooseOctree( bool b )
{
mLoose = b;
};
/** Resizes the octree to the given size */
void resize( const AxisAlignedBox &box );
/** Sets the given option for the SceneManager
@remarks
Options are:
"Size", AxisAlignedBox *;
"Depth", int *;
"ShowOctree", bool *;
*/
virtual bool setOption( const String &, const void * );
/** Gets the given option for the Scene Manager.
@remarks
See setOption
*/
virtual bool getOption( const String &, void * );
bool getOptionValues( const String & key, StringVector &refValueList );
bool getOptionKeys( StringVector &refKeys );
/** Overridden from SceneManager */
void clearScene(void);
AxisAlignedBoxSceneQuery* createAABBQuery(const AxisAlignedBox& box, unsigned long mask);
SphereSceneQuery* createSphereQuery(const Sphere& sphere, unsigned long mask);
PlaneBoundedVolumeListSceneQuery* createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask);
RaySceneQuery* createRayQuery(const Ray& ray, unsigned long mask);
IntersectionSceneQuery* createIntersectionQuery(unsigned long mask);
protected:
Octree::NodeList mVisible;
/// The root octree
Octree *mOctree;
/// List of boxes to be rendered
BoxList mBoxes;
/// Number of rendered objs
int mNumObjects;
/// Max depth for the tree
int mMaxDepth;
/// Size of the octree
AxisAlignedBox mBox;
/// Boxes visibility flag
bool mShowBoxes;
bool mLoose;
Real mCorners[ 24 ];
static unsigned long mColors[ 8 ];
static unsigned short mIndexes[ 24 ];
Matrix4 mScaleFactor;
};
/// Factory for OctreeSceneManager
class OctreeSceneManagerFactory : public SceneManagerFactory
{
protected:
void initMetaData(void) const;
public:
OctreeSceneManagerFactory() {}
~OctreeSceneManagerFactory() {}
/// Factory type name
static const String FACTORY_TYPE_NAME;
SceneManager* createInstance(const String& instanceName);
void destroyInstance(SceneManager* instance);
};
}
#endif
|