1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__
5 * Copyright (c) 2014 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/common/vector-wrapper.h>
23 #include <dali/public-api/common/dali-common.h>
24 #include <dali/integration-api/resource-declarations.h>
25 #include <dali/internal/common/message.h>
26 #include <dali/internal/common/type-abstraction-enums.h>
27 #include <dali/internal/event/common/event-thread-services.h>
28 #include <dali/internal/update/nodes/node.h>
29 #include <dali/internal/update/node-attachments/node-attachment.h>
30 #include <dali/internal/update/common/scene-graph-buffers.h>
31 #include <dali/internal/update/animation/scene-graph-animation.h>
32 #include <dali/internal/update/common/scene-graph-property-notification.h>
33 #include <dali/internal/update/modeling/scene-graph-animatable-mesh.h>
34 #include <dali/internal/update/nodes/scene-graph-layer.h>
35 #include <dali/internal/render/shaders/shader.h>
43 class GlSyncAbstraction;
44 class RenderController;
45 struct DynamicsWorldSettings;
47 } // namespace Integration
52 class PropertyNotifier;
53 struct DynamicsWorldSettings;
54 class NotificationManager;
55 class CompleteNotificationInterface;
56 class ResourceManager;
59 // value types used by messages
60 template <> struct ParameterType< PropertyNotification::NotifyMode >
61 : public BasicType< PropertyNotification::NotifyMode > {};
76 typedef OwnerContainer< AnimatableMesh* > AnimatableMeshContainer;
77 typedef OwnerContainer< Material* > MaterialContainer;
80 * UpdateManager holds a scene graph i.e. a tree of nodes.
81 * It controls the Update traversal, in which nodes are repositioned/animated,
82 * and organises the culling and rendering of the scene.
89 * Construct a new UpdateManager.
90 * @param[in] notificationManager This should be notified when animations have finished.
91 * @param[in] glSyncAbstraction Used to determine when framebuffers are ready
92 * @param[in] animationFinishedNotifier The CompleteNotificationInterface that handles animation completions
93 * @param[in] propertyNotifier The PropertyNotifier
94 * @param[in] resourceManager The resource manager used to load textures etc.
95 * @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
96 * @param[in] controller After messages are flushed, we request a render from the RenderController.
97 * @param[in] renderManager This is responsible for rendering the results of each "update".
98 * @param[in] renderQueue Used to queue messages for the next render.
99 * @param[in] textureCache Used for caching textures.
100 * @param[in] touchResampler Used for re-sampling touch events.
102 UpdateManager( NotificationManager& notificationManager,
103 Integration::GlSyncAbstraction& glSyncAbstraction,
104 CompleteNotificationInterface& animationFinishedNotifier,
105 PropertyNotifier& propertyNotifier,
106 ResourceManager& resourceManager,
107 DiscardQueue& discardQueue,
108 Integration::RenderController& controller,
109 RenderManager& renderManager,
110 RenderQueue& renderQueue,
111 TextureCache& textureCache,
112 TouchResampler& touchResampler );
115 * Destructor. Not virtual as this is not a base class
119 // Node connection methods
122 * Get the scene graph side list of RenderTasks.
123 * @param[in] systemLevel True if using the system-level overlay.
124 * @return The list of render tasks
126 RenderTaskList* GetRenderTaskList( bool systemLevel );
129 * Installs a new layer as the root node.
130 * @pre The UpdateManager does not already have an installed root node.
131 * @pre The layer is of derived Node type Layer.
132 * @pre The layer does not have a parent.
133 * @param[in] layer The new root node.
134 * @param[in] systemLevel True if using the system-level overlay.
135 * @post The node is owned by UpdateManager.
137 void InstallRoot( Layer* layer, bool systemLevel );
140 * Add a Node; UpdateManager takes ownership.
141 * @pre The node does not have a parent.
142 * @param[in] node The node to add.
144 void AddNode( Node* node );
147 * Connect a Node to the scene-graph.
148 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
149 * @pre The node does not already have a parent.
150 * @param[in] node The new parent node.
151 * @param[in] node The node to connect.
153 void ConnectNode( Node* parent, Node* node, int index );
156 * Disconnect a Node from the scene-graph.
157 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
158 * @pre The node has a parent.
159 * @param[in] node The node to disconnect.
161 void DisconnectNode( Node* node );
164 * Called when a property is set on a disconnected Node (via public API)
165 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
166 * @pre The node does not have a parent.
167 * @param[in] node The node to set as "active".
169 void SetNodeActive( Node* node );
172 * Destroy a Node owned by UpdateManager.
173 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
174 * In the following update, the previously queued Nodes may be deleted.
175 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
176 * @param[in] node The node to destroy.
178 void DestroyNode( Node* node );
181 * Attach an object to a Node.
182 * The UpdateManager is responsible for calling NodeAttachment::Initialize().
183 * @param[in] node The node which will own the attachment.
184 * @param[in] attachment The object to attach.
186 void AttachToNode( Node* node, NodeAttachment* attachment );
189 * Add a newly created object.
190 * @param[in] object The object to add.
191 * @post The object is owned by UpdateManager.
193 void AddObject( PropertyOwner* object );
197 * @param[in] object The object to remove.
199 void RemoveObject( PropertyOwner* object );
204 * Add a newly created animation.
205 * @param[in] animation The animation to add.
206 * @post The animation is owned by UpdateManager.
208 void AddAnimation( Animation* animation );
212 * @param[in] animation The animation to stop.
214 void StopAnimation( Animation* animation );
217 * Remove an animation.
218 * @param[in] animation The animation to remove.
220 void RemoveAnimation( Animation* animation );
223 * Query whether any animations are currently running.
224 * @return True if any animations are running.
226 bool IsAnimationRunning() const;
228 // Property Notification
231 * Add a newly created property notification
232 * @param[in] propertyNotification The notification to add
233 * @post The propertyNotification is owned by UpdateManager.
235 void AddPropertyNotification( PropertyNotification* propertyNotification );
238 * Remove a property notification
239 * @param[in] propertyNotification The notification to remove
241 void RemovePropertyNotification( PropertyNotification* propertyNotification );
244 * Set Notify state for PropertyNotification
245 * @param[in] propertyNotification The notification to remove
246 * @param[in] notifyMode The notification mode.
248 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
253 * Add a newly created shader.
254 * @param[in] shader The shader to add.
255 * @post The shader is owned by the UpdateManager.
257 void AddShader(Shader* shader);
261 * @pre The shader has been added to the UpdateManager.
262 * @param[in] shader The shader to remove.
263 * @post The shader is destroyed.
265 void RemoveShader(Shader* shader);
268 * Set the shader program for a specified GeometryType to a Shader object
269 * @param[in] shader The shader to modify
270 * @param[in] geometryType The GeometryType to map to the program
271 * @param[in] subType The program subtype
272 * @param[in] resourceId A ResourceManager ticket ID for the program data (source and compiled binary)
273 * @param[in] shaderHash hash key created with vertex and fragment shader code
274 * @param[in] modifiesGeometry True if the vertex shader modifies geometry
276 void SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, Integration::ResourceId resourceId, size_t shaderHash, bool modifiesGeometry );
279 * Add an animatable mesh
280 * @param[in] animatableMesh The animatable mesh to add.
281 * @post the animatableMesh is owned by the UpdateManager.
283 void AddAnimatableMesh( AnimatableMesh* animatableMesh );
286 * Remove an animatable mesh
287 * @pre The animatable mesh has been added to the update manager
288 * @param[in] animatableMesh The animatable mesh to add.
290 void RemoveAnimatableMesh( AnimatableMesh* animatableMesh );
294 * @param[in] material The material to add
295 * @post the material remains owned by its event object
297 void AddMaterial(Material* material);
301 * @pre The material has been added to the UpdateManager
302 * @param[in] material The material to remove
304 void RemoveMaterial(Material* material);
307 * Add a newly created gesture.
308 * @param[in] gesture The gesture to add.
309 * @post The gesture is owned by the UpdateManager.
311 void AddGesture( PanGesture* gesture );
315 * @pre The gesture has been added to the UpdateManager.
316 * @param[in] gesture The gesture to remove.
317 * @post The gesture is destroyed.
319 void RemoveGesture( PanGesture* gesture );
321 // Message queue handling
324 * Reserve space for another message in the queue; this must then be initialized by the caller.
325 * The message will be read from the update-thread after the next FlushMessages is called.
326 * @post Calling this method may invalidate any previously returned slots.
327 * @param[in] size The message size with respect to the size of type "char".
328 * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
329 * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
330 * @return A pointer to the first char allocated for the message.
332 unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true );
335 * @return the current event-buffer index.
337 BufferIndex GetEventBufferIndex() const
339 // inlined as its called often from event thread
340 return mSceneGraphBuffers.GetEventBufferIndex();
344 * Called by the event-thread to signal that FlushQueue will be called
345 * e.g. when it has finished event processing.
347 void EventProcessingStarted();
350 * Flush the set of messages, which were previously stored with QueueMessage().
351 * Calls to this thread-safe method should be minimized, to avoid thread blocking.
353 * @return True if there are messages to process.
360 * Performs an Update traversal on the scene-graph.
361 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
362 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
363 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
364 * @return True if further updates are required e.g. during animations.
366 unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
369 * Set the background color i.e. the glClear color used at the beginning of each frame.
370 * @param[in] color The new background color.
372 void SetBackgroundColor(const Vector4& color);
375 * Set the default surface rect.
376 * @param[in] rect The rect value representing the surface.
378 void SetDefaultSurfaceRect( const Rect<int>& rect );
381 * @copydoc Dali::Stage::KeepRendering()
383 void KeepRendering( float durationSeconds );
386 * Sets the depths of all layers.
387 * @param layers The layers in depth order.
388 * @param[in] systemLevel True if using the system-level overlay.
390 void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
392 #ifdef DALI_DYNAMICS_SUPPORT
395 * Initialize the dynamics world
396 * @param[in] world The dynamics world
397 * @param[in] worldSettings The dynamics world settings
398 * @param[in] debugShader The shader used for rendering dynamics debug information
400 void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings );
403 * Terminate the dynamics world
405 void TerminateDynamicsWorld();
407 #endif // DALI_DYNAMICS_SUPPORT
412 UpdateManager(const UpdateManager&);
415 UpdateManager& operator=(const UpdateManager& rhs);
418 * Helper to check whether the update-thread should keep going.
419 * @param[in] elapsedSeconds The time in seconds since the previous update.
420 * @return True if the update-thread should keep going.
422 unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
425 * Helper to calculate new camera setup when root node resizes.
426 * @param[in] updateBuffer The buffer to read the root node size from.
428 void UpdateProjectionAndViewMatrices(int updateBuffer);
431 * Post process resources that have been updated by renderer
433 void PostProcessResources();
436 * Helper to reset a Node properties.
437 * @param[in] node The node.
439 void ResetNodeProperty( Node& node );
442 * Helper to reset all Node properties
444 void ResetProperties();
447 * Perform gesture updates.
448 * @param[in] lastVSyncTime The last VSync time in milliseconds.
449 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
450 * @return true, if any properties were updated.
452 bool ProcessGestures( unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
455 * Perform animation updates
456 * @param[in] elapsedSeconds time since last frame
458 void Animate( float elapsedSeconds );
461 * Perform constraint updates.
462 * @note Applies constraints to nodes first (depth first search order).
463 * Then shader constraints second (construction order)
465 void ApplyConstraints();
468 * Perform property notification updates
470 void ProcessPropertyNotifications();
473 * Update the default camera.
474 * This must be altered to match the root Node for 2D layouting.
475 * @param[in] updateBuffer The buffer to read the root node size from.
477 void UpdateDefaultCamera( int updateBuffer );
480 * Update node shaders, opacity, geometry etc.
485 * Update animatable meshes
487 void UpdateMeshes( BufferIndex updateBufferIndex, AnimatableMeshContainer& meshes );
490 * Update materials - Ensure all render materials are updated with texture pointers
493 void UpdateMaterials( BufferIndex updateBufferIndex, MaterialContainer& materials );
496 * PrepareMaterials - Ensure updated material properties are sent to render materials
498 void PrepareMaterials( BufferIndex updateBufferIndex, MaterialContainer& materials );
502 // needs to be direct member so that getter for event buffer can be inlined
503 SceneGraphBuffers mSceneGraphBuffers;
510 // Messages for UpdateManager
512 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
514 typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
516 // Reserve some memory inside the message queue
517 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
519 // Construct message in the message queue memory; note that delete should not be called on the return value
520 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
523 inline void AddNodeMessage( UpdateManager& manager, Node& node )
525 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
527 // Reserve some memory inside the message queue
528 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
530 // Construct message in the message queue memory; note that delete should not be called on the return value
531 new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
534 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild, int index )
536 // Update thread can edit the object
537 Node& parent = const_cast< Node& >( constParent );
538 Node& child = const_cast< Node& >( constChild );
540 typedef MessageValue3< UpdateManager, Node*, Node*, int > LocalType;
542 // Reserve some memory inside the message queue
543 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
545 // Construct message in the message queue memory; note that delete should not be called on the return value
546 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child, index );
549 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
551 // Scene graph thread can modify this object.
552 Node& node = const_cast< Node& >( constNode );
554 typedef MessageValue1< UpdateManager, Node* > LocalType;
556 // Reserve some memory inside the message queue
557 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
559 // Construct message in the message queue memory; note that delete should not be called on the return value
560 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
563 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
565 // Scene graph thread can destroy this object.
566 Node& node = const_cast< Node& >( constNode );
568 typedef MessageValue1< UpdateManager, Node* > LocalType;
570 // Reserve some memory inside the message queue
571 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
573 // Construct message in the message queue memory; note that delete should not be called on the return value
574 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
577 inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment )
579 // Scene graph thread can modify this object.
580 Node& parent = const_cast< Node& >( constParent );
582 typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType;
584 // Reserve some memory inside the message queue
585 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
587 // Construct message in the message queue memory; note that delete should not be called on the return value
588 new (slot) LocalType( &manager, &UpdateManager::AttachToNode, &parent, attachment );
591 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
593 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
595 // Reserve some memory inside the message queue
596 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
598 // Construct message in the message queue memory; note that delete should not be called on the return value
599 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
602 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
604 typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
606 // Reserve some memory inside the message queue
607 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
609 // Construct message in the message queue memory; note that delete should not be called on the return value
610 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
613 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
615 typedef MessageValue1< UpdateManager, Animation* > LocalType;
617 // Reserve some memory inside the message queue
618 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
620 // Construct message in the message queue memory; note that delete should not be called on the return value
621 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
624 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
626 // The scene-graph thread owns this object so it can safely edit it.
627 Animation& animation = const_cast< Animation& >( constAnimation );
629 typedef MessageValue1< UpdateManager, Animation* > LocalType;
631 // Reserve some memory inside the message queue
632 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
634 // Construct message in the message queue memory; note that delete should not be called on the return value
635 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
638 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
640 // The scene-graph thread owns this object so it can safely edit it.
641 Animation& animation = const_cast< Animation& >( constAnimation );
643 typedef MessageValue1< UpdateManager, Animation* > LocalType;
645 // Reserve some memory inside the message queue
646 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
648 // Construct message in the message queue memory; note that delete should not be called on the return value
649 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
652 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
654 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
656 // Reserve some memory inside the message queue
657 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
659 // Construct message in the message queue memory; note that delete should not be called on the return value
660 new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
663 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
665 // The scene-graph thread owns this object so it can safely edit it.
666 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
668 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
670 // Reserve some memory inside the message queue
671 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
673 // Construct message in the message queue memory; note that delete should not be called on the return value
674 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
677 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
678 const PropertyNotification* constPropertyNotification,
679 PropertyNotification::NotifyMode notifyMode )
681 // The scene-graph thread owns this object so it can safely edit it.
682 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
684 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
686 // Reserve some memory inside the message queue
687 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
689 // Construct message in the message queue memory; note that delete should not be called on the return value
690 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
693 // The render thread can safely change the Shader
694 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
696 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
698 // Reserve some memory inside the message queue
699 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
701 // Construct message in the message queue memory; note that delete should not be called on the return value
702 new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
705 // The render thread can safely change the Shader
706 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
708 typedef MessageValue1< UpdateManager, Shader* > LocalType;
710 // Reserve some memory inside the message queue
711 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
713 // Construct message in the message queue memory; note that delete should not be called on the return value
714 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
717 inline void SetShaderProgramMessage( UpdateManager& manager,
719 GeometryType geometryType,
720 ShaderSubTypes subType,
721 Integration::ResourceId resourceId,
723 bool modifiesGeometry )
725 typedef MessageValue6< UpdateManager, Shader*, GeometryType, ShaderSubTypes, Integration::ResourceId, size_t, bool > LocalType;
727 // Reserve some memory inside the message queue
728 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
730 // Construct message in the message queue memory; note that delete should not be called on the return value
731 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, geometryType, subType, resourceId, shaderHash, modifiesGeometry );
734 // The render thread can safely change the AnimatableMesh
735 inline void AddAnimatableMeshMessage( UpdateManager& manager, AnimatableMesh& animatableMesh )
737 typedef MessageValue1< UpdateManager, AnimatableMesh* > LocalType;
739 // Reserve some memory inside the message queue
740 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
742 // Construct message in the message queue memory; note that delete should not be called on the return value
743 new (slot) LocalType( &manager, &UpdateManager::AddAnimatableMesh, &animatableMesh );
746 // The render thread can safely change the AnimatableMesh
747 inline void RemoveAnimatableMeshMessage( UpdateManager& manager, AnimatableMesh& animatableMesh )
749 typedef MessageValue1< UpdateManager, AnimatableMesh* > LocalType;
751 // Reserve some memory inside the message queue
752 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
754 // Construct message in the message queue memory; note that delete should not be called on the return value
755 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimatableMesh, &animatableMesh );
759 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
761 typedef MessageValue1< UpdateManager, Vector4 > LocalType;
763 // Reserve some memory inside the message queue
764 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
766 // Construct message in the message queue memory; note that delete should not be called on the return value
767 new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
770 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
772 typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
774 // Reserve some memory inside the message queue
775 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
777 // Construct message in the message queue memory; note that delete should not be called on the return value
778 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
781 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
783 typedef MessageValue1< UpdateManager, float > LocalType;
785 // Reserve some memory inside the message queue
786 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
788 // Construct message in the message queue memory; note that delete should not be called on the return value
789 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
793 * Create a message for setting the depth of a layer
794 * @param[in] manager The update manager
795 * @param[in] layers list of layers
796 * @param[in] systemLevel True if the layers are added via the SystemOverlay API
798 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
800 typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
802 // Reserve some memory inside the message queue
803 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
805 // Construct message in the message queue memory; note that delete should not be called on the return value
806 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
809 inline void AddMaterialMessage( UpdateManager& manager, Material* material )
811 typedef MessageValue1< UpdateManager, Material* > LocalType;
813 // Reserve some memory inside the message queue
814 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
816 // Construct message in the message queue memory; note that delete should not be called on the return value
817 new (slot) LocalType( &manager, &UpdateManager::AddMaterial, material );
820 inline void RemoveMaterialMessage( UpdateManager& manager, Material* material )
822 typedef MessageValue1< UpdateManager, Material* > LocalType;
824 // Reserve some memory inside the message queue
825 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
827 // Construct message in the message queue memory; note that delete should not be called on the return value
828 new (slot) LocalType( &manager, &UpdateManager::RemoveMaterial, material );
831 inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
833 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
835 // Reserve some memory inside the message queue
836 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
838 // Construct message in the message queue memory; note that delete should not be called on the return value
839 new (slot) LocalType( &manager, &UpdateManager::AddGesture, gesture );
842 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
844 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
846 // Reserve some memory inside the message queue
847 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
849 // Construct message in the message queue memory; note that delete should not be called on the return value
850 new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture );
853 #ifdef DALI_DYNAMICS_SUPPORT
856 inline void InitializeDynamicsWorldMessage( UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings )
858 typedef MessageValue2< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings* > LocalType;
860 // Reserve some memory inside the message queue
861 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
863 // Construct message in the message queue memory; note that delete should not be called on the return value
864 new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings );
867 inline void TerminateDynamicsWorldMessage(UpdateManager& manager)
869 typedef Message< UpdateManager > LocalType;
871 // Reserve some memory inside the message queue
872 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
874 // Construct message in the message queue memory; note that delete should not be called on the return value
875 new (slot) LocalType( &manager, &UpdateManager::TerminateDynamicsWorld );
878 #endif // DALI_DYNAMICS_SUPPORT
880 } // namespace SceneGraph
882 } // namespace Internal
886 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__