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>
25 #include <dali/integration-api/resource-declarations.h>
27 #include <dali/internal/common/message.h>
28 #include <dali/internal/common/type-abstraction-enums.h>
29 #include <dali/internal/event/common/event-thread-services.h>
30 #include <dali/internal/update/animation/scene-graph-animation.h>
31 #include <dali/internal/update/common/scene-graph-buffers.h>
32 #include <dali/internal/update/common/scene-graph-property-notification.h>
33 #include <dali/internal/update/manager/object-owner-container.h>
34 #include <dali/internal/update/node-attachments/node-attachment.h>
35 #include <dali/internal/update/nodes/node.h>
36 #include <dali/internal/update/nodes/scene-graph-layer.h>
38 #include <dali/internal/render/shaders/scene-graph-shader.h>
45 class GlSyncAbstraction;
46 class RenderController;
47 struct DynamicsWorldSettings;
49 } // namespace Integration
54 class PropertyNotifier;
55 struct DynamicsWorldSettings;
56 class NotificationManager;
57 class CompleteNotificationInterface;
58 class ResourceManager;
61 // value types used by messages
62 template <> struct ParameterType< PropertyNotification::NotifyMode >
63 : public BasicType< PropertyNotification::NotifyMode > {};
80 class RendererAttachment;
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 organises 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 CompleteNotificationInterface that handles animation completions
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 CompleteNotificationInterface& 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
122 // Node connection methods
125 * Get the scene graph side list of RenderTasks.
126 * @param[in] systemLevel True if using the system-level overlay.
127 * @return The list of render tasks
129 RenderTaskList* GetRenderTaskList( bool systemLevel );
132 * Installs a new layer as the root node.
133 * @pre The UpdateManager does not already have an installed root node.
134 * @pre The layer is of derived Node type Layer.
135 * @pre The layer does not have a parent.
136 * @param[in] layer The new root node.
137 * @param[in] systemLevel True if using the system-level overlay.
138 * @post The node is owned by UpdateManager.
140 void InstallRoot( Layer* layer, bool systemLevel );
143 * Add a Node; UpdateManager takes ownership.
144 * @pre The node does not have a parent.
145 * @param[in] node The node to add.
147 void AddNode( Node* node );
150 * Connect a Node to the scene-graph.
151 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
152 * @pre The node does not already have a parent.
153 * @param[in] node The new parent node.
154 * @param[in] node The node to connect.
156 void ConnectNode( Node* parent, Node* node, int index );
159 * Disconnect a Node from the scene-graph.
160 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
161 * @pre The node has a parent.
162 * @param[in] node The node to disconnect.
164 void DisconnectNode( Node* node );
167 * Called when a property is set on a disconnected Node (via public API)
168 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
169 * @pre The node does not have a parent.
170 * @param[in] node The node to set as "active".
172 void SetNodeActive( Node* node );
175 * Destroy a Node owned by UpdateManager.
176 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
177 * In the following update, the previously queued Nodes may be deleted.
178 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
179 * @param[in] node The node to destroy.
181 void DestroyNode( Node* node );
184 * Attach an object to a Node.
185 * The UpdateManager is responsible for calling NodeAttachment::Initialize().
186 * @param[in] node The node which will own the attachment.
187 * @param[in] attachment The object to attach.
189 void AttachToNode( Node* node, NodeAttachment* attachment );
192 * Attach a renderer to the scene graph
194 void AttachToSceneGraph( RendererAttachment* renderer );
198 * Add a newly created object.
199 * @param[in] object The object to add.
200 * @post The object is owned by UpdateManager.
202 void AddObject( PropertyOwner* object );
206 * @param[in] object The object to remove.
208 void RemoveObject( PropertyOwner* object );
213 * Add a newly created animation.
214 * @param[in] animation The animation to add.
215 * @post The animation is owned by UpdateManager.
217 void AddAnimation( Animation* animation );
221 * @param[in] animation The animation to stop.
223 void StopAnimation( Animation* animation );
226 * Remove an animation.
227 * @param[in] animation The animation to remove.
229 void RemoveAnimation( Animation* animation );
232 * Query whether any animations are currently running.
233 * @return True if any animations are running.
235 bool IsAnimationRunning() const;
237 // Property Notification
240 * Add a newly created property notification
241 * @param[in] propertyNotification The notification to add
242 * @post The propertyNotification is owned by UpdateManager.
244 void AddPropertyNotification( PropertyNotification* propertyNotification );
247 * Remove a property notification
248 * @param[in] propertyNotification The notification to remove
250 void RemovePropertyNotification( PropertyNotification* propertyNotification );
253 * Set Notify state for PropertyNotification
254 * @param[in] propertyNotification The notification to remove
255 * @param[in] notifyMode The notification mode.
257 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
260 * @brief Get the geometry owner
262 * @return The geometry owner
264 ObjectOwnerContainer< Geometry >& GetGeometryOwner();
267 * @brief Get the material owner
269 * @return The material owner
271 ObjectOwnerContainer< Material >& GetMaterialOwner();
274 * @brief Get the sampler owner
276 * @return The sampler owner
278 ObjectOwnerContainer< Sampler >& GetSamplerOwner();
281 * @brief Get the property buffer owner
283 * @return The property buffer owner
285 ObjectOwnerContainer< PropertyBuffer >& GetPropertyBufferOwner();
291 * Add a newly created shader.
292 * @param[in] shader The shader to add.
293 * @post The shader is owned by the UpdateManager.
295 void AddShader(Shader* shader);
299 * @pre The shader has been added to the UpdateManager.
300 * @param[in] shader The shader to remove.
301 * @post The shader is destroyed.
303 void RemoveShader(Shader* shader);
306 * Set the shader program for a specified GeometryType to a Shader object
307 * @param[in] shader The shader to modify
308 * @param[in] geometryType The GeometryType to map to the program
309 * @param[in] subType The program subtype
310 * @param[in] resourceId A ResourceManager ticket ID for the program data (source and compiled binary)
311 * @param[in] shaderHash hash key created with vertex and fragment shader code
312 * @param[in] modifiesGeometry True if the vertex shader modifies geometry
314 void SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, Integration::ResourceId resourceId, size_t shaderHash, bool modifiesGeometry );
317 * Add a newly created gesture.
318 * @param[in] gesture The gesture to add.
319 * @post The gesture is owned by the UpdateManager.
321 void AddGesture( PanGesture* gesture );
325 * @pre The gesture has been added to the UpdateManager.
326 * @param[in] gesture The gesture to remove.
327 * @post The gesture is destroyed.
329 void RemoveGesture( PanGesture* gesture );
331 // Message queue handling
334 * Reserve space for another message in the queue; this must then be initialized by the caller.
335 * The message will be read from the update-thread after the next FlushMessages is called.
336 * @post Calling this method may invalidate any previously returned slots.
337 * @param[in] size The message size with respect to the size of type "char".
338 * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
339 * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
340 * @return A pointer to the first char allocated for the message.
342 unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true );
345 * @return the current event-buffer index.
347 BufferIndex GetEventBufferIndex() const
349 // inlined as its called often from event thread
350 return mSceneGraphBuffers.GetEventBufferIndex();
354 * Called by the event-thread to signal that FlushQueue will be called
355 * e.g. when it has finished event processing.
357 void EventProcessingStarted();
360 * Flush the set of messages, which were previously stored with QueueMessage().
361 * Calls to this thread-safe method should be minimized, to avoid thread blocking.
363 * @return True if there are messages to process.
370 * Performs an Update traversal on the scene-graph.
371 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
372 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
373 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
374 * @return True if further updates are required e.g. during animations.
376 unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
379 * Set the background color i.e. the glClear color used at the beginning of each frame.
380 * @param[in] color The new background color.
382 void SetBackgroundColor(const Vector4& color);
385 * Set the default surface rect.
386 * @param[in] rect The rect value representing the surface.
388 void SetDefaultSurfaceRect( const Rect<int>& rect );
391 * @copydoc Dali::Stage::KeepRendering()
393 void KeepRendering( float durationSeconds );
396 * Sets the depths of all layers.
397 * @param layers The layers in depth order.
398 * @param[in] systemLevel True if using the system-level overlay.
400 void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
402 #ifdef DYNAMICS_SUPPORT
405 * Initialize the dynamics world
406 * @param[in] world The dynamics world
407 * @param[in] worldSettings The dynamics world settings
408 * @param[in] debugShader The shader used for rendering dynamics debug information
410 void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings );
413 * Terminate the dynamics world
415 void TerminateDynamicsWorld();
417 #endif // DYNAMICS_SUPPORT
422 UpdateManager(const UpdateManager&);
425 UpdateManager& operator=(const UpdateManager& rhs);
428 * Helper to check whether the update-thread should keep going.
429 * @param[in] elapsedSeconds The time in seconds since the previous update.
430 * @return True if the update-thread should keep going.
432 unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
435 * Helper to calculate new camera setup when root node resizes.
436 * @param[in] updateBuffer The buffer to read the root node size from.
438 void UpdateProjectionAndViewMatrices(int updateBuffer);
441 * Post process resources that have been updated by renderer
443 void PostProcessResources();
446 * Helper to reset a Node properties.
447 * @param[in] node The node.
449 void ResetNodeProperty( Node& node );
452 * Helper to reset all Node properties
454 void ResetProperties();
457 * Perform gesture updates.
458 * @param[in] lastVSyncTime The last VSync time in milliseconds.
459 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
460 * @return true, if any properties were updated.
462 bool ProcessGestures( unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
465 * Perform animation updates
466 * @param[in] elapsedSeconds time since last frame
468 void Animate( float elapsedSeconds );
471 * Perform constraint updates.
472 * @note Applies constraints to nodes first (depth first search order).
473 * Then shader constraints second (construction order)
475 void ApplyConstraints();
478 * Perform property notification updates
480 void ProcessPropertyNotifications();
483 * Update the default camera.
484 * This must be altered to match the root Node for 2D layouting.
485 * @param[in] updateBuffer The buffer to read the root node size from.
487 void UpdateDefaultCamera( int updateBuffer );
490 * Update node shaders, opacity, geometry etc.
496 // needs to be direct member so that getter for event buffer can be inlined
497 SceneGraphBuffers mSceneGraphBuffers;
504 // Messages for UpdateManager
506 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
508 typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
510 // Reserve some memory inside the message queue
511 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
513 // Construct message in the message queue memory; note that delete should not be called on the return value
514 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
517 inline void AddNodeMessage( UpdateManager& manager, Node& node )
519 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
521 // Reserve some memory inside the message queue
522 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
524 // Construct message in the message queue memory; note that delete should not be called on the return value
525 new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
528 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild, int index )
530 // Update thread can edit the object
531 Node& parent = const_cast< Node& >( constParent );
532 Node& child = const_cast< Node& >( constChild );
534 typedef MessageValue3< UpdateManager, Node*, Node*, int > LocalType;
536 // Reserve some memory inside the message queue
537 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
539 // Construct message in the message queue memory; note that delete should not be called on the return value
540 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child, index );
543 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
545 // Scene graph thread can modify this object.
546 Node& node = const_cast< Node& >( constNode );
548 typedef MessageValue1< UpdateManager, Node* > LocalType;
550 // Reserve some memory inside the message queue
551 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
553 // Construct message in the message queue memory; note that delete should not be called on the return value
554 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
557 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
559 // Scene graph thread can destroy this object.
560 Node& node = const_cast< Node& >( constNode );
562 typedef MessageValue1< UpdateManager, Node* > LocalType;
564 // Reserve some memory inside the message queue
565 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
567 // Construct message in the message queue memory; note that delete should not be called on the return value
568 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
571 inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment )
573 // Scene graph thread can modify this object.
574 Node& parent = const_cast< Node& >( constParent );
576 typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType;
578 // Reserve some memory inside the message queue
579 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
581 // Construct message in the message queue memory; note that delete should not be called on the return value
582 new (slot) LocalType( &manager, &UpdateManager::AttachToNode, &parent, attachment );
585 inline void AttachToSceneGraphMessage( UpdateManager& manager, RendererAttachment* renderer )
587 typedef MessageValue1< UpdateManager, RendererAttachment* > LocalType;
589 // Reserve some memory inside the message queue
590 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
592 // Construct message in the message queue memory; note that delete should not be called on the return value
593 new (slot) LocalType( &manager, &UpdateManager::AttachToSceneGraph, renderer );
596 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
598 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
600 // Reserve some memory inside the message queue
601 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
603 // Construct message in the message queue memory; note that delete should not be called on the return value
604 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
607 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
609 typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
611 // Reserve some memory inside the message queue
612 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
614 // Construct message in the message queue memory; note that delete should not be called on the return value
615 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
618 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
620 typedef MessageValue1< UpdateManager, Animation* > LocalType;
622 // Reserve some memory inside the message queue
623 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
625 // Construct message in the message queue memory; note that delete should not be called on the return value
626 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
629 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
631 // The scene-graph thread owns this object so it can safely edit it.
632 Animation& animation = const_cast< Animation& >( constAnimation );
634 typedef MessageValue1< UpdateManager, Animation* > LocalType;
636 // Reserve some memory inside the message queue
637 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
639 // Construct message in the message queue memory; note that delete should not be called on the return value
640 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
643 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
645 // The scene-graph thread owns this object so it can safely edit it.
646 Animation& animation = const_cast< Animation& >( constAnimation );
648 typedef MessageValue1< UpdateManager, Animation* > LocalType;
650 // Reserve some memory inside the message queue
651 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
653 // Construct message in the message queue memory; note that delete should not be called on the return value
654 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
657 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
659 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
661 // Reserve some memory inside the message queue
662 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
664 // Construct message in the message queue memory; note that delete should not be called on the return value
665 new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
668 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
670 // The scene-graph thread owns this object so it can safely edit it.
671 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
673 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
675 // Reserve some memory inside the message queue
676 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
678 // Construct message in the message queue memory; note that delete should not be called on the return value
679 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
682 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
683 const PropertyNotification* constPropertyNotification,
684 PropertyNotification::NotifyMode notifyMode )
686 // The scene-graph thread owns this object so it can safely edit it.
687 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
689 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
691 // Reserve some memory inside the message queue
692 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
694 // Construct message in the message queue memory; note that delete should not be called on the return value
695 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
700 // The render thread can safely change the Shader
701 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
703 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
705 // Reserve some memory inside the message queue
706 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
708 // Construct message in the message queue memory; note that delete should not be called on the return value
709 new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
712 // The render thread can safely change the Shader
713 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
715 typedef MessageValue1< UpdateManager, Shader* > LocalType;
717 // Reserve some memory inside the message queue
718 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
720 // Construct message in the message queue memory; note that delete should not be called on the return value
721 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
724 inline void SetShaderProgramMessage( UpdateManager& manager,
726 GeometryType geometryType,
727 ShaderSubTypes subType,
728 Integration::ResourceId resourceId,
730 bool modifiesGeometry )
732 typedef MessageValue6< UpdateManager, Shader*, GeometryType, ShaderSubTypes, Integration::ResourceId, size_t, bool > LocalType;
734 // Reserve some memory inside the message queue
735 unsigned int* slot = manager.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::SetShaderProgram, &shader, geometryType, subType, resourceId, shaderHash, modifiesGeometry );
741 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
743 typedef MessageValue1< UpdateManager, Vector4 > LocalType;
745 // Reserve some memory inside the message queue
746 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
748 // Construct message in the message queue memory; note that delete should not be called on the return value
749 new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
752 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
754 typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
756 // Reserve some memory inside the message queue
757 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
759 // Construct message in the message queue memory; note that delete should not be called on the return value
760 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
763 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
765 typedef MessageValue1< UpdateManager, float > LocalType;
767 // Reserve some memory inside the message queue
768 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
770 // Construct message in the message queue memory; note that delete should not be called on the return value
771 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
775 * Create a message for setting the depth of a layer
776 * @param[in] manager The update manager
777 * @param[in] layers list of layers
778 * @param[in] systemLevel True if the layers are added via the SystemOverlay API
780 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
782 typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
784 // Reserve some memory inside the message queue
785 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
787 // Construct message in the message queue memory; note that delete should not be called on the return value
788 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
791 inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
793 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
795 // Reserve some memory inside the message queue
796 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
798 // Construct message in the message queue memory; note that delete should not be called on the return value
799 new (slot) LocalType( &manager, &UpdateManager::AddGesture, gesture );
802 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
804 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
806 // Reserve some memory inside the message queue
807 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
809 // Construct message in the message queue memory; note that delete should not be called on the return value
810 new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture );
813 #ifdef DYNAMICS_SUPPORT
816 inline void InitializeDynamicsWorldMessage( UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings )
818 typedef MessageValue2< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings* > LocalType;
820 // Reserve some memory inside the message queue
821 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
823 // Construct message in the message queue memory; note that delete should not be called on the return value
824 new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings );
827 inline void TerminateDynamicsWorldMessage(UpdateManager& manager)
829 typedef Message< UpdateManager > LocalType;
831 // Reserve some memory inside the message queue
832 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
834 // Construct message in the message queue memory; note that delete should not be called on the return value
835 new (slot) LocalType( &manager, &UpdateManager::TerminateDynamicsWorld );
838 #endif // DYNAMICS_SUPPORT
841 template< typename T >
842 inline void AddMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
844 typedef MessageValue1< ObjectOwnerContainer<T>, OwnerPointer< T > > LocalType;
846 // Reserve some memory inside the message queue
847 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
848 // Construct message in the message queue memory; note that delete should not be called on the return value
849 new (slot) LocalType( &owner, &ObjectOwnerContainer<T>::Add, &object );
852 template< typename T >
853 inline void RemoveMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
855 typedef MessageValue1< ObjectOwnerContainer<T>, OwnerPointer< T > > LocalType;
857 // Reserve some memory inside the message queue
858 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
859 // Construct message in the message queue memory; note that delete should not be called on the return value
860 new (slot) LocalType( &owner, &ObjectOwnerContainer<T>::Remove, &object );
863 } // namespace SceneGraph
865 } // namespace Internal
869 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__