1 #ifndef DALI_INTERNAL_SCENE_GRAPH_NODE_H
2 #define DALI_INTERNAL_SCENE_GRAPH_NODE_H
5 * Copyright (c) 2017 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/devel-api/common/set-wrapper.h>
25 #include <dali/public-api/math/quaternion.h>
26 #include <dali/public-api/math/math-utils.h>
27 #include <dali/public-api/math/vector3.h>
28 #include <dali/integration-api/debug.h>
29 #include <dali/internal/common/message.h>
30 #include <dali/internal/event/common/event-thread-services.h>
31 #include <dali/internal/render/data-providers/node-data-provider.h>
32 #include <dali/internal/update/common/animatable-property.h>
33 #include <dali/internal/update/common/property-owner.h>
34 #include <dali/internal/update/common/property-vector3.h>
35 #include <dali/internal/update/common/scene-graph-buffers.h>
36 #include <dali/internal/update/common/inherited-property.h>
37 #include <dali/internal/update/manager/transform-manager.h>
38 #include <dali/internal/update/manager/transform-manager-property.h>
39 #include <dali/internal/update/nodes/node-declarations.h>
40 #include <dali/internal/update/rendering/scene-graph-renderer.h>
48 // Value types used by messages.
49 template <> struct ParameterType< ColorMode > : public BasicType< ColorMode > {};
50 template <> struct ParameterType< PositionInheritanceMode > : public BasicType< PositionInheritanceMode > {};
51 template <> struct ParameterType< ClippingMode::Type > : public BasicType< ClippingMode::Type > {};
62 * Flag whether property has changed, during the Update phase.
64 enum NodePropertyFlags
67 TransformFlag = 0x001,
72 SortModifierFlag = 0x020,
73 ChildDeletedFlag = 0x040,
76 static const int AllFlags = ( ChildDeletedFlag << 1 ) - 1; // all the flags
79 * Size is not inherited. VisibleFlag is inherited
81 static const int InheritedDirtyFlags = TransformFlag | VisibleFlag | ColorFlag | OverlayFlag;
83 // Flags which require the scene renderable lists to be updated
84 static const int RenderableUpdateFlags = TransformFlag | SortModifierFlag | ChildDeletedFlag;
87 * Node is the base class for all nodes in the Scene Graph.
89 * Each node provides a transformation which applies to the node and
90 * its children. Node data is double-buffered. This allows an update
91 * thread to modify node data, without interferring with another
92 * thread reading the values from the previous update traversal.
94 class Node : public PropertyOwner, public NodeDataProvider
99 static const PositionInheritanceMode DEFAULT_POSITION_INHERITANCE_MODE;
100 static const ColorMode DEFAULT_COLOR_MODE;
105 * Construct a new Node.
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
145 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth )
147 // We only set up the sort value if we have a 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( DALI_LIKELY( 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;
168 * Gets the Clipping ID for this node.
169 * @return The Clipping ID for this node.
171 uint32_t GetClippingId() const
173 return mClippingSortModifier >> 1u;
177 * Gets the Clipping Depth for this node.
178 * @return The Clipping Depth for this node.
180 uint32_t GetClippingDepth() const
182 return mClippingDepth;
186 * Sets the clipping mode for this node.
187 * @param[in] clippingMode The ClippingMode to set
189 void SetClippingMode( const ClippingMode::Type clippingMode )
191 mClippingMode = clippingMode;
195 * Gets the Clipping Mode for this node.
196 * @return The ClippingMode of this node
198 ClippingMode::Type GetClippingMode() const
200 return mClippingMode;
204 * Add a renderer to the node
205 * @param[in] renderer The renderer added to the node
207 void AddRenderer( Renderer* renderer );
210 * Remove a renderer from the node
211 * @param[in] renderer The renderer to be removed
213 void RemoveRenderer( Renderer* renderer );
216 * Get the renderer at the given index
219 Renderer* GetRendererAt( unsigned int index ) const
221 return mRenderer[index];
225 * Retrieve the number of renderers for the node
227 unsigned int GetRendererCount()
229 return mRenderer.Size();
232 // Containment methods
235 * Query whether a node is the root node. Root nodes cannot have a parent node.
236 * A node becomes a root node, when it is installed by UpdateManager.
237 * @return True if the node is a root node.
245 * Set whether a node is the root node. Root nodes cannot have a parent node.
246 * This method should only be called by UpdateManager.
247 * @pre When isRoot is true, the node must not have a parent.
248 * @param[in] isRoot Whether the node is now a root node.
250 void SetRoot(bool isRoot);
253 * Retrieve the parent of a Node.
254 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
262 * Retrieve the parent of a Node.
263 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
265 const Node* GetParent() const
271 * Connect a node to the scene-graph.
272 * @pre A node cannot be added to itself.
273 * @pre The parent node is connected to the scene-graph.
274 * @pre The childNode does not already have a parent.
275 * @pre The childNode is not a root node.
276 * @param[in] childNode The child to add.
278 void ConnectChild( Node* childNode );
281 * Disconnect a child (& its children) from the scene-graph.
282 * @pre childNode is a child of this Node.
283 * @param[in] updateBufferIndex The current update buffer index.
284 * @param[in] childNode The node to disconnect.
286 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
289 * Retrieve the children a Node.
290 * @return The container of children.
292 const NodeContainer& GetChildren() const
298 * Retrieve the children a Node.
299 * @return The container of children.
301 NodeContainer& GetChildren()
309 * Flag that one of the node values has changed in the current frame.
310 * @param[in] flag The flag to set.
312 void SetDirtyFlag(NodePropertyFlags flag)
318 * Flag that all of the node values are dirty.
320 void SetAllDirtyFlags()
322 mDirtyFlags = AllFlags;
326 * Query whether a node is dirty.
327 * @return The dirty flags
329 int GetDirtyFlags() const;
332 * Retrieve the parent-origin of the node.
333 * @return The parent-origin.
335 const Vector3& GetParentOrigin() const
337 return mParentOrigin.Get(0);
341 * Sets both the local & base parent-origins of the node.
342 * @param[in] origin The new local & base parent-origins.
344 void SetParentOrigin(const Vector3& origin)
346 mParentOrigin.Set(0,origin );
350 * Retrieve the anchor-point of the node.
351 * @return The anchor-point.
353 const Vector3& GetAnchorPoint() const
355 return mAnchorPoint.Get(0);
359 * Sets both the local & base anchor-points of the node.
360 * @param[in] anchor The new local & base anchor-points.
362 void SetAnchorPoint(const Vector3& anchor)
364 mAnchorPoint.Set(0, anchor );
368 * Retrieve the local position of the node, relative to its parent.
369 * @param[in] bufferIndex The buffer to read from.
370 * @return The local position.
372 const Vector3& GetPosition(BufferIndex bufferIndex) const
374 if( mTransformId != INVALID_TRANSFORM_ID )
376 return mPosition.Get(bufferIndex);
379 return Vector3::ZERO;
383 * Retrieve the position of the node derived from the position of all its parents.
384 * @return The world position.
386 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
388 return mWorldPosition.Get(bufferIndex);
392 * Set whether the Node inherits position.
393 * @param[in] inherit True if the parent position is inherited.
395 void SetInheritPosition(bool inherit)
397 if( mTransformId != INVALID_TRANSFORM_ID )
399 mTransformManager->SetInheritPosition( mTransformId, inherit );
404 * Retrieve the local orientation of the node, relative to its parent.
405 * @param[in] bufferIndex The buffer to read from.
406 * @return The local orientation.
408 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
410 if( mTransformId != INVALID_TRANSFORM_ID )
412 return mOrientation.Get(0);
415 return Quaternion::IDENTITY;
419 * Retrieve the orientation of the node derived from the rotation of all its parents.
420 * @param[in] bufferIndex The buffer to read from.
421 * @return The world rotation.
423 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
425 return mWorldOrientation.Get(0);
429 * Set whether the Node inherits orientation.
430 * @param[in] inherit True if the parent orientation is inherited.
432 void SetInheritOrientation(bool inherit)
434 if( mTransformId != INVALID_TRANSFORM_ID )
436 mTransformManager->SetInheritOrientation(mTransformId, inherit );
441 * Retrieve the local scale of the node, relative to its parent.
442 * @param[in] bufferIndex The buffer to read from.
443 * @return The local scale.
445 const Vector3& GetScale(BufferIndex bufferIndex) const
447 if( mTransformId != INVALID_TRANSFORM_ID )
449 return mScale.Get(0);
457 * Retrieve the scale of the node derived from the scale of all its parents.
458 * @param[in] bufferIndex The buffer to read from.
459 * @return The world scale.
461 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
463 return mWorldScale.Get(0);
467 * Set whether the Node inherits scale.
468 * @param inherit True if the Node inherits scale.
470 void SetInheritScale( bool inherit )
472 if( mTransformId != INVALID_TRANSFORM_ID )
474 mTransformManager->SetInheritScale(mTransformId, inherit );
479 * Retrieve the visibility of the node.
480 * @param[in] bufferIndex The buffer to read from.
481 * @return True if the node is visible.
483 bool IsVisible(BufferIndex bufferIndex) const
485 return mVisible[bufferIndex];
489 * Retrieve the opacity of the node.
490 * @param[in] bufferIndex The buffer to read from.
491 * @return The opacity.
493 float GetOpacity(BufferIndex bufferIndex) const
495 return mColor[bufferIndex].a;
499 * Retrieve the color of the node.
500 * @param[in] bufferIndex The buffer to read from.
503 const Vector4& GetColor(BufferIndex bufferIndex) const
505 return mColor[bufferIndex];
509 * Sets the color of the node derived from the color of all its parents.
510 * @param[in] color The world color.
511 * @param[in] updateBufferIndex The current update buffer index.
513 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
515 mWorldColor.Set( updateBufferIndex, color );
519 * Sets the color of the node derived from the color of all its parents.
520 * This method should only be called when the parents world color is up-to-date.
521 * @pre The node has a parent.
522 * @param[in] updateBufferIndex The current update buffer index.
524 void InheritWorldColor( BufferIndex updateBufferIndex )
526 DALI_ASSERT_DEBUG(mParent != NULL);
529 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
531 const Vector4& ownColor = mColor[updateBufferIndex];
532 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
534 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
536 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
538 else if( mColorMode == USE_PARENT_COLOR )
540 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
542 else // USE_OWN_COLOR
544 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
549 * Copies the previous inherited scale, if this changed in the previous frame.
550 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
551 * does not need to be recalculated in the current frame.
552 * @param[in] updateBufferIndex The current update buffer index.
554 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
556 mWorldColor.CopyPrevious( updateBufferIndex );
560 * Retrieve the color of the node, possibly derived from the color
561 * of all its parents, depending on the value of mColorMode.
562 * @param[in] bufferIndex The buffer to read from.
563 * @return The world color.
565 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
567 return mWorldColor[bufferIndex];
571 * Set the color mode. This specifies whether the Node uses its own color,
572 * or inherits its parent color.
573 * @param[in] colorMode The new color mode.
575 void SetColorMode(ColorMode colorMode)
577 mColorMode = colorMode;
579 SetDirtyFlag(ColorFlag);
583 * Retrieve the color mode.
584 * @return The color mode.
586 ColorMode GetColorMode() const
592 * Retrieve the size of the node.
593 * @param[in] bufferIndex The buffer to read from.
596 const Vector3& GetSize(BufferIndex bufferIndex) const
598 if( mTransformId != INVALID_TRANSFORM_ID )
603 return Vector3::ZERO;
607 * Retrieve the bounding sphere of the node
608 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
610 const Vector4& GetBoundingSphere() const
612 if( mTransformId != INVALID_TRANSFORM_ID )
614 return mTransformManager->GetBoundingSphere( mTransformId );
617 return Vector4::ZERO;
621 * Retrieve world matrix and size of the node
622 * @param[out] The local to world matrix of the node
623 * @param[out] size The current size of the node
625 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
627 if( mTransformId != INVALID_TRANSFORM_ID )
629 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
634 * Checks if local matrix has changed since last update
635 * @return true if local matrix has changed, false otherwise
637 bool IsLocalMatrixDirty() const
639 return (mTransformId != INVALID_TRANSFORM_ID) &&
640 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
644 * Retrieve the cached world-matrix of a node.
645 * @param[in] bufferIndex The buffer to read from.
646 * @return The world-matrix.
648 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
650 return mWorldMatrix.Get(bufferIndex);
654 * Mark the node as exclusive to a single RenderTask.
655 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
657 void SetExclusiveRenderTask( RenderTask* renderTask )
659 mExclusiveRenderTask = renderTask;
663 * Query whether the node is exclusive to a single RenderTask.
664 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
666 RenderTask* GetExclusiveRenderTask() const
668 return mExclusiveRenderTask;
672 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
673 * @param[in] drawMode The new draw-mode to use.
675 void SetDrawMode( const DrawMode::Type& drawMode )
677 mDrawMode = drawMode;
681 * Returns whether node is an overlay or not.
682 * @return True if node is an overlay, false otherwise.
684 DrawMode::Type GetDrawMode() const
690 * Returns the transform id of the node
691 * @return The transform component id of the node
693 TransformId GetTransformId() const
699 * Equality operator, checks for identity, not values.
702 bool operator==( const Node* rhs ) const
704 return ( this == rhs );
708 * @brief Sets the sibling order of the node
709 * @param[in] order The new order
711 void SetDepthIndex( unsigned int depthIndex ){ mDepthIndex = depthIndex; }
714 * @brief Get the depth index of the node
715 * @return Current depth index
717 unsigned int GetDepthIndex(){ return mDepthIndex; }
720 * @brief Sets the boolean which states whether the position should use the anchor-point.
721 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
723 void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
725 if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
727 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
728 mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
734 * @copydoc UniformMap::Add
736 void AddUniformMapping( UniformPropertyMapping* map );
739 * @copydoc UniformMap::Remove
741 void RemoveUniformMapping( const std::string& uniformName );
744 * Prepare the node for rendering.
745 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
746 * @param[in] updateBufferIndex The current update buffer index.
748 void PrepareRender( BufferIndex bufferIndex );
751 * Called by UpdateManager when the node is added.
752 * Creates a new transform component in the transform manager and initialize all the properties
753 * related to the transformation
754 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
756 void CreateTransform( SceneGraph::TransformManager* transformManager );
761 * Set the parent of a Node.
762 * @param[in] parentNode the new parent.
764 void SetParent( Node& parentNode );
769 * Protected constructor; See also Node::New()
774 * Protected virtual destructor; See also Node::Delete( Node* )
775 * Kept protected to allow destructor chaining from layer
779 private: // from NodeDataProvider
782 * @copydoc NodeDataProvider::GetModelMatrix
784 virtual const Matrix& GetModelMatrix( unsigned int bufferId ) const
786 return GetWorldMatrix( bufferId );
790 * @copydoc NodeDataProvider::GetRenderColor
792 virtual const Vector4& GetRenderColor( unsigned int bufferId ) const
794 return GetWorldColor( bufferId );
797 public: // From UniformMapDataProvider
799 * @copydoc UniformMapDataProvider::GetUniformMapChanged
801 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
803 return mUniformMapChanged[bufferIndex];
807 * @copydoc UniformMapDataProvider::GetUniformMap
809 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
811 return mCollectedUniformMap[bufferIndex];
820 Node& operator=(const Node& rhs);
823 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
825 virtual void ResetDefaultProperties( BufferIndex updateBufferIndex );
828 * Recursive helper to disconnect a Node and its children.
829 * Disconnected Nodes have no parent or children.
830 * @param[in] updateBufferIndex The current update buffer index.
832 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
834 public: // Default properties
836 TransformManager* mTransformManager;
837 TransformId mTransformId;
838 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the TransformFlag dirty when changed
839 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the TransformFlag dirty when changed
840 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
841 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
842 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
843 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
845 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
846 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
848 // Inherited properties; read-only from public API
850 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
851 TransformManagerVector3Input mWorldScale;
852 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
853 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
854 InheritedColor mWorldColor; ///< Full inherited color
856 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
860 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
861 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
863 RendererContainer mRenderer; ///< Container of renderers; not owned
865 NodeContainer mChildren; ///< Container of children; not owned
867 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
868 unsigned int mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
869 uint32_t mClippingDepth; ///< The number of clipping nodes deep this node is
871 uint32_t mDepthIndex; ///< Depth index of the node
873 // flags, compressed to bitfield
874 unsigned int mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
875 int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
876 DrawMode::Type mDrawMode:2; ///< How the Node and its children should be drawn
877 ColorMode mColorMode:2; ///< Determines whether mWorldColor is inherited, 2 bits is enough
878 ClippingMode::Type mClippingMode:2; ///< The clipping mode of this node
879 bool mIsRoot:1; ///< True if the node cannot have a parent
880 bool mIsLayer:1; ///< True if the node is a layer
881 bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
882 // Changes scope, should be at end of class
883 DALI_LOG_OBJECT_STRING_DECLARATION;
888 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
890 typedef MessageValue1< Node, bool > LocalType;
892 // Reserve some memory inside the message queue
893 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
895 // Construct message in the message queue memory; note that delete should not be called on the return value
896 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
899 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
901 typedef MessageValue1< Node, Vector3 > LocalType;
903 // Reserve some memory inside the message queue
904 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
906 // Construct message in the message queue memory; note that delete should not be called on the return value
907 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
910 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
912 typedef MessageValue1< Node, Vector3 > LocalType;
914 // Reserve some memory inside the message queue
915 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
917 // Construct message in the message queue memory; note that delete should not be called on the return value
918 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
921 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
923 typedef MessageValue1< Node, bool > LocalType;
925 // Reserve some memory inside the message queue
926 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
928 // Construct message in the message queue memory; note that delete should not be called on the return value
929 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
932 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
934 typedef MessageValue1< Node, bool > LocalType;
936 // Reserve some memory inside the message queue
937 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
939 // Construct message in the message queue memory; note that delete should not be called on the return value
940 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
943 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
945 typedef MessageValue1< Node, ColorMode > LocalType;
947 // Reserve some memory inside the message queue
948 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
950 // Construct message in the message queue memory; note that delete should not be called on the return value
951 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
954 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
956 typedef MessageValue1< Node, DrawMode::Type > LocalType;
958 // Reserve some memory inside the message queue
959 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
961 // Construct message in the message queue memory; note that delete should not be called on the return value
962 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
965 inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
967 typedef MessageValue1< Node, Renderer* > LocalType;
969 // Reserve some memory inside the message queue
970 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
972 // Construct message in the message queue memory; note that delete should not be called on the return value
973 new (slot) LocalType( &node, &Node::AddRenderer, renderer );
976 inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
978 typedef MessageValue1< Node, Renderer* > LocalType;
980 // Reserve some memory inside the message queue
981 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
983 // Construct message in the message queue memory; note that delete should not be called on the return value
984 new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
987 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, unsigned int depthIndex )
989 typedef MessageValue1< Node, unsigned int > LocalType;
991 // Reserve some memory inside the message queue
992 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
994 // Construct message in the message queue memory; note that delete should not be called on the return value
995 new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
998 inline void SetClippingModeMessage( EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode )
1000 typedef MessageValue1< Node, ClippingMode::Type > LocalType;
1002 // Reserve some memory inside the message queue
1003 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1005 // Construct message in the message queue memory; note that delete should not be called on the return value
1006 new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
1009 inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
1011 typedef MessageValue1< Node, bool > LocalType;
1013 // Reserve some memory inside the message queue
1014 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1016 // Construct message in the message queue memory; note that delete should not be called on the return value
1017 new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
1020 } // namespace SceneGraph
1022 // Template specialisation for OwnerPointer<Node>, because delete is protected
1024 void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset();
1026 } // namespace Internal
1028 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1030 void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer );
1034 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H