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 > {};
60 class GeometryBatcher;
63 * Flag whether property has changed, during the Update phase.
65 enum NodePropertyFlags
68 TransformFlag = 0x001,
73 SortModifierFlag = 0x020,
74 ChildDeletedFlag = 0x040,
77 static const int AllFlags = ( ChildDeletedFlag << 1 ) - 1; // all the flags
80 * Size is not inherited. VisibleFlag is inherited
82 static const int InheritedDirtyFlags = TransformFlag | VisibleFlag | ColorFlag | OverlayFlag;
84 // Flags which require the scene renderable lists to be updated
85 static const int RenderableUpdateFlags = TransformFlag | SortModifierFlag | ChildDeletedFlag;
88 * Node is the base class for all nodes in the Scene Graph.
90 * Each node provides a transformation which applies to the node and
91 * its children. Node data is double-buffered. This allows an update
92 * thread to modify node data, without interferring with another
93 * thread reading the values from the previous update traversal.
95 class Node : public PropertyOwner, public NodeDataProvider
100 static const PositionInheritanceMode DEFAULT_POSITION_INHERITANCE_MODE;
101 static const ColorMode DEFAULT_COLOR_MODE;
106 * Construct a new Node.
116 * Overriden delete operator
117 * Deletes the node from its global memory pool
119 void operator delete( void* ptr );
122 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
129 * Query whether the node is a layer.
130 * @return True if the node is a layer.
134 return (GetLayer() != NULL);
138 * Convert a node to a layer.
139 * @return A pointer to the layer, or NULL.
141 virtual Layer* GetLayer()
147 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
148 * A value is calculated that can be used during sorting to increase sort speed.
149 * @param[in] clippingId The Clipping ID of the node to set
150 * @param[in] clippingDepth The Clipping Depth of the node to set
152 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth )
154 // We only set up the sort value if we have a clipping depth, IE. At least 1 clipping node has been hit.
155 // If not, if we traverse down a clipping tree and back up, and there is another
156 // node on the parent, this will have a non-zero clipping ID that must be ignored
157 if( DALI_LIKELY( clippingDepth > 0u ) )
159 mClippingDepth = clippingDepth;
161 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
162 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
163 // For the same ID, the clipping nodes must be first, so we negate the
164 // clipping enabled flag and set it as the least significant bit.
165 mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
169 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
170 mClippingSortModifier = 0u;
175 * Gets the Clipping ID for this node.
176 * @return The Clipping ID for this node.
178 uint32_t GetClippingId() const
180 return mClippingSortModifier >> 1u;
184 * Gets the Clipping Depth for this node.
185 * @return The Clipping Depth for this node.
187 uint32_t GetClippingDepth() const
189 return mClippingDepth;
193 * Sets the clipping mode for this node.
194 * @param[in] clippingMode The ClippingMode to set
196 void SetClippingMode( const ClippingMode::Type clippingMode )
198 mClippingMode = clippingMode;
202 * Gets the Clipping Mode for this node.
203 * @return The ClippingMode of this node
205 ClippingMode::Type GetClippingMode() const
207 return mClippingMode;
211 * Add a renderer to the node
212 * @param[in] renderer The renderer added to the node
214 void AddRenderer( Renderer* renderer );
217 * Remove a renderer from the node
218 * @param[in] renderer The renderer to be removed
220 void RemoveRenderer( Renderer* renderer );
223 * Get the renderer at the given index
226 Renderer* GetRendererAt( unsigned int index ) const
228 return mRenderer[index];
232 * Retrieve the number of renderers for the node
234 unsigned int GetRendererCount()
236 return mRenderer.Size();
239 // Containment methods
242 * Query whether a node is the root node. Root nodes cannot have a parent node.
243 * A node becomes a root node, when it is installed by UpdateManager.
244 * @return True if the node is a root node.
252 * Set whether a node is the root node. Root nodes cannot have a parent node.
253 * This method should only be called by UpdateManager.
254 * @pre When isRoot is true, the node must not have a parent.
255 * @param[in] isRoot Whether the node is now a root node.
257 void SetRoot(bool isRoot);
260 * Retrieve the parent of a Node.
261 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
269 * Retrieve the parent of a Node.
270 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
272 const Node* GetParent() const
278 * Connect a node to the scene-graph.
279 * @pre A node cannot be added to itself.
280 * @pre The parent node is connected to the scene-graph.
281 * @pre The childNode does not already have a parent.
282 * @pre The childNode is not a root node.
283 * @param[in] childNode The child to add.
285 void ConnectChild( Node* childNode );
288 * Disconnect a child (& its children) from the scene-graph.
289 * @pre childNode is a child of this Node.
290 * @param[in] updateBufferIndex The current update buffer index.
291 * @param[in] childNode The node to disconnect.
293 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
296 * Retrieve the children a Node.
297 * @return The container of children.
299 const NodeContainer& GetChildren() const
305 * Retrieve the children a Node.
306 * @return The container of children.
308 NodeContainer& GetChildren()
316 * Flag that one of the node values has changed in the current frame.
317 * @param[in] flag The flag to set.
319 void SetDirtyFlag(NodePropertyFlags flag)
325 * Flag that all of the node values are dirty.
327 void SetAllDirtyFlags()
329 mDirtyFlags = AllFlags;
333 * Query whether a node is dirty.
334 * @return The dirty flags
336 int GetDirtyFlags() const;
339 * Query whether a node is clean.
340 * @return True if the node is clean.
344 return ( NothingFlag == GetDirtyFlags() );
348 * Retrieve the parent-origin of the node.
349 * @return The parent-origin.
351 const Vector3& GetParentOrigin() const
353 return mParentOrigin.Get(0);
357 * Sets both the local & base parent-origins of the node.
358 * @param[in] origin The new local & base parent-origins.
360 void SetParentOrigin(const Vector3& origin)
362 mParentOrigin.Set(0,origin );
366 * Retrieve the anchor-point of the node.
367 * @return The anchor-point.
369 const Vector3& GetAnchorPoint() const
371 return mAnchorPoint.Get(0);
375 * Sets both the local & base anchor-points of the node.
376 * @param[in] anchor The new local & base anchor-points.
378 void SetAnchorPoint(const Vector3& anchor)
380 mAnchorPoint.Set(0, anchor );
384 * Retrieve the local position of the node, relative to its parent.
385 * @param[in] bufferIndex The buffer to read from.
386 * @return The local position.
388 const Vector3& GetPosition(BufferIndex bufferIndex) const
390 if( mTransformId != INVALID_TRANSFORM_ID )
392 return mPosition.Get(bufferIndex);
395 return Vector3::ZERO;
399 * Retrieve the position of the node derived from the position of all its parents.
400 * @return The world position.
402 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
404 return mWorldPosition.Get(bufferIndex);
408 * Set whether the Node inherits position.
409 * @param[in] inherit True if the parent position is inherited.
411 void SetInheritPosition(bool inherit)
413 if( mTransformId != INVALID_TRANSFORM_ID )
415 mTransformManager->SetInheritPosition( mTransformId, inherit );
420 * Retrieve the local orientation of the node, relative to its parent.
421 * @param[in] bufferIndex The buffer to read from.
422 * @return The local orientation.
424 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
426 if( mTransformId != INVALID_TRANSFORM_ID )
428 return mOrientation.Get(0);
431 return Quaternion::IDENTITY;
435 * Retrieve the orientation of the node derived from the rotation of all its parents.
436 * @param[in] bufferIndex The buffer to read from.
437 * @return The world rotation.
439 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
441 return mWorldOrientation.Get(0);
445 * Set whether the Node inherits orientation.
446 * @param[in] inherit True if the parent orientation is inherited.
448 void SetInheritOrientation(bool inherit)
450 if( mTransformId != INVALID_TRANSFORM_ID )
452 mTransformManager->SetInheritOrientation(mTransformId, inherit );
457 * Retrieve the local scale of the node, relative to its parent.
458 * @param[in] bufferIndex The buffer to read from.
459 * @return The local scale.
461 const Vector3& GetScale(BufferIndex bufferIndex) const
463 if( mTransformId != INVALID_TRANSFORM_ID )
465 return mScale.Get(0);
473 * Retrieve the scale of the node derived from the scale of all its parents.
474 * @param[in] bufferIndex The buffer to read from.
475 * @return The world scale.
477 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
479 return mWorldScale.Get(0);
483 * Set whether the Node inherits scale.
484 * @param inherit True if the Node inherits scale.
486 void SetInheritScale( bool inherit )
488 if( mTransformId != INVALID_TRANSFORM_ID )
490 mTransformManager->SetInheritScale(mTransformId, inherit );
495 * Retrieve the visibility of the node.
496 * @param[in] bufferIndex The buffer to read from.
497 * @return True if the node is visible.
499 bool IsVisible(BufferIndex bufferIndex) const
501 return mVisible[bufferIndex];
505 * Retrieve the opacity of the node.
506 * @param[in] bufferIndex The buffer to read from.
507 * @return The opacity.
509 float GetOpacity(BufferIndex bufferIndex) const
511 return mColor[bufferIndex].a;
515 * Retrieve the color of the node.
516 * @param[in] bufferIndex The buffer to read from.
519 const Vector4& GetColor(BufferIndex bufferIndex) const
521 return mColor[bufferIndex];
525 * Sets the color of the node derived from the color of all its parents.
526 * @param[in] color The world color.
527 * @param[in] updateBufferIndex The current update buffer index.
529 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
531 mWorldColor.Set( updateBufferIndex, color );
535 * Sets the color of the node derived from the color of all its parents.
536 * This method should only be called when the parents world color is up-to-date.
537 * @pre The node has a parent.
538 * @param[in] updateBufferIndex The current update buffer index.
540 void InheritWorldColor( BufferIndex updateBufferIndex )
542 DALI_ASSERT_DEBUG(mParent != NULL);
545 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
547 const Vector4& ownColor = mColor[updateBufferIndex];
548 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
550 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
552 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
554 else if( mColorMode == USE_PARENT_COLOR )
556 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
558 else // USE_OWN_COLOR
560 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
565 * Copies the previous inherited scale, if this changed in the previous frame.
566 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
567 * does not need to be recalculated in the current frame.
568 * @param[in] updateBufferIndex The current update buffer index.
570 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
572 mWorldColor.CopyPrevious( updateBufferIndex );
576 * Retrieve the color of the node, possibly derived from the color
577 * of all its parents, depending on the value of mColorMode.
578 * @param[in] bufferIndex The buffer to read from.
579 * @return The world color.
581 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
583 return mWorldColor[bufferIndex];
587 * Set the color mode. This specifies whether the Node uses its own color,
588 * or inherits its parent color.
589 * @param[in] colorMode The new color mode.
591 void SetColorMode(ColorMode colorMode)
593 mColorMode = colorMode;
595 SetDirtyFlag(ColorFlag);
599 * Retrieve the color mode.
600 * @return The color mode.
602 ColorMode GetColorMode() const
608 * Retrieve the size of the node.
609 * @param[in] bufferIndex The buffer to read from.
612 const Vector3& GetSize(BufferIndex bufferIndex) const
614 if( mTransformId != INVALID_TRANSFORM_ID )
619 return Vector3::ZERO;
623 * Retrieve the bounding sphere of the node
624 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
626 const Vector4& GetBoundingSphere() const
628 if( mTransformId != INVALID_TRANSFORM_ID )
630 return mTransformManager->GetBoundingSphere( mTransformId );
633 return Vector4::ZERO;
637 * Retrieve world matrix and size of the node
638 * @param[out] The local to world matrix of the node
639 * @param[out] size The current size of the node
641 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
643 if( mTransformId != INVALID_TRANSFORM_ID )
645 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
650 * Checks if local matrix has changed since last update
651 * @return true if local matrix has changed, false otherwise
653 bool IsLocalMatrixDirty() const
655 return (mTransformId != INVALID_TRANSFORM_ID) &&
656 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
660 * Retrieve the cached world-matrix of a node.
661 * @param[in] bufferIndex The buffer to read from.
662 * @return The world-matrix.
664 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
666 return mWorldMatrix.Get(bufferIndex);
670 * Mark the node as exclusive to a single RenderTask.
671 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
673 void SetExclusiveRenderTask( RenderTask* renderTask )
675 mExclusiveRenderTask = renderTask;
679 * Query whether the node is exclusive to a single RenderTask.
680 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
682 RenderTask* GetExclusiveRenderTask() const
684 return mExclusiveRenderTask;
688 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
689 * @param[in] drawMode The new draw-mode to use.
691 void SetDrawMode( const DrawMode::Type& drawMode )
693 mDrawMode = drawMode;
697 * Returns whether node is an overlay or not.
698 * @return True if node is an overlay, false otherwise.
700 DrawMode::Type GetDrawMode() const
706 * Returns the transform id of the node
707 * @return The transform component id of the node
709 TransformId GetTransformId() const
715 * Equality operator, checks for identity, not values.
718 bool operator==( const Node* rhs ) const
720 return ( this == rhs );
724 * @brief Turns on or off being a batch parent for the node
725 * @param[in] enabled If true the node becomes a parent for batch of its children
727 void SetIsBatchParent( bool enabled );
730 * @brief Sets the sibling order of the node
731 * @param[in] order The new order
733 void SetDepthIndex( unsigned int depthIndex ){ mDepthIndex = depthIndex; }
736 * @brief Get the depth index of the node
737 * @return Current depth index
739 unsigned int GetDepthIndex(){ return mDepthIndex; }
742 * @brief Tells if the node is a batch parent
743 * @return True if node is a batch parent, false otherwise.
745 inline bool GetIsBatchParent()
747 return mIsBatchParent;
751 * Set the batch parent of a Node.
752 * @param[in] batchParentNode The new batch parent.
754 void SetBatchParent( Node* batchParentNode );
757 * Retrieve the batch parent of a Node.
758 * @return The batch parent node, or NULL if the Node has not been added to the scene-graph.
760 Node* GetBatchParent() const
767 * @copydoc UniformMap::Add
769 void AddUniformMapping( UniformPropertyMapping* map );
772 * @copydoc UniformMap::Remove
774 void RemoveUniformMapping( const std::string& uniformName );
777 * Prepare the node for rendering.
778 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
779 * @param[in] updateBufferIndex The current update buffer index.
781 void PrepareRender( BufferIndex bufferIndex );
784 * Called by UpdateManager when the node is added.
785 * Creates a new transform component in the transform manager and initialize all the properties
786 * related to the transformation
787 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
789 void CreateTransform( SceneGraph::TransformManager* transformManager );
794 * Set the parent of a Node.
795 * @param[in] parentNode the new parent.
797 void SetParent( Node& parentNode );
802 * Protected constructor; See also Node::New()
806 private: // from NodeDataProvider
809 * @copydoc NodeDataProvider::GetModelMatrix
811 virtual const Matrix& GetModelMatrix( unsigned int bufferId ) const
813 return GetWorldMatrix( bufferId );
817 * @copydoc NodeDataProvider::GetRenderColor
819 virtual const Vector4& GetRenderColor( unsigned int bufferId ) const
821 return GetWorldColor( bufferId );
824 public: // From UniformMapDataProvider
826 * @copydoc UniformMapDataProvider::GetUniformMapChanged
828 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
830 return mUniformMapChanged[bufferIndex];
834 * @copydoc UniformMapDataProvider::GetUniformMap
836 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
838 return mCollectedUniformMap[bufferIndex];
847 Node& operator=(const Node& rhs);
850 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
852 virtual void ResetDefaultProperties( BufferIndex updateBufferIndex );
855 * Recursive helper to disconnect a Node and its children.
856 * Disconnected Nodes have no parent or children.
857 * @param[in] updateBufferIndex The current update buffer index.
859 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
861 public: // Default properties
863 TransformManager* mTransformManager;
864 TransformId mTransformId;
865 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the TransformFlag dirty when changed
866 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the TransformFlag dirty when changed
867 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
868 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
869 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
870 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
872 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
873 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
875 // Inherited properties; read-only from public API
877 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
878 TransformManagerVector3Input mWorldScale;
879 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
880 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
881 InheritedColor mWorldColor; ///< Full inherited color
883 GeometryBatcher* mGeometryBatcher; ///< A pointer to an instance of geometry batcher
884 uint32_t mBatchIndex; ///< Batch 32bit handle, BATCH_NULL_HANDLE by default
885 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
887 bool mIsBatchParent:1; ///< Marks node as a batch parent
891 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
892 Node* mBatchParent; ///< Pointer to batch parent node
893 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
895 RendererContainer mRenderer; ///< Container of renderers; not owned
897 NodeContainer mChildren; ///< Container of children; not owned
899 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
900 unsigned int mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
901 uint32_t mClippingDepth; ///< The number of clipping nodes deep this node is
903 uint32_t mDepthIndex; ///< Depth index of the node
905 // flags, compressed to bitfield
906 unsigned int mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
907 int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
908 DrawMode::Type mDrawMode:2; ///< How the Node and its children should be drawn
909 ColorMode mColorMode:2; ///< Determines whether mWorldColor is inherited, 2 bits is enough
910 ClippingMode::Type mClippingMode:2; ///< The clipping mode of this node
911 bool mIsRoot:1; ///< True if the node cannot have a parent
913 // Changes scope, should be at end of class
914 DALI_LOG_OBJECT_STRING_DECLARATION;
919 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
921 typedef MessageValue1< Node, bool > LocalType;
923 // Reserve some memory inside the message queue
924 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
926 // Construct message in the message queue memory; note that delete should not be called on the return value
927 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
930 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
932 typedef MessageValue1< Node, Vector3 > LocalType;
934 // Reserve some memory inside the message queue
935 unsigned int* 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::SetParentOrigin, origin );
941 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
943 typedef MessageValue1< Node, Vector3 > LocalType;
945 // Reserve some memory inside the message queue
946 unsigned int* 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::SetAnchorPoint, anchor );
952 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
954 typedef MessageValue1< Node, bool > LocalType;
956 // Reserve some memory inside the message queue
957 unsigned int* 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::SetInheritPosition, inherit );
963 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
965 typedef MessageValue1< Node, bool > LocalType;
967 // Reserve some memory inside the message queue
968 unsigned int* 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::SetInheritScale, inherit );
974 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
976 typedef MessageValue1< Node, ColorMode > LocalType;
978 // Reserve some memory inside the message queue
979 unsigned int* 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::SetColorMode, colorMode );
985 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
987 typedef MessageValue1< Node, DrawMode::Type > LocalType;
989 // Reserve some memory inside the message queue
990 unsigned int* 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::SetDrawMode, drawMode );
996 inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
998 typedef MessageValue1< Node, Renderer* > LocalType;
1000 // Reserve some memory inside the message queue
1001 unsigned int* 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::AddRenderer, renderer );
1007 inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
1009 typedef MessageValue1< Node, Renderer* > LocalType;
1011 // Reserve some memory inside the message queue
1012 unsigned int* 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::RemoveRenderer, renderer );
1018 inline void SetIsBatchParentMessage( EventThreadServices& eventThreadServices, const Node& node, bool isBatchParent )
1020 typedef MessageValue1< Node, bool > LocalType;
1022 // Reserve some memory inside the message queue
1023 unsigned int* 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::SetIsBatchParent, isBatchParent );
1029 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, unsigned int depthIndex )
1031 typedef MessageValue1< Node, unsigned int > LocalType;
1033 // Reserve some memory inside the message queue
1034 unsigned int* 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 unsigned int* 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 );
1052 } // namespace SceneGraph
1054 } // namespace Internal
1058 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H