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/manager/object-owner-container.h>
35 #include <dali/internal/update/node-attachments/node-attachment.h>
36 #include <dali/internal/update/nodes/node.h>
37 #include <dali/internal/update/nodes/scene-graph-layer.h>
39 #include <dali/internal/render/shaders/scene-graph-shader.h>
47 class GlSyncAbstraction;
48 class RenderController;
49 struct DynamicsWorldSettings;
51 } // namespace Integration
56 class PropertyNotifier;
58 struct DynamicsWorldSettings;
59 class NotificationManager;
60 class CompleteNotificationInterface;
61 class ResourceManager;
64 // value types used by messages
65 template <> struct ParameterType< PropertyNotification::NotifyMode >
66 : 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 );
271 * @brief Get the geometry owner
273 * @return The geometry owner
275 ObjectOwnerContainer<Geometry*>& GetGeometryOwner();
278 * @brief Get the material owner
280 * @return The material owner
282 ObjectOwnerContainer<Material*>& GetMaterialOwner();
285 * @brief Get the sampler owner
287 * @return The sampler owner
289 ObjectOwnerContainer<Sampler*>& GetSamplerOwner();
292 * @brief Get the property buffer owner
294 * @return The property buffer owner
296 ObjectOwnerContainer<PropertyBuffer*>& GetPropertyBufferOwner();
302 * Add a newly created shader.
303 * @param[in] shader The shader to add.
304 * @post The shader is owned by the UpdateManager.
306 void AddShader(Shader* shader);
310 * @pre The shader has been added to the UpdateManager.
311 * @param[in] shader The shader to remove.
312 * @post The shader is destroyed.
314 void RemoveShader(Shader* shader);
317 * Set the shader program for a specified GeometryType to a Shader object
318 * @param[in] shader The shader to modify
319 * @param[in] geometryType The GeometryType to map to the program
320 * @param[in] subType The program subtype
321 * @param[in] resourceId A ResourceManager ticket ID for the program data (source and compiled binary)
322 * @param[in] shaderHash hash key created with vertex and fragment shader code
323 * @param[in] modifiesGeometry True if the vertex shader modifies geometry
325 void SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, Integration::ResourceId resourceId, size_t shaderHash, bool modifiesGeometry );
328 * Add a newly created gesture.
329 * @param[in] gesture The gesture to add.
330 * @post The gesture is owned by the UpdateManager.
332 void AddGesture( PanGesture* gesture );
336 * @pre The gesture has been added to the UpdateManager.
337 * @param[in] gesture The gesture to remove.
338 * @post The gesture is destroyed.
340 void RemoveGesture( PanGesture* gesture );
345 * Performs an Update traversal on the scene-graph.
346 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
347 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
348 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
349 * @return True if further updates are required e.g. during animations.
351 unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
354 * Set the background color i.e. the glClear color used at the beginning of each frame.
355 * @param[in] color The new background color.
357 void SetBackgroundColor(const Vector4& color);
360 * Set the default surface rect.
361 * @param[in] rect The rect value representing the surface.
363 void SetDefaultSurfaceRect( const Rect<int>& rect );
366 * @copydoc Dali::Stage::KeepRendering()
368 void KeepRendering( float durationSeconds );
371 * Sets the depths of all layers.
372 * @param layers The layers in depth order.
373 * @param[in] systemLevel True if using the system-level overlay.
375 void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
377 #ifdef DYNAMICS_SUPPORT
380 * Initialize the dynamics world
381 * @param[in] world The dynamics world
382 * @param[in] worldSettings The dynamics world settings
383 * @param[in] debugShader The shader used for rendering dynamics debug information
385 void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings );
388 * Terminate the dynamics world
390 void TerminateDynamicsWorld();
392 #endif // DYNAMICS_SUPPORT
397 UpdateManager(const UpdateManager&);
400 UpdateManager& operator=(const UpdateManager& rhs);
403 * Helper to check whether the update-thread should keep going.
404 * @param[in] elapsedSeconds The time in seconds since the previous update.
405 * @return True if the update-thread should keep going.
407 unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
410 * Helper to calculate new camera setup when root node resizes.
411 * @param[in] updateBuffer The buffer to read the root node size from.
413 void UpdateProjectionAndViewMatrices(int updateBuffer);
416 * Post process resources that have been updated by renderer
418 void PostProcessResources();
421 * Helper to reset a Node properties.
422 * @param[in] node The node.
424 void ResetNodeProperty( Node& node );
427 * Helper to reset all Node properties
429 void ResetProperties();
432 * Perform gesture updates.
433 * @param[in] lastVSyncTime The last VSync time in milliseconds.
434 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
435 * @return true, if any properties were updated.
437 bool ProcessGestures( unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
440 * Perform animation updates
441 * @param[in] elapsedSeconds time since last frame
443 void Animate( float elapsedSeconds );
446 * Perform constraint updates.
447 * @note Applies constraints to nodes first (depth first search order).
448 * Then shader constraints second (construction order)
450 void ApplyConstraints();
453 * Perform property notification updates
455 void ProcessPropertyNotifications();
458 * Update the default camera.
459 * This must be altered to match the root Node for 2D layouting.
460 * @param[in] updateBuffer The buffer to read the root node size from.
462 void UpdateDefaultCamera( int updateBuffer );
465 * Update node shaders, opacity, geometry etc.
471 // needs to be direct member so that getter for event buffer can be inlined
472 SceneGraphBuffers mSceneGraphBuffers;
479 // Messages for UpdateManager
481 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
483 typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
485 // Reserve some memory inside the message queue
486 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
488 // Construct message in the message queue memory; note that delete should not be called on the return value
489 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
492 inline void AddNodeMessage( UpdateManager& manager, Node& node )
494 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > 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::AddNode, &node );
503 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild, int index )
505 // Update thread can edit the object
506 Node& parent = const_cast< Node& >( constParent );
507 Node& child = const_cast< Node& >( constChild );
509 typedef MessageValue3< UpdateManager, Node*, Node*, int > LocalType;
511 // Reserve some memory inside the message queue
512 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
514 // Construct message in the message queue memory; note that delete should not be called on the return value
515 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child, index );
518 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
520 // Scene graph thread can modify this object.
521 Node& node = const_cast< Node& >( constNode );
523 typedef MessageValue1< UpdateManager, Node* > LocalType;
525 // Reserve some memory inside the message queue
526 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
528 // Construct message in the message queue memory; note that delete should not be called on the return value
529 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
532 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
534 // Scene graph thread can destroy this object.
535 Node& node = const_cast< Node& >( constNode );
537 typedef MessageValue1< UpdateManager, Node* > LocalType;
539 // Reserve some memory inside the message queue
540 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
542 // Construct message in the message queue memory; note that delete should not be called on the return value
543 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
546 inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment )
548 // Scene graph thread can modify this object.
549 Node& parent = const_cast< Node& >( constParent );
551 typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType;
553 // Reserve some memory inside the message queue
554 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
556 // Construct message in the message queue memory; note that delete should not be called on the return value
557 new (slot) LocalType( &manager, &UpdateManager::AttachToNode, &parent, attachment );
560 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
562 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > 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::AddObject, object );
571 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
573 typedef MessageValue1< UpdateManager, 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::RemoveObject, object );
582 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
584 typedef MessageValue1< UpdateManager, Animation* > 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::AddAnimation, animation );
593 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
595 // The scene-graph thread owns this object so it can safely edit it.
596 Animation& animation = const_cast< Animation& >( constAnimation );
598 typedef MessageValue1< UpdateManager, Animation* > LocalType;
600 // Reserve some memory inside the message queue
601 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
603 // Construct message in the message queue memory; note that delete should not be called on the return value
604 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
607 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
609 // The scene-graph thread owns this object so it can safely edit it.
610 Animation& animation = const_cast< Animation& >( constAnimation );
612 typedef MessageValue1< UpdateManager, Animation* > LocalType;
614 // Reserve some memory inside the message queue
615 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
617 // Construct message in the message queue memory; note that delete should not be called on the return value
618 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
621 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
623 typedef MessageValue1< UpdateManager, PropertyNotification* > 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::AddPropertyNotification, propertyNotification );
632 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
634 // The scene-graph thread owns this object so it can safely edit it.
635 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
637 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
639 // Reserve some memory inside the message queue
640 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
642 // Construct message in the message queue memory; note that delete should not be called on the return value
643 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
646 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
647 const PropertyNotification* constPropertyNotification,
648 PropertyNotification::NotifyMode notifyMode )
650 // The scene-graph thread owns this object so it can safely edit it.
651 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
653 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
655 // Reserve some memory inside the message queue
656 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
658 // Construct message in the message queue memory; note that delete should not be called on the return value
659 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
664 // The render thread can safely change the Shader
665 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
667 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
669 // Reserve some memory inside the message queue
670 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
672 // Construct message in the message queue memory; note that delete should not be called on the return value
673 new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
676 // The render thread can safely change the Shader
677 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
679 typedef MessageValue1< UpdateManager, Shader* > LocalType;
681 // Reserve some memory inside the message queue
682 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
684 // Construct message in the message queue memory; note that delete should not be called on the return value
685 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
688 inline void SetShaderProgramMessage( UpdateManager& manager,
690 GeometryType geometryType,
691 ShaderSubTypes subType,
692 Integration::ResourceId resourceId,
694 bool modifiesGeometry )
696 typedef MessageValue6< UpdateManager, Shader*, GeometryType, ShaderSubTypes, Integration::ResourceId, size_t, bool > LocalType;
698 // Reserve some memory inside the message queue
699 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
701 // Construct message in the message queue memory; note that delete should not be called on the return value
702 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, geometryType, subType, resourceId, shaderHash, modifiesGeometry );
705 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
707 typedef MessageValue1< UpdateManager, Vector4 > LocalType;
709 // Reserve some memory inside the message queue
710 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
712 // Construct message in the message queue memory; note that delete should not be called on the return value
713 new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
716 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
718 typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
720 // Reserve some memory inside the message queue
721 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
723 // Construct message in the message queue memory; note that delete should not be called on the return value
724 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
727 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
729 typedef MessageValue1< UpdateManager, float > LocalType;
731 // Reserve some memory inside the message queue
732 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
734 // Construct message in the message queue memory; note that delete should not be called on the return value
735 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
739 * Create a message for setting the depth of a layer
740 * @param[in] manager The update manager
741 * @param[in] layers list of layers
742 * @param[in] systemLevel True if the layers are added via the SystemOverlay API
744 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
746 typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
748 // Reserve some memory inside the message queue
749 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
751 // Construct message in the message queue memory; note that delete should not be called on the return value
752 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
755 inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
757 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
759 // Reserve some memory inside the message queue
760 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
762 // Construct message in the message queue memory; note that delete should not be called on the return value
763 new (slot) LocalType( &manager, &UpdateManager::AddGesture, gesture );
766 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
768 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
770 // Reserve some memory inside the message queue
771 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
773 // Construct message in the message queue memory; note that delete should not be called on the return value
774 new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture );
777 #ifdef DYNAMICS_SUPPORT
780 inline void InitializeDynamicsWorldMessage( UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings )
782 typedef MessageValue2< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings* > LocalType;
784 // Reserve some memory inside the message queue
785 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
787 // Construct message in the message queue memory; note that delete should not be called on the return value
788 new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings );
791 inline void TerminateDynamicsWorldMessage(UpdateManager& manager)
793 typedef Message< UpdateManager > LocalType;
795 // Reserve some memory inside the message queue
796 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
798 // Construct message in the message queue memory; note that delete should not be called on the return value
799 new (slot) LocalType( &manager, &UpdateManager::TerminateDynamicsWorld );
802 #endif // DYNAMICS_SUPPORT
805 template< typename T >
806 inline void AddMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
808 typedef MessageValue1< ObjectOwnerContainer<T>, OwnerPointer< T > > LocalType;
810 // Reserve some memory inside the message queue
811 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
812 // Construct message in the message queue memory; note that delete should not be called on the return value
813 new (slot) LocalType( &owner, &ObjectOwnerContainer<T>::Add, &object );
816 template< typename T >
817 inline void RemoveMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
819 typedef MessageValue1< ObjectOwnerContainer<T>, OwnerPointer< T > > LocalType;
821 // Reserve some memory inside the message queue
822 unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
823 // Construct message in the message queue memory; note that delete should not be called on the return value
824 new (slot) LocalType( &owner, &ObjectOwnerContainer<T>::Remove, &object );
827 } // namespace SceneGraph
829 } // namespace Internal
833 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__