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/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
144 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth )
146 // We only set up the sort value if we have a clipping depth, IE. At least 1 clipping node has been hit.
147 // If not, if we traverse down a clipping tree and back up, and there is another
148 // node on the parent, this will have a non-zero clipping ID that must be ignored
149 if( DALI_LIKELY( clippingDepth > 0u ) )
151 mClippingDepth = clippingDepth;
153 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
154 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
155 // For the same ID, the clipping nodes must be first, so we negate the
156 // clipping enabled flag and set it as the least significant bit.
157 mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
161 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
162 mClippingSortModifier = 0u;
167 * Gets the Clipping ID for this node.
168 * @return The Clipping ID for this node.
170 uint32_t GetClippingId() const
172 return mClippingSortModifier >> 1u;
176 * Gets the Clipping Depth for this node.
177 * @return The Clipping Depth for this node.
179 uint32_t GetClippingDepth() const
181 return mClippingDepth;
185 * Sets the clipping mode for this node.
186 * @param[in] clippingMode The ClippingMode to set
188 void SetClippingMode( const ClippingMode::Type clippingMode )
190 mClippingMode = clippingMode;
194 * Gets the Clipping Mode for this node.
195 * @return The ClippingMode of this node
197 ClippingMode::Type GetClippingMode() const
199 return mClippingMode;
203 * Add a renderer to the node
204 * @param[in] renderer The renderer added to the node
206 void AddRenderer( Renderer* renderer );
209 * Remove a renderer from the node
210 * @param[in] renderer The renderer to be removed
212 void RemoveRenderer( Renderer* renderer );
215 * Get the renderer at the given index
218 Renderer* GetRendererAt( unsigned int index ) const
220 return mRenderer[index];
224 * Retrieve the number of renderers for the node
226 unsigned int GetRendererCount()
228 return mRenderer.Size();
231 // Containment methods
234 * Query whether a node is the root node. Root nodes cannot have a parent node.
235 * A node becomes a root node, when it is installed by UpdateManager.
236 * @return True if the node is a root node.
244 * Set whether a node is the root node. Root nodes cannot have a parent node.
245 * This method should only be called by UpdateManager.
246 * @pre When isRoot is true, the node must not have a parent.
247 * @param[in] isRoot Whether the node is now a root node.
249 void SetRoot(bool isRoot);
252 * Retrieve the parent of a Node.
253 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
261 * Retrieve the parent of a Node.
262 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
264 const Node* GetParent() const
270 * Connect a node to the scene-graph.
271 * @pre A node cannot be added to itself.
272 * @pre The parent node is connected to the scene-graph.
273 * @pre The childNode does not already have a parent.
274 * @pre The childNode is not a root node.
275 * @param[in] childNode The child to add.
277 void ConnectChild( Node* childNode );
280 * Disconnect a child (& its children) from the scene-graph.
281 * @pre childNode is a child of this Node.
282 * @param[in] updateBufferIndex The current update buffer index.
283 * @param[in] childNode The node to disconnect.
285 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
288 * Retrieve the children a Node.
289 * @return The container of children.
291 const NodeContainer& GetChildren() const
297 * Retrieve the children a Node.
298 * @return The container of children.
300 NodeContainer& GetChildren()
308 * Flag that one of the node values has changed in the current frame.
309 * @param[in] flag The flag to set.
311 void SetDirtyFlag(NodePropertyFlags flag)
317 * Flag that all of the node values are dirty.
319 void SetAllDirtyFlags()
321 mDirtyFlags = AllFlags;
325 * Query whether a node is dirty.
326 * @return The dirty flags
328 int GetDirtyFlags() const;
331 * Retrieve the parent-origin of the node.
332 * @return The parent-origin.
334 const Vector3& GetParentOrigin() const
336 return mParentOrigin.Get(0);
340 * Sets both the local & base parent-origins of the node.
341 * @param[in] origin The new local & base parent-origins.
343 void SetParentOrigin(const Vector3& origin)
345 mParentOrigin.Set(0,origin );
349 * Retrieve the anchor-point of the node.
350 * @return The anchor-point.
352 const Vector3& GetAnchorPoint() const
354 return mAnchorPoint.Get(0);
358 * Sets both the local & base anchor-points of the node.
359 * @param[in] anchor The new local & base anchor-points.
361 void SetAnchorPoint(const Vector3& anchor)
363 mAnchorPoint.Set(0, anchor );
367 * Retrieve the local position of the node, relative to its parent.
368 * @param[in] bufferIndex The buffer to read from.
369 * @return The local position.
371 const Vector3& GetPosition(BufferIndex bufferIndex) const
373 if( mTransformId != INVALID_TRANSFORM_ID )
375 return mPosition.Get(bufferIndex);
378 return Vector3::ZERO;
382 * Retrieve the position of the node derived from the position of all its parents.
383 * @return The world position.
385 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
387 return mWorldPosition.Get(bufferIndex);
391 * Set whether the Node inherits position.
392 * @param[in] inherit True if the parent position is inherited.
394 void SetInheritPosition(bool inherit)
396 if( mTransformId != INVALID_TRANSFORM_ID )
398 mTransformManager->SetInheritPosition( mTransformId, inherit );
403 * Retrieve the local orientation of the node, relative to its parent.
404 * @param[in] bufferIndex The buffer to read from.
405 * @return The local orientation.
407 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
409 if( mTransformId != INVALID_TRANSFORM_ID )
411 return mOrientation.Get(0);
414 return Quaternion::IDENTITY;
418 * Retrieve the orientation of the node derived from the rotation of all its parents.
419 * @param[in] bufferIndex The buffer to read from.
420 * @return The world rotation.
422 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
424 return mWorldOrientation.Get(0);
428 * Set whether the Node inherits orientation.
429 * @param[in] inherit True if the parent orientation is inherited.
431 void SetInheritOrientation(bool inherit)
433 if( mTransformId != INVALID_TRANSFORM_ID )
435 mTransformManager->SetInheritOrientation(mTransformId, inherit );
440 * Retrieve the local scale of the node, relative to its parent.
441 * @param[in] bufferIndex The buffer to read from.
442 * @return The local scale.
444 const Vector3& GetScale(BufferIndex bufferIndex) const
446 if( mTransformId != INVALID_TRANSFORM_ID )
448 return mScale.Get(0);
456 * Retrieve the scale of the node derived from the scale of all its parents.
457 * @param[in] bufferIndex The buffer to read from.
458 * @return The world scale.
460 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
462 return mWorldScale.Get(0);
466 * Set whether the Node inherits scale.
467 * @param inherit True if the Node inherits scale.
469 void SetInheritScale( bool inherit )
471 if( mTransformId != INVALID_TRANSFORM_ID )
473 mTransformManager->SetInheritScale(mTransformId, inherit );
478 * Retrieve the visibility of the node.
479 * @param[in] bufferIndex The buffer to read from.
480 * @return True if the node is visible.
482 bool IsVisible(BufferIndex bufferIndex) const
484 return mVisible[bufferIndex];
488 * Retrieve the opacity of the node.
489 * @param[in] bufferIndex The buffer to read from.
490 * @return The opacity.
492 float GetOpacity(BufferIndex bufferIndex) const
494 return mColor[bufferIndex].a;
498 * Retrieve the color of the node.
499 * @param[in] bufferIndex The buffer to read from.
502 const Vector4& GetColor(BufferIndex bufferIndex) const
504 return mColor[bufferIndex];
508 * Sets the color of the node derived from the color of all its parents.
509 * @param[in] color The world color.
510 * @param[in] updateBufferIndex The current update buffer index.
512 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
514 mWorldColor.Set( updateBufferIndex, color );
518 * Sets the color of the node derived from the color of all its parents.
519 * This method should only be called when the parents world color is up-to-date.
520 * @pre The node has a parent.
521 * @param[in] updateBufferIndex The current update buffer index.
523 void InheritWorldColor( BufferIndex updateBufferIndex )
525 DALI_ASSERT_DEBUG(mParent != NULL);
528 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
530 const Vector4& ownColor = mColor[updateBufferIndex];
531 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
533 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
535 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
537 else if( mColorMode == USE_PARENT_COLOR )
539 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
541 else // USE_OWN_COLOR
543 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
548 * Copies the previous inherited scale, if this changed in the previous frame.
549 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
550 * does not need to be recalculated in the current frame.
551 * @param[in] updateBufferIndex The current update buffer index.
553 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
555 mWorldColor.CopyPrevious( updateBufferIndex );
559 * Retrieve the color of the node, possibly derived from the color
560 * of all its parents, depending on the value of mColorMode.
561 * @param[in] bufferIndex The buffer to read from.
562 * @return The world color.
564 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
566 return mWorldColor[bufferIndex];
570 * Set the color mode. This specifies whether the Node uses its own color,
571 * or inherits its parent color.
572 * @param[in] colorMode The new color mode.
574 void SetColorMode(ColorMode colorMode)
576 mColorMode = colorMode;
578 SetDirtyFlag(ColorFlag);
582 * Retrieve the color mode.
583 * @return The color mode.
585 ColorMode GetColorMode() const
591 * Retrieve the size of the node.
592 * @param[in] bufferIndex The buffer to read from.
595 const Vector3& GetSize(BufferIndex bufferIndex) const
597 if( mTransformId != INVALID_TRANSFORM_ID )
602 return Vector3::ZERO;
606 * Retrieve the bounding sphere of the node
607 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
609 const Vector4& GetBoundingSphere() const
611 if( mTransformId != INVALID_TRANSFORM_ID )
613 return mTransformManager->GetBoundingSphere( mTransformId );
616 return Vector4::ZERO;
620 * Retrieve world matrix and size of the node
621 * @param[out] The local to world matrix of the node
622 * @param[out] size The current size of the node
624 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
626 if( mTransformId != INVALID_TRANSFORM_ID )
628 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
633 * Checks if local matrix has changed since last update
634 * @return true if local matrix has changed, false otherwise
636 bool IsLocalMatrixDirty() const
638 return (mTransformId != INVALID_TRANSFORM_ID) &&
639 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
643 * Retrieve the cached world-matrix of a node.
644 * @param[in] bufferIndex The buffer to read from.
645 * @return The world-matrix.
647 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
649 return mWorldMatrix.Get(bufferIndex);
653 * Mark the node as exclusive to a single RenderTask.
654 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
656 void SetExclusiveRenderTask( RenderTask* renderTask )
658 mExclusiveRenderTask = renderTask;
662 * Query whether the node is exclusive to a single RenderTask.
663 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
665 RenderTask* GetExclusiveRenderTask() const
667 return mExclusiveRenderTask;
671 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
672 * @param[in] drawMode The new draw-mode to use.
674 void SetDrawMode( const DrawMode::Type& drawMode )
676 mDrawMode = drawMode;
680 * Returns whether node is an overlay or not.
681 * @return True if node is an overlay, false otherwise.
683 DrawMode::Type GetDrawMode() const
689 * Returns the transform id of the node
690 * @return The transform component id of the node
692 TransformId GetTransformId() const
698 * Equality operator, checks for identity, not values.
701 bool operator==( const Node* rhs ) const
703 return ( this == rhs );
707 * @brief Sets the sibling order of the node
708 * @param[in] order The new order
710 void SetDepthIndex( unsigned int depthIndex ){ mDepthIndex = depthIndex; }
713 * @brief Get the depth index of the node
714 * @return Current depth index
716 unsigned int GetDepthIndex(){ return mDepthIndex; }
719 * @brief Sets the boolean which states whether the position should use the anchor-point.
720 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
722 void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
724 if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
726 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
727 mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
733 * @copydoc UniformMap::Add
735 void AddUniformMapping( UniformPropertyMapping* map );
738 * @copydoc UniformMap::Remove
740 void RemoveUniformMapping( const std::string& uniformName );
743 * Prepare the node for rendering.
744 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
745 * @param[in] updateBufferIndex The current update buffer index.
747 void PrepareRender( BufferIndex bufferIndex );
750 * Called by UpdateManager when the node is added.
751 * Creates a new transform component in the transform manager and initialize all the properties
752 * related to the transformation
753 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
755 void CreateTransform( SceneGraph::TransformManager* transformManager );
760 * Set the parent of a Node.
761 * @param[in] parentNode the new parent.
763 void SetParent( Node& parentNode );
768 * Protected constructor; See also Node::New()
773 * Protected virtual destructor; See also Node::Delete( Node* )
774 * Kept protected to allow destructor chaining from layer
778 private: // from NodeDataProvider
781 * @copydoc NodeDataProvider::GetModelMatrix
783 virtual const Matrix& GetModelMatrix( unsigned int bufferId ) const
785 return GetWorldMatrix( bufferId );
789 * @copydoc NodeDataProvider::GetRenderColor
791 virtual const Vector4& GetRenderColor( unsigned int bufferId ) const
793 return GetWorldColor( bufferId );
796 public: // From UniformMapDataProvider
798 * @copydoc UniformMapDataProvider::GetUniformMapChanged
800 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
802 return mUniformMapChanged[bufferIndex];
806 * @copydoc UniformMapDataProvider::GetUniformMap
808 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
810 return mCollectedUniformMap[bufferIndex];
819 Node& operator=(const Node& rhs);
822 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
824 virtual void ResetDefaultProperties( BufferIndex updateBufferIndex );
827 * Recursive helper to disconnect a Node and its children.
828 * Disconnected Nodes have no parent or children.
829 * @param[in] updateBufferIndex The current update buffer index.
831 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
833 public: // Default properties
835 TransformManager* mTransformManager;
836 TransformId mTransformId;
837 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the TransformFlag dirty when changed
838 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the TransformFlag dirty when changed
839 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
840 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
841 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
842 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
844 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
845 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
847 // Inherited properties; read-only from public API
849 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
850 TransformManagerVector3Input mWorldScale;
851 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
852 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
853 InheritedColor mWorldColor; ///< Full inherited color
855 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
859 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
860 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
862 RendererContainer mRenderer; ///< Container of renderers; not owned
864 NodeContainer mChildren; ///< Container of children; not owned
866 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
867 unsigned int mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
868 uint32_t mClippingDepth; ///< The number of clipping nodes deep this node is
870 uint32_t mDepthIndex; ///< Depth index of the node
872 // flags, compressed to bitfield
873 unsigned int mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
874 int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
875 DrawMode::Type mDrawMode:2; ///< How the Node and its children should be drawn
876 ColorMode mColorMode:2; ///< Determines whether mWorldColor is inherited, 2 bits is enough
877 ClippingMode::Type mClippingMode:2; ///< The clipping mode of this node
878 bool mIsRoot:1; ///< True if the node cannot have a parent
879 bool mIsLayer:1; ///< True if the node is a layer
880 bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
881 // Changes scope, should be at end of class
882 DALI_LOG_OBJECT_STRING_DECLARATION;
887 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
889 typedef MessageValue1< Node, bool > LocalType;
891 // Reserve some memory inside the message queue
892 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
894 // Construct message in the message queue memory; note that delete should not be called on the return value
895 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
898 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
900 typedef MessageValue1< Node, Vector3 > LocalType;
902 // Reserve some memory inside the message queue
903 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
905 // Construct message in the message queue memory; note that delete should not be called on the return value
906 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
909 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
911 typedef MessageValue1< Node, Vector3 > LocalType;
913 // Reserve some memory inside the message queue
914 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
916 // Construct message in the message queue memory; note that delete should not be called on the return value
917 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
920 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
922 typedef MessageValue1< Node, bool > LocalType;
924 // Reserve some memory inside the message queue
925 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
927 // Construct message in the message queue memory; note that delete should not be called on the return value
928 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
931 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
933 typedef MessageValue1< Node, bool > LocalType;
935 // Reserve some memory inside the message queue
936 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
938 // Construct message in the message queue memory; note that delete should not be called on the return value
939 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
942 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
944 typedef MessageValue1< Node, ColorMode > LocalType;
946 // Reserve some memory inside the message queue
947 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
949 // Construct message in the message queue memory; note that delete should not be called on the return value
950 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
953 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
955 typedef MessageValue1< Node, DrawMode::Type > LocalType;
957 // Reserve some memory inside the message queue
958 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
960 // Construct message in the message queue memory; note that delete should not be called on the return value
961 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
964 inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
966 typedef MessageValue1< Node, Renderer* > LocalType;
968 // Reserve some memory inside the message queue
969 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
971 // Construct message in the message queue memory; note that delete should not be called on the return value
972 new (slot) LocalType( &node, &Node::AddRenderer, renderer );
975 inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
977 typedef MessageValue1< Node, Renderer* > LocalType;
979 // Reserve some memory inside the message queue
980 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
982 // Construct message in the message queue memory; note that delete should not be called on the return value
983 new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
986 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, unsigned int depthIndex )
988 typedef MessageValue1< Node, unsigned int > LocalType;
990 // Reserve some memory inside the message queue
991 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
993 // Construct message in the message queue memory; note that delete should not be called on the return value
994 new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
997 inline void SetClippingModeMessage( EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode )
999 typedef MessageValue1< Node, ClippingMode::Type > LocalType;
1001 // Reserve some memory inside the message queue
1002 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1004 // Construct message in the message queue memory; note that delete should not be called on the return value
1005 new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
1008 inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
1010 typedef MessageValue1< Node, bool > LocalType;
1012 // Reserve some memory inside the message queue
1013 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1015 // Construct message in the message queue memory; note that delete should not be called on the return value
1016 new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
1019 } // namespace SceneGraph
1021 // Template specialisation for OwnerPointer<Node>, because delete is protected
1023 void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset();
1025 } // namespace Internal
1027 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1029 void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer );
1033 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H