1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_NODE_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_NODE_H__
5 * Copyright (c) 2015 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/node-attachments/node-attachment-declarations.h>
41 #include <dali/internal/update/rendering/scene-graph-renderer.h>
49 // value types used by messages
50 template <> struct ParameterType< ColorMode > : public BasicType< ColorMode > {};
51 template <> struct ParameterType< PositionInheritanceMode > : public BasicType< PositionInheritanceMode > {};
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.
81 * VisibleFlag is inherited so that attachments can be synchronized with nodes after they become visible
83 static const int InheritedDirtyFlags = TransformFlag | VisibleFlag | ColorFlag | OverlayFlag;
85 // Flags which require the scene renderable lists to be updated
86 static const int RenderableUpdateFlags = TransformFlag | SortModifierFlag | ChildDeletedFlag;
89 * Node is the base class for all nodes in the Scene Graph.
91 * Each node provides a transformation which applies to the node and
92 * its children. Node data is double-buffered. This allows an update
93 * thread to modify node data, without interferring with another
94 * thread reading the values from the previous update traversal.
96 class Node : public PropertyOwner, public NodeDataProvider
101 static const PositionInheritanceMode DEFAULT_POSITION_INHERITANCE_MODE;
102 static const ColorMode DEFAULT_COLOR_MODE;
107 * Construct a new Node.
117 * Overriden delete operator
118 * Deletes the node from its global memory pool
120 void operator delete( void* ptr );
123 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
130 * Query whether the node is a layer.
131 * @return True if the node is a layer.
135 return (GetLayer() != NULL);
139 * Convert a node to a layer.
140 * @return A pointer to the layer, or NULL.
142 virtual Layer* GetLayer()
150 * Attach an object to this Node; This should only be done by UpdateManager::AttachToNode.
151 * @pre The Node does not already have an attachment.
152 * @param[in] attachment The object to attach.
154 void Attach( NodeAttachment& attachment );
157 * Query the node if it has an attachment.
158 * @return True if it has an attachment.
160 bool HasAttachment() const
166 * Add a renderer to the node
167 * @param[in] renderer The renderer added to the node
169 void AddRenderer( Renderer* renderer )
171 //Check that it has not been already added
172 unsigned int rendererCount( mRenderer.Size() );
173 for( unsigned int i(0); i<rendererCount; ++i )
175 if( mRenderer[i] == renderer )
177 //Renderer already in the list
182 //If it is the first renderer added, make sure the world transform will be calculated
183 //in the next update as world transform is not computed if node has no renderers
184 if( rendererCount == 0 )
186 mDirtyFlags |= TransformFlag;
189 mRenderer.PushBack( renderer );
193 * Remove a renderer from the node
194 * @param[in] renderer The renderer to be removed
196 void RemoveRenderer( Renderer* renderer );
199 * Get the renderer at the given index
202 Renderer* GetRendererAt( unsigned int index )
204 return mRenderer[index];
208 * Retrieve the number of renderers for the node
210 unsigned int GetRendererCount()
212 return mRenderer.Size();
216 * Retreive the object attached to this node.
217 * @return The attachment.
219 NodeAttachment& GetAttachment() const
224 // Containment methods
227 * Query whether a node is the root node. Root nodes cannot have a parent node.
228 * A node becomes a root node, when it is installed by UpdateManager.
229 * @return True if the node is a root node.
237 * Set whether a node is the root node. Root nodes cannot have a parent node.
238 * This method should only be called by UpdateManager.
239 * @pre When isRoot is true, the node must not have a parent.
240 * @param[in] isRoot Whether the node is now a root node.
242 void SetRoot(bool isRoot);
245 * Retrieve the parent of a Node.
246 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
254 * Retrieve the parent of a Node.
255 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
257 const Node* GetParent() const
263 * Connect a node to the scene-graph.
264 * @pre A node cannot be added to itself.
265 * @pre The parent node is connected to the scene-graph.
266 * @pre The childNode does not already have a parent.
267 * @pre The childNode is not a root node.
268 * @param[in] childNode The child to add.
270 void ConnectChild( Node* childNode );
273 * Disconnect a child (& its children) from the scene-graph.
274 * @pre childNode is a child of this Node.
275 * @param[in] updateBufferIndex The current update buffer index.
276 * @param[in] childNode The node to disconnect.
278 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
281 * Retrieve the children a Node.
282 * @return The container of children.
284 const NodeContainer& GetChildren() const
290 * Retrieve the children a Node.
291 * @return The container of children.
293 NodeContainer& GetChildren()
301 * Flag that one of the node values has changed in the current frame.
302 * @param[in] flag The flag to set.
304 void SetDirtyFlag(NodePropertyFlags flag)
310 * Flag that all of the node values are dirty.
312 void SetAllDirtyFlags()
314 mDirtyFlags = AllFlags;
318 * Query whether a node is dirty.
319 * @return The dirty flags
321 int GetDirtyFlags() const;
324 * Query whether a node is clean.
325 * @return True if the node is clean.
329 return ( NothingFlag == GetDirtyFlags() );
333 * Retrieve the parent-origin of the node.
334 * @return The parent-origin.
336 const Vector3& GetParentOrigin() const
338 return mParentOrigin.Get(0);
342 * Sets both the local & base parent-origins of the node.
343 * @param[in] origin The new local & base parent-origins.
345 void SetParentOrigin(const Vector3& origin)
347 mParentOrigin.Set(0,origin );
351 * Retrieve the anchor-point of the node.
352 * @return The anchor-point.
354 const Vector3& GetAnchorPoint() const
356 return mAnchorPoint.Get(0);
360 * Sets both the local & base anchor-points of the node.
361 * @param[in] anchor The new local & base anchor-points.
363 void SetAnchorPoint(const Vector3& anchor)
365 mAnchorPoint.Set(0, anchor );
369 * Retrieve the local position of the node, relative to its parent.
370 * @param[in] bufferIndex The buffer to read from.
371 * @return The local position.
373 const Vector3& GetPosition(BufferIndex bufferIndex) const
375 if( mTransformId != INVALID_TRANSFORM_ID )
377 return mPosition.Get(bufferIndex);
380 return Vector3::ZERO;
384 * Retrieve the position of the node derived from the position of all its parents.
385 * @return The world position.
387 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
389 return mWorldPosition.Get(bufferIndex);
393 * Set whether the Node inherits position.
394 * @param[in] inherit True if the parent position is inherited.
396 void SetInheritPosition(bool inherit)
398 if( mTransformId != INVALID_TRANSFORM_ID )
400 mTransformManager->SetInheritPosition( mTransformId, inherit );
405 * Set the position inheritance mode.
406 * @see Dali::Actor::PositionInheritanceMode
407 * @param[in] mode The new position inheritance mode.
409 void SetPositionInheritanceMode( PositionInheritanceMode mode )
411 if( mTransformId != INVALID_TRANSFORM_ID )
413 mTransformManager->SetInheritPosition(mTransformId, mode == INHERIT_PARENT_POSITION );
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 * Checks if local matrix has changed since last update
622 * @return true if local matrix has changed, false otherwise
624 bool IsLocalMatrixDirty() const
626 return (mTransformId != INVALID_TRANSFORM_ID) &&
627 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
632 * Retrieve the cached world-matrix of a node.
633 * @param[in] bufferIndex The buffer to read from.
634 * @return The world-matrix.
636 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
638 return mWorldMatrix.Get(bufferIndex);
642 * Mark the node as exclusive to a single RenderTask.
643 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
645 void SetExclusiveRenderTask( RenderTask* renderTask )
647 mExclusiveRenderTask = renderTask;
651 * Query whether the node is exclusive to a single RenderTask.
652 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
654 RenderTask* GetExclusiveRenderTask() const
656 return mExclusiveRenderTask;
660 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
661 * @param[in] drawMode The new draw-mode to use.
663 void SetDrawMode( const DrawMode::Type& drawMode )
665 mDrawMode = drawMode;
669 * Returns whether node is an overlay or not.
670 * @return True if node is an overlay, false otherwise.
672 DrawMode::Type GetDrawMode() const
678 * Returns the transform id of the node
679 * @return The transform component id of the node
681 TransformId GetTransformId() const
687 * Equality operator, checks for identity, not values.
690 bool operator==( const Node* rhs ) const
699 unsigned short GetDepth() const
706 * @copydoc UniformMap::Add
708 void AddUniformMapping( UniformPropertyMapping* map );
711 * @copydoc UniformMap::Remove
713 void RemoveUniformMapping( const std::string& uniformName );
716 * Prepare the node for rendering.
717 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
718 * @param[in] updateBufferIndex The current update buffer index.
720 void PrepareRender( BufferIndex bufferIndex );
723 * Called by UpdateManager when the node is added.
724 * Creates a new transform component in the transform manager and initialize all the properties
725 * related to the transformation
726 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
728 void CreateTransform( SceneGraph::TransformManager* transformManager );
733 * Set the parent of a Node.
734 * @param[in] parentNode the new parent.
736 void SetParent(Node& parentNode);
739 * Protected constructor; See also Node::New()
743 private: // from NodeDataProvider
746 * @copydoc NodeDataProvider::GetModelMatrix
748 virtual const Matrix& GetModelMatrix( unsigned int bufferId ) const
750 return GetWorldMatrix( bufferId );
754 * @copydoc NodeDataProvider::GetRenderColor
756 virtual const Vector4& GetRenderColor( unsigned int bufferId ) const
758 return GetWorldColor( bufferId );
761 public: // From UniformMapDataProvider
763 * @copydoc UniformMapDataProvider::GetUniformMapChanged
765 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
767 return mUniformMapChanged[bufferIndex];
771 * @copydoc UniformMapDataProvider::GetUniformMap
773 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
775 return mCollectedUniformMap[bufferIndex];
784 Node& operator=(const Node& rhs);
787 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
789 virtual void ResetDefaultProperties( BufferIndex updateBufferIndex );
792 * Recursive helper to disconnect a Node and its children.
793 * Disconnected Nodes have no parent or children.
794 * @param[in] updateBufferIndex The current update buffer index.
796 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
798 public: // Default properties
800 TransformManager* mTransformManager;
801 TransformId mTransformId;
802 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the TransformFlag dirty when changed
803 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the TransformFlag dirty when changed
804 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
805 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
806 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
807 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
809 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
810 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
812 // Inherited properties; read-only from public API
814 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
815 TransformManagerVector3Input mWorldScale;
816 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
817 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
818 InheritedColor mWorldColor; ///< Full inherited color
822 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
823 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
825 NodeAttachmentOwner mAttachment; ///< Optional owned attachment
826 RendererContainer mRenderer; ///< Container of renderers; not owned
828 NodeContainer mChildren; ///< Container of children; not owned
830 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
831 unsigned int mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
832 unsigned int mRegenerateUniformMap : 2; ///< Indicate if the uniform map has to be regenerated this frame
834 // flags, compressed to bitfield
835 unsigned short mDepth: 12; ///< Depth in the hierarchy
836 int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
838 bool mIsRoot:1; ///< True if the node cannot have a parent
840 DrawMode::Type mDrawMode:2; ///< How the Node and its children should be drawn
841 ColorMode mColorMode:2; ///< Determines whether mWorldColor is inherited, 2 bits is enough
843 // Changes scope, should be at end of class
844 DALI_LOG_OBJECT_STRING_DECLARATION;
849 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
851 typedef MessageValue1< Node, bool > LocalType;
853 // Reserve some memory inside the message queue
854 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
856 // Construct message in the message queue memory; note that delete should not be called on the return value
857 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
860 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
862 typedef MessageValue1< Node, Vector3 > LocalType;
864 // Reserve some memory inside the message queue
865 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
867 // Construct message in the message queue memory; note that delete should not be called on the return value
868 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
871 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
873 typedef MessageValue1< Node, Vector3 > LocalType;
875 // Reserve some memory inside the message queue
876 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
878 // Construct message in the message queue memory; note that delete should not be called on the return value
879 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
882 inline void SetPositionInheritanceModeMessage( EventThreadServices& eventThreadServices, const Node& node, PositionInheritanceMode mode )
884 typedef MessageValue1< Node, PositionInheritanceMode > LocalType;
886 // Reserve some memory inside the message queue
887 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
889 // Construct message in the message queue memory; note that delete should not be called on the return value
890 new (slot) LocalType( &node, &Node::SetPositionInheritanceMode, mode );
893 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
895 typedef MessageValue1< Node, bool > LocalType;
897 // Reserve some memory inside the message queue
898 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
900 // Construct message in the message queue memory; note that delete should not be called on the return value
901 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
904 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
906 typedef MessageValue1< Node, bool > LocalType;
908 // Reserve some memory inside the message queue
909 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
911 // Construct message in the message queue memory; note that delete should not be called on the return value
912 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
915 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
917 typedef MessageValue1< Node, ColorMode > LocalType;
919 // Reserve some memory inside the message queue
920 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
922 // Construct message in the message queue memory; note that delete should not be called on the return value
923 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
926 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
928 typedef MessageValue1< Node, DrawMode::Type > LocalType;
930 // Reserve some memory inside the message queue
931 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
933 // Construct message in the message queue memory; note that delete should not be called on the return value
934 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
937 inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
939 typedef MessageValue1< Node, Renderer* > LocalType;
941 // Reserve some memory inside the message queue
942 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
944 // Construct message in the message queue memory; note that delete should not be called on the return value
945 new (slot) LocalType( &node, &Node::AddRenderer, renderer );
948 inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
950 typedef MessageValue1< Node, Renderer* > LocalType;
952 // Reserve some memory inside the message queue
953 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
955 // Construct message in the message queue memory; note that delete should not be called on the return value
956 new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
958 } // namespace SceneGraph
960 } // namespace Internal
964 #endif // __DALI_INTERNAL_SCENE_GRAPH_NODE_H_