Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/PlugIns/OctreeSceneManager/include/OgreOctreeNode.h @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 4.4 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29/***************************************************************************
30octreenode.h  -  description
31-------------------
32begin                : Fri Sep 27 2002
33copyright            : (C) 2002 by Jon Anderson
34email                : janders@users.sf.net
35
36Enhancements 2003 - 2004 (C) The OGRE Team
37***************************************************************************/
38
39#ifndef OCTREENODE_H
40#define OCTREENODE_H
41
42#include <OgreSceneNode.h>
43
44#include <OgreOctreeSceneManager.h>
45#include "OgreTerrainPrerequisites.h"
46
47namespace Ogre
48{
49
50/** Specialized SceneNode that is customized for working within an Octree. Each node
51* maintains its own bounding box, rather than merging it with all the children.
52*
53*/
54
55class _OgreOctreePluginExport OctreeNode : public SceneNode
56{
57public:
58    /** Standard constructor */
59    OctreeNode( SceneManager* creator );
60    /** Standard constructor */
61    OctreeNode( SceneManager* creator, const String& name );
62    /** Standard destructor */
63    ~OctreeNode();
64
65    /** Overridden from Node to remove any reference to octants */
66    Node * removeChild( unsigned short index );
67   
68    /** Overridden from Node to remove any reference to octants */
69    Node * removeChild( const String & name );
70
71    /** Overridden from Node to remove any reference to octants */
72    Node * removeChild( Node* child);
73
74        /** Overridden from Node to remove any reference to octants */
75        void removeAllChildren(void);
76
77    /** Returns the Octree in which this OctreeNode resides
78    */
79    Octree * getOctant()
80    {
81        return mOctant;
82    };
83
84    /** Sets the Octree in which this OctreeNode resides
85    */
86    void setOctant( Octree *o )
87    {
88        mOctant = o;
89    };
90
91    /** Determines if the center of this node is within the given box
92    */
93    bool _isIn( AxisAlignedBox &box );
94
95    /** Adds all the attached scenenodes to the render queue
96    */
97    virtual void _addToRenderQueue( Camera* cam, RenderQueue * q, bool onlyShadowCasters, 
98                VisibleObjectsBoundsInfo* visibleBounds);
99
100    /** Sets up the LegacyRenderOperation for rendering this scene node as geometry.
101    @remarks
102    This will render the scenenode as a bounding box.
103    */
104    virtual void getRenderOperation( RenderOperation& op );
105
106    /** Returns the local bounding box of this OctreeNode.
107    @remarks
108    This is used to render the bounding box, rather then the global.
109    */
110    AxisAlignedBox & _getLocalAABB()
111    {
112        return mLocalAABB;
113    };
114
115
116
117
118protected:
119
120    /** Internal method for updating the bounds for this OctreeNode.
121    @remarks
122    This method determines the bounds solely from the attached objects, not
123    any children. If the node has changed its bounds, it is removed from its
124    current octree, and reinserted into the tree.
125    */
126    void _updateBounds( void );
127
128    void _removeNodeAndChildren( );
129
130    ///local bounding box
131    AxisAlignedBox mLocalAABB;
132
133    ///Octree this node is attached to.
134    Octree *mOctant;
135
136    ///preallocated corners for rendering
137    Real mCorners[ 24 ];
138    ///shared colors for rendering
139    static unsigned long mColors[ 8 ];
140    ///shared indexes for rendering
141    static unsigned short mIndexes[ 24 ];
142
143
144};
145
146}
147
148
149#endif
Note: See TracBrowser for help on using the repository browser.