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/event-to-update.h>
29 #include <dali/internal/common/type-abstraction-enums.h>
31 #include <dali/internal/update/animation/scene-graph-animation.h>
32 #include <dali/internal/update/common/scene-graph-buffers.h>
33 #include <dali/internal/update/common/scene-graph-property-notification.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>
40 //@todo MESH_REWORK Move messages to a separate file to avoid having dependent headers
41 // pollute core & slow the build down.
42 #include <dali/internal/update/geometry/scene-graph-geometry.h>
43 #include <dali/internal/update/effects/scene-graph-material.h>
51 class GlSyncAbstraction;
52 class RenderController;
53 struct DynamicsWorldSettings;
55 } // namespace Integration
60 class PropertyNotifier;
62 struct DynamicsWorldSettings;
63 class NotificationManager;
64 class CompleteNotificationInterface;
65 class ResourceManager;
68 // value types used by messages
69 template <> struct ParameterType< PropertyNotification::NotifyMode >
70 : public BasicType< PropertyNotification::NotifyMode > {};
85 * UpdateManager holds a scene graph i.e. a tree of nodes.
86 * It controls the Update traversal, in which nodes are repositioned/animated,
87 * and organizes the the culling and rendering of the scene.
94 * Construct a new UpdateManager.
95 * @param[in] notificationManager This should be notified when animations have finished.
96 * @param[in] glSyncAbstraction Used to determine when framebuffers are ready
97 * @param[in] animationFinishedNotifier The CompleteNotificationInterface that handles animation completions
98 * @param[in] propertyNotifier The PropertyNotifier
99 * @param[in] resourceManager The resource manager used to load textures etc.
100 * @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
101 * @param[in] controller After messages are flushed, we request a render from the RenderController.
102 * @param[in] renderManager This is responsible for rendering the results of each "update".
103 * @param[in] renderQueue Used to queue messages for the next render.
104 * @param[in] textureCache Used for caching textures.
105 * @param[in] touchResampler Used for re-sampling touch events.
107 UpdateManager( NotificationManager& notificationManager,
108 Integration::GlSyncAbstraction& glSyncAbstraction,
109 CompleteNotificationInterface& animationFinishedNotifier,
110 PropertyNotifier& propertyNotifier,
111 ResourceManager& resourceManager,
112 DiscardQueue& discardQueue,
113 Integration::RenderController& controller,
114 RenderManager& renderManager,
115 RenderQueue& renderQueue,
116 TextureCache& textureCache,
117 TouchResampler& touchResampler );
120 * Destructor. Not virtual as this is not a base class
125 * The event-thread uses this interface to queue messages for the next update.
126 * @return The event-to-update interface.
128 EventToUpdate& GetEventToUpdate();
131 * @return the event buffer index
133 BufferIndex GetEventBufferIndex() const
135 // inlined as its called often
136 return mSceneGraphBuffers.GetEventBufferIndex();
139 // Node connection methods
142 * Get the scene graph side list of RenderTasks.
143 * @param[in] systemLevel True if using the system-level overlay.
144 * @return The list of render tasks
146 RenderTaskList* GetRenderTaskList( bool systemLevel );
149 * Installs a new layer as the root node.
150 * @pre The UpdateManager does not already have an installed root node.
151 * @pre The layer is of derived Node type Layer.
152 * @pre The layer does not have a parent.
153 * @param[in] layer The new root node.
154 * @param[in] systemLevel True if using the system-level overlay.
155 * @post The node is owned by UpdateManager.
157 void InstallRoot( Layer* layer, bool systemLevel );
160 * Add a Node; UpdateManager takes ownership.
161 * @pre The node does not have a parent.
162 * @param[in] node The node to add.
164 void AddNode( Node* node );
167 * Connect a Node to the scene-graph.
168 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
169 * @pre The node does not already have a parent.
170 * @param[in] node The new parent node.
171 * @param[in] node The node to connect.
173 void ConnectNode( Node* parent, Node* node, int index );
176 * Disconnect a Node from the scene-graph.
177 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
178 * @pre The node has a parent.
179 * @param[in] node The node to disconnect.
181 void DisconnectNode( Node* node );
184 * Called when a property is set on a disconnected Node (via public API)
185 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
186 * @pre The node does not have a parent.
187 * @param[in] node The node to set as "active".
189 void SetNodeActive( Node* node );
192 * Destroy a Node owned by UpdateManager.
193 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
194 * In the following update, the previously queued Nodes may be deleted.
195 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
196 * @param[in] node The node to destroy.
198 void DestroyNode( Node* node );
201 * Attach an object to a Node.
202 * The UpdateManager is responsible for calling NodeAttachment::Initialize().
203 * @param[in] node The node which will own the attachment.
204 * @param[in] attachment The object to attach.
206 void AttachToNode( Node* node, NodeAttachment* attachment );
209 * Add a newly created object.
210 * @param[in] object The object to add.
211 * @post The object is owned by UpdateManager.
213 void AddObject( PropertyOwner* object );
217 * @param[in] object The object to remove.
219 void RemoveObject( PropertyOwner* object );
224 * Add a newly created animation.
225 * @param[in] animation The animation to add.
226 * @post The animation is owned by UpdateManager.
228 void AddAnimation( Animation* animation );
232 * @param[in] animation The animation to stop.
234 void StopAnimation( Animation* animation );
237 * Remove an animation.
238 * @param[in] animation The animation to remove.
240 void RemoveAnimation( Animation* animation );
243 * Query whether any animations are currently running.
244 * @return True if any animations are running.
246 bool IsAnimationRunning() const;
248 // Property Notification
251 * Add a newly created property notification
252 * @param[in] propertyNotification The notification to add
253 * @post The propertyNotification is owned by UpdateManager.
255 void AddPropertyNotification( PropertyNotification* propertyNotification );
258 * Remove a property notification
259 * @param[in] propertyNotification The notification to remove
261 void RemovePropertyNotification( PropertyNotification* propertyNotification );
264 * Set Notify state for PropertyNotification
265 * @param[in] propertyNotification The notification to remove
266 * @param[in] notifyMode The notification mode.
268 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
272 * Add a geometry to the scene graph
273 * @param[in] geometry The geometry to add
275 void AddGeometry( Geometry* geometry );
278 * Remove a geometry from the scene graph
279 * @param[in] geometry The geometry to remove
281 void RemoveGeometry( Geometry* geometry );
284 * Add a material to the scene graph
285 * @param[in] material The material to add
287 void AddMaterial( Material* material );
290 * Remove a material from the scene graph
291 * @param[in] material The material to remove
293 void RemoveMaterial( Material* material );
298 * Add a newly created shader.
299 * @param[in] shader The shader to add.
300 * @post The shader is owned by the UpdateManager.
302 void AddShader(Shader* shader);
306 * @pre The shader has been added to the UpdateManager.
307 * @param[in] shader The shader to remove.
308 * @post The shader is destroyed.
310 void RemoveShader(Shader* shader);
313 * Set the shader program for a specified GeometryType to a Shader object
314 * @param[in] shader The shader to modify
315 * @param[in] geometryType The GeometryType to map to the program
316 * @param[in] subType The program subtype
317 * @param[in] resourceId A ResourceManager ticket ID for the program data (source and compiled binary)
318 * @param[in] shaderHash hash key created with vertex and fragment shader code
319 * @param[in] modifiesGeometry True if the vertex shader modifies geometry
321 void SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, Integration::ResourceId resourceId, size_t shaderHash, bool modifiesGeometry );
324 * Add a newly created gesture.
325 * @param[in] gesture The gesture to add.
326 * @post The gesture is owned by the UpdateManager.
328 void AddGesture( PanGesture* gesture );
332 * @pre The gesture has been added to the UpdateManager.
333 * @param[in] gesture The gesture to remove.
334 * @post The gesture is destroyed.
336 void RemoveGesture( PanGesture* gesture );
341 * Performs an Update traversal on the scene-graph.
342 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
343 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
344 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
345 * @return True if further updates are required e.g. during animations.
347 unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
350 * Set the background color i.e. the glClear color used at the beginning of each frame.
351 * @param[in] color The new background color.
353 void SetBackgroundColor(const Vector4& color);
356 * Set the default surface rect.
357 * @param[in] rect The rect value representing the surface.
359 void SetDefaultSurfaceRect( const Rect<int>& rect );
362 * @copydoc Dali::Stage::KeepRendering()
364 void KeepRendering( float durationSeconds );
367 * Sets the depths of all layers.
368 * @param layers The layers in depth order.
369 * @param[in] systemLevel True if using the system-level overlay.
371 void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
373 #ifdef DYNAMICS_SUPPORT
376 * Initialize the dynamics world
377 * @param[in] world The dynamics world
378 * @param[in] worldSettings The dynamics world settings
379 * @param[in] debugShader The shader used for rendering dynamics debug information
381 void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings );
384 * Terminate the dynamics world
386 void TerminateDynamicsWorld();
388 #endif // DYNAMICS_SUPPORT
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 in milliseconds.
430 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
431 * @return true, if any properties were updated.
433 bool ProcessGestures( unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
436 * Perform animation updates
437 * @param[in] elapsedSeconds time since last frame
439 void Animate( float elapsedSeconds );
442 * Perform constraint updates.
443 * @note Applies constraints to nodes first (depth first search order).
444 * Then shader constraints second (construction order)
446 void ApplyConstraints();
449 * Perform property notification updates
451 void ProcessPropertyNotifications();
454 * Update the default camera.
455 * This must be altered to match the root Node for 2D layouting.
456 * @param[in] updateBuffer The buffer to read the root node size from.
458 void UpdateDefaultCamera( int updateBuffer );
461 * Update node shaders, opacity, geometry etc.
467 // needs to be direct member so that getter for event buffer can be inlined
468 SceneGraphBuffers mSceneGraphBuffers;
475 // Messages for UpdateManager
477 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
479 typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
481 // Reserve some memory inside the message queue
482 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
484 // Construct message in the message queue memory; note that delete should not be called on the return value
485 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
488 inline void AddNodeMessage( UpdateManager& manager, Node& node )
490 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
492 // Reserve some memory inside the message queue
493 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
495 // Construct message in the message queue memory; note that delete should not be called on the return value
496 new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
499 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild, int index )
501 // Update thread can edit the object
502 Node& parent = const_cast< Node& >( constParent );
503 Node& child = const_cast< Node& >( constChild );
505 typedef MessageValue3< UpdateManager, Node*, Node*, int > 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::ConnectNode, &parent, &child, index );
514 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
516 // Scene graph thread can modify this object.
517 Node& node = const_cast< Node& >( constNode );
519 typedef MessageValue1< UpdateManager, Node* > LocalType;
521 // Reserve some memory inside the message queue
522 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
524 // Construct message in the message queue memory; note that delete should not be called on the return value
525 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
528 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
530 // Scene graph thread can destroy this object.
531 Node& node = const_cast< Node& >( constNode );
533 typedef MessageValue1< UpdateManager, Node* > LocalType;
535 // Reserve some memory inside the message queue
536 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
538 // Construct message in the message queue memory; note that delete should not be called on the return value
539 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
542 inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment )
544 // Scene graph thread can modify this object.
545 Node& parent = const_cast< Node& >( constParent );
547 typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType;
549 // Reserve some memory inside the message queue
550 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
552 // Construct message in the message queue memory; note that delete should not be called on the return value
553 new (slot) LocalType( &manager, &UpdateManager::AttachToNode, &parent, attachment );
556 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
558 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
560 // Reserve some memory inside the message queue
561 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
563 // Construct message in the message queue memory; note that delete should not be called on the return value
564 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
567 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
569 typedef MessageValue1< UpdateManager, PropertyOwner* > 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::RemoveObject, object );
578 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
580 typedef MessageValue1< UpdateManager, Animation* > 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::AddAnimation, animation );
589 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
591 // The scene-graph thread owns this object so it can safely edit it.
592 Animation& animation = const_cast< Animation& >( constAnimation );
594 typedef MessageValue1< UpdateManager, Animation* > LocalType;
596 // Reserve some memory inside the message queue
597 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
599 // Construct message in the message queue memory; note that delete should not be called on the return value
600 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
603 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
605 // The scene-graph thread owns this object so it can safely edit it.
606 Animation& animation = const_cast< Animation& >( constAnimation );
608 typedef MessageValue1< UpdateManager, Animation* > LocalType;
610 // Reserve some memory inside the message queue
611 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
613 // Construct message in the message queue memory; note that delete should not be called on the return value
614 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
617 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
619 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
621 // Reserve some memory inside the message queue
622 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
624 // Construct message in the message queue memory; note that delete should not be called on the return value
625 new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
628 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
630 // The scene-graph thread owns this object so it can safely edit it.
631 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
633 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
635 // Reserve some memory inside the message queue
636 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
638 // Construct message in the message queue memory; note that delete should not be called on the return value
639 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
642 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
643 const PropertyNotification* constPropertyNotification,
644 PropertyNotification::NotifyMode notifyMode )
646 // The scene-graph thread owns this object so it can safely edit it.
647 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
649 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
651 // Reserve some memory inside the message queue
652 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
654 // Construct message in the message queue memory; note that delete should not be called on the return value
655 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
658 inline void AddGeometryMessage( UpdateManager& manager, Geometry& geometry )
660 typedef MessageValue1< UpdateManager, OwnerPointer< Geometry > > LocalType;
662 // Reserve some memory inside the message queue
663 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
665 // Construct message in the message queue memory; note that delete should not be called on the return value
666 new (slot) LocalType( &manager, &UpdateManager::AddGeometry, &geometry );
669 // The render thread can safely change the Geometry
670 inline void RemoveGeometryMessage( UpdateManager& manager, Geometry& geometry )
672 typedef MessageValue1< UpdateManager, Geometry* > LocalType;
674 // Reserve some memory inside the message queue
675 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
677 // Construct message in the message queue memory; note that delete should not be called on the return value
678 new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry );
681 inline void AddMaterialMessage( UpdateManager& manager, Material& material )
683 typedef MessageValue1< UpdateManager, OwnerPointer< Material > > 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::AddMaterial, &material );
692 // The render thread can safely change the Material
693 inline void RemoveMaterialMessage( UpdateManager& manager, Material& material )
695 typedef MessageValue1< UpdateManager, Material* > 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::RemoveMaterial, &material );
705 // The render thread can safely change the Shader
706 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
708 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
710 // Reserve some memory inside the message queue
711 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
713 // Construct message in the message queue memory; note that delete should not be called on the return value
714 new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
717 // The render thread can safely change the Shader
718 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
720 typedef MessageValue1< UpdateManager, Shader* > LocalType;
722 // Reserve some memory inside the message queue
723 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
725 // Construct message in the message queue memory; note that delete should not be called on the return value
726 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
729 inline void SetShaderProgramMessage( UpdateManager& manager,
731 GeometryType geometryType,
732 ShaderSubTypes subType,
733 Integration::ResourceId resourceId,
735 bool modifiesGeometry )
737 typedef MessageValue6< UpdateManager, Shader*, GeometryType, ShaderSubTypes, Integration::ResourceId, size_t, bool > LocalType;
739 // Reserve some memory inside the message queue
740 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
742 // Construct message in the message queue memory; note that delete should not be called on the return value
743 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, geometryType, subType, resourceId, shaderHash, modifiesGeometry );
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 AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
798 typedef MessageValue1< UpdateManager, PanGesture* > 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::AddGesture, gesture );
807 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
809 typedef MessageValue1< UpdateManager, PanGesture* > 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::RemoveGesture, gesture );
818 #ifdef DYNAMICS_SUPPORT
821 inline void InitializeDynamicsWorldMessage( UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings )
823 typedef MessageValue2< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings* > LocalType;
825 // Reserve some memory inside the message queue
826 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
828 // Construct message in the message queue memory; note that delete should not be called on the return value
829 new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings );
832 inline void TerminateDynamicsWorldMessage(UpdateManager& manager)
834 typedef Message< UpdateManager > LocalType;
836 // Reserve some memory inside the message queue
837 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
839 // Construct message in the message queue memory; note that delete should not be called on the return value
840 new (slot) LocalType( &manager, &UpdateManager::TerminateDynamicsWorld );
843 #endif // DYNAMICS_SUPPORT
845 } // namespace SceneGraph
847 } // namespace Internal
851 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__