Coverage Report

Created: 2025-07-11 06:36

/src/ogre/PlugIns/OctreeSceneManager/include/OgreOctreeNode.h
Line
Count
Source (jump to first uncovered line)
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
*/
28
/***************************************************************************
29
octreenode.h  -  description
30
-------------------
31
begin                : Fri Sep 27 2002
32
copyright            : (C) 2002 by Jon Anderson
33
email                : janders@users.sf.net
34
35
***************************************************************************/
36
37
#ifndef OCTREENODE_H
38
#define OCTREENODE_H
39
40
#include "OgreSceneNode.h"
41
42
#include "OgreOctreePrerequisites.h"
43
#include "OgreOctree.h"
44
45
namespace Ogre
46
{
47
/** \addtogroup Plugins Plugins
48
*  @{
49
*/
50
/** \addtogroup Octree OctreeSceneManager
51
* Octree datastructure for managing scene nodes.
52
*  @{
53
*/
54
/** Specialized SceneNode that is customized for working within an Octree. Each node
55
* maintains its own bounding box, rather than merging it with all the children.
56
*
57
*/
58
59
class _OgreOctreePluginExport OctreeNode : public SceneNode
60
{
61
public:
62
    /** Standard constructor */
63
    OctreeNode( SceneManager* creator );
64
    /** Standard constructor */
65
    OctreeNode( SceneManager* creator, const String& name );
66
    /** Standard destructor */
67
    ~OctreeNode();
68
69
    /** Overridden from Node to remove any reference to octants */
70
    Node * removeChild( unsigned short index ) override;
71
    
72
    /** Overridden from Node to remove any reference to octants */
73
    Node * removeChild( const String & name ) override;
74
75
    /** Overridden from Node to remove any reference to octants */
76
    Node * removeChild( Node* child) override;
77
78
    /** Overridden from Node to remove any reference to octants */
79
    void removeAllChildren(void) override;
80
81
    /** Returns the Octree in which this OctreeNode resides
82
    */
83
    Octree * getOctant()
84
0
    {
85
0
        return mOctant;
86
0
    };
87
88
    /** Sets the Octree in which this OctreeNode resides
89
    */
90
    void setOctant( Octree *o )
91
0
    {
92
0
        mOctant = o;
93
0
    };
94
95
    /** Determines if the center of this node is within the given box
96
    */
97
    bool _isIn( AxisAlignedBox &box );
98
99
    /** Adds all the attached scenenodes to the render queue
100
    */
101
    virtual void _addToRenderQueue( Camera* cam, RenderQueue * q, bool onlyShadowCasters, 
102
        VisibleObjectsBoundsInfo* visibleBounds);
103
104
    /** Sets up the LegacyRenderOperation for rendering this scene node as geometry.
105
106
    This will render the scenenode as a bounding box.
107
    */
108
    virtual void getRenderOperation( RenderOperation& op );
109
110
    /** Returns the local bounding box of this OctreeNode.
111
112
    This is used to render the bounding box, rather then the global.
113
    */
114
    AxisAlignedBox & _getLocalAABB()
115
0
    {
116
0
        return mLocalAABB;
117
0
    };
118
119
120
121
122
protected:
123
124
    /** Internal method for updating the bounds for this OctreeNode.
125
126
    This method determines the bounds solely from the attached objects, not
127
    any children. If the node has changed its bounds, it is removed from its
128
    current octree, and reinserted into the tree.
129
    */
130
    void _updateBounds( void ) override;
131
132
    void _removeNodeAndChildren( );
133
134
    /// Local bounding box
135
    AxisAlignedBox mLocalAABB;
136
137
    ///Octree this node is attached to.
138
    Octree *mOctant;
139
140
    /// Preallocated corners for rendering
141
    Real mCorners[ 24 ];
142
    /// Shared colors for rendering
143
    static unsigned long mColors[ 8 ];
144
    /// Shared indexes for rendering
145
    static unsigned short mIndexes[ 24 ];
146
147
148
};
149
/** @} */
150
/** @} */
151
}
152
153
154
#endif