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/event-to-update.h>
27 #include <dali/internal/render/shaders/shader.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/common/double-buffered.h>
34 #include <dali/internal/update/modeling/scene-graph-animatable-mesh.h>
35 #include <dali/internal/update/nodes/scene-graph-layer.h>
36 #include <dali/internal/event/effects/shader-declarations.h>
37 #include <dali/internal/common/type-abstraction-enums.h>
44 class GlSyncAbstraction;
45 class RenderController;
46 struct DynamicsWorldSettings;
48 } // namespace Integration
53 class AnimationFinishedNotifier;
54 class PropertyNotifier;
56 struct DynamicsWorldSettings;
57 class NotificationManager;
58 class ResourceManager;
62 // value types used by messages
63 template <> struct ParameterType< PropertyNotification::NotifyMode >
64 : public BasicType< PropertyNotification::NotifyMode > {};
79 typedef OwnerContainer< AnimatableMesh* > AnimatableMeshContainer;
80 typedef OwnerContainer< Material* > MaterialContainer;
83 * UpdateManager holds a scene graph i.e. a tree of nodes.
84 * It controls the Update traversal, in which nodes are repositioned/animated,
85 * and organizes the the culling and rendering of the scene.
92 * Construct a new UpdateManager.
93 * @param[in] notificationManager This should be notified when animations have finished.
94 * @param[in] glSyncAbstraction Used to determine when framebuffers are ready
95 * @param[in] animationFinishedNotifier The AnimationFinishedNotifier
96 * @param[in] propertyNotifier The PropertyNotifier
97 * @param[in] resourceManager The resource manager used to load textures etc.
98 * @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
99 * @param[in] controller After messages are flushed, we request a render from the RenderController.
100 * @param[in] renderManager This is responsible for rendering the results of each "update".
101 * @param[in] renderQueue Used to queue messages for the next render.
102 * @param[in] textureCache Used for caching textures.
103 * @param[in] touchResampler Used for re-sampling touch events.
105 UpdateManager( NotificationManager& notificationManager,
106 Integration::GlSyncAbstraction& glSyncAbstraction,
107 AnimationFinishedNotifier& animationFinishedNotifier,
108 PropertyNotifier& propertyNotifier,
109 ResourceManager& resourceManager,
110 DiscardQueue& discardQueue,
111 Integration::RenderController& controller,
112 RenderManager& renderManager,
113 RenderQueue& renderQueue,
114 TextureCache& textureCache,
115 TouchResampler& touchResampler );
118 * Destructor. Not virtual as this is not a base class
123 * Sets a pointer to the internal render task list.
125 * The render task list is used to notify which render tasks with refresh rate REFRESH_ONCE have finished.
127 * @param[in] renderTaskList A pointer to the internal render task list.
129 void SetRenderTaskList( Internal::RenderTaskList* renderTaskList );
132 * The event-thread uses this interface to queue messages for the next update.
133 * @return The event-to-update interface.
135 EventToUpdate& GetEventToUpdate();
138 * @return the event buffer index
140 BufferIndex GetEventBufferIndex() const
142 // inlined as its called often
143 return mSceneGraphBuffers.GetEventBufferIndex();
146 // Node connection methods
149 * Get the scene graph side list of RenderTasks.
150 * @param[in] systemLevel True if using the system-level overlay.
151 * @return The list of render tasks
153 RenderTaskList* GetRenderTaskList( bool systemLevel );
156 * Installs a new layer as the root node.
157 * @pre The UpdateManager does not already have an installed root node.
158 * @pre The layer is of derived Node type Layer.
159 * @pre The layer does not have a parent.
160 * @param[in] layer The new root node.
161 * @param[in] systemLevel True if using the system-level overlay.
162 * @post The node is owned by UpdateManager.
164 void InstallRoot( Layer* layer, bool systemLevel );
167 * Add a Node; UpdateManager takes ownership.
168 * @pre The node does not have a parent.
169 * @param[in] node The node to add.
171 void AddNode( Node* node );
174 * Connect a Node to the scene-graph.
175 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
176 * @pre The node does not already have a parent.
177 * @param[in] node The new parent node.
178 * @param[in] node The node to connect.
180 void ConnectNode( Node* parent, Node* node );
183 * Disconnect a Node from the scene-graph.
184 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
185 * @pre The node has a parent.
186 * @param[in] node The node to disconnect.
188 void DisconnectNode( Node* node );
191 * Called when a property is set on a disconnected Node (via public API)
192 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
193 * @pre The node does not have a parent.
194 * @param[in] node The node to set as "active".
196 void SetNodeActive( Node* node );
199 * Destroy a Node owned by UpdateManager.
200 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
201 * In the following update, the previously queued Nodes may be deleted.
202 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
203 * @param[in] node The node to destroy.
205 void DestroyNode( Node* node );
208 * Attach an object to a Node.
209 * The UpdateManager is responsible for calling NodeAttachment::Initialize().
210 * @param[in] node The node which will own the attachment.
211 * @param[in] attachment The object to attach.
213 void AttachToNode( Node* node, NodeAttachment* attachment );
216 * Add a newly created object.
217 * @param[in] object The object to add.
218 * @post The object is owned by UpdateManager.
220 void AddObject( PropertyOwner* object );
224 * @param[in] object The object to remove.
226 void RemoveObject( PropertyOwner* object );
231 * Add a newly created animation.
232 * @param[in] animation The animation to add.
233 * @post The animation is owned by UpdateManager.
235 void AddAnimation( Animation* animation );
239 * @param[in] animation The animation to stop.
241 void StopAnimation( Animation* animation );
244 * Remove an animation.
245 * @param[in] animation The animation to remove.
247 void RemoveAnimation( Animation* animation );
250 * Query whether any animations are currently running.
251 * @return True if any animations are running.
253 bool IsAnimationRunning() const;
255 // Property Notification
258 * Add a newly created property notification
259 * @param[in] propertyNotification The notification to add
260 * @post The propertyNotification is owned by UpdateManager.
262 void AddPropertyNotification( PropertyNotification* propertyNotification );
265 * Remove a property notification
266 * @param[in] propertyNotification The notification to remove
268 void RemovePropertyNotification( PropertyNotification* propertyNotification );
271 * Set Notify state for PropertyNotification
272 * @param[in] propertyNotification The notification to remove
273 * @param[in] notifyMode The notification mode.
275 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
280 * Retrieve the default shader.
281 * @return The default shader.
283 Shader* GetDefaultShader();
286 * Add a newly created shader.
287 * @param[in] shader The shader to add.
288 * @post The shader is owned by the UpdateManager.
290 void AddShader(Shader* shader);
294 * @pre The shader has been added to the UpdateManager.
295 * @param[in] shader The shader to remove.
296 * @post The shader is destroyed.
298 void RemoveShader(Shader* shader);
301 * Set the shader program for a specified GeometryType to a Shader object
302 * @param[in] shader The shader to modify
303 * @param[in] geometryType The GeometryType to map to the program
304 * @param[in] subType The program subtype
305 * @param[in] resourceId A ResourceManager ticket ID for the program data (source and compiled binary)
306 * @param[in] shaderHash hash key created with vertex and fragment shader code
308 void SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, Integration::ResourceId resourceId, size_t shaderHash );
311 * Add an animatable mesh
312 * @param[in] animatableMesh The animatable mesh to add.
313 * @post the animatableMesh is owned by the UpdateManager.
315 void AddAnimatableMesh( AnimatableMesh* animatableMesh );
318 * Remove an animatable mesh
319 * @pre The animatable mesh has been added to the update manager
320 * @param[in] animatableMesh The animatable mesh to add.
322 void RemoveAnimatableMesh( AnimatableMesh* animatableMesh );
326 * @param[in] material The material to add
327 * @post the material remains owned by its event object
329 void AddMaterial(Material* material);
333 * @pre The material has been added to the UpdateManager
334 * @param[in] material The material to remove
336 void RemoveMaterial(Material* material);
339 * Add a newly created gesture.
340 * @param[in] gesture The gesture to add.
341 * @post The gesture is owned by the UpdateManager.
343 void AddGesture( PanGesture* gesture );
347 * @pre The gesture has been added to the UpdateManager.
348 * @param[in] gesture The gesture to remove.
349 * @post The gesture is destroyed.
351 void RemoveGesture( PanGesture* gesture );
356 * Performs an Update traversal on the scene-graph.
357 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
358 * @param[in] lastVSyncTime The last time, in milliseconds, that we had a VSync.
359 * @param[in] nextVSyncTime The estimated time, in milliseconds, of the next VSync.
360 * @return True if further updates are required e.g. during animations.
362 unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTime, unsigned int nextVSyncTime );
365 * Set the background color i.e. the glClear color used at the beginning of each frame.
366 * @param[in] color The new background color.
368 void SetBackgroundColor(const Vector4& color);
371 * Set the default surface rect.
372 * @param[in] rect The rect value representing the surface.
374 void SetDefaultSurfaceRect( const Rect<int>& rect );
377 * @copydoc Dali::Stage::KeepRendering()
379 void KeepRendering( float durationSeconds );
382 * Sets the depths of all layers.
383 * @param layers The layers in depth order.
384 * @param[in] systemLevel True if using the system-level overlay.
386 void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
388 #ifdef DYNAMICS_SUPPORT
391 * Initialize the dynamics world
392 * @param[in] world The dynamics world
393 * @param[in] worldSettings The dynamics world settings
394 * @param[in] debugShader The shader used for rendering dynamics debug information
396 void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings, Shader* debugShader );
399 * Terminate the dynamics world
401 void TerminateDynamicsWorld();
403 #endif // DYNAMICS_SUPPORT
408 UpdateManager(const UpdateManager&);
411 UpdateManager& operator=(const UpdateManager& rhs);
414 * Helper to check whether the update-thread should keep going.
415 * @param[in] elapsedSeconds The time in seconds since the previous update.
416 * @return True if the update-thread should keep going.
418 unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
421 * Helper to calculate new camera setup when root node resizes.
422 * @param[in] updateBuffer The buffer to read the root node size from.
424 void UpdateProjectionAndViewMatrices(int updateBuffer);
427 * Post process resources that have been updated by renderer
429 void PostProcessResources();
432 * Helper to reset a Node properties.
433 * @param[in] node The node.
435 void ResetNodeProperty( Node& node );
438 * Helper to reset all Node properties
440 void ResetProperties();
443 * Perform gesture updates.
444 * @param[in] lastVSyncTime The last VSync time.
445 * @param[in] nextVSyncTime The estimated time of the next VSync.
446 * @return true, if any properties were updated.
448 bool ProcessGestures( unsigned int lastVSyncTime, unsigned int nextVSyncTime );
451 * Perform animation updates
452 * @param[in] elapsedSeconds time since last frame
454 void Animate( float elapsedSeconds );
457 * Perform constraint updates.
458 * @note Applies constraints to nodes first (depth first search order).
459 * Then shader constraints second (construction order)
461 void ApplyConstraints();
464 * Perform property notification updates
466 void ProcessPropertyNotifications();
469 * Update the default camera.
470 * This must be altered to match the root Node for 2D layouting.
471 * @param[in] updateBuffer The buffer to read the root node size from.
473 void UpdateDefaultCamera( int updateBuffer );
476 * Update node shaders, opacity, geometry etc.
481 * Update animatable meshes
483 void UpdateMeshes( BufferIndex updateBufferIndex, AnimatableMeshContainer& meshes );
486 * Update materials - Ensure all render materials are updated with texture pointers
489 void UpdateMaterials( BufferIndex updateBufferIndex, MaterialContainer& materials );
492 * PrepareMaterials - Ensure updated material properties are sent to render materials
494 void PrepareMaterials( BufferIndex updateBufferIndex, MaterialContainer& materials );
498 // needs to be direct member so that getter for event buffer can be inlined
499 SceneGraphBuffers mSceneGraphBuffers;
506 // Messages for UpdateManager
508 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
510 typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
512 // Reserve some memory inside the message queue
513 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
515 // Construct message in the message queue memory; note that delete should not be called on the return value
516 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
519 inline void AddNodeMessage( UpdateManager& manager, Node& node )
521 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
523 // Reserve some memory inside the message queue
524 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
526 // Construct message in the message queue memory; note that delete should not be called on the return value
527 new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
530 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
532 // Update thread can edit the object
533 Node& parent = const_cast< Node& >( constParent );
534 Node& child = const_cast< Node& >( constChild );
536 typedef MessageValue2< UpdateManager, Node*, Node* > LocalType;
538 // Reserve some memory inside the message queue
539 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
541 // Construct message in the message queue memory; note that delete should not be called on the return value
542 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
545 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
547 // Scene graph thread can modify this object.
548 Node& node = const_cast< Node& >( constNode );
550 typedef MessageValue1< UpdateManager, Node* > LocalType;
552 // Reserve some memory inside the message queue
553 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
555 // Construct message in the message queue memory; note that delete should not be called on the return value
556 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
559 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
561 // Scene graph thread can destroy this object.
562 Node& node = const_cast< Node& >( constNode );
564 typedef MessageValue1< UpdateManager, Node* > LocalType;
566 // Reserve some memory inside the message queue
567 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
569 // Construct message in the message queue memory; note that delete should not be called on the return value
570 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
573 inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment )
575 // Scene graph thread can modify this object.
576 Node& parent = const_cast< Node& >( constParent );
578 typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType;
580 // Reserve some memory inside the message queue
581 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
583 // Construct message in the message queue memory; note that delete should not be called on the return value
584 new (slot) LocalType( &manager, &UpdateManager::AttachToNode, &parent, attachment );
587 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
589 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
591 // Reserve some memory inside the message queue
592 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
594 // Construct message in the message queue memory; note that delete should not be called on the return value
595 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
598 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
600 typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
602 // Reserve some memory inside the message queue
603 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
605 // Construct message in the message queue memory; note that delete should not be called on the return value
606 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
609 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
611 typedef MessageValue1< UpdateManager, Animation* > LocalType;
613 // Reserve some memory inside the message queue
614 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
616 // Construct message in the message queue memory; note that delete should not be called on the return value
617 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
620 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
622 // The scene-graph thread owns this object so it can safely edit it.
623 Animation& animation = const_cast< Animation& >( constAnimation );
625 typedef MessageValue1< UpdateManager, Animation* > LocalType;
627 // Reserve some memory inside the message queue
628 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
630 // Construct message in the message queue memory; note that delete should not be called on the return value
631 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
634 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
636 // The scene-graph thread owns this object so it can safely edit it.
637 Animation& animation = const_cast< Animation& >( constAnimation );
639 typedef MessageValue1< UpdateManager, Animation* > LocalType;
641 // Reserve some memory inside the message queue
642 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
644 // Construct message in the message queue memory; note that delete should not be called on the return value
645 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
648 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
650 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
652 // Reserve some memory inside the message queue
653 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
655 // Construct message in the message queue memory; note that delete should not be called on the return value
656 new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
659 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
661 // The scene-graph thread owns this object so it can safely edit it.
662 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
664 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
666 // Reserve some memory inside the message queue
667 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
669 // Construct message in the message queue memory; note that delete should not be called on the return value
670 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
673 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
674 const PropertyNotification* constPropertyNotification,
675 PropertyNotification::NotifyMode notifyMode )
677 // The scene-graph thread owns this object so it can safely edit it.
678 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
680 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
682 // Reserve some memory inside the message queue
683 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
685 // Construct message in the message queue memory; note that delete should not be called on the return value
686 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
689 // The render thread can safely change the Shader
690 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
692 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
694 // Reserve some memory inside the message queue
695 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
697 // Construct message in the message queue memory; note that delete should not be called on the return value
698 new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
701 // The render thread can safely change the Shader
702 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
704 typedef MessageValue1< UpdateManager, Shader* > LocalType;
706 // Reserve some memory inside the message queue
707 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
709 // Construct message in the message queue memory; note that delete should not be called on the return value
710 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
713 inline void SetShaderProgramMessage( UpdateManager& manager,
715 GeometryType geometryType,
716 ShaderSubTypes subType,
717 Integration::ResourceId resourceId,
720 typedef MessageValue5< UpdateManager, Shader*, GeometryType, ShaderSubTypes, Integration::ResourceId, size_t > LocalType;
722 // Reserve some memory inside the message queue
723 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
725 // Construct message in the message queue memory; note that delete should not be called on the return value
726 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, geometryType, subType, resourceId, shaderHash );
729 // The render thread can safely change the AnimatableMesh
730 inline void AddAnimatableMeshMessage( UpdateManager& manager, AnimatableMesh& animatableMesh )
732 typedef MessageValue1< UpdateManager, AnimatableMesh* > LocalType;
734 // Reserve some memory inside the message queue
735 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
737 // Construct message in the message queue memory; note that delete should not be called on the return value
738 new (slot) LocalType( &manager, &UpdateManager::AddAnimatableMesh, &animatableMesh );
741 // The render thread can safely change the AnimatableMesh
742 inline void RemoveAnimatableMeshMessage( UpdateManager& manager, AnimatableMesh& animatableMesh )
744 typedef MessageValue1< UpdateManager, AnimatableMesh* > LocalType;
746 // Reserve some memory inside the message queue
747 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
749 // Construct message in the message queue memory; note that delete should not be called on the return value
750 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimatableMesh, &animatableMesh );
754 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
756 typedef MessageValue1< UpdateManager, Vector4 > LocalType;
758 // Reserve some memory inside the message queue
759 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
761 // Construct message in the message queue memory; note that delete should not be called on the return value
762 new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
765 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
767 typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
769 // Reserve some memory inside the message queue
770 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
772 // Construct message in the message queue memory; note that delete should not be called on the return value
773 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
776 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
778 typedef MessageValue1< UpdateManager, float > LocalType;
780 // Reserve some memory inside the message queue
781 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
783 // Construct message in the message queue memory; note that delete should not be called on the return value
784 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
788 * Create a message for setting the depth of a layer
789 * @param[in] manager The update manager
790 * @param[in] layers list of layers
791 * @param[in] systemLevel True if the layers are added via the SystemOverlay API
793 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
795 typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
797 // Reserve some memory inside the message queue
798 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
800 // Construct message in the message queue memory; note that delete should not be called on the return value
801 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
804 inline void AddMaterialMessage( UpdateManager& manager, Material* material )
806 typedef MessageValue1< UpdateManager, Material* > LocalType;
808 // Reserve some memory inside the message queue
809 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
811 // Construct message in the message queue memory; note that delete should not be called on the return value
812 new (slot) LocalType( &manager, &UpdateManager::AddMaterial, material );
815 inline void RemoveMaterialMessage( UpdateManager& manager, Material* material )
817 typedef MessageValue1< UpdateManager, Material* > LocalType;
819 // Reserve some memory inside the message queue
820 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
822 // Construct message in the message queue memory; note that delete should not be called on the return value
823 new (slot) LocalType( &manager, &UpdateManager::RemoveMaterial, material );
826 inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
828 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
830 // Reserve some memory inside the message queue
831 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
833 // Construct message in the message queue memory; note that delete should not be called on the return value
834 new (slot) LocalType( &manager, &UpdateManager::AddGesture, gesture );
837 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
839 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
841 // Reserve some memory inside the message queue
842 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
844 // Construct message in the message queue memory; note that delete should not be called on the return value
845 new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture );
848 #ifdef DYNAMICS_SUPPORT
851 inline void InitializeDynamicsWorldMessage(UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings, const Shader* debugShader)
853 typedef MessageValue3< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings*, Shader*> LocalType;
855 // Reserve some memory inside the message queue
856 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
858 // Construct message in the message queue memory; note that delete should not be called on the return value
859 new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings, const_cast<Shader*>(debugShader) );
862 inline void TerminateDynamicsWorldMessage(UpdateManager& manager)
864 typedef Message< UpdateManager > LocalType;
866 // Reserve some memory inside the message queue
867 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
869 // Construct message in the message queue memory; note that delete should not be called on the return value
870 new (slot) LocalType( &manager, &UpdateManager::TerminateDynamicsWorld );
873 #endif // DYNAMICS_SUPPORT
875 } // namespace SceneGraph
877 } // namespace Internal
881 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__