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 Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/public-api/common/vector-wrapper.h>
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/integration-api/resource-declarations.h>
24 #include <dali/internal/common/message.h>
25 #include <dali/internal/common/event-to-update.h>
26 #include <dali/internal/render/shaders/shader.h>
27 #include <dali/internal/update/nodes/node.h>
28 #include <dali/internal/update/node-attachments/node-attachment.h>
29 #include <dali/internal/update/common/scene-graph-buffers.h>
30 #include <dali/internal/update/animation/scene-graph-animation.h>
31 #include <dali/internal/update/common/scene-graph-property-notification.h>
32 #include <dali/internal/update/common/double-buffered.h>
33 #include <dali/internal/update/modeling/scene-graph-animatable-mesh.h>
34 #include <dali/internal/update/nodes/scene-graph-layer.h>
35 #include <dali/internal/event/effects/shader-declarations.h>
36 #include <dali/internal/common/type-abstraction-enums.h>
43 class GlSyncAbstraction;
44 class RenderController;
45 struct DynamicsWorldSettings;
47 } // namespace Integration
52 class AnimationFinishedNotifier;
53 class PropertyNotifier;
55 struct DynamicsWorldSettings;
56 class NotificationManager;
57 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 AnimationFinishedNotifier
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 AnimationFinishedNotifier& 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 * Sets a pointer to the internal render task list.
124 * The render task list is used to notify which render tasks with refresh rate REFRESH_ONCE have finished.
126 * @param[in] renderTaskList A pointer to the internal render task list.
128 void SetRenderTaskList( Internal::RenderTaskList* renderTaskList );
131 * The event-thread uses this interface to queue messages for the next update.
132 * @return The event-to-update interface.
134 EventToUpdate& GetEventToUpdate();
137 * @return the event buffer index
139 BufferIndex GetEventBufferIndex() const
141 // inlined as its called often
142 return mSceneGraphBuffers.GetEventBufferIndex();
145 // Node connection methods
148 * Get the scene graph side list of RenderTasks.
149 * @param[in] systemLevel True if using the system-level overlay.
150 * @return The list of render tasks
152 RenderTaskList* GetRenderTaskList( bool systemLevel );
155 * Installs a new layer as the root node.
156 * @pre The UpdateManager does not already have an installed root node.
157 * @pre The layer is of derived Node type Layer.
158 * @pre The layer does not have a parent.
159 * @param[in] layer The new root node.
160 * @param[in] systemLevel True if using the system-level overlay.
161 * @post The node is owned by UpdateManager.
163 void InstallRoot( Layer* layer, bool systemLevel );
166 * Add a Node; UpdateManager takes ownership.
167 * @pre The node does not have a parent.
168 * @param[in] node The node to add.
170 void AddNode( Node* node );
173 * Connect a Node to the scene-graph.
174 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
175 * @pre The node does not already have a parent.
176 * @param[in] node The new parent node.
177 * @param[in] node The node to connect.
179 void ConnectNode( Node* parent, Node* node );
182 * Disconnect a Node from the scene-graph.
183 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
184 * @pre The node has a parent.
185 * @param[in] node The node to disconnect.
187 void DisconnectNode( Node* node );
190 * Called when a property is set on a disconnected Node (via public API)
191 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
192 * @pre The node does not have a parent.
193 * @param[in] node The node to set as "active".
195 void SetNodeActive( Node* node );
198 * Destroy a Node owned by UpdateManager.
199 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
200 * In the following update, the previously queued Nodes may be deleted.
201 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
202 * @param[in] node The node to destroy.
204 void DestroyNode( Node* node );
207 * Attach an object to a Node.
208 * The UpdateManager is responsible for calling NodeAttachment::Initialize().
209 * @param[in] node The node which will own the attachment.
210 * @param[in] attachment The object to attach.
212 void AttachToNode( Node* node, NodeAttachment* attachment );
215 * Add a newly created object.
216 * @param[in] object The object to add.
217 * @post The object is owned by UpdateManager.
219 void AddObject( PropertyOwner* object );
223 * @param[in] object The object to remove.
225 void RemoveObject( PropertyOwner* object );
230 * Add a newly created animation.
231 * @param[in] animation The animation to add.
232 * @post The animation is owned by UpdateManager.
234 void AddAnimation( Animation* animation );
238 * @param[in] animation The animation to stop.
240 void StopAnimation( Animation* animation );
243 * Remove an animation.
244 * @param[in] animation The animation to remove.
246 void RemoveAnimation( Animation* animation );
249 * Query whether any animations are currently running.
250 * @return True if any animations are running.
252 bool IsAnimationRunning() const;
254 // Property Notification
257 * Add a newly created property notification
258 * @param[in] propertyNotification The notification to add
259 * @post The propertyNotification is owned by UpdateManager.
261 void AddPropertyNotification( PropertyNotification* propertyNotification );
264 * Remove a property notification
265 * @param[in] propertyNotification The notification to remove
267 void RemovePropertyNotification( PropertyNotification* propertyNotification );
270 * Set Notify state for PropertyNotification
271 * @param[in] propertyNotification The notification to remove
272 * @param[in] notifyMode The notification mode.
274 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
279 * Retrieve the default shader.
280 * @return The default shader.
282 Shader* GetDefaultShader();
285 * Add a newly created shader.
286 * @param[in] shader The shader to add.
287 * @post The shader is owned by the UpdateManager.
289 void AddShader(Shader* shader);
293 * @pre The shader has been added to the UpdateManager.
294 * @param[in] shader The shader to remove.
295 * @post The shader is destroyed.
297 void RemoveShader(Shader* shader);
300 * Set the shader program for a specified GeometryType to a Shader object
301 * @param[in] shader The shader to modify
302 * @param[in] geometryType The GeometryType to map to the program
303 * @param[in] subType The program subtype
304 * @param[in] resourceId A ResourceManager ticket ID for the program data (source and compiled binary)
305 * @param[in] shaderHash hash key created with vertex and fragment shader code
307 void SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, Integration::ResourceId resourceId, size_t shaderHash );
310 * Add an animatable mesh
311 * @param[in] animatableMesh The animatable mesh to add.
312 * @post the animatableMesh is owned by the UpdateManager.
314 void AddAnimatableMesh( AnimatableMesh* animatableMesh );
317 * Remove an animatable mesh
318 * @pre The animatable mesh has been added to the update manager
319 * @param[in] animatableMesh The animatable mesh to add.
321 void RemoveAnimatableMesh( AnimatableMesh* animatableMesh );
325 * @param[in] material The material to add
326 * @post the material remains owned by its event object
328 void AddMaterial(Material* material);
332 * @pre The material has been added to the UpdateManager
333 * @param[in] material The material to remove
335 void RemoveMaterial(Material* material);
338 * Add a newly created gesture.
339 * @param[in] gesture The gesture to add.
340 * @post The gesture is owned by the UpdateManager.
342 void AddGesture( PanGesture* gesture );
346 * @pre The gesture has been added to the UpdateManager.
347 * @param[in] gesture The gesture to remove.
348 * @post The gesture is destroyed.
350 void RemoveGesture( PanGesture* gesture );
355 * Performs an Update traversal on the scene-graph.
356 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
357 * @param[in] lastVSyncTime The last time, in milliseconds, that we had a VSync.
358 * @param[in] nextVSyncTime The estimated time, in milliseconds, of the next VSync.
359 * @return True if further updates are required e.g. during animations.
361 unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTime, unsigned int nextVSyncTime );
364 * Set the background color i.e. the glClear color used at the beginning of each frame.
365 * @param[in] color The new background color.
367 void SetBackgroundColor(const Vector4& color);
370 * Set the default surface rect.
371 * @param[in] rect The rect value representing the surface.
373 void SetDefaultSurfaceRect( const Rect<int>& rect );
376 * @copydoc Dali::Stage::KeepRendering()
378 void KeepRendering( float durationSeconds );
381 * Sets the depths of all layers.
382 * @param layers The layers in depth order.
383 * @param[in] systemLevel True if using the system-level overlay.
385 void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
387 void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings, Shader* debugShader );
388 void TerminateDynamicsWorld();
393 UpdateManager(const UpdateManager&);
396 UpdateManager& operator=(const UpdateManager& rhs);
399 * Helper to check whether the update-thread should keep going.
400 * @param[in] elapsedSeconds The time in seconds since the previous update.
401 * @return True if the update-thread should keep going.
403 unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
406 * Helper to calculate new camera setup when root node resizes.
407 * @param[in] updateBuffer The buffer to read the root node size from.
409 void UpdateProjectionAndViewMatrices(int updateBuffer);
412 * Post process resources that have been updated by renderer
414 void PostProcessResources();
417 * Helper to reset a Node properties.
418 * @param[in] node The node.
420 void ResetNodeProperty( Node& node );
423 * Helper to reset all Node properties
425 void ResetProperties();
428 * Perform gesture updates.
429 * @param[in] lastVSyncTime The last VSync time.
430 * @param[in] nextVSyncTime The estimated time of the next VSync.
432 void ProcessGestures( unsigned int lastVSyncTime, unsigned int nextVSyncTime );
435 * Perform animation updates
436 * @param[in] elapsedSeconds time since last frame
438 void Animate( float elapsedSeconds );
441 * Perform constraint updates.
442 * @note Applies constraints to nodes first (depth first search order).
443 * Then shader constraints second (construction order)
445 void ApplyConstraints();
448 * Perform property notification updates
450 void ProcessPropertyNotifications();
453 * Update the default camera.
454 * This must be altered to match the root Node for 2D layouting.
455 * @param[in] updateBuffer The buffer to read the root node size from.
457 void UpdateDefaultCamera( int updateBuffer );
460 * Update node shaders, opacity, geometry etc.
465 * Update animatable meshes
467 void UpdateMeshes( BufferIndex updateBufferIndex, AnimatableMeshContainer& meshes );
470 * Update materials - Ensure all render materials are updated with texture pointers
473 void UpdateMaterials( BufferIndex updateBufferIndex, MaterialContainer& materials );
476 * PrepareMaterials - Ensure updated material properties are sent to render materials
478 void PrepareMaterials( BufferIndex updateBufferIndex, MaterialContainer& materials );
482 // needs to be direct member so that getter for event buffer can be inlined
483 SceneGraphBuffers mSceneGraphBuffers;
490 // Messages for UpdateManager
492 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
494 typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
496 // Reserve some memory inside the message queue
497 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
499 // Construct message in the message queue memory; note that delete should not be called on the return value
500 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
503 inline void AddNodeMessage( UpdateManager& manager, Node& node )
505 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
507 // Reserve some memory inside the message queue
508 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
510 // Construct message in the message queue memory; note that delete should not be called on the return value
511 new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
514 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
516 // Update thread can edit the object
517 Node& parent = const_cast< Node& >( constParent );
518 Node& child = const_cast< Node& >( constChild );
520 typedef MessageValue2< UpdateManager, Node*, Node* > LocalType;
522 // Reserve some memory inside the message queue
523 unsigned int* slot = manager.GetEventToUpdate().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::ConnectNode, &parent, &child );
529 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
531 // Scene graph thread can modify this object.
532 Node& node = const_cast< Node& >( constNode );
534 typedef MessageValue1< UpdateManager, Node* > LocalType;
536 // Reserve some memory inside the message queue
537 unsigned int* slot = manager.GetEventToUpdate().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::DisconnectNode, &node );
543 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
545 // Scene graph thread can destroy 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.GetEventToUpdate().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::DestroyNode, &node );
557 inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment )
559 // Scene graph thread can modify this object.
560 Node& parent = const_cast< Node& >( constParent );
562 typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType;
564 // Reserve some memory inside the message queue
565 unsigned int* slot = manager.GetEventToUpdate().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::AttachToNode, &parent, attachment );
571 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
573 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
575 // Reserve some memory inside the message queue
576 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
578 // Construct message in the message queue memory; note that delete should not be called on the return value
579 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
582 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
584 typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
586 // Reserve some memory inside the message queue
587 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
589 // Construct message in the message queue memory; note that delete should not be called on the return value
590 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
593 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
595 typedef MessageValue1< UpdateManager, Animation* > LocalType;
597 // Reserve some memory inside the message queue
598 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
600 // Construct message in the message queue memory; note that delete should not be called on the return value
601 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
604 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
606 // The scene-graph thread owns this object so it can safely edit it.
607 Animation& animation = const_cast< Animation& >( constAnimation );
609 typedef MessageValue1< UpdateManager, Animation* > LocalType;
611 // Reserve some memory inside the message queue
612 unsigned int* slot = manager.GetEventToUpdate().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::StopAnimation, &animation );
618 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
620 // The scene-graph thread owns this object so it can safely edit it.
621 Animation& animation = const_cast< Animation& >( constAnimation );
623 typedef MessageValue1< UpdateManager, Animation* > LocalType;
625 // Reserve some memory inside the message queue
626 unsigned int* slot = manager.GetEventToUpdate().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::RemoveAnimation, &animation );
632 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
634 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
636 // Reserve some memory inside the message queue
637 unsigned int* slot = manager.GetEventToUpdate().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::AddPropertyNotification, propertyNotification );
643 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
645 // The scene-graph thread owns this object so it can safely edit it.
646 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
648 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
650 // Reserve some memory inside the message queue
651 unsigned int* slot = manager.GetEventToUpdate().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::RemovePropertyNotification, &propertyNotification );
657 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
658 const PropertyNotification* constPropertyNotification,
659 PropertyNotification::NotifyMode notifyMode )
661 // The scene-graph thread owns this object so it can safely edit it.
662 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
664 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
666 // Reserve some memory inside the message queue
667 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
669 // Construct message in the message queue memory; note that delete should not be called on the return value
670 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
673 // The render thread can safely change the Shader
674 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
676 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
678 // Reserve some memory inside the message queue
679 unsigned int* slot = manager.GetEventToUpdate().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::AddShader, &shader );
685 // The render thread can safely change the Shader
686 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
688 typedef MessageValue1< UpdateManager, Shader* > LocalType;
690 // Reserve some memory inside the message queue
691 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
693 // Construct message in the message queue memory; note that delete should not be called on the return value
694 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
697 inline void SetShaderProgramMessage( UpdateManager& manager,
699 GeometryType geometryType,
700 ShaderSubTypes subType,
701 Integration::ResourceId resourceId,
704 typedef MessageValue5< UpdateManager, Shader*, GeometryType, ShaderSubTypes, Integration::ResourceId, size_t > LocalType;
706 // Reserve some memory inside the message queue
707 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
709 // Construct message in the message queue memory; note that delete should not be called on the return value
710 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, geometryType, subType, resourceId, shaderHash );
713 // The render thread can safely change the AnimatableMesh
714 inline void AddAnimatableMeshMessage( UpdateManager& manager, AnimatableMesh& animatableMesh )
716 typedef MessageValue1< UpdateManager, AnimatableMesh* > LocalType;
718 // Reserve some memory inside the message queue
719 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
721 // Construct message in the message queue memory; note that delete should not be called on the return value
722 new (slot) LocalType( &manager, &UpdateManager::AddAnimatableMesh, &animatableMesh );
725 // The render thread can safely change the AnimatableMesh
726 inline void RemoveAnimatableMeshMessage( UpdateManager& manager, AnimatableMesh& animatableMesh )
728 typedef MessageValue1< UpdateManager, AnimatableMesh* > LocalType;
730 // Reserve some memory inside the message queue
731 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
733 // Construct message in the message queue memory; note that delete should not be called on the return value
734 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimatableMesh, &animatableMesh );
738 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
740 typedef MessageValue1< UpdateManager, Vector4 > LocalType;
742 // Reserve some memory inside the message queue
743 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
745 // Construct message in the message queue memory; note that delete should not be called on the return value
746 new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
749 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
751 typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
753 // Reserve some memory inside the message queue
754 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
756 // Construct message in the message queue memory; note that delete should not be called on the return value
757 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
760 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
762 typedef MessageValue1< UpdateManager, float > LocalType;
764 // Reserve some memory inside the message queue
765 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
767 // Construct message in the message queue memory; note that delete should not be called on the return value
768 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
772 * Create a message for setting the depth of a layer
773 * @param[in] manager The update manager
774 * @param[in] layers list of layers
775 * @param[in] systemLevel True if the layers are added via the SystemOverlay API
777 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
779 typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
781 // Reserve some memory inside the message queue
782 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
784 // Construct message in the message queue memory; note that delete should not be called on the return value
785 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
789 inline void InitializeDynamicsWorldMessage(UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings, const Shader* debugShader)
791 typedef MessageValue3< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings*, Shader*> LocalType;
793 // Reserve some memory inside the message queue
794 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
796 // Construct message in the message queue memory; note that delete should not be called on the return value
797 new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings, const_cast<Shader*>(debugShader) );
800 inline void TerminateDynamicsWorldMessage(UpdateManager& manager)
802 typedef Message< UpdateManager > LocalType;
804 // Reserve some memory inside the message queue
805 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
807 // Construct message in the message queue memory; note that delete should not be called on the return value
808 new (slot) LocalType( &manager, &UpdateManager::TerminateDynamicsWorld );
811 inline void AddMaterialMessage( UpdateManager& manager, Material* material )
813 typedef MessageValue1< UpdateManager, Material* > LocalType;
815 // Reserve some memory inside the message queue
816 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
818 // Construct message in the message queue memory; note that delete should not be called on the return value
819 new (slot) LocalType( &manager, &UpdateManager::AddMaterial, material );
822 inline void RemoveMaterialMessage( UpdateManager& manager, Material* material )
824 typedef MessageValue1< UpdateManager, Material* > LocalType;
826 // Reserve some memory inside the message queue
827 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
829 // Construct message in the message queue memory; note that delete should not be called on the return value
830 new (slot) LocalType( &manager, &UpdateManager::RemoveMaterial, material );
833 inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
835 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
837 // Reserve some memory inside the message queue
838 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
840 // Construct message in the message queue memory; note that delete should not be called on the return value
841 new (slot) LocalType( &manager, &UpdateManager::AddGesture, gesture );
844 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
846 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
848 // Reserve some memory inside the message queue
849 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
851 // Construct message in the message queue memory; note that delete should not be called on the return value
852 new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture );
855 } // namespace SceneGraph
857 } // namespace Internal
861 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__