Coverage Report

Created: 2025-08-25 06:48

/src/ogre/OgreMain/include/OgreNode.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
#ifndef _Node_H__
29
#define _Node_H__
30
31
#include "OgrePrerequisites.h"
32
33
#include "OgreMatrix4.h"
34
#include "OgreUserObjectBindings.h"
35
#include "OgreHeaderPrefix.h"
36
37
namespace Ogre {
38
    template <typename T> class VectorIterator;
39
    template <typename T> class ConstVectorIterator;
40
41
    /** \addtogroup Core
42
    *  @{
43
    */
44
    /** \addtogroup Scene
45
    *  @{
46
    */
47
    /** Class representing a general-purpose node an articulated scene graph.
48
49
        A node in the scene graph is a node in a structured tree. A node contains
50
        information about the transformation which will apply to
51
        it and all of it's children. Child nodes can have transforms of their own, which
52
        are combined with their parent's transformations.
53
    @par
54
        This is an abstract class - concrete classes are based on this for specific purposes,
55
        e.g. SceneNode, Bone
56
    */
57
    class _OgreExport Node : public NodeAlloc
58
    {
59
    public:
60
        /** Enumeration denoting the spaces which a transform can be relative to.
61
        */
62
        enum TransformSpace
63
        {
64
            /// Transform is relative to the local space
65
            TS_LOCAL,
66
            /// Transform is relative to the space of the parent node
67
            TS_PARENT,
68
            /// Transform is relative to world space
69
            TS_WORLD
70
        };
71
        typedef std::vector<Node*> ChildNodeMap;
72
        typedef VectorIterator<ChildNodeMap> ChildNodeIterator;
73
        typedef ConstVectorIterator<ChildNodeMap> ConstChildNodeIterator;
74
75
        /** Listener which gets called back on Node events.
76
        */
77
        class _OgreExport Listener
78
        {
79
        public:
80
0
            Listener() {}
81
0
            virtual ~Listener() {}
82
            /** Called when a node gets updated.
83
84
                Note that this happens when the node's derived update happens,
85
                not every time a method altering it's state occurs. There may 
86
                be several state-changing calls but only one of these calls, 
87
                when the node graph is fully updated.
88
            */
89
0
            virtual void nodeUpdated(const Node*) {}
90
            /** Node is being destroyed */
91
0
            virtual void nodeDestroyed(const Node*) {}
92
            /** Node has been attached to a parent */
93
0
            virtual void nodeAttached(const Node*) {}
94
            /** Node has been detached from a parent */
95
0
            virtual void nodeDetached(const Node*) {}
96
        };
97
98
    protected:
99
        /// Pointer to parent node
100
        Node* mParent;
101
        /// Collection of pointers to direct children
102
        ChildNodeMap mChildren;
103
104
        typedef std::set<Node*> ChildUpdateSet;
105
        /// List of children which need updating, used if self is not out of date but children are
106
        ChildUpdateSet mChildrenToUpdate;
107
        /// Friendly name of this node
108
        String mName;
109
110
        /// Flag to indicate own transform from parent is out of date
111
        mutable bool mNeedParentUpdate : 1;
112
        /// Flag indicating that all children need to be updated
113
        bool mNeedChildUpdate : 1;
114
        /// Flag indicating that parent has been notified about update request
115
        bool mParentNotified : 1;
116
        /// Flag indicating that the node has been queued for update
117
        bool mQueuedForUpdate : 1;
118
        /// Stores whether this node inherits orientation from it's parent
119
        bool mInheritOrientation : 1;
120
        /// Stores whether this node inherits scale from it's parent
121
        bool mInheritScale : 1;
122
        mutable bool mCachedTransformOutOfDate : 1;
123
124
        /// Stores the orientation of the node relative to it's parent.
125
        Quaternion mOrientation;
126
        /// Stores the position/translation of the node relative to its parent.
127
        Vector3 mPosition;
128
        /// Stores the scaling factor applied to this node
129
        Vector3 mScale;
130
131
        /// Cached derived transform as a 4x4 matrix
132
        mutable Affine3 mCachedTransform;
133
134
        /// Only available internally - notification of parent.
135
        virtual void setParent(Node* parent);
136
137
        /** Cached combined orientation.
138
        @par
139
            This member is the orientation derived by combining the
140
            local transformations and those of it's parents.
141
            This is updated when _updateFromParent is called by the
142
            SceneManager or the nodes parent.
143
        */
144
        mutable Quaternion mDerivedOrientation;
145
146
        /** Cached combined position.
147
        @par
148
            This member is the position derived by combining the
149
            local transformations and those of it's parents.
150
            This is updated when _updateFromParent is called by the
151
            SceneManager or the nodes parent.
152
        */
153
        mutable Vector3 mDerivedPosition;
154
155
        /** Cached combined scale.
156
        @par
157
            This member is the position derived by combining the
158
            local transformations and those of it's parents.
159
            This is updated when _updateFromParent is called by the
160
            SceneManager or the nodes parent.
161
        */
162
        mutable Vector3 mDerivedScale;
163
164
        /** Triggers the node to update it's combined transforms.
165
        @par
166
            This method is called internally by Ogre to ask the node
167
            to update it's complete transformation based on it's parents
168
            derived transform.
169
        */
170
        void _updateFromParent(void) const;
171
172
        /** Class-specific implementation of _updateFromParent.
173
174
            Splitting the implementation of the update away from the update call
175
            itself allows the detail to be overridden without disrupting the 
176
            general sequence of updateFromParent (e.g. raising events)
177
        */
178
        virtual void updateFromParentImpl(void) const;
179
    private:
180
        /// The position to use as a base for keyframe animation
181
        Vector3 mInitialPosition;
182
        /// The orientation to use as a base for keyframe animation
183
        Quaternion mInitialOrientation;
184
        /// The scale to use as a base for keyframe animation
185
        Vector3 mInitialScale;
186
187
        /** Node listener - only one allowed (no list) for size & performance reasons. */
188
        Listener* mListener;
189
190
        /// User objects binding.
191
        UserObjectBindings mUserObjectBindings;
192
193
        typedef std::vector<Node*> QueuedUpdates;
194
        static QueuedUpdates msQueuedUpdates;
195
196
        /** Internal method for creating a new child node - must be overridden per subclass. */
197
        virtual Node* createChildImpl(void) = 0;
198
199
        /** Internal method for creating a new child node - must be overridden per subclass. */
200
        virtual Node* createChildImpl(const String& name) = 0;
201
    public:
202
        /// Constructor, should only be called by parent, not directly.
203
        Node(const String& name = "");
204
205
        virtual ~Node();  
206
207
        /** Returns the name of the node. */
208
0
        const String& getName(void) const { return mName; }
209
210
        /** Gets this node's parent (NULL if this is the root).
211
        */
212
0
        Node* getParent(void) const { return mParent; }
213
214
        /** Returns a quaternion representing the nodes orientation.
215
        */
216
0
        const Quaternion & getOrientation() const { return mOrientation; }
217
218
        /** Sets the orientation of this node via a quaternion.
219
220
            Orientations, unlike other transforms, are not always inherited by child nodes.
221
            Whether or not orientations affect the orientation of the child nodes depends on
222
            the setInheritOrientation option of the child. In some cases you want a orientating
223
            of a parent node to apply to a child node (e.g. where the child node is a part of
224
            the same object, so you want it to be the same relative orientation based on the
225
            parent's orientation), but not in other cases (e.g. where the child node is just
226
            for positioning another object, you want it to maintain it's own orientation).
227
            The default is to inherit as with other transforms.
228
        @par
229
            Note that rotations are oriented around the node's origin.
230
        */
231
        void setOrientation( const Quaternion& q );
232
233
        /// @overload
234
        void setOrientation( Real w, Real x, Real y, Real z);
235
236
        /** Resets the nodes orientation (local axes as world axes, no rotation).
237
238
            Orientations, unlike other transforms, are not always inherited by child nodes.
239
            Whether or not orientations affect the orientation of the child nodes depends on
240
            the setInheritOrientation option of the child. In some cases you want a orientating
241
            of a parent node to apply to a child node (e.g. where the child node is a part of
242
            the same object, so you want it to be the same relative orientation based on the
243
            parent's orientation), but not in other cases (e.g. where the child node is just
244
            for positioning another object, you want it to maintain it's own orientation).
245
            The default is to inherit as with other transforms.
246
        @par
247
            Note that rotations are oriented around the node's origin.
248
        */
249
        void resetOrientation(void);
250
251
        /** Sets the position of the node relative to it's parent.
252
        */
253
        void setPosition(const Vector3& pos);
254
255
        /// @overload
256
0
        void setPosition(Real x, Real y, Real z) { setPosition(Vector3(x, y, z)); }
257
258
        /** Gets the position of the node relative to it's parent.
259
        */
260
0
        const Vector3 & getPosition(void) const { return mPosition; }
261
262
        /** Sets the scaling factor applied to this node.
263
264
            Scaling factors, unlike other transforms, are not always inherited by child nodes.
265
            Whether or not scalings affect the size of the child nodes depends on the setInheritScale
266
            option of the child. In some cases you want a scaling factor of a parent node to apply to
267
            a child node (e.g. where the child node is a part of the same object, so you want it to be
268
            the same relative size based on the parent's size), but not in other cases (e.g. where the
269
            child node is just for positioning another object, you want it to maintain it's own size).
270
            The default is to inherit as with other transforms.
271
        @par
272
            Note that like rotations, scalings are oriented around the node's origin.
273
        */
274
        void setScale(const Vector3& scale);
275
276
        /// @overload
277
0
        void setScale(Real x, Real y, Real z) { setScale(Vector3(x, y, z)); }
278
279
        /** Gets the scaling factor of this node.
280
        */
281
0
        const Vector3& getScale(void) const { return mScale; }
282
283
        /** Tells the node whether it should inherit orientation from it's parent node.
284
285
            Orientations, unlike other transforms, are not always inherited by child nodes.
286
            Whether or not orientations affect the orientation of the child nodes depends on
287
            the setInheritOrientation option of the child. In some cases you want a orientating
288
            of a parent node to apply to a child node (e.g. where the child node is a part of
289
            the same object, so you want it to be the same relative orientation based on the
290
            parent's orientation), but not in other cases (e.g. where the child node is just
291
            for positioning another object, you want it to maintain it's own orientation).
292
            The default is to inherit as with other transforms.
293
        @param inherit If true, this node's orientation will be affected by its parent's orientation.
294
            If false, it will not be affected.
295
        */
296
        void setInheritOrientation(bool inherit);
297
298
        /** Returns true if this node is affected by orientation applied to the parent node. 
299
300
            Orientations, unlike other transforms, are not always inherited by child nodes.
301
            Whether or not orientations affect the orientation of the child nodes depends on
302
            the setInheritOrientation option of the child. In some cases you want a orientating
303
            of a parent node to apply to a child node (e.g. where the child node is a part of
304
            the same object, so you want it to be the same relative orientation based on the
305
            parent's orientation), but not in other cases (e.g. where the child node is just
306
            for positioning another object, you want it to maintain it's own orientation).
307
            The default is to inherit as with other transforms.
308
309
            See setInheritOrientation for more info.
310
        */
311
0
        bool getInheritOrientation(void) const { return mInheritOrientation; }
312
313
        /** Tells the node whether it should inherit scaling factors from it's parent node.
314
315
            Scaling factors, unlike other transforms, are not always inherited by child nodes.
316
            Whether or not scalings affect the size of the child nodes depends on the setInheritScale
317
            option of the child. In some cases you want a scaling factor of a parent node to apply to
318
            a child node (e.g. where the child node is a part of the same object, so you want it to be
319
            the same relative size based on the parent's size), but not in other cases (e.g. where the
320
            child node is just for positioning another object, you want it to maintain it's own size).
321
            The default is to inherit as with other transforms.
322
        @param inherit If true, this node's scale will be affected by its parent's scale. If false,
323
            it will not be affected.
324
        */
325
        void setInheritScale(bool inherit);
326
327
        /** Returns true if this node is affected by scaling factors applied to the parent node. 
328
329
            See setInheritScale for more info.
330
        */
331
0
        bool getInheritScale(void) const { return mInheritScale; }
332
333
        /** Scales the node, combining it's current scale with the passed in scaling factor. 
334
335
            This method applies an extra scaling factor to the node's existing scale, (unlike setScale
336
            which overwrites it) combining it's current scale with the new one. E.g. calling this 
337
            method twice with Vector3(2,2,2) would have the same effect as setScale(Vector3(4,4,4)) if
338
            the existing scale was 1.
339
        @par
340
            Note that like rotations, scalings are oriented around the node's origin.
341
        */
342
        void scale(const Vector3& scale);
343
344
        /// @overload
345
        void scale(Real x, Real y, Real z);
346
347
        /** Moves the node along the Cartesian axes.
348
        @par
349
            This method moves the node by the supplied vector along the
350
            world Cartesian axes, i.e. along world x,y,z
351
        @param d
352
            Vector with x,y,z values representing the translation.
353
        @param relativeTo
354
            The space which this transform is relative to.
355
        */
356
        void translate(const Vector3& d, TransformSpace relativeTo = TS_PARENT);
357
        /// @overload
358
        void translate(Real x, Real y, Real z, TransformSpace relativeTo = TS_PARENT)
359
0
        {
360
0
            translate(Vector3(x, y, z), relativeTo);
361
0
        }
362
        /** Moves the node along arbitrary axes.
363
364
            This method translates the node by a vector which is relative to
365
            a custom set of axes.
366
        @param axes
367
            A 3x3 Matrix containing 3 column vectors each representing the
368
            axes X, Y and Z respectively. In this format the standard cartesian
369
            axes would be expressed as:
370
            <pre>
371
            1 0 0
372
            0 1 0
373
            0 0 1
374
            </pre>
375
            i.e. the identity matrix.
376
        @param move
377
            Vector relative to the axes above.
378
        @param relativeTo
379
            The space which this transform is relative to.
380
        */
381
        void translate(const Matrix3& axes, const Vector3& move, TransformSpace relativeTo = TS_PARENT)
382
0
        {
383
0
            translate(axes * move, relativeTo);
384
0
        }
385
        /// @overload
386
        void translate(const Matrix3& axes, Real x, Real y, Real z, TransformSpace relativeTo = TS_PARENT)
387
0
        {
388
0
            translate(axes, Vector3(x, y, z), relativeTo);
389
0
        }
390
391
        /** Rotate the node around the Z-axis.
392
        */
393
        virtual void roll(const Radian& angle, TransformSpace relativeTo = TS_LOCAL)
394
0
        {
395
0
            rotate(Quaternion(angle, Vector3::UNIT_Z), relativeTo);
396
0
        }
397
398
        /** Rotate the node around the X-axis.
399
        */
400
        virtual void pitch(const Radian& angle, TransformSpace relativeTo = TS_LOCAL)
401
0
        {
402
0
            rotate(Quaternion(angle, Vector3::UNIT_X), relativeTo);
403
0
        }
404
405
        /** Rotate the node around the Y-axis.
406
        */
407
        virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL)
408
0
        {
409
0
            rotate(Quaternion(angle, Vector3::UNIT_Y), relativeTo);
410
0
        }
411
412
        /** Rotate the node around an arbitrary axis.
413
        */
414
        void rotate(const Vector3& axis, const Radian& angle, TransformSpace relativeTo = TS_LOCAL)
415
0
        {
416
0
            rotate(Quaternion(angle, axis), relativeTo);
417
0
        }
418
419
        /** Rotate the node around an arbitrary axis using a Quarternion.
420
        */
421
        void rotate(const Quaternion& q, TransformSpace relativeTo = TS_LOCAL);
422
423
        /** Gets a matrix whose columns are the local axes based on
424
            the nodes orientation relative to it's parent. */
425
        Matrix3 getLocalAxes(void) const;
426
427
        /** Creates an unnamed new Node as a child of this node.
428
        @param translate
429
            Initial translation offset of child relative to parent
430
        @param rotate
431
            Initial rotation relative to parent
432
        */
433
        virtual Node* createChild(
434
            const Vector3& translate = Vector3::ZERO, 
435
            const Quaternion& rotate = Quaternion::IDENTITY );
436
437
        /** Creates a new named Node as a child of this node.
438
439
            This creates a child node with a given name, which allows you to look the node up from 
440
            the parent which holds this collection of nodes.
441
        @param name Name of the Node to create
442
        @param translate
443
            Initial translation offset of child relative to parent
444
        @param rotate
445
            Initial rotation relative to parent
446
        */
447
        virtual Node* createChild(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
448
449
        /** Adds a (precreated) child scene node to this node. If it is attached to another node,
450
            it must be detached first.
451
        @param child The Node which is to become a child node of this one
452
        */
453
        void addChild(Node* child);
454
455
        /** Reports the number of child nodes under this one.
456
        @deprecated use getChildren()
457
        */
458
0
        uint16 numChildren(void) const { return static_cast< uint16 >( mChildren.size() ); }
459
460
        /** Gets a pointer to a child node.
461
462
            There is an alternate getChild method which returns a named child.
463
        @deprecated use getChildren()
464
        */
465
        Node* getChild(unsigned short index) const;
466
467
        /** Gets a pointer to a named child node.
468
        */
469
        Node* getChild(const String& name) const;
470
471
        /// @deprecated use getChildren()
472
        OGRE_DEPRECATED ChildNodeIterator getChildIterator(void);
473
474
        /// @deprecated use getChildren()
475
        OGRE_DEPRECATED ConstChildNodeIterator getChildIterator(void) const;
476
477
        /// List of sub-nodes of this Node
478
0
        const ChildNodeMap& getChildren() const { return mChildren; }
479
480
        /** Drops the specified child from this node. 
481
482
            Does not delete the node, just detaches it from
483
            this parent, potentially to be reattached elsewhere. 
484
            There is also an alternate version which drops a named
485
            child from this node.
486
        */
487
        virtual Node* removeChild(unsigned short index);
488
        /// @overload
489
        virtual Node* removeChild(Node* child);
490
491
        /** Drops the named child from this node. 
492
493
            Does not delete the node, just detaches it from
494
            this parent, potentially to be reattached elsewhere.
495
        */
496
        virtual Node* removeChild(const String& name);
497
        /** Removes all child Nodes attached to this node. Does not delete the nodes, just detaches them from
498
            this parent, potentially to be reattached elsewhere.
499
        */
500
        virtual void removeAllChildren(void);
501
        
502
        /** Sets the final world position of the node directly.
503
504
            It's advisable to use the local setPosition if possible
505
        */
506
        void _setDerivedPosition(const Vector3& pos);
507
508
        /** Sets the final world orientation of the node directly.
509
510
            It's advisable to use the local setOrientation if possible, this simply does
511
            the conversion for you.
512
        */
513
        void _setDerivedOrientation(const Quaternion& q);
514
515
        /** Gets the orientation of the node as derived from all parents.
516
        */
517
        const Quaternion & _getDerivedOrientation(void) const;
518
519
        /** Gets the position of the node as derived from all parents.
520
        */
521
        const Vector3 & _getDerivedPosition(void) const;
522
523
        /** Gets the scaling factor of the node as derived from all parents.
524
        */
525
        const Vector3 & _getDerivedScale(void) const;
526
527
        /** Gets the full transformation matrix for this node.
528
529
            This method returns the full transformation matrix
530
            for this node, including the effect of any parent node
531
            transformations, provided they have been updated using the Node::_update method.
532
            This should only be called by a SceneManager which knows the
533
            derived transforms have been updated before calling this method.
534
            Applications using Ogre should just use the relative transforms.
535
        */
536
        const Affine3& _getFullTransform(void) const;
537
538
        /** Internal method to update the Node.
539
        @note
540
            Updates this node and any relevant children to incorporate transforms etc.
541
            Don't call this yourself unless you are writing a SceneManager implementation.
542
        @param updateChildren
543
            If @c true, the update cascades down to all children. Specify false if you wish to
544
            update children separately, e.g. because of a more selective SceneManager implementation.
545
        @param parentHasChanged
546
            This flag indicates that the parent transform has changed,
547
            so the child should retrieve the parent's transform and combine
548
            it with its own even if it hasn't changed itself.
549
        */
550
        virtual void _update(bool updateChildren, bool parentHasChanged);
551
552
        /** Sets a listener for this Node.
553
554
            Note for size and performance reasons only one listener per node is
555
            allowed.
556
        */
557
0
        void setListener(Listener* listener) { mListener = listener; }
558
        
559
        /** Gets the current listener for this Node.
560
        */
561
0
        Listener* getListener(void) const { return mListener; }
562
        
563
564
        /** Sets the current transform of this node to be the 'initial state' ie that
565
            position / orientation / scale to be used as a basis for delta values used
566
            in keyframe animation.
567
568
            You never need to call this method unless you plan to animate this node. If you do
569
            plan to animate it, call this method once you've loaded the node with it's base state,
570
            ie the state on which all keyframes are based.
571
        @par
572
            If you never call this method, the initial state is the identity transform, ie do nothing.
573
        */
574
        void setInitialState(void);
575
576
        /** Resets the position / orientation / scale of this node to it's initial state, see setInitialState for more info. */
577
        void resetToInitialState(void);
578
579
        /** Gets the initial position of this node, see setInitialState for more info. 
580
581
            Also resets the cumulative animation weight used for blending.
582
        */
583
0
        const Vector3& getInitialPosition(void) const { return mInitialPosition; }
584
        
585
        /** Gets the local position, relative to this node, of the given world-space position */
586
        Vector3 convertWorldToLocalPosition( const Vector3 &worldPos );
587
588
        /** Gets the world position of a point in the node local space
589
            useful for simple transforms that don't require a child node.*/
590
        Vector3 convertLocalToWorldPosition( const Vector3 &localPos );
591
592
        /** Gets the local direction, relative to this node, of the given world-space direction */
593
        Vector3 convertWorldToLocalDirection( const Vector3 &worldDir, bool useScale );
594
595
        /** Gets the world direction of a point in the node local space
596
            useful for simple transforms that don't require a child node.*/
597
        Vector3 convertLocalToWorldDirection( const Vector3 &localDir, bool useScale );
598
599
        /** Gets the local orientation, relative to this node, of the given world-space orientation */
600
        Quaternion convertWorldToLocalOrientation( const Quaternion &worldOrientation );
601
602
        /** Gets the world orientation of an orientation in the node local space
603
            useful for simple transforms that don't require a child node.*/
604
        Quaternion convertLocalToWorldOrientation( const Quaternion &localOrientation );
605
606
        /** Gets the initial orientation of this node, see setInitialState for more info. */
607
0
        const Quaternion& getInitialOrientation(void) const { return mInitialOrientation; }
608
609
        /** Gets the initial position of this node, see setInitialState for more info. */
610
0
        const Vector3& getInitialScale(void) const { return mInitialScale; }
611
612
        /** Helper function, get the squared view depth.  */
613
        Real getSquaredViewDepth(const Camera* cam) const;
614
615
        /** To be called in the event of transform changes to this node that require it's recalculation.
616
617
            This not only tags the node state as being 'dirty', it also requests it's parent to 
618
            know about it's dirtiness so it will get an update next time.
619
        @param forceParentUpdate Even if the node thinks it has already told it's
620
            parent, tell it anyway
621
        */
622
        virtual void needUpdate(bool forceParentUpdate = false);
623
        /** Called by children to notify their parent that they need an update.
624
        @param child The child Node to be updated
625
        @param forceParentUpdate Even if the node thinks it has already told it's
626
            parent, tell it anyway
627
        */
628
        void requestUpdate(Node* child, bool forceParentUpdate = false);
629
        /** Called by children to notify their parent that they no longer need an update. */
630
        void cancelUpdate(Node* child);
631
632
        /** Queue a 'needUpdate' call to a node safely.
633
634
            You can't call needUpdate() during the scene graph update, e.g. in
635
            response to a Node::Listener hook, because the graph is already being 
636
            updated, and update flag changes cannot be made reliably in that context. 
637
            Call this method if you need to queue a needUpdate call in this case.
638
        */
639
        static void queueNeedUpdate(Node* n);
640
        /** Process queued 'needUpdate' calls. */
641
        static void processQueuedUpdates(void);
642
643
644
        /** @deprecated use UserObjectBindings::setUserAny via getUserObjectBindings() instead.
645
        */
646
0
        OGRE_DEPRECATED void setUserAny(const Any& anything) { getUserObjectBindings().setUserAny(anything); }
647
648
        /** @deprecated use UserObjectBindings::getUserAny via getUserObjectBindings() instead.
649
        */
650
0
        OGRE_DEPRECATED const Any& getUserAny(void) const { return getUserObjectBindings().getUserAny(); }
651
652
        /// @copydoc UserObjectBindings
653
0
        UserObjectBindings& getUserObjectBindings() { return mUserObjectBindings; }
654
655
        /// @overload
656
0
        const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; }
657
658
    };
659
    /** @} */
660
    /** @} */
661
662
} // namespace Ogre
663
664
#include "OgreHeaderSuffix.h"
665
666
#endif // _Node_H__