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.
105 * @param[in] id The unique ID of the node
107 static Node* New( unsigned int id );
112 static void Delete( Node* node );
115 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
122 * Query whether the node is a layer.
123 * @return True if the node is a layer.
131 * Convert a node to a layer.
132 * @return A pointer to the layer, or NULL.
134 virtual Layer* GetLayer()
140 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
141 * A value is calculated that can be used during sorting to increase sort speed.
142 * @param[in] clippingId The Clipping ID of the node to set
143 * @param[in] clippingDepth The Clipping Depth of the node to set
144 * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
146 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth )
148 // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
149 // If not, if we traverse down a clipping tree and back up, and there is another
150 // node on the parent, this will have a non-zero clipping ID that must be ignored
151 if( clippingDepth > 0u )
153 mClippingDepth = clippingDepth;
155 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
156 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
157 // For the same ID, the clipping nodes must be first, so we negate the
158 // clipping enabled flag and set it as the least significant bit.
159 mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
163 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
164 mClippingSortModifier = 0u;
167 // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
168 // For this reason we can always update the member variable.
169 mScissorDepth = scissorDepth;
173 * Gets the Clipping ID for this node.
174 * @return The Clipping ID for this node.
176 uint32_t GetClippingId() const
178 return mClippingSortModifier >> 1u;
182 * Gets the Clipping Depth for this node.
183 * @return The Clipping Depth for this node.
185 uint32_t GetClippingDepth() const
187 return mClippingDepth;
191 * Gets the Scissor Clipping Depth for this node.
192 * @return The Scissor Clipping Depth for this node.
194 uint32_t GetScissorDepth() const
196 return mScissorDepth;
200 * Sets the clipping mode for this node.
201 * @param[in] clippingMode The ClippingMode to set
203 void SetClippingMode( const ClippingMode::Type clippingMode )
205 mClippingMode = clippingMode;
209 * Gets the Clipping Mode for this node.
210 * @return The ClippingMode of this node
212 ClippingMode::Type GetClippingMode() const
214 return mClippingMode;
218 * Add a renderer to the node
219 * @param[in] renderer The renderer added to the node
221 void AddRenderer( Renderer* renderer );
224 * Remove a renderer from the node
225 * @param[in] renderer The renderer to be removed
227 void RemoveRenderer( Renderer* renderer );
230 * Get the renderer at the given index
233 Renderer* GetRendererAt( unsigned int index ) const
235 return mRenderer[index];
239 * Retrieve the number of renderers for the node
241 unsigned int GetRendererCount()
243 return mRenderer.Size();
246 // Containment methods
249 * Query whether a node is the root node. Root nodes cannot have a parent node.
250 * A node becomes a root node, when it is installed by UpdateManager.
251 * @return True if the node is a root node.
259 * Set whether a node is the root node. Root nodes cannot have a parent node.
260 * This method should only be called by UpdateManager.
261 * @pre When isRoot is true, the node must not have a parent.
262 * @param[in] isRoot Whether the node is now a root node.
264 void SetRoot(bool isRoot);
267 * Retrieve the parent of a Node.
268 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
276 * Retrieve the parent of a Node.
277 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
279 const Node* GetParent() const
285 * Connect a node to the scene-graph.
286 * @pre A node cannot be added to itself.
287 * @pre The parent node is connected to the scene-graph.
288 * @pre The childNode does not already have a parent.
289 * @pre The childNode is not a root node.
290 * @param[in] childNode The child to add.
292 void ConnectChild( Node* childNode );
295 * Disconnect a child (& its children) from the scene-graph.
296 * @pre childNode is a child of this Node.
297 * @param[in] updateBufferIndex The current update buffer index.
298 * @param[in] childNode The node to disconnect.
300 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
303 * Retrieve the children a Node.
304 * @return The container of children.
306 const NodeContainer& GetChildren() const
312 * Retrieve the children a Node.
313 * @return The container of children.
315 NodeContainer& GetChildren()
323 * Flag that one of the node values has changed in the current frame.
324 * @param[in] flag The flag to set.
326 void SetDirtyFlag(NodePropertyFlags flag)
332 * Flag that all of the node values are dirty.
334 void SetAllDirtyFlags()
336 mDirtyFlags = AllFlags;
340 * Query whether a node is dirty.
341 * @return The dirty flags
343 int GetDirtyFlags() const;
346 * Retrieve the parent-origin of the node.
347 * @return The parent-origin.
349 const Vector3& GetParentOrigin() const
351 return mParentOrigin.Get(0);
355 * Sets both the local & base parent-origins of the node.
356 * @param[in] origin The new local & base parent-origins.
358 void SetParentOrigin(const Vector3& origin)
360 mParentOrigin.Set(0,origin );
364 * Retrieve the anchor-point of the node.
365 * @return The anchor-point.
367 const Vector3& GetAnchorPoint() const
369 return mAnchorPoint.Get(0);
373 * Sets both the local & base anchor-points of the node.
374 * @param[in] anchor The new local & base anchor-points.
376 void SetAnchorPoint(const Vector3& anchor)
378 mAnchorPoint.Set(0, anchor );
382 * Retrieve the local position of the node, relative to its parent.
383 * @param[in] bufferIndex The buffer to read from.
384 * @return The local position.
386 const Vector3& GetPosition(BufferIndex bufferIndex) const
388 if( mTransformId != INVALID_TRANSFORM_ID )
390 return mPosition.Get(bufferIndex);
393 return Vector3::ZERO;
397 * Retrieve the position of the node derived from the position of all its parents.
398 * @return The world position.
400 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
402 return mWorldPosition.Get(bufferIndex);
406 * Set whether the Node inherits position.
407 * @param[in] inherit True if the parent position is inherited.
409 void SetInheritPosition(bool inherit)
411 if( mTransformId != INVALID_TRANSFORM_ID )
413 mTransformManager->SetInheritPosition( mTransformId, inherit );
418 * Retrieve the local orientation of the node, relative to its parent.
419 * @param[in] bufferIndex The buffer to read from.
420 * @return The local orientation.
422 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
424 if( mTransformId != INVALID_TRANSFORM_ID )
426 return mOrientation.Get(0);
429 return Quaternion::IDENTITY;
433 * Retrieve the orientation of the node derived from the rotation of all its parents.
434 * @param[in] bufferIndex The buffer to read from.
435 * @return The world rotation.
437 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
439 return mWorldOrientation.Get(0);
443 * Set whether the Node inherits orientation.
444 * @param[in] inherit True if the parent orientation is inherited.
446 void SetInheritOrientation(bool inherit)
448 if( mTransformId != INVALID_TRANSFORM_ID )
450 mTransformManager->SetInheritOrientation(mTransformId, inherit );
455 * Retrieve the local scale of the node, relative to its parent.
456 * @param[in] bufferIndex The buffer to read from.
457 * @return The local scale.
459 const Vector3& GetScale(BufferIndex bufferIndex) const
461 if( mTransformId != INVALID_TRANSFORM_ID )
463 return mScale.Get(0);
471 * Retrieve the scale of the node derived from the scale of all its parents.
472 * @param[in] bufferIndex The buffer to read from.
473 * @return The world scale.
475 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
477 return mWorldScale.Get(0);
481 * Set whether the Node inherits scale.
482 * @param inherit True if the Node inherits scale.
484 void SetInheritScale( bool inherit )
486 if( mTransformId != INVALID_TRANSFORM_ID )
488 mTransformManager->SetInheritScale(mTransformId, inherit );
493 * Retrieve the visibility of the node.
494 * @param[in] bufferIndex The buffer to read from.
495 * @return True if the node is visible.
497 bool IsVisible(BufferIndex bufferIndex) const
499 return mVisible[bufferIndex];
503 * Retrieve the opacity of the node.
504 * @param[in] bufferIndex The buffer to read from.
505 * @return The opacity.
507 float GetOpacity(BufferIndex bufferIndex) const
509 return mColor[bufferIndex].a;
513 * Retrieve the color of the node.
514 * @param[in] bufferIndex The buffer to read from.
517 const Vector4& GetColor(BufferIndex bufferIndex) const
519 return mColor[bufferIndex];
523 * Sets the color of the node derived from the color of all its parents.
524 * @param[in] color The world color.
525 * @param[in] updateBufferIndex The current update buffer index.
527 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
529 mWorldColor.Set( updateBufferIndex, color );
533 * Sets the color of the node derived from the color of all its parents.
534 * This method should only be called when the parents world color is up-to-date.
535 * @pre The node has a parent.
536 * @param[in] updateBufferIndex The current update buffer index.
538 void InheritWorldColor( BufferIndex updateBufferIndex )
540 DALI_ASSERT_DEBUG(mParent != NULL);
543 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
545 const Vector4& ownColor = mColor[updateBufferIndex];
546 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
548 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
550 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
552 else if( mColorMode == USE_PARENT_COLOR )
554 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
556 else // USE_OWN_COLOR
558 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
563 * Copies the previous inherited scale, if this changed in the previous frame.
564 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
565 * does not need to be recalculated in the current frame.
566 * @param[in] updateBufferIndex The current update buffer index.
568 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
570 mWorldColor.CopyPrevious( updateBufferIndex );
574 * Retrieve the color of the node, possibly derived from the color
575 * of all its parents, depending on the value of mColorMode.
576 * @param[in] bufferIndex The buffer to read from.
577 * @return The world color.
579 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
581 return mWorldColor[bufferIndex];
585 * Set the color mode. This specifies whether the Node uses its own color,
586 * or inherits its parent color.
587 * @param[in] colorMode The new color mode.
589 void SetColorMode(ColorMode colorMode)
591 mColorMode = colorMode;
593 SetDirtyFlag(ColorFlag);
597 * Retrieve the color mode.
598 * @return The color mode.
600 ColorMode GetColorMode() const
606 * Retrieve the size of the node.
607 * @param[in] bufferIndex The buffer to read from.
610 const Vector3& GetSize(BufferIndex bufferIndex) const
612 if( mTransformId != INVALID_TRANSFORM_ID )
617 return Vector3::ZERO;
621 * Retrieve the bounding sphere of the node
622 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
624 const Vector4& GetBoundingSphere() const
626 if( mTransformId != INVALID_TRANSFORM_ID )
628 return mTransformManager->GetBoundingSphere( mTransformId );
631 return Vector4::ZERO;
635 * Retrieve world matrix and size of the node
636 * @param[out] The local to world matrix of the node
637 * @param[out] size The current size of the node
639 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
641 if( mTransformId != INVALID_TRANSFORM_ID )
643 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
648 * Checks if local matrix has changed since last update
649 * @return true if local matrix has changed, false otherwise
651 bool IsLocalMatrixDirty() const
653 return (mTransformId != INVALID_TRANSFORM_ID) &&
654 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
658 * Retrieve the cached world-matrix of a node.
659 * @param[in] bufferIndex The buffer to read from.
660 * @return The world-matrix.
662 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
664 return mWorldMatrix.Get(bufferIndex);
668 * Mark the node as exclusive to a single RenderTask.
669 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
671 void SetExclusiveRenderTask( RenderTask* renderTask )
673 mExclusiveRenderTask = renderTask;
677 * Query whether the node is exclusive to a single RenderTask.
678 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
680 RenderTask* GetExclusiveRenderTask() const
682 return mExclusiveRenderTask;
686 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
687 * @param[in] drawMode The new draw-mode to use.
689 void SetDrawMode( const DrawMode::Type& drawMode )
691 mDrawMode = drawMode;
695 * Returns whether node is an overlay or not.
696 * @return True if node is an overlay, false otherwise.
698 DrawMode::Type GetDrawMode() const
704 * Returns the transform id of the node
705 * @return The transform component id of the node
707 TransformId GetTransformId() const
713 * Equality operator, checks for identity, not values.
716 bool operator==( const Node* rhs ) const
718 return ( this == rhs );
722 * @brief Sets the sibling order of the node
723 * @param[in] order The new order
725 void SetDepthIndex( unsigned int depthIndex ){ mDepthIndex = depthIndex; }
728 * @brief Get the depth index of the node
729 * @return Current depth index
731 unsigned int GetDepthIndex(){ return mDepthIndex; }
734 * @brief Sets the boolean which states whether the position should use the anchor-point.
735 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
737 void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
739 if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
741 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
742 mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
748 * @copydoc UniformMap::Add
750 void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
753 * @copydoc UniformMap::Remove
755 void RemoveUniformMapping( const std::string& uniformName );
758 * Prepare the node for rendering.
759 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
760 * @param[in] updateBufferIndex The current update buffer index.
762 void PrepareRender( BufferIndex bufferIndex );
765 * Called by UpdateManager when the node is added.
766 * Creates a new transform component in the transform manager and initialize all the properties
767 * related to the transformation
768 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
770 void CreateTransform( SceneGraph::TransformManager* transformManager );
775 void ResetDirtyFlags( BufferIndex updateBufferIndex );
780 * Set the parent of a Node.
781 * @param[in] parentNode the new parent.
783 void SetParent( Node& parentNode );
788 * Protected constructor; See also Node::New()
789 * @param[in] id The Unique ID of the actor creating the node
791 Node( unsigned int id );
794 * Protected virtual destructor; See also Node::Delete( Node* )
795 * Kept protected to allow destructor chaining from layer
799 private: // from NodeDataProvider
802 * @copydoc NodeDataProvider::GetModelMatrix
804 virtual const Matrix& GetModelMatrix( unsigned int bufferId ) const
806 return GetWorldMatrix( bufferId );
810 * @copydoc NodeDataProvider::GetRenderColor
812 virtual const Vector4& GetRenderColor( unsigned int bufferId ) const
814 return GetWorldColor( bufferId );
817 public: // From UniformMapDataProvider
819 * @copydoc UniformMapDataProvider::GetUniformMapChanged
821 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
823 return mUniformMapChanged[bufferIndex];
827 * @copydoc UniformMapDataProvider::GetUniformMap
829 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
831 return mCollectedUniformMap[bufferIndex];
840 Node& operator=(const Node& rhs);
843 * Recursive helper to disconnect a Node and its children.
844 * Disconnected Nodes have no parent or children.
845 * @param[in] updateBufferIndex The current update buffer index.
847 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
849 public: // Default properties
851 TransformManager* mTransformManager;
852 TransformId mTransformId;
853 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the TransformFlag dirty when changed
854 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the TransformFlag dirty when changed
855 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
856 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
857 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
858 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
860 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
861 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
863 // Inherited properties; read-only from public API
865 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
866 TransformManagerVector3Input mWorldScale;
867 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
868 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
869 InheritedColor mWorldColor; ///< Full inherited color
871 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
872 const unsigned int mId; ///< The Unique ID of the node.
876 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
877 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
879 RendererContainer mRenderer; ///< Container of renderers; not owned
881 NodeContainer mChildren; ///< Container of children; not owned
883 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
884 unsigned int mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
885 uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
886 uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
888 uint32_t mDepthIndex; ///< Depth index of the node
890 // flags, compressed to bitfield
891 unsigned int mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
892 int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
893 DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn
894 ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
895 ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node
896 bool mIsRoot:1; ///< True if the node cannot have a parent
897 bool mIsLayer:1; ///< True if the node is a layer
898 bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
899 // Changes scope, should be at end of class
900 DALI_LOG_OBJECT_STRING_DECLARATION;
905 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
907 typedef MessageValue1< Node, bool > LocalType;
909 // Reserve some memory inside the message queue
910 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
912 // Construct message in the message queue memory; note that delete should not be called on the return value
913 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
916 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
918 typedef MessageValue1< Node, Vector3 > LocalType;
920 // Reserve some memory inside the message queue
921 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
923 // Construct message in the message queue memory; note that delete should not be called on the return value
924 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
927 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
929 typedef MessageValue1< Node, Vector3 > LocalType;
931 // Reserve some memory inside the message queue
932 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
934 // Construct message in the message queue memory; note that delete should not be called on the return value
935 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
938 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
940 typedef MessageValue1< Node, bool > LocalType;
942 // Reserve some memory inside the message queue
943 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
945 // Construct message in the message queue memory; note that delete should not be called on the return value
946 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
949 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
951 typedef MessageValue1< Node, bool > LocalType;
953 // Reserve some memory inside the message queue
954 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
956 // Construct message in the message queue memory; note that delete should not be called on the return value
957 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
960 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
962 typedef MessageValue1< Node, ColorMode > LocalType;
964 // Reserve some memory inside the message queue
965 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
967 // Construct message in the message queue memory; note that delete should not be called on the return value
968 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
971 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
973 typedef MessageValue1< Node, DrawMode::Type > LocalType;
975 // Reserve some memory inside the message queue
976 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
978 // Construct message in the message queue memory; note that delete should not be called on the return value
979 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
982 inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
984 typedef MessageValue1< Node, Renderer* > LocalType;
986 // Reserve some memory inside the message queue
987 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
989 // Construct message in the message queue memory; note that delete should not be called on the return value
990 new (slot) LocalType( &node, &Node::AddRenderer, renderer );
993 inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
995 typedef MessageValue1< Node, Renderer* > LocalType;
997 // Reserve some memory inside the message queue
998 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1000 // Construct message in the message queue memory; note that delete should not be called on the return value
1001 new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
1004 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, unsigned int depthIndex )
1006 typedef MessageValue1< Node, unsigned int > LocalType;
1008 // Reserve some memory inside the message queue
1009 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1011 // Construct message in the message queue memory; note that delete should not be called on the return value
1012 new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
1015 inline void SetClippingModeMessage( EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode )
1017 typedef MessageValue1< Node, ClippingMode::Type > LocalType;
1019 // Reserve some memory inside the message queue
1020 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1022 // Construct message in the message queue memory; note that delete should not be called on the return value
1023 new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
1026 inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
1028 typedef MessageValue1< Node, bool > LocalType;
1030 // Reserve some memory inside the message queue
1031 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1033 // Construct message in the message queue memory; note that delete should not be called on the return value
1034 new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
1037 } // namespace SceneGraph
1039 // Template specialisation for OwnerPointer<Node>, because delete is protected
1041 inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
1043 if (mObject != NULL)
1045 Dali::Internal::SceneGraph::Node::Delete(mObject);
1049 } // namespace Internal
1051 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1053 inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer )
1055 Dali::Internal::SceneGraph::Node::Delete(pointer);
1059 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H