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/scene-graph-buffers.h>
34 #include <dali/internal/update/common/inherited-property.h>
35 #include <dali/internal/update/manager/transform-manager.h>
36 #include <dali/internal/update/manager/transform-manager-property.h>
37 #include <dali/internal/update/nodes/node-declarations.h>
38 #include <dali/internal/update/rendering/scene-graph-renderer.h>
46 // Value types used by messages.
47 template <> struct ParameterType< ColorMode > : public BasicType< ColorMode > {};
48 template <> struct ParameterType< ClippingMode::Type > : public BasicType< ClippingMode::Type > {};
59 // Flags which require the scene renderable lists to be updated
60 static NodePropertyFlags RenderableUpdateFlags = NodePropertyFlags::TRANSFORM | NodePropertyFlags::CHILD_DELETED;
63 * Node is the base class for all nodes in the Scene Graph.
65 * Each node provides a transformation which applies to the node and
66 * its children. Node data is double-buffered. This allows an update
67 * thread to modify node data, without interferring with another
68 * thread reading the values from the previous update traversal.
70 class Node : public PropertyOwner, public NodeDataProvider
75 static const ColorMode DEFAULT_COLOR_MODE;
80 * Construct a new Node.
87 static void Delete( Node* node );
90 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
95 * @return the unique ID of the node
97 uint32_t GetId() const;
102 * Query whether the node is a layer.
103 * @return True if the node is a layer.
111 * Convert a node to a layer.
112 * @return A pointer to the layer, or NULL.
114 virtual Layer* GetLayer()
120 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
121 * A value is calculated that can be used during sorting to increase sort speed.
122 * @param[in] clippingId The Clipping ID of the node to set
123 * @param[in] clippingDepth The Clipping Depth of the node to set
124 * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
126 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth )
128 // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
129 // If not, if we traverse down a clipping tree and back up, and there is another
130 // node on the parent, this will have a non-zero clipping ID that must be ignored
131 if( clippingDepth > 0u )
133 mClippingDepth = clippingDepth;
135 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
136 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
137 // For the same ID, the clipping nodes must be first, so we negate the
138 // clipping enabled flag and set it as the least significant bit.
139 mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
143 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
144 mClippingSortModifier = 0u;
147 // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
148 // For this reason we can always update the member variable.
149 mScissorDepth = scissorDepth;
153 * Gets the Clipping ID for this node.
154 * @return The Clipping ID for this node.
156 uint32_t GetClippingId() const
158 return mClippingSortModifier >> 1u;
162 * Gets the Clipping Depth for this node.
163 * @return The Clipping Depth for this node.
165 uint32_t GetClippingDepth() const
167 return mClippingDepth;
171 * Gets the Scissor Clipping Depth for this node.
172 * @return The Scissor Clipping Depth for this node.
174 uint32_t GetScissorDepth() const
176 return mScissorDepth;
180 * Sets the clipping mode for this node.
181 * @param[in] clippingMode The ClippingMode to set
183 void SetClippingMode( const ClippingMode::Type clippingMode )
185 mClippingMode = clippingMode;
189 * Gets the Clipping Mode for this node.
190 * @return The ClippingMode of this node
192 ClippingMode::Type GetClippingMode() const
194 return mClippingMode;
198 * Add a renderer to the node
199 * @param[in] renderer The renderer added to the node
201 void AddRenderer( Renderer* renderer );
204 * Remove a renderer from the node
205 * @param[in] renderer The renderer to be removed
207 void RemoveRenderer( const Renderer* renderer );
210 * Get the renderer at the given index
213 Renderer* GetRendererAt( uint32_t index ) const
215 return mRenderer[index];
219 * Retrieve the number of renderers for the node
221 uint32_t GetRendererCount() const
223 return static_cast<uint32_t>( mRenderer.Size() );
226 // Containment methods
229 * Query whether a node is the root node. Root nodes cannot have a parent node.
230 * A node becomes a root node, when it is installed by UpdateManager.
231 * @return True if the node is a root node.
239 * Set whether a node is the root node. Root nodes cannot have a parent node.
240 * This method should only be called by UpdateManager.
241 * @pre When isRoot is true, the node must not have a parent.
242 * @param[in] isRoot Whether the node is now a root node.
244 void SetRoot(bool isRoot);
247 * Retrieve the parent of a Node.
248 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
256 * Retrieve the parent of a Node.
257 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
259 const Node* GetParent() const
265 * @return true if the node is connected to SceneGraph
267 bool ConnectedToScene()
269 return IsRoot() || GetParent();
273 * Connect a node to the scene-graph.
274 * @pre A node cannot be added to itself.
275 * @pre The parent node is connected to the scene-graph.
276 * @pre The childNode does not already have a parent.
277 * @pre The childNode is not a root node.
278 * @param[in] childNode The child to add.
280 void ConnectChild( Node* childNode );
283 * Disconnect a child (& its children) from the scene-graph.
284 * @pre childNode is a child of this Node.
285 * @param[in] updateBufferIndex The current update buffer index.
286 * @param[in] childNode The node to disconnect.
288 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
291 * Retrieve the children a Node.
292 * @return The container of children.
294 const NodeContainer& GetChildren() const
300 * Retrieve the children a Node.
301 * @return The container of children.
303 NodeContainer& GetChildren()
311 * Flag that one of the node values has changed in the current frame.
312 * @param[in] flag The flag to set.
314 void SetDirtyFlag( NodePropertyFlags flag )
320 * Flag that all of the node values are dirty.
322 void SetAllDirtyFlags()
324 mDirtyFlags = NodePropertyFlags::ALL;
328 * Query whether a node is dirty.
329 * @return The dirty flags
331 NodePropertyFlags GetDirtyFlags() const;
334 * Query inherited dirty flags.
336 * @param The parentFlags to or with
337 * @return The inherited dirty flags
339 NodePropertyFlags GetInheritedDirtyFlags( NodePropertyFlags parentFlags ) const;
342 * Retrieve the parent-origin of the node.
343 * @return The parent-origin.
345 const Vector3& GetParentOrigin() const
347 return mParentOrigin.Get(0);
351 * Sets both the local & base parent-origins of the node.
352 * @param[in] origin The new local & base parent-origins.
354 void SetParentOrigin(const Vector3& origin)
356 mParentOrigin.Set(0,origin );
360 * Retrieve the anchor-point of the node.
361 * @return The anchor-point.
363 const Vector3& GetAnchorPoint() const
365 return mAnchorPoint.Get(0);
369 * Sets both the local & base anchor-points of the node.
370 * @param[in] anchor The new local & base anchor-points.
372 void SetAnchorPoint(const Vector3& anchor)
374 mAnchorPoint.Set(0, anchor );
378 * Retrieve the local position of the node, relative to its parent.
379 * @param[in] bufferIndex The buffer to read from.
380 * @return The local position.
382 const Vector3& GetPosition(BufferIndex bufferIndex) const
384 if( mTransformId != INVALID_TRANSFORM_ID )
386 return mPosition.Get(bufferIndex);
389 return Vector3::ZERO;
393 * Retrieve the position of the node derived from the position of all its parents.
394 * @return The world position.
396 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
398 return mWorldPosition.Get(bufferIndex);
402 * Set whether the Node inherits position.
403 * @param[in] inherit True if the parent position is inherited.
405 void SetInheritPosition(bool inherit)
407 if( mTransformId != INVALID_TRANSFORM_ID )
409 mTransformManager->SetInheritPosition( mTransformId, inherit );
414 * Retrieve the local orientation of the node, relative to its parent.
415 * @param[in] bufferIndex The buffer to read from.
416 * @return The local orientation.
418 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
420 if( mTransformId != INVALID_TRANSFORM_ID )
422 return mOrientation.Get(0);
425 return Quaternion::IDENTITY;
429 * Retrieve the orientation of the node derived from the rotation of all its parents.
430 * @param[in] bufferIndex The buffer to read from.
431 * @return The world rotation.
433 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
435 return mWorldOrientation.Get(0);
439 * Set whether the Node inherits orientation.
440 * @param[in] inherit True if the parent orientation is inherited.
442 void SetInheritOrientation(bool inherit)
444 if( mTransformId != INVALID_TRANSFORM_ID )
446 mTransformManager->SetInheritOrientation(mTransformId, inherit );
451 * Retrieve the local scale of the node, relative to its parent.
452 * @param[in] bufferIndex The buffer to read from.
453 * @return The local scale.
455 const Vector3& GetScale(BufferIndex bufferIndex) const
457 if( mTransformId != INVALID_TRANSFORM_ID )
459 return mScale.Get(0);
467 * Retrieve the scale of the node derived from the scale of all its parents.
468 * @param[in] bufferIndex The buffer to read from.
469 * @return The world scale.
471 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
473 return mWorldScale.Get(0);
477 * Set whether the Node inherits scale.
478 * @param inherit True if the Node inherits scale.
480 void SetInheritScale( bool inherit )
482 if( mTransformId != INVALID_TRANSFORM_ID )
484 mTransformManager->SetInheritScale(mTransformId, inherit );
489 * Retrieve the visibility of the node.
490 * @param[in] bufferIndex The buffer to read from.
491 * @return True if the node is visible.
493 bool IsVisible(BufferIndex bufferIndex) const
495 return mVisible[bufferIndex];
499 * Retrieve the opacity of the node.
500 * @param[in] bufferIndex The buffer to read from.
501 * @return The opacity.
503 float GetOpacity(BufferIndex bufferIndex) const
505 return mColor[bufferIndex].a;
509 * Retrieve the color of the node.
510 * @param[in] bufferIndex The buffer to read from.
513 const Vector4& GetColor(BufferIndex bufferIndex) const
515 return mColor[bufferIndex];
519 * Sets the color of the node derived from the color of all its parents.
520 * @param[in] color The world color.
521 * @param[in] updateBufferIndex The current update buffer index.
523 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
525 mWorldColor.Set( updateBufferIndex, color );
529 * Sets the color of the node derived from the color of all its parents.
530 * This method should only be called when the parents world color is up-to-date.
531 * @pre The node has a parent.
532 * @param[in] updateBufferIndex The current update buffer index.
534 void InheritWorldColor( BufferIndex updateBufferIndex )
536 DALI_ASSERT_DEBUG(mParent != NULL);
539 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
541 const Vector4& ownColor = mColor[updateBufferIndex];
542 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
544 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
546 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
548 else if( mColorMode == USE_PARENT_COLOR )
550 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
552 else // USE_OWN_COLOR
554 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
559 * Copies the previous inherited scale, if this changed in the previous frame.
560 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
561 * does not need to be recalculated in the current frame.
562 * @param[in] updateBufferIndex The current update buffer index.
564 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
566 mWorldColor.CopyPrevious( updateBufferIndex );
570 * Retrieve the color of the node, possibly derived from the color
571 * of all its parents, depending on the value of mColorMode.
572 * @param[in] bufferIndex The buffer to read from.
573 * @return The world color.
575 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
577 return mWorldColor[bufferIndex];
581 * Set the color mode. This specifies whether the Node uses its own color,
582 * or inherits its parent color.
583 * @param[in] colorMode The new color mode.
585 void SetColorMode( ColorMode colorMode )
587 mColorMode = colorMode;
589 SetDirtyFlag( NodePropertyFlags::COLOR );
593 * Retrieve the color mode.
594 * @return The color mode.
596 ColorMode GetColorMode() const
602 * Retrieve the size of the node.
603 * @param[in] bufferIndex The buffer to read from.
606 const Vector3& GetSize(BufferIndex bufferIndex) const
608 if( mTransformId != INVALID_TRANSFORM_ID )
613 return Vector3::ZERO;
617 * Retrieve the bounding sphere of the node
618 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
620 const Vector4& GetBoundingSphere() const
622 if( mTransformId != INVALID_TRANSFORM_ID )
624 return mTransformManager->GetBoundingSphere( mTransformId );
627 return Vector4::ZERO;
631 * Retrieve world matrix and size of the node
632 * @param[out] The local to world matrix of the node
633 * @param[out] size The current size of the node
635 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
637 if( mTransformId != INVALID_TRANSFORM_ID )
639 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
644 * Checks if local matrix has changed since last update
645 * @return true if local matrix has changed, false otherwise
647 bool IsLocalMatrixDirty() const
649 return (mTransformId != INVALID_TRANSFORM_ID) &&
650 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
654 * Retrieve the cached world-matrix of a node.
655 * @param[in] bufferIndex The buffer to read from.
656 * @return The world-matrix.
658 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
660 return mWorldMatrix.Get(bufferIndex);
664 * Mark the node as exclusive to a single RenderTask.
665 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
667 void SetExclusiveRenderTask( RenderTask* renderTask )
669 mExclusiveRenderTask = renderTask;
673 * Query whether the node is exclusive to a single RenderTask.
674 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
676 RenderTask* GetExclusiveRenderTask() const
678 return mExclusiveRenderTask;
682 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
683 * @param[in] drawMode The new draw-mode to use.
685 void SetDrawMode( const DrawMode::Type& drawMode )
687 mDrawMode = drawMode;
691 * Returns whether node is an overlay or not.
692 * @return True if node is an overlay, false otherwise.
694 DrawMode::Type GetDrawMode() const
700 * Returns the transform id of the node
701 * @return The transform component id of the node
703 TransformId GetTransformId() const
709 * Equality operator, checks for identity, not values.
712 bool operator==( const Node* rhs ) const
714 return ( this == rhs );
718 * @brief Sets the sibling order of the node
719 * @param[in] order The new order
721 void SetDepthIndex( uint32_t depthIndex )
723 mDepthIndex = depthIndex;
727 * @brief Get the depth index of the node
728 * @return Current depth index
730 uint32_t GetDepthIndex() const
736 * @brief Sets the boolean which states whether the position should use the anchor-point.
737 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
739 void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
741 if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
743 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
744 mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
749 * @brief Sets whether the node is culled or not.
750 * @param[in] bufferIndex The buffer to read from.
751 * @param[in] culled True if the node is culled.
753 void SetCulled( BufferIndex bufferIndex, bool culled )
755 mCulled[bufferIndex] = culled;
759 * @brief Retrieves whether the node is culled or not.
760 * @param[in] bufferIndex The buffer to read from.
761 * @return True if the node is culled.
763 bool IsCulled( BufferIndex bufferIndex ) const
765 return mCulled[bufferIndex];
770 * @copydoc UniformMap::Add
772 void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
775 * @copydoc UniformMap::Remove
777 void RemoveUniformMapping( const std::string& uniformName );
780 * Prepare the node for rendering.
781 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
782 * @param[in] updateBufferIndex The current update buffer index.
784 void PrepareRender( BufferIndex bufferIndex );
787 * Called by UpdateManager when the node is added.
788 * Creates a new transform component in the transform manager and initialize all the properties
789 * related to the transformation
790 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
792 void CreateTransform( SceneGraph::TransformManager* transformManager );
797 void ResetDirtyFlags( BufferIndex updateBufferIndex );
802 * Set the parent of a Node.
803 * @param[in] parentNode the new parent.
805 void SetParent( Node& parentNode );
810 * Protected constructor; See also Node::New()
815 * Protected virtual destructor; See also Node::Delete( Node* )
816 * Kept protected to allow destructor chaining from layer
820 private: // from NodeDataProvider
823 * @copydoc NodeDataProvider::GetModelMatrix
825 virtual const Matrix& GetModelMatrix( BufferIndex bufferIndex ) const
827 return GetWorldMatrix( bufferIndex );
831 * @copydoc NodeDataProvider::GetRenderColor
833 virtual const Vector4& GetRenderColor( BufferIndex bufferIndex ) const
835 return GetWorldColor( bufferIndex );
838 public: // From UniformMapDataProvider
840 * @copydoc UniformMapDataProvider::GetUniformMapChanged
842 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
844 return mUniformMapChanged[bufferIndex];
848 * @copydoc UniformMapDataProvider::GetUniformMap
850 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
852 return mCollectedUniformMap[bufferIndex];
861 Node& operator=(const Node& rhs);
864 * Recursive helper to disconnect a Node and its children.
865 * Disconnected Nodes have no parent or children.
866 * @param[in] updateBufferIndex The current update buffer index.
868 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
870 public: // Default properties
872 TransformManager* mTransformManager;
873 TransformId mTransformId;
874 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the Transform flag dirty when changed
875 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the Transform flag dirty when changed
876 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
877 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
878 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
879 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
881 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
882 AnimatableProperty<bool> mCulled; ///< True if the node is culled. This is not animatable. It is just double-buffered.
883 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
885 // Inherited properties; read-only from public API
887 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
888 TransformManagerVector3Input mWorldScale;
889 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
890 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
891 InheritedColor mWorldColor; ///< Full inherited color
893 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
894 const uint32_t mId; ///< The Unique ID of the node.
898 static uint32_t mNodeCounter; ///< count of total nodes, used for unique ids
900 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
901 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
903 RendererContainer mRenderer; ///< Container of renderers; not owned
905 NodeContainer mChildren; ///< Container of children; not owned
907 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
908 uint32_t mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
909 uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
910 uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
912 uint32_t mDepthIndex; ///< Depth index of the node
914 // flags, compressed to bitfield
915 NodePropertyFlags mDirtyFlags; ///< Dirty flags for each of the Node properties
916 uint32_t mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
917 DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn
918 ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
919 ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node
920 bool mIsRoot:1; ///< True if the node cannot have a parent
921 bool mIsLayer:1; ///< True if the node is a layer
922 bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
924 // Changes scope, should be at end of class
925 DALI_LOG_OBJECT_STRING_DECLARATION;
930 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
932 typedef MessageValue1< Node, bool > LocalType;
934 // Reserve some memory inside the message queue
935 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
937 // Construct message in the message queue memory; note that delete should not be called on the return value
938 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
941 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
943 typedef MessageValue1< Node, Vector3 > LocalType;
945 // Reserve some memory inside the message queue
946 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
948 // Construct message in the message queue memory; note that delete should not be called on the return value
949 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
952 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
954 typedef MessageValue1< Node, Vector3 > LocalType;
956 // Reserve some memory inside the message queue
957 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
959 // Construct message in the message queue memory; note that delete should not be called on the return value
960 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
963 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
965 typedef MessageValue1< Node, bool > LocalType;
967 // Reserve some memory inside the message queue
968 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
970 // Construct message in the message queue memory; note that delete should not be called on the return value
971 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
974 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
976 typedef MessageValue1< Node, bool > LocalType;
978 // Reserve some memory inside the message queue
979 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
981 // Construct message in the message queue memory; note that delete should not be called on the return value
982 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
985 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
987 typedef MessageValue1< Node, ColorMode > LocalType;
989 // Reserve some memory inside the message queue
990 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
992 // Construct message in the message queue memory; note that delete should not be called on the return value
993 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
996 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
998 typedef MessageValue1< Node, DrawMode::Type > LocalType;
1000 // Reserve some memory inside the message queue
1001 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1003 // Construct message in the message queue memory; note that delete should not be called on the return value
1004 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
1007 inline void AttachRendererMessage( EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer )
1009 typedef MessageValue1< Node, Renderer* > LocalType;
1011 // Reserve some memory inside the message queue
1012 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1014 // Construct message in the message queue memory; note that delete should not be called on the return value
1015 new (slot) LocalType( &node, &Node::AddRenderer, const_cast<Renderer*>( &renderer ) );
1018 inline void DetachRendererMessage( EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer )
1020 typedef MessageValue1< Node, const Renderer* > LocalType;
1022 // Reserve some memory inside the message queue
1023 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1025 // Construct message in the message queue memory; note that delete should not be called on the return value
1026 new (slot) LocalType( &node, &Node::RemoveRenderer, &renderer );
1029 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, uint32_t depthIndex )
1031 typedef MessageValue1< Node, uint32_t > LocalType;
1033 // Reserve some memory inside the message queue
1034 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1036 // Construct message in the message queue memory; note that delete should not be called on the return value
1037 new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
1040 inline void SetClippingModeMessage( EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode )
1042 typedef MessageValue1< Node, ClippingMode::Type > LocalType;
1044 // Reserve some memory inside the message queue
1045 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1047 // Construct message in the message queue memory; note that delete should not be called on the return value
1048 new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
1051 inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
1053 typedef MessageValue1< Node, bool > LocalType;
1055 // Reserve some memory inside the message queue
1056 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1058 // Construct message in the message queue memory; note that delete should not be called on the return value
1059 new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
1062 } // namespace SceneGraph
1064 // Template specialisation for OwnerPointer<Node>, because delete is protected
1066 inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
1068 if (mObject != NULL)
1070 Dali::Internal::SceneGraph::Node::Delete(mObject);
1074 } // namespace Internal
1076 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1078 inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer )
1080 Dali::Internal::SceneGraph::Node::Delete(pointer);
1084 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H