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 maintains a scene graph i.e. a tree of nodes and attachments and
84 * other property owner objects.
85 * It controls the Update traversal, in which nodes are repositioned/animated,
86 * and organizes the the culling and rendering of the scene.
87 * It also maintains the lifecycle of nodes and other property owners that are
88 * disconnected from the scene graph.
95 * Construct a new UpdateManager.
96 * @param[in] notificationManager This should be notified when animations have finished.
97 * @param[in] glSyncAbstraction Used to determine when framebuffers are ready
98 * @param[in] animationFinishedNotifier The CompleteNotificationInterface that handles animation completions
99 * @param[in] propertyNotifier The PropertyNotifier
100 * @param[in] resourceManager The resource manager used to load textures etc.
101 * @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
102 * @param[in] controller After messages are flushed, we request a render from the RenderController.
103 * @param[in] renderManager This is responsible for rendering the results of each "update".
104 * @param[in] renderQueue Used to queue messages for the next render.
105 * @param[in] textureCache Used for caching textures.
106 * @param[in] touchResampler Used for re-sampling touch events.
108 UpdateManager( NotificationManager& notificationManager,
109 Integration::GlSyncAbstraction& glSyncAbstraction,
110 CompleteNotificationInterface& animationFinishedNotifier,
111 PropertyNotifier& propertyNotifier,
112 ResourceManager& resourceManager,
113 DiscardQueue& discardQueue,
114 Integration::RenderController& controller,
115 RenderManager& renderManager,
116 RenderQueue& renderQueue,
117 TextureCache& textureCache,
118 TouchResampler& touchResampler );
121 * Destructor. Not virtual as this is not a base class
125 // Node connection methods
128 * Get the scene graph side list of RenderTasks.
129 * @param[in] systemLevel True if using the system-level overlay.
130 * @return The list of render tasks
132 RenderTaskList* GetRenderTaskList( bool systemLevel );
135 * Installs a new layer as the root node.
136 * @pre The UpdateManager does not already have an installed root node.
137 * @pre The layer is of derived Node type Layer.
138 * @pre The layer does not have a parent.
139 * @param[in] layer The new root node.
140 * @param[in] systemLevel True if using the system-level overlay.
141 * @post The node is owned by UpdateManager.
143 void InstallRoot( Layer* layer, bool systemLevel );
146 * Add a Node; UpdateManager takes ownership.
147 * @pre The node does not have a parent.
148 * @param[in] node The node to add.
150 void AddNode( Node* node );
153 * Connect a Node to the scene-graph.
154 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
155 * @pre The node does not already have a parent.
156 * @param[in] node The new parent node.
157 * @param[in] node The node to connect.
159 void ConnectNode( Node* parent, Node* node, int index );
162 * Disconnect a Node from the scene-graph.
163 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
164 * @pre The node has a parent.
165 * @param[in] node The node to disconnect.
167 void DisconnectNode( Node* node );
170 * Called when a property is set on a disconnected Node (via public API)
171 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
172 * @pre The node does not have a parent.
173 * @param[in] node The node to set as "active".
175 void SetNodeActive( Node* node );
178 * Destroy a Node owned by UpdateManager.
179 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
180 * In the following update, the previously queued Nodes may be deleted.
181 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
182 * @param[in] node The node to destroy.
184 void DestroyNode( Node* node );
187 * Attach an object to a Node.
188 * The UpdateManager is responsible for calling NodeAttachment::Initialize().
189 * @param[in] node The node which will own the attachment.
190 * @param[in] attachment The object to attach.
192 void AttachToNode( Node* node, NodeAttachment* attachment );
195 * Attach a renderer to the scene graph
197 void AttachToSceneGraph( RendererAttachment* renderer );
201 * Add a newly created object.
202 * @param[in] object The object to add.
203 * @post The object is owned by UpdateManager.
205 void AddObject( PropertyOwner* object );
209 * @param[in] object The object to remove.
211 void RemoveObject( PropertyOwner* object );
216 * Add a newly created animation.
217 * @param[in] animation The animation to add.
218 * @post The animation is owned by UpdateManager.
220 void AddAnimation( Animation* animation );
224 * @param[in] animation The animation to stop.
226 void StopAnimation( Animation* animation );
229 * Remove an animation.
230 * @param[in] animation The animation to remove.
232 void RemoveAnimation( Animation* animation );
235 * Query whether any animations are currently running.
236 * @return True if any animations are running.
238 bool IsAnimationRunning() const;
240 // Property Notification
243 * Add a newly created property notification
244 * @param[in] propertyNotification The notification to add
245 * @post The propertyNotification is owned by UpdateManager.
247 void AddPropertyNotification( PropertyNotification* propertyNotification );
250 * Remove a property notification
251 * @param[in] propertyNotification The notification to remove
253 void RemovePropertyNotification( PropertyNotification* propertyNotification );
256 * Set Notify state for PropertyNotification
257 * @param[in] propertyNotification The notification to remove
258 * @param[in] notifyMode The notification mode.
260 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
263 * @brief Get the geometry owner
265 * @return The geometry owner
267 ObjectOwnerContainer< Geometry >& GetGeometryOwner();
270 * @brief Get the material owner
272 * @return The material owner
274 ObjectOwnerContainer< Material >& GetMaterialOwner();
277 * @brief Get the sampler owner
279 * @return The sampler owner
281 ObjectOwnerContainer< Sampler >& GetSamplerOwner();
284 * @brief Get the property buffer owner
286 * @return The property buffer owner
288 ObjectOwnerContainer< PropertyBuffer >& GetPropertyBufferOwner();
294 * Add a newly created shader.
295 * @param[in] shader The shader to add.
296 * @post The shader is owned by the UpdateManager.
298 void AddShader(Shader* shader);
302 * @pre The shader has been added to the UpdateManager.
303 * @param[in] shader The shader to remove.
304 * @post The shader is destroyed.
306 void RemoveShader(Shader* shader);
309 * Set the shader program for a Shader object
310 * @param[in] shader The shader to modify
311 * @param[in] resourceId A ResourceManager ticket ID for the program data (source and compiled binary)
312 * @param[in] shaderHash hash key created with vertex and fragment shader code
313 * @param[in] modifiesGeometry True if the vertex shader modifies geometry
315 void SetShaderProgram( Shader* shader, Integration::ResourceId resourceId, size_t shaderHash, bool modifiesGeometry );
318 * Add a newly created gesture.
319 * @param[in] gesture The gesture to add.
320 * @post The gesture is owned by the UpdateManager.
322 void AddGesture( PanGesture* gesture );
326 * @pre The gesture has been added to the UpdateManager.
327 * @param[in] gesture The gesture to remove.
328 * @post The gesture is destroyed.
330 void RemoveGesture( PanGesture* gesture );
332 // Message queue handling
335 * Reserve space for another message in the queue; this must then be initialized by the caller.
336 * The message will be read from the update-thread after the next FlushMessages is called.
337 * @post Calling this method may invalidate any previously returned slots.
338 * @param[in] size The message size with respect to the size of type "char".
339 * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
340 * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
341 * @return A pointer to the first char allocated for the message.
343 unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true );
346 * @return the current event-buffer index.
348 BufferIndex GetEventBufferIndex() const
350 // inlined as its called often from event thread
351 return mSceneGraphBuffers.GetEventBufferIndex();
355 * Called by the event-thread to signal that FlushQueue will be called
356 * e.g. when it has finished event processing.
358 void EventProcessingStarted();
361 * Flush the set of messages, which were previously stored with QueueMessage().
362 * Calls to this thread-safe method should be minimized, to avoid thread blocking.
364 * @return True if there are messages to process.
371 * Performs an Update traversal on the scene-graph.
372 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
373 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
374 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
375 * @return True if further updates are required e.g. during animations.
377 unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
380 * Set the background color i.e. the glClear color used at the beginning of each frame.
381 * @param[in] color The new background color.
383 void SetBackgroundColor(const Vector4& color);
386 * Set the default surface rect.
387 * @param[in] rect The rect value representing the surface.
389 void SetDefaultSurfaceRect( const Rect<int>& rect );
392 * @copydoc Dali::Stage::KeepRendering()
394 void KeepRendering( float durationSeconds );
397 * Sets the depths of all layers.
398 * @param layers The layers in depth order.
399 * @param[in] systemLevel True if using the system-level overlay.
401 void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
403 #ifdef DYNAMICS_SUPPORT
406 * Initialize the dynamics world
407 * @param[in] world The dynamics world
408 * @param[in] worldSettings The dynamics world settings
409 * @param[in] debugShader The shader used for rendering dynamics debug information
411 void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings );
414 * Terminate the dynamics world
416 void TerminateDynamicsWorld();
418 #endif // DYNAMICS_SUPPORT
423 UpdateManager(const UpdateManager&);
426 UpdateManager& operator=(const UpdateManager& rhs);
429 * Helper to check whether the update-thread should keep going.
430 * @param[in] elapsedSeconds The time in seconds since the previous update.
431 * @return True if the update-thread should keep going.
433 unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
436 * Helper to calculate new camera setup when root node resizes.
437 * @param[in] updateBuffer The buffer to read the root node size from.
439 void UpdateProjectionAndViewMatrices(int updateBuffer);
442 * Post process resources that have been updated by renderer
444 void PostProcessResources();
447 * Helper to reset a Node properties.
448 * @param[in] node The node.
450 void ResetNodeProperty( Node& node );
453 * Helper to reset all Node properties
455 void ResetProperties();
458 * Perform gesture updates.
459 * @param[in] lastVSyncTime The last VSync time in milliseconds.
460 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
461 * @return true, if any properties were updated.
463 bool ProcessGestures( unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
466 * Perform animation updates
467 * @param[in] elapsedSeconds time since last frame
469 void Animate( float elapsedSeconds );
472 * Perform constraint updates.
473 * @note Applies constraints to nodes first (depth first search order).
474 * Then shader constraints second (construction order)
476 void ApplyConstraints();
479 * Perform property notification updates
481 void ProcessPropertyNotifications();
484 * Update the default camera.
485 * This must be altered to match the root Node for 2D layouting.
486 * @param[in] updateBuffer The buffer to read the root node size from.
488 void UpdateDefaultCamera( int updateBuffer );
491 * Update node shaders, opacity, geometry etc.
497 // needs to be direct member so that getter for event buffer can be inlined
498 SceneGraphBuffers mSceneGraphBuffers;
505 // Messages for UpdateManager
507 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
509 typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
511 // Reserve some memory inside the message queue
512 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
514 // Construct message in the message queue memory; note that delete should not be called on the return value
515 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
518 inline void AddNodeMessage( UpdateManager& manager, Node& node )
520 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
522 // Reserve some memory inside the message queue
523 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
525 // Construct message in the message queue memory; note that delete should not be called on the return value
526 new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
529 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild, int index )
531 // Update thread can edit the object
532 Node& parent = const_cast< Node& >( constParent );
533 Node& child = const_cast< Node& >( constChild );
535 typedef MessageValue3< UpdateManager, Node*, Node*, int > LocalType;
537 // Reserve some memory inside the message queue
538 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
540 // Construct message in the message queue memory; note that delete should not be called on the return value
541 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child, index );
544 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
546 // Scene graph thread can modify this object.
547 Node& node = const_cast< Node& >( constNode );
549 typedef MessageValue1< UpdateManager, Node* > LocalType;
551 // Reserve some memory inside the message queue
552 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
554 // Construct message in the message queue memory; note that delete should not be called on the return value
555 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
558 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
560 // Scene graph thread can destroy this object.
561 Node& node = const_cast< Node& >( constNode );
563 typedef MessageValue1< UpdateManager, Node* > LocalType;
565 // Reserve some memory inside the message queue
566 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
568 // Construct message in the message queue memory; note that delete should not be called on the return value
569 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
572 inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment )
574 // Scene graph thread can modify this object.
575 Node& parent = const_cast< Node& >( constParent );
577 // @todo MESH_REWORK Don't pass by owner pointer after merge with SceneGraph::RenderableAttachment ? (not needed if we split RendererAttachment to 2 objects)
578 typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType;
580 // Reserve some memory inside the message queue
581 unsigned int* slot = manager.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 AttachToSceneGraphMessage( UpdateManager& manager, RendererAttachment* renderer )
589 // @todo MESH_REWORK Pass by owner pointer after merge with SceneGraph::RenderableAttachment
590 typedef MessageValue1< UpdateManager, RendererAttachment* > LocalType;
592 // Reserve some memory inside the message queue
593 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
595 // Construct message in the message queue memory; note that delete should not be called on the return value
596 new (slot) LocalType( &manager, &UpdateManager::AttachToSceneGraph, renderer );
599 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
601 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
603 // Reserve some memory inside the message queue
604 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
606 // Construct message in the message queue memory; note that delete should not be called on the return value
607 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
610 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
612 typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
614 // Reserve some memory inside the message queue
615 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
617 // Construct message in the message queue memory; note that delete should not be called on the return value
618 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
621 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
623 typedef MessageValue1< UpdateManager, Animation* > LocalType;
625 // Reserve some memory inside the message queue
626 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
628 // Construct message in the message queue memory; note that delete should not be called on the return value
629 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
632 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
634 // The scene-graph thread owns this object so it can safely edit it.
635 Animation& animation = const_cast< Animation& >( constAnimation );
637 typedef MessageValue1< UpdateManager, Animation* > LocalType;
639 // Reserve some memory inside the message queue
640 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
642 // Construct message in the message queue memory; note that delete should not be called on the return value
643 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
646 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
648 // The scene-graph thread owns this object so it can safely edit it.
649 Animation& animation = const_cast< Animation& >( constAnimation );
651 typedef MessageValue1< UpdateManager, Animation* > LocalType;
653 // Reserve some memory inside the message queue
654 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
656 // Construct message in the message queue memory; note that delete should not be called on the return value
657 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
660 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
662 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
664 // Reserve some memory inside the message queue
665 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
667 // Construct message in the message queue memory; note that delete should not be called on the return value
668 new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
671 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
673 // The scene-graph thread owns this object so it can safely edit it.
674 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
676 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
678 // Reserve some memory inside the message queue
679 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
681 // Construct message in the message queue memory; note that delete should not be called on the return value
682 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
685 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
686 const PropertyNotification* constPropertyNotification,
687 PropertyNotification::NotifyMode notifyMode )
689 // The scene-graph thread owns this object so it can safely edit it.
690 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
692 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
694 // Reserve some memory inside the message queue
695 unsigned int* slot = manager.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::PropertyNotificationSetNotify, propertyNotification, notifyMode );
703 // The render thread can safely change the Shader
704 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
706 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
708 // Reserve some memory inside the message queue
709 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
711 // Construct message in the message queue memory; note that delete should not be called on the return value
712 new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
715 // The render thread can safely change the Shader
716 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
718 typedef MessageValue1< UpdateManager, Shader* > LocalType;
720 // Reserve some memory inside the message queue
721 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
723 // Construct message in the message queue memory; note that delete should not be called on the return value
724 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
727 inline void SetShaderProgramMessage( UpdateManager& manager,
729 Integration::ResourceId resourceId,
731 bool modifiesGeometry )
733 typedef MessageValue4< UpdateManager, Shader*, Integration::ResourceId, size_t, bool > LocalType;
735 // Reserve some memory inside the message queue
736 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
738 // Construct message in the message queue memory; note that delete should not be called on the return value
739 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, resourceId, shaderHash, modifiesGeometry );
742 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
744 typedef MessageValue1< UpdateManager, Vector4 > LocalType;
746 // Reserve some memory inside the message queue
747 unsigned int* slot = manager.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::SetBackgroundColor, color );
753 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
755 typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
757 // Reserve some memory inside the message queue
758 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
760 // Construct message in the message queue memory; note that delete should not be called on the return value
761 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
764 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
766 typedef MessageValue1< UpdateManager, float > LocalType;
768 // Reserve some memory inside the message queue
769 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
771 // Construct message in the message queue memory; note that delete should not be called on the return value
772 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
776 * Create a message for setting the depth of a layer
777 * @param[in] manager The update manager
778 * @param[in] layers list of layers
779 * @param[in] systemLevel True if the layers are added via the SystemOverlay API
781 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
783 typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > 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::SetLayerDepths, layers, systemLevel );
792 inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
794 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
796 // Reserve some memory inside the message queue
797 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
799 // Construct message in the message queue memory; note that delete should not be called on the return value
800 new (slot) LocalType( &manager, &UpdateManager::AddGesture, gesture );
803 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
805 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
807 // Reserve some memory inside the message queue
808 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
810 // Construct message in the message queue memory; note that delete should not be called on the return value
811 new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture );
814 #ifdef DYNAMICS_SUPPORT
817 inline void InitializeDynamicsWorldMessage( UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings )
819 typedef MessageValue2< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings* > LocalType;
821 // Reserve some memory inside the message queue
822 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
824 // Construct message in the message queue memory; note that delete should not be called on the return value
825 new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings );
828 inline void TerminateDynamicsWorldMessage(UpdateManager& manager)
830 typedef Message< UpdateManager > LocalType;
832 // Reserve some memory inside the message queue
833 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
835 // Construct message in the message queue memory; note that delete should not be called on the return value
836 new (slot) LocalType( &manager, &UpdateManager::TerminateDynamicsWorld );
839 #endif // DYNAMICS_SUPPORT
842 template< typename T >
843 inline void AddMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
845 typedef MessageValue1< ObjectOwnerContainer<T>, OwnerPointer< T > > LocalType;
847 // Reserve some memory inside the message queue
848 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( &owner, &ObjectOwnerContainer<T>::Add, &object );
853 template< typename T >
854 inline void RemoveMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
856 typedef MessageValue1< ObjectOwnerContainer<T>, OwnerPointer< T > > LocalType;
858 // Reserve some memory inside the message queue
859 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
860 // Construct message in the message queue memory; note that delete should not be called on the return value
861 new (slot) LocalType( &owner, &ObjectOwnerContainer<T>::Remove, &object );
864 } // namespace SceneGraph
866 } // namespace Internal
870 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__