1 #ifndef DALI_INTERNAL_SCENE_GRAPH_NODE_H
2 #define DALI_INTERNAL_SCENE_GRAPH_NODE_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/actors/actor-enumerations.h>
23 #include <dali/public-api/actors/draw-mode.h>
24 #include <dali/public-api/math/quaternion.h>
25 #include <dali/public-api/math/math-utils.h>
26 #include <dali/public-api/math/vector3.h>
27 #include <dali/integration-api/debug.h>
28 #include <dali/internal/common/message.h>
29 #include <dali/internal/event/common/event-thread-services.h>
30 #include <dali/internal/render/data-providers/node-data-provider.h>
31 #include <dali/internal/update/common/animatable-property.h>
32 #include <dali/internal/update/common/property-owner.h>
33 #include <dali/internal/update/common/property-vector3.h>
34 #include <dali/internal/update/common/scene-graph-buffers.h>
35 #include <dali/internal/update/common/inherited-property.h>
36 #include <dali/internal/update/manager/transform-manager.h>
37 #include <dali/internal/update/manager/transform-manager-property.h>
38 #include <dali/internal/update/nodes/node-declarations.h>
39 #include <dali/internal/update/rendering/scene-graph-renderer.h>
47 // Value types used by messages.
48 template <> struct ParameterType< ColorMode > : public BasicType< ColorMode > {};
49 template <> struct ParameterType< PositionInheritanceMode > : public BasicType< PositionInheritanceMode > {};
50 template <> struct ParameterType< ClippingMode::Type > : public BasicType< ClippingMode::Type > {};
61 * Flag whether property has changed, during the Update phase.
63 enum NodePropertyFlags
66 TransformFlag = 0x001,
71 SortModifierFlag = 0x020,
72 ChildDeletedFlag = 0x040,
75 static const int AllFlags = ( ChildDeletedFlag << 1 ) - 1; // all the flags
78 * Size is not inherited. VisibleFlag is inherited
80 static const int InheritedDirtyFlags = TransformFlag | VisibleFlag | ColorFlag | OverlayFlag;
82 // Flags which require the scene renderable lists to be updated
83 static const int RenderableUpdateFlags = TransformFlag | SortModifierFlag | ChildDeletedFlag;
86 * Node is the base class for all nodes in the Scene Graph.
88 * Each node provides a transformation which applies to the node and
89 * its children. Node data is double-buffered. This allows an update
90 * thread to modify node data, without interferring with another
91 * thread reading the values from the previous update traversal.
93 class Node : public PropertyOwner, public NodeDataProvider
98 static const PositionInheritanceMode DEFAULT_POSITION_INHERITANCE_MODE;
99 static const ColorMode DEFAULT_COLOR_MODE;
104 * Construct a new Node.
111 static void Delete( Node* node );
114 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
121 * Query whether the node is a layer.
122 * @return True if the node is a layer.
130 * Convert a node to a layer.
131 * @return A pointer to the layer, or NULL.
133 virtual Layer* GetLayer()
139 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
140 * A value is calculated that can be used during sorting to increase sort speed.
141 * @param[in] clippingId The Clipping ID of the node to set
142 * @param[in] clippingDepth The Clipping Depth of the node to set
143 * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
145 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth )
147 // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
148 // If not, if we traverse down a clipping tree and back up, and there is another
149 // node on the parent, this will have a non-zero clipping ID that must be ignored
150 if( clippingDepth > 0u )
152 mClippingDepth = clippingDepth;
154 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
155 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
156 // For the same ID, the clipping nodes must be first, so we negate the
157 // clipping enabled flag and set it as the least significant bit.
158 mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
162 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
163 mClippingSortModifier = 0u;
166 // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
167 // For this reason we can always update the member variable.
168 mScissorDepth = scissorDepth;
172 * Gets the Clipping ID for this node.
173 * @return The Clipping ID for this node.
175 uint32_t GetClippingId() const
177 return mClippingSortModifier >> 1u;
181 * Gets the Clipping Depth for this node.
182 * @return The Clipping Depth for this node.
184 uint32_t GetClippingDepth() const
186 return mClippingDepth;
190 * Gets the Scissor Clipping Depth for this node.
191 * @return The Scissor Clipping Depth for this node.
193 uint32_t GetScissorDepth() const
195 return mScissorDepth;
199 * Sets the clipping mode for this node.
200 * @param[in] clippingMode The ClippingMode to set
202 void SetClippingMode( const ClippingMode::Type clippingMode )
204 mClippingMode = clippingMode;
208 * Gets the Clipping Mode for this node.
209 * @return The ClippingMode of this node
211 ClippingMode::Type GetClippingMode() const
213 return mClippingMode;
217 * Add a renderer to the node
218 * @param[in] renderer The renderer added to the node
220 void AddRenderer( Renderer* renderer );
223 * Remove a renderer from the node
224 * @param[in] renderer The renderer to be removed
226 void RemoveRenderer( Renderer* renderer );
229 * Get the renderer at the given index
232 Renderer* GetRendererAt( unsigned int index ) const
234 return mRenderer[index];
238 * Retrieve the number of renderers for the node
240 unsigned int GetRendererCount()
242 return mRenderer.Size();
245 // Containment methods
248 * Query whether a node is the root node. Root nodes cannot have a parent node.
249 * A node becomes a root node, when it is installed by UpdateManager.
250 * @return True if the node is a root node.
258 * Set whether a node is the root node. Root nodes cannot have a parent node.
259 * This method should only be called by UpdateManager.
260 * @pre When isRoot is true, the node must not have a parent.
261 * @param[in] isRoot Whether the node is now a root node.
263 void SetRoot(bool isRoot);
266 * Retrieve the parent of a Node.
267 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
275 * Retrieve the parent of a Node.
276 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
278 const Node* GetParent() const
284 * Connect a node to the scene-graph.
285 * @pre A node cannot be added to itself.
286 * @pre The parent node is connected to the scene-graph.
287 * @pre The childNode does not already have a parent.
288 * @pre The childNode is not a root node.
289 * @param[in] childNode The child to add.
291 void ConnectChild( Node* childNode );
294 * Disconnect a child (& its children) from the scene-graph.
295 * @pre childNode is a child of this Node.
296 * @param[in] updateBufferIndex The current update buffer index.
297 * @param[in] childNode The node to disconnect.
299 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
302 * Retrieve the children a Node.
303 * @return The container of children.
305 const NodeContainer& GetChildren() const
311 * Retrieve the children a Node.
312 * @return The container of children.
314 NodeContainer& GetChildren()
322 * Flag that one of the node values has changed in the current frame.
323 * @param[in] flag The flag to set.
325 void SetDirtyFlag(NodePropertyFlags flag)
331 * Flag that all of the node values are dirty.
333 void SetAllDirtyFlags()
335 mDirtyFlags = AllFlags;
339 * Query whether a node is dirty.
340 * @return The dirty flags
342 int GetDirtyFlags() const;
345 * Retrieve the parent-origin of the node.
346 * @return The parent-origin.
348 const Vector3& GetParentOrigin() const
350 return mParentOrigin.Get(0);
354 * Sets both the local & base parent-origins of the node.
355 * @param[in] origin The new local & base parent-origins.
357 void SetParentOrigin(const Vector3& origin)
359 mParentOrigin.Set(0,origin );
363 * Retrieve the anchor-point of the node.
364 * @return The anchor-point.
366 const Vector3& GetAnchorPoint() const
368 return mAnchorPoint.Get(0);
372 * Sets both the local & base anchor-points of the node.
373 * @param[in] anchor The new local & base anchor-points.
375 void SetAnchorPoint(const Vector3& anchor)
377 mAnchorPoint.Set(0, anchor );
381 * Retrieve the local position of the node, relative to its parent.
382 * @param[in] bufferIndex The buffer to read from.
383 * @return The local position.
385 const Vector3& GetPosition(BufferIndex bufferIndex) const
387 if( mTransformId != INVALID_TRANSFORM_ID )
389 return mPosition.Get(bufferIndex);
392 return Vector3::ZERO;
396 * Retrieve the position of the node derived from the position of all its parents.
397 * @return The world position.
399 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
401 return mWorldPosition.Get(bufferIndex);
405 * Set whether the Node inherits position.
406 * @param[in] inherit True if the parent position is inherited.
408 void SetInheritPosition(bool inherit)
410 if( mTransformId != INVALID_TRANSFORM_ID )
412 mTransformManager->SetInheritPosition( mTransformId, inherit );
417 * Retrieve the local orientation of the node, relative to its parent.
418 * @param[in] bufferIndex The buffer to read from.
419 * @return The local orientation.
421 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
423 if( mTransformId != INVALID_TRANSFORM_ID )
425 return mOrientation.Get(0);
428 return Quaternion::IDENTITY;
432 * Retrieve the orientation of the node derived from the rotation of all its parents.
433 * @param[in] bufferIndex The buffer to read from.
434 * @return The world rotation.
436 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
438 return mWorldOrientation.Get(0);
442 * Set whether the Node inherits orientation.
443 * @param[in] inherit True if the parent orientation is inherited.
445 void SetInheritOrientation(bool inherit)
447 if( mTransformId != INVALID_TRANSFORM_ID )
449 mTransformManager->SetInheritOrientation(mTransformId, inherit );
454 * Retrieve the local scale of the node, relative to its parent.
455 * @param[in] bufferIndex The buffer to read from.
456 * @return The local scale.
458 const Vector3& GetScale(BufferIndex bufferIndex) const
460 if( mTransformId != INVALID_TRANSFORM_ID )
462 return mScale.Get(0);
470 * Retrieve the scale of the node derived from the scale of all its parents.
471 * @param[in] bufferIndex The buffer to read from.
472 * @return The world scale.
474 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
476 return mWorldScale.Get(0);
480 * Set whether the Node inherits scale.
481 * @param inherit True if the Node inherits scale.
483 void SetInheritScale( bool inherit )
485 if( mTransformId != INVALID_TRANSFORM_ID )
487 mTransformManager->SetInheritScale(mTransformId, inherit );
492 * Retrieve the visibility of the node.
493 * @param[in] bufferIndex The buffer to read from.
494 * @return True if the node is visible.
496 bool IsVisible(BufferIndex bufferIndex) const
498 return mVisible[bufferIndex];
502 * Retrieve the opacity of the node.
503 * @param[in] bufferIndex The buffer to read from.
504 * @return The opacity.
506 float GetOpacity(BufferIndex bufferIndex) const
508 return mColor[bufferIndex].a;
512 * Retrieve the color of the node.
513 * @param[in] bufferIndex The buffer to read from.
516 const Vector4& GetColor(BufferIndex bufferIndex) const
518 return mColor[bufferIndex];
522 * Sets the color of the node derived from the color of all its parents.
523 * @param[in] color The world color.
524 * @param[in] updateBufferIndex The current update buffer index.
526 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
528 mWorldColor.Set( updateBufferIndex, color );
532 * Sets the color of the node derived from the color of all its parents.
533 * This method should only be called when the parents world color is up-to-date.
534 * @pre The node has a parent.
535 * @param[in] updateBufferIndex The current update buffer index.
537 void InheritWorldColor( BufferIndex updateBufferIndex )
539 DALI_ASSERT_DEBUG(mParent != NULL);
542 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
544 const Vector4& ownColor = mColor[updateBufferIndex];
545 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
547 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
549 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
551 else if( mColorMode == USE_PARENT_COLOR )
553 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
555 else // USE_OWN_COLOR
557 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
562 * Copies the previous inherited scale, if this changed in the previous frame.
563 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
564 * does not need to be recalculated in the current frame.
565 * @param[in] updateBufferIndex The current update buffer index.
567 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
569 mWorldColor.CopyPrevious( updateBufferIndex );
573 * Retrieve the color of the node, possibly derived from the color
574 * of all its parents, depending on the value of mColorMode.
575 * @param[in] bufferIndex The buffer to read from.
576 * @return The world color.
578 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
580 return mWorldColor[bufferIndex];
584 * Set the color mode. This specifies whether the Node uses its own color,
585 * or inherits its parent color.
586 * @param[in] colorMode The new color mode.
588 void SetColorMode(ColorMode colorMode)
590 mColorMode = colorMode;
592 SetDirtyFlag(ColorFlag);
596 * Retrieve the color mode.
597 * @return The color mode.
599 ColorMode GetColorMode() const
605 * Retrieve the size of the node.
606 * @param[in] bufferIndex The buffer to read from.
609 const Vector3& GetSize(BufferIndex bufferIndex) const
611 if( mTransformId != INVALID_TRANSFORM_ID )
616 return Vector3::ZERO;
620 * Retrieve the bounding sphere of the node
621 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
623 const Vector4& GetBoundingSphere() const
625 if( mTransformId != INVALID_TRANSFORM_ID )
627 return mTransformManager->GetBoundingSphere( mTransformId );
630 return Vector4::ZERO;
634 * Retrieve world matrix and size of the node
635 * @param[out] The local to world matrix of the node
636 * @param[out] size The current size of the node
638 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
640 if( mTransformId != INVALID_TRANSFORM_ID )
642 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
647 * Checks if local matrix has changed since last update
648 * @return true if local matrix has changed, false otherwise
650 bool IsLocalMatrixDirty() const
652 return (mTransformId != INVALID_TRANSFORM_ID) &&
653 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
657 * Retrieve the cached world-matrix of a node.
658 * @param[in] bufferIndex The buffer to read from.
659 * @return The world-matrix.
661 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
663 return mWorldMatrix.Get(bufferIndex);
667 * Mark the node as exclusive to a single RenderTask.
668 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
670 void SetExclusiveRenderTask( RenderTask* renderTask )
672 mExclusiveRenderTask = renderTask;
676 * Query whether the node is exclusive to a single RenderTask.
677 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
679 RenderTask* GetExclusiveRenderTask() const
681 return mExclusiveRenderTask;
685 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
686 * @param[in] drawMode The new draw-mode to use.
688 void SetDrawMode( const DrawMode::Type& drawMode )
690 mDrawMode = drawMode;
694 * Returns whether node is an overlay or not.
695 * @return True if node is an overlay, false otherwise.
697 DrawMode::Type GetDrawMode() const
703 * Returns the transform id of the node
704 * @return The transform component id of the node
706 TransformId GetTransformId() const
712 * Equality operator, checks for identity, not values.
715 bool operator==( const Node* rhs ) const
717 return ( this == rhs );
721 * @brief Sets the sibling order of the node
722 * @param[in] order The new order
724 void SetDepthIndex( unsigned int depthIndex ){ mDepthIndex = depthIndex; }
727 * @brief Get the depth index of the node
728 * @return Current depth index
730 unsigned int GetDepthIndex(){ return mDepthIndex; }
733 * @brief Sets the boolean which states whether the position should use the anchor-point.
734 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
736 void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
738 if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
740 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
741 mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
747 * @copydoc UniformMap::Add
749 void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
752 * @copydoc UniformMap::Remove
754 void RemoveUniformMapping( const std::string& uniformName );
757 * Prepare the node for rendering.
758 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
759 * @param[in] updateBufferIndex The current update buffer index.
761 void PrepareRender( BufferIndex bufferIndex );
764 * Called by UpdateManager when the node is added.
765 * Creates a new transform component in the transform manager and initialize all the properties
766 * related to the transformation
767 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
769 void CreateTransform( SceneGraph::TransformManager* transformManager );
774 void ResetDirtyFlags( BufferIndex updateBufferIndex );
779 * Set the parent of a Node.
780 * @param[in] parentNode the new parent.
782 void SetParent( Node& parentNode );
787 * Protected constructor; See also Node::New()
792 * Protected virtual destructor; See also Node::Delete( Node* )
793 * Kept protected to allow destructor chaining from layer
797 private: // from NodeDataProvider
800 * @copydoc NodeDataProvider::GetModelMatrix
802 virtual const Matrix& GetModelMatrix( unsigned int bufferId ) const
804 return GetWorldMatrix( bufferId );
808 * @copydoc NodeDataProvider::GetRenderColor
810 virtual const Vector4& GetRenderColor( unsigned int bufferId ) const
812 return GetWorldColor( bufferId );
815 public: // From UniformMapDataProvider
817 * @copydoc UniformMapDataProvider::GetUniformMapChanged
819 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
821 return mUniformMapChanged[bufferIndex];
825 * @copydoc UniformMapDataProvider::GetUniformMap
827 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
829 return mCollectedUniformMap[bufferIndex];
838 Node& operator=(const Node& rhs);
841 * Recursive helper to disconnect a Node and its children.
842 * Disconnected Nodes have no parent or children.
843 * @param[in] updateBufferIndex The current update buffer index.
845 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
847 public: // Default properties
849 TransformManager* mTransformManager;
850 TransformId mTransformId;
851 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the TransformFlag dirty when changed
852 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the TransformFlag dirty when changed
853 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
854 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
855 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
856 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
858 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
859 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
861 // Inherited properties; read-only from public API
863 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
864 TransformManagerVector3Input mWorldScale;
865 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
866 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
867 InheritedColor mWorldColor; ///< Full inherited color
869 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
873 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
874 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
876 RendererContainer mRenderer; ///< Container of renderers; not owned
878 NodeContainer mChildren; ///< Container of children; not owned
880 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
881 unsigned int mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
882 uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
883 uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
885 uint32_t mDepthIndex; ///< Depth index of the node
887 // flags, compressed to bitfield
888 unsigned int mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
889 int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
890 DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn
891 ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
892 ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node
893 bool mIsRoot:1; ///< True if the node cannot have a parent
894 bool mIsLayer:1; ///< True if the node is a layer
895 bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
896 // Changes scope, should be at end of class
897 DALI_LOG_OBJECT_STRING_DECLARATION;
902 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
904 typedef MessageValue1< Node, bool > LocalType;
906 // Reserve some memory inside the message queue
907 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
909 // Construct message in the message queue memory; note that delete should not be called on the return value
910 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
913 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
915 typedef MessageValue1< Node, Vector3 > LocalType;
917 // Reserve some memory inside the message queue
918 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
920 // Construct message in the message queue memory; note that delete should not be called on the return value
921 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
924 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
926 typedef MessageValue1< Node, Vector3 > LocalType;
928 // Reserve some memory inside the message queue
929 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
931 // Construct message in the message queue memory; note that delete should not be called on the return value
932 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
935 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
937 typedef MessageValue1< Node, bool > LocalType;
939 // Reserve some memory inside the message queue
940 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
942 // Construct message in the message queue memory; note that delete should not be called on the return value
943 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
946 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
948 typedef MessageValue1< Node, bool > LocalType;
950 // Reserve some memory inside the message queue
951 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
953 // Construct message in the message queue memory; note that delete should not be called on the return value
954 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
957 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
959 typedef MessageValue1< Node, ColorMode > LocalType;
961 // Reserve some memory inside the message queue
962 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
964 // Construct message in the message queue memory; note that delete should not be called on the return value
965 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
968 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
970 typedef MessageValue1< Node, DrawMode::Type > LocalType;
972 // Reserve some memory inside the message queue
973 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
975 // Construct message in the message queue memory; note that delete should not be called on the return value
976 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
979 inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
981 typedef MessageValue1< Node, Renderer* > LocalType;
983 // Reserve some memory inside the message queue
984 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
986 // Construct message in the message queue memory; note that delete should not be called on the return value
987 new (slot) LocalType( &node, &Node::AddRenderer, renderer );
990 inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
992 typedef MessageValue1< Node, Renderer* > LocalType;
994 // Reserve some memory inside the message queue
995 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
997 // Construct message in the message queue memory; note that delete should not be called on the return value
998 new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
1001 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, unsigned int depthIndex )
1003 typedef MessageValue1< Node, unsigned int > LocalType;
1005 // Reserve some memory inside the message queue
1006 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1008 // Construct message in the message queue memory; note that delete should not be called on the return value
1009 new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
1012 inline void SetClippingModeMessage( EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode )
1014 typedef MessageValue1< Node, ClippingMode::Type > LocalType;
1016 // Reserve some memory inside the message queue
1017 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1019 // Construct message in the message queue memory; note that delete should not be called on the return value
1020 new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
1023 inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
1025 typedef MessageValue1< Node, bool > LocalType;
1027 // Reserve some memory inside the message queue
1028 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1030 // Construct message in the message queue memory; note that delete should not be called on the return value
1031 new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
1034 } // namespace SceneGraph
1036 // Template specialisation for OwnerPointer<Node>, because delete is protected
1038 inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
1040 if (mObject != NULL)
1042 Dali::Internal::SceneGraph::Node::Delete(mObject);
1046 } // namespace Internal
1048 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1050 inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer )
1052 Dali::Internal::SceneGraph::Node::Delete(pointer);
1056 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H