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 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 > {};
78 typedef OwnerContainer< AnimatableMesh* > AnimatableMeshContainer;
79 typedef OwnerContainer< Material* > MaterialContainer;
82 * UpdateManager holds a scene graph i.e. a tree of nodes.
83 * It controls the Update traversal, in which nodes are repositioned/animated,
84 * and organizes the the culling and rendering of the scene.
91 * Construct a new UpdateManager.
92 * @param[in] notificationManager This should be notified when animations have finished.
93 * @param[in] glSyncAbstraction Used to determine when framebuffers are ready
94 * @param[in] animationFinishedNotifier The CompleteNotificationInterface that handles animation completions
95 * @param[in] propertyNotifier The PropertyNotifier
96 * @param[in] resourceManager The resource manager used to load textures etc.
97 * @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
98 * @param[in] controller After messages are flushed, we request a render from the RenderController.
99 * @param[in] renderManager This is responsible for rendering the results of each "update".
100 * @param[in] renderQueue Used to queue messages for the next render.
101 * @param[in] textureCache Used for caching textures.
102 * @param[in] touchResampler Used for re-sampling touch events.
104 UpdateManager( NotificationManager& notificationManager,
105 Integration::GlSyncAbstraction& glSyncAbstraction,
106 CompleteNotificationInterface& animationFinishedNotifier,
107 PropertyNotifier& propertyNotifier,
108 ResourceManager& resourceManager,
109 DiscardQueue& discardQueue,
110 Integration::RenderController& controller,
111 RenderManager& renderManager,
112 RenderQueue& renderQueue,
113 TextureCache& textureCache,
114 TouchResampler& touchResampler );
117 * Destructor. Not virtual as this is not a base class
122 * The event-thread uses this interface to queue messages for the next update.
123 * @return The event-to-update interface.
125 EventToUpdate& GetEventToUpdate();
128 * @return the event buffer index
130 BufferIndex GetEventBufferIndex() const
132 // inlined as its called often
133 return mSceneGraphBuffers.GetEventBufferIndex();
136 // Node connection methods
139 * Get the scene graph side list of RenderTasks.
140 * @param[in] systemLevel True if using the system-level overlay.
141 * @return The list of render tasks
143 RenderTaskList* GetRenderTaskList( bool systemLevel );
146 * Installs a new layer as the root node.
147 * @pre The UpdateManager does not already have an installed root node.
148 * @pre The layer is of derived Node type Layer.
149 * @pre The layer does not have a parent.
150 * @param[in] layer The new root node.
151 * @param[in] systemLevel True if using the system-level overlay.
152 * @post The node is owned by UpdateManager.
154 void InstallRoot( Layer* layer, bool systemLevel );
157 * Add a Node; UpdateManager takes ownership.
158 * @pre The node does not have a parent.
159 * @param[in] node The node to add.
161 void AddNode( Node* node );
164 * Connect a Node to the scene-graph.
165 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
166 * @pre The node does not already have a parent.
167 * @param[in] node The new parent node.
168 * @param[in] node The node to connect.
170 void ConnectNode( Node* parent, Node* node, int index );
173 * Disconnect a Node from the scene-graph.
174 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
175 * @pre The node has a parent.
176 * @param[in] node The node to disconnect.
178 void DisconnectNode( Node* node );
181 * Called when a property is set on a disconnected Node (via public API)
182 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
183 * @pre The node does not have a parent.
184 * @param[in] node The node to set as "active".
186 void SetNodeActive( Node* node );
189 * Destroy a Node owned by UpdateManager.
190 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
191 * In the following update, the previously queued Nodes may be deleted.
192 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
193 * @param[in] node The node to destroy.
195 void DestroyNode( Node* node );
198 * Attach an object to a Node.
199 * The UpdateManager is responsible for calling NodeAttachment::Initialize().
200 * @param[in] node The node which will own the attachment.
201 * @param[in] attachment The object to attach.
203 void AttachToNode( Node* node, NodeAttachment* attachment );
206 * Add a newly created object.
207 * @param[in] object The object to add.
208 * @post The object is owned by UpdateManager.
210 void AddObject( PropertyOwner* object );
214 * @param[in] object The object to remove.
216 void RemoveObject( PropertyOwner* object );
221 * Add a newly created animation.
222 * @param[in] animation The animation to add.
223 * @post The animation is owned by UpdateManager.
225 void AddAnimation( Animation* animation );
229 * @param[in] animation The animation to stop.
231 void StopAnimation( Animation* animation );
234 * Remove an animation.
235 * @param[in] animation The animation to remove.
237 void RemoveAnimation( Animation* animation );
240 * Query whether any animations are currently running.
241 * @return True if any animations are running.
243 bool IsAnimationRunning() const;
245 // Property Notification
248 * Add a newly created property notification
249 * @param[in] propertyNotification The notification to add
250 * @post The propertyNotification is owned by UpdateManager.
252 void AddPropertyNotification( PropertyNotification* propertyNotification );
255 * Remove a property notification
256 * @param[in] propertyNotification The notification to remove
258 void RemovePropertyNotification( PropertyNotification* propertyNotification );
261 * Set Notify state for PropertyNotification
262 * @param[in] propertyNotification The notification to remove
263 * @param[in] notifyMode The notification mode.
265 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
270 * Retrieve the default shader.
271 * @return The default shader.
273 Shader* GetDefaultShader();
276 * Add a newly created shader.
277 * @param[in] shader The shader to add.
278 * @post The shader is owned by the UpdateManager.
280 void AddShader(Shader* shader);
284 * @pre The shader has been added to the UpdateManager.
285 * @param[in] shader The shader to remove.
286 * @post The shader is destroyed.
288 void RemoveShader(Shader* shader);
291 * Set the shader program for a specified GeometryType to a Shader object
292 * @param[in] shader The shader to modify
293 * @param[in] geometryType The GeometryType to map to the program
294 * @param[in] subType The program subtype
295 * @param[in] resourceId A ResourceManager ticket ID for the program data (source and compiled binary)
296 * @param[in] shaderHash hash key created with vertex and fragment shader code
297 * @param[in] modifiesGeometry True if the vertex shader modifies geometry
299 void SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, Integration::ResourceId resourceId, size_t shaderHash, bool modifiesGeometry );
302 * Add an animatable mesh
303 * @param[in] animatableMesh The animatable mesh to add.
304 * @post the animatableMesh is owned by the UpdateManager.
306 void AddAnimatableMesh( AnimatableMesh* animatableMesh );
309 * Remove an animatable mesh
310 * @pre The animatable mesh has been added to the update manager
311 * @param[in] animatableMesh The animatable mesh to add.
313 void RemoveAnimatableMesh( AnimatableMesh* animatableMesh );
317 * @param[in] material The material to add
318 * @post the material remains owned by its event object
320 void AddMaterial(Material* material);
324 * @pre The material has been added to the UpdateManager
325 * @param[in] material The material to remove
327 void RemoveMaterial(Material* material);
330 * Add a newly created gesture.
331 * @param[in] gesture The gesture to add.
332 * @post The gesture is owned by the UpdateManager.
334 void AddGesture( PanGesture* gesture );
338 * @pre The gesture has been added to the UpdateManager.
339 * @param[in] gesture The gesture to remove.
340 * @post The gesture is destroyed.
342 void RemoveGesture( PanGesture* gesture );
347 * Performs an Update traversal on the scene-graph.
348 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
349 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
350 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
351 * @return True if further updates are required e.g. during animations.
353 unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
356 * Set the background color i.e. the glClear color used at the beginning of each frame.
357 * @param[in] color The new background color.
359 void SetBackgroundColor(const Vector4& color);
362 * Set the default surface rect.
363 * @param[in] rect The rect value representing the surface.
365 void SetDefaultSurfaceRect( const Rect<int>& rect );
368 * @copydoc Dali::Stage::KeepRendering()
370 void KeepRendering( float durationSeconds );
373 * Sets the depths of all layers.
374 * @param layers The layers in depth order.
375 * @param[in] systemLevel True if using the system-level overlay.
377 void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
379 #ifdef DYNAMICS_SUPPORT
382 * Initialize the dynamics world
383 * @param[in] world The dynamics world
384 * @param[in] worldSettings The dynamics world settings
385 * @param[in] debugShader The shader used for rendering dynamics debug information
387 void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings );
390 * Terminate the dynamics world
392 void TerminateDynamicsWorld();
394 #endif // DYNAMICS_SUPPORT
399 UpdateManager(const UpdateManager&);
402 UpdateManager& operator=(const UpdateManager& rhs);
405 * Helper to check whether the update-thread should keep going.
406 * @param[in] elapsedSeconds The time in seconds since the previous update.
407 * @return True if the update-thread should keep going.
409 unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
412 * Helper to calculate new camera setup when root node resizes.
413 * @param[in] updateBuffer The buffer to read the root node size from.
415 void UpdateProjectionAndViewMatrices(int updateBuffer);
418 * Post process resources that have been updated by renderer
420 void PostProcessResources();
423 * Helper to reset a Node properties.
424 * @param[in] node The node.
426 void ResetNodeProperty( Node& node );
429 * Helper to reset all Node properties
431 void ResetProperties();
434 * Perform gesture updates.
435 * @param[in] lastVSyncTime The last VSync time in milliseconds.
436 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
437 * @return true, if any properties were updated.
439 bool ProcessGestures( unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
442 * Perform animation updates
443 * @param[in] elapsedSeconds time since last frame
445 void Animate( float elapsedSeconds );
448 * Perform constraint updates.
449 * @note Applies constraints to nodes first (depth first search order).
450 * Then shader constraints second (construction order)
452 void ApplyConstraints();
455 * Perform property notification updates
457 void ProcessPropertyNotifications();
460 * Update the default camera.
461 * This must be altered to match the root Node for 2D layouting.
462 * @param[in] updateBuffer The buffer to read the root node size from.
464 void UpdateDefaultCamera( int updateBuffer );
467 * Update node shaders, opacity, geometry etc.
472 * Update animatable meshes
474 void UpdateMeshes( BufferIndex updateBufferIndex, AnimatableMeshContainer& meshes );
477 * Update materials - Ensure all render materials are updated with texture pointers
480 void UpdateMaterials( BufferIndex updateBufferIndex, MaterialContainer& materials );
483 * PrepareMaterials - Ensure updated material properties are sent to render materials
485 void PrepareMaterials( BufferIndex updateBufferIndex, MaterialContainer& materials );
489 // needs to be direct member so that getter for event buffer can be inlined
490 SceneGraphBuffers mSceneGraphBuffers;
497 // Messages for UpdateManager
499 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
501 typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
503 // Reserve some memory inside the message queue
504 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
506 // Construct message in the message queue memory; note that delete should not be called on the return value
507 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
510 inline void AddNodeMessage( UpdateManager& manager, Node& node )
512 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
514 // Reserve some memory inside the message queue
515 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
517 // Construct message in the message queue memory; note that delete should not be called on the return value
518 new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
521 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild, int index )
523 // Update thread can edit the object
524 Node& parent = const_cast< Node& >( constParent );
525 Node& child = const_cast< Node& >( constChild );
527 typedef MessageValue3< UpdateManager, Node*, Node*, int > LocalType;
529 // Reserve some memory inside the message queue
530 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
532 // Construct message in the message queue memory; note that delete should not be called on the return value
533 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child, index );
536 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
538 // Scene graph thread can modify this object.
539 Node& node = const_cast< Node& >( constNode );
541 typedef MessageValue1< UpdateManager, Node* > LocalType;
543 // Reserve some memory inside the message queue
544 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
546 // Construct message in the message queue memory; note that delete should not be called on the return value
547 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
550 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
552 // Scene graph thread can destroy this object.
553 Node& node = const_cast< Node& >( constNode );
555 typedef MessageValue1< UpdateManager, Node* > LocalType;
557 // Reserve some memory inside the message queue
558 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
560 // Construct message in the message queue memory; note that delete should not be called on the return value
561 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
564 inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment )
566 // Scene graph thread can modify this object.
567 Node& parent = const_cast< Node& >( constParent );
569 typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType;
571 // Reserve some memory inside the message queue
572 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
574 // Construct message in the message queue memory; note that delete should not be called on the return value
575 new (slot) LocalType( &manager, &UpdateManager::AttachToNode, &parent, attachment );
578 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
580 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
582 // Reserve some memory inside the message queue
583 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
585 // Construct message in the message queue memory; note that delete should not be called on the return value
586 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
589 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
591 typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
593 // Reserve some memory inside the message queue
594 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
596 // Construct message in the message queue memory; note that delete should not be called on the return value
597 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
600 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
602 typedef MessageValue1< UpdateManager, Animation* > LocalType;
604 // Reserve some memory inside the message queue
605 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
607 // Construct message in the message queue memory; note that delete should not be called on the return value
608 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
611 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
613 // The scene-graph thread owns this object so it can safely edit it.
614 Animation& animation = const_cast< Animation& >( constAnimation );
616 typedef MessageValue1< UpdateManager, Animation* > LocalType;
618 // Reserve some memory inside the message queue
619 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
621 // Construct message in the message queue memory; note that delete should not be called on the return value
622 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
625 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
627 // The scene-graph thread owns this object so it can safely edit it.
628 Animation& animation = const_cast< Animation& >( constAnimation );
630 typedef MessageValue1< UpdateManager, Animation* > LocalType;
632 // Reserve some memory inside the message queue
633 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
635 // Construct message in the message queue memory; note that delete should not be called on the return value
636 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
639 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
641 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
643 // Reserve some memory inside the message queue
644 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
646 // Construct message in the message queue memory; note that delete should not be called on the return value
647 new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
650 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
652 // The scene-graph thread owns this object so it can safely edit it.
653 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
655 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
657 // Reserve some memory inside the message queue
658 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
660 // Construct message in the message queue memory; note that delete should not be called on the return value
661 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
664 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
665 const PropertyNotification* constPropertyNotification,
666 PropertyNotification::NotifyMode notifyMode )
668 // The scene-graph thread owns this object so it can safely edit it.
669 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
671 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
673 // Reserve some memory inside the message queue
674 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
676 // Construct message in the message queue memory; note that delete should not be called on the return value
677 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
680 // The render thread can safely change the Shader
681 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
683 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
685 // Reserve some memory inside the message queue
686 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
688 // Construct message in the message queue memory; note that delete should not be called on the return value
689 new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
692 // The render thread can safely change the Shader
693 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
695 typedef MessageValue1< UpdateManager, Shader* > LocalType;
697 // Reserve some memory inside the message queue
698 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
700 // Construct message in the message queue memory; note that delete should not be called on the return value
701 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
704 inline void SetShaderProgramMessage( UpdateManager& manager,
706 GeometryType geometryType,
707 ShaderSubTypes subType,
708 Integration::ResourceId resourceId,
710 bool modifiesGeometry )
712 typedef MessageValue6< UpdateManager, Shader*, GeometryType, ShaderSubTypes, Integration::ResourceId, size_t, bool > LocalType;
714 // Reserve some memory inside the message queue
715 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
717 // Construct message in the message queue memory; note that delete should not be called on the return value
718 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, geometryType, subType, resourceId, shaderHash, modifiesGeometry );
721 // The render thread can safely change the AnimatableMesh
722 inline void AddAnimatableMeshMessage( UpdateManager& manager, AnimatableMesh& animatableMesh )
724 typedef MessageValue1< UpdateManager, AnimatableMesh* > LocalType;
726 // Reserve some memory inside the message queue
727 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
729 // Construct message in the message queue memory; note that delete should not be called on the return value
730 new (slot) LocalType( &manager, &UpdateManager::AddAnimatableMesh, &animatableMesh );
733 // The render thread can safely change the AnimatableMesh
734 inline void RemoveAnimatableMeshMessage( UpdateManager& manager, AnimatableMesh& animatableMesh )
736 typedef MessageValue1< UpdateManager, AnimatableMesh* > LocalType;
738 // Reserve some memory inside the message queue
739 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
741 // Construct message in the message queue memory; note that delete should not be called on the return value
742 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimatableMesh, &animatableMesh );
746 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
748 typedef MessageValue1< UpdateManager, Vector4 > LocalType;
750 // Reserve some memory inside the message queue
751 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
753 // Construct message in the message queue memory; note that delete should not be called on the return value
754 new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
757 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
759 typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
761 // Reserve some memory inside the message queue
762 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
764 // Construct message in the message queue memory; note that delete should not be called on the return value
765 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
768 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
770 typedef MessageValue1< UpdateManager, float > LocalType;
772 // Reserve some memory inside the message queue
773 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
775 // Construct message in the message queue memory; note that delete should not be called on the return value
776 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
780 * Create a message for setting the depth of a layer
781 * @param[in] manager The update manager
782 * @param[in] layers list of layers
783 * @param[in] systemLevel True if the layers are added via the SystemOverlay API
785 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
787 typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
789 // Reserve some memory inside the message queue
790 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
792 // Construct message in the message queue memory; note that delete should not be called on the return value
793 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
796 inline void AddMaterialMessage( UpdateManager& manager, Material* material )
798 typedef MessageValue1< UpdateManager, Material* > LocalType;
800 // Reserve some memory inside the message queue
801 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
803 // Construct message in the message queue memory; note that delete should not be called on the return value
804 new (slot) LocalType( &manager, &UpdateManager::AddMaterial, material );
807 inline void RemoveMaterialMessage( UpdateManager& manager, Material* material )
809 typedef MessageValue1< UpdateManager, Material* > LocalType;
811 // Reserve some memory inside the message queue
812 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
814 // Construct message in the message queue memory; note that delete should not be called on the return value
815 new (slot) LocalType( &manager, &UpdateManager::RemoveMaterial, material );
818 inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
820 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
822 // Reserve some memory inside the message queue
823 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
825 // Construct message in the message queue memory; note that delete should not be called on the return value
826 new (slot) LocalType( &manager, &UpdateManager::AddGesture, gesture );
829 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
831 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
833 // Reserve some memory inside the message queue
834 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
836 // Construct message in the message queue memory; note that delete should not be called on the return value
837 new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture );
840 #ifdef DYNAMICS_SUPPORT
843 inline void InitializeDynamicsWorldMessage( UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings )
845 typedef MessageValue2< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings* > LocalType;
847 // Reserve some memory inside the message queue
848 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
850 // Construct message in the message queue memory; note that delete should not be called on the return value
851 new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings );
854 inline void TerminateDynamicsWorldMessage(UpdateManager& manager)
856 typedef Message< UpdateManager > LocalType;
858 // Reserve some memory inside the message queue
859 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
861 // Construct message in the message queue memory; note that delete should not be called on the return value
862 new (slot) LocalType( &manager, &UpdateManager::TerminateDynamicsWorld );
865 #endif // DYNAMICS_SUPPORT
867 } // namespace SceneGraph
869 } // namespace Internal
873 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__