#define DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/vector-wrapper.h>
+
+#include <dali/devel-api/common/stage-devel.h>
#include <dali/internal/common/message.h>
-#include <dali/internal/common/type-abstraction-enums.h>
#include <dali/internal/common/shader-saver.h>
+#include <dali/internal/common/type-abstraction-enums.h>
#include <dali/internal/event/common/event-thread-services.h>
+#include <dali/internal/event/rendering/texture-impl.h>
+#include <dali/internal/render/renderers/render-texture.h> // For OwnerPointer<Render::Texture>
+#include <dali/internal/render/renderers/render-vertex-buffer.h>
+#include <dali/internal/render/shaders/render-shader.h> // for OwnerPointer< Shader >
#include <dali/internal/update/animation/scene-graph-animation.h>
+#include <dali/internal/update/common/node-resetter.h>
#include <dali/internal/update/common/property-resetter.h>
#include <dali/internal/update/common/scene-graph-buffers.h>
#include <dali/internal/update/common/scene-graph-property-notification.h>
+#include <dali/internal/update/common/scene-graph-scene.h>
+#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
+#include <dali/internal/update/manager/scene-graph-frame-callback.h> // for OwnerPointer< FrameCallback >
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/nodes/scene-graph-layer.h>
-#include <dali/internal/update/rendering/scene-graph-renderer.h> // for OwnerPointer< Renderer >
-#include <dali/internal/update/rendering/scene-graph-texture-set.h> // for OwnerPointer< TextureSet >
-#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
#include <dali/internal/update/render-tasks/scene-graph-camera.h>
-#include <dali/internal/render/shaders/scene-graph-shader.h> // for OwnerPointer< Shader >
-#include <dali/internal/render/renderers/render-property-buffer.h>
-#include <dali/internal/event/rendering/texture-impl.h>
+#include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
+#include <dali/internal/update/rendering/scene-graph-renderer.h> // for OwnerPointer< Renderer >
+#include <dali/internal/update/rendering/scene-graph-texture-set.h> // for OwnerPointer< TextureSet >
namespace Dali
{
+class FrameCallbackInterface;
namespace Integration
{
-class GlSyncAbstraction;
class RenderController;
} // namespace Integration
namespace Internal
{
-
class PropertyNotifier;
class NotificationManager;
class CompleteNotificationInterface;
{
struct Sampler;
class FrameBuffer;
-}
+} // namespace Render
// value types used by messages
-template <> struct ParameterType< PropertyNotification::NotifyMode >
-: public BasicType< PropertyNotification::NotifyMode > {};
+template<>
+struct ParameterType<PropertyNotification::NotifyMode>
+: public BasicType<PropertyNotification::NotifyMode>
+{
+};
namespace SceneGraph
{
-
class Animation;
class DiscardQueue;
class RenderManager;
class RenderTaskList;
class RenderTaskProcessor;
class RenderQueue;
-class PropertyBuffer;
-
-struct NodeDepthPair
-{
- SceneGraph::Node* node;
- uint32_t sortedDepth;
- NodeDepthPair( SceneGraph::Node* node, uint32_t sortedDepth )
- : node(node),
- sortedDepth(sortedDepth)
- {
- }
-};
-
-struct NodeDepths
-{
- NodeDepths()
- {
- }
-
- void Add( SceneGraph::Node* node, uint32_t sortedDepth )
- {
- nodeDepths.push_back( NodeDepthPair( node, sortedDepth ) );
- }
-
- std::vector<NodeDepthPair> nodeDepths;
-};
-
+class VertexBuffer;
/**
* UpdateManager maintains a scene graph i.e. a tree of nodes as well as
class UpdateManager : public ShaderSaver
{
public:
-
/**
* Construct a new UpdateManager.
* @param[in] notificationManager This should be notified when animations have finished.
* @param[in] renderQueue Used to queue messages for the next render.
* @param[in] renderTaskProcessor Handles RenderTasks and RenderInstrucitons.
*/
- UpdateManager( NotificationManager& notificationManager,
- CompleteNotificationInterface& animationPlaylist,
- PropertyNotifier& propertyNotifier,
- DiscardQueue& discardQueue,
- Integration::RenderController& controller,
- RenderManager& renderManager,
- RenderQueue& renderQueue,
- RenderTaskProcessor& renderTaskProcessor );
+ UpdateManager(NotificationManager& notificationManager,
+ CompleteNotificationInterface& animationPlaylist,
+ PropertyNotifier& propertyNotifier,
+ DiscardQueue& discardQueue,
+ Integration::RenderController& controller,
+ RenderManager& renderManager,
+ RenderQueue& renderQueue,
+ RenderTaskProcessor& renderTaskProcessor);
/**
* Destructor.
*/
- virtual ~UpdateManager();
+ ~UpdateManager() override;
// Node connection methods
/**
* Installs a new layer as the root node.
- * @pre The UpdateManager does not already have an installed root node.
* @pre The layer is of derived Node type Layer.
* @pre The layer does not have a parent.
* @param[in] layer The new root node.
- * @param[in] systemLevel True if using the system-level overlay.
* @post The node is owned by UpdateManager.
*/
- void InstallRoot( OwnerPointer<Layer>& layer, bool systemLevel );
+ void InstallRoot(OwnerPointer<Layer>& layer);
+
+ /**
+ * Uninstalls the root node.
+ * @pre The layer is of derived Node type Layer.
+ * @pre The layer does not have a parent.
+ * @param[in] layer The root node.
+ * @post The node is owned by UpdateManager.
+ */
+ void UninstallRoot(Layer* layer);
/**
* Add a Node; UpdateManager takes ownership.
* @note even though nodes are pool allocated, they also contain other heap allocated data, thus using OwnerPointer when transferring the data
* @param[in] node The node to add.
*/
- void AddNode( OwnerPointer<Node>& node );
+ void AddNode(OwnerPointer<Node>& node);
/**
* Connect a Node to the scene-graph.
* @pre The node does not already have a parent.
* @param[in] parent The new parent node.
*/
- void ConnectNode( Node* parent, Node* node );
+ void ConnectNode(Node* parent, Node* node);
/**
* Disconnect a Node from the scene-graph.
* @pre The node has a parent.
* @param[in] node The node to disconnect.
*/
- void DisconnectNode( Node* node );
+ void DisconnectNode(Node* node);
/**
* Destroy a Node owned by UpdateManager.
* @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
* @param[in] node The node to destroy.
*/
- void DestroyNode( Node* node );
+ void DestroyNode(Node* node);
/**
* Add a camera on scene
* @param[in] camera The camera to add
*/
- void AddCamera( OwnerPointer< Camera >& camera );
+ void AddCamera(OwnerPointer<Camera>& camera);
/**
* Remove a camera from scene
* @param[in] camera to remove
*/
- void RemoveCamera( const Camera* camera );
+ void RemoveCamera(Camera* camera);
/**
* Add a newly created object.
* @param[in] object The object to add.
* @post The object is owned by UpdateManager.
*/
- void AddObject( OwnerPointer<PropertyOwner>& object );
+ void AddObject(OwnerPointer<PropertyOwner>& object);
/**
* Remove an object.
* @param[in] object The object to remove.
*/
- void RemoveObject( PropertyOwner* object );
+ void RemoveObject(PropertyOwner* object);
+
+ /**
+ * Add a newly created render task list.
+ * @param[in] taskList The render task list to add.
+ * @post The render task list is owned by UpdateManager.
+ */
+ void AddRenderTaskList(OwnerPointer<RenderTaskList>& taskList);
+
+ /**
+ * Remove a render task list.
+ * @param[in] taskList The render task list to remove.
+ */
+ void RemoveRenderTaskList(RenderTaskList* taskList);
+
+ /**
+ * Add a newly created scene.
+ * @param[in] scene The scene to add.
+ * @post The scene is owned by UpdateManager.
+ */
+ void AddScene(OwnerPointer<Scene>& scene);
+
+ /**
+ * Remove a scene.
+ * @param[in] scene The scene to remove.
+ */
+ void RemoveScene(Scene* scene);
// Animations
* @param[in] animation The animation to add.
* @post The animation is owned by UpdateManager.
*/
- void AddAnimation( OwnerPointer< SceneGraph::Animation >& animation );
+ void AddAnimation(OwnerPointer<SceneGraph::Animation>& animation);
/**
* Stop an animation.
* @param[in] animation The animation to stop.
*/
- void StopAnimation( Animation* animation );
+ void StopAnimation(Animation* animation);
/**
* Remove an animation.
* @param[in] animation The animation to remove.
*/
- void RemoveAnimation( Animation* animation );
+ void RemoveAnimation(Animation* animation);
/**
* Query whether any animations are currently running.
* It will be killed by UpdateManager when the associated animator or
* constraint has finished; or the property owner of the property is destroyed.
*/
- void AddPropertyResetter( OwnerPointer<PropertyResetterBase>& propertyResetter );
+ void AddPropertyResetter(OwnerPointer<PropertyResetterBase>& propertyResetter);
+
+ /**
+ * Add a node resetter. UpdateManager takes ownership of the object.
+ * It will be killed by UpdateManager when the node is disconnected from the scene graph;
+ * or when the node is destroyed.
+ */
+ void AddNodeResetter(OwnerPointer<NodeResetter>& nodeResetter);
// Property Notification
* @param[in] propertyNotification The notification to add
* @post The propertyNotification is owned by UpdateManager.
*/
- void AddPropertyNotification( OwnerPointer< PropertyNotification >& propertyNotification );
+ void AddPropertyNotification(OwnerPointer<PropertyNotification>& propertyNotification);
/**
* Remove a property notification
* @param[in] propertyNotification The notification to remove
*/
- void RemovePropertyNotification( PropertyNotification* propertyNotification );
+ void RemovePropertyNotification(PropertyNotification* propertyNotification);
/**
* Set Notify state for PropertyNotification
* @param[in] propertyNotification The notification to remove
* @param[in] notifyMode The notification mode.
*/
- void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
+ void PropertyNotificationSetNotify(PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode);
// Shaders
* @param[in] shader The shader to add.
* @post The shader is owned by the UpdateManager.
*/
- void AddShader( OwnerPointer< Shader >& shader );
+ void AddShader(OwnerPointer<Shader>& shader);
/**
* Remove a shader.
* @param[in] shader The shader to remove.
* @post The shader is destroyed.
*/
- void RemoveShader( Shader* shader );
+ void RemoveShader(Shader* shader);
/**
- * Set the shader program for a Shader object
+ * Set the shader data for a Shader object
* @param[in] shader The shader to modify
* @param[in] shaderData Source code, hash over source, and optional compiled binary for the shader program
- * @param[in] modifiesGeometry True if the vertex shader modifies geometry
*/
- void SetShaderProgram( Shader* shader, Internal::ShaderDataPtr shaderData, bool modifiesGeometry );
+ void SetShaderData(Shader* shader, Internal::ShaderDataPtr shaderData);
/**
* @brief Accept compiled shaders passed back on render thread for saving.
* @param[in] shaderData Source code, hash over source, and corresponding compiled binary to be saved.
*/
- virtual void SaveBinary( Internal::ShaderDataPtr shaderData );
+ void SaveBinary(Internal::ShaderDataPtr shaderData) override;
/**
* @brief Set the destination for compiled shader binaries to be passed on to.
* The dispatcher passed in will be called from the update thread.
* @param[in] upstream A sink for ShaderDatas to be passed into.
*/
- void SetShaderSaver( ShaderSaver& upstream );
+ void SetShaderSaver(ShaderSaver& upstream);
// Renderers
* Add a new renderer to scene
* @param renderer to add
*/
- void AddRenderer( OwnerPointer< Renderer >& renderer );
+ void AddRenderer(OwnerPointer<Renderer>& renderer);
/**
* Add a renderer from scene
* @param renderer to remove
*/
- void RemoveRenderer( Renderer* renderer );
+ void RemoveRenderer(Renderer* renderer);
+
+ /**
+ * Attach a renderer to node
+ * @param renderer to attach
+ */
+ void AttachRenderer(Node* node, Renderer* renderer);
// Gestures
* @param[in] gesture The gesture processor.
* @post The gestureProcessor is owned by the UpdateManager.
*/
- void SetPanGestureProcessor( PanGesture* gestureProcessor );
+ void SetPanGestureProcessor(PanGesture* gestureProcessor);
// Textures
* @param[in] textureSet The texture set to add.
* @post The TextureSet is owned by the UpdateManager.
*/
- void AddTextureSet( OwnerPointer< TextureSet >& textureSet );
+ void AddTextureSet(OwnerPointer<TextureSet>& textureSet);
/**
* Remove a TextureSet.
* @param[in] textureSet The TextureSet to remove.
* @post The TextureSet is destroyed.
*/
- void RemoveTextureSet( TextureSet* textureSet );
+ void RemoveTextureSet(TextureSet* textureSet);
// Render tasks
* @param[in] systemLevel True if using the system-level overlay.
* @return The list of render tasks
*/
- RenderTaskList* GetRenderTaskList( bool systemLevel );
+ RenderTaskList* GetRenderTaskList(bool systemLevel);
-// Message queue handling
+ // Message queue handling
/**
* Reserve space for another message in the queue; this must then be initialized by the caller.
* @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
* @return A pointer to the first char allocated for the message.
*/
- unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true );
+ uint32_t* ReserveMessageSlot(uint32_t size, bool updateScene = true);
/**
* @return the current event-buffer index.
* @post Sends a message to RenderManager to add the sampler.
* The sampler will be owned by RenderManager
*/
- void AddSampler( OwnerPointer< Render::Sampler >& sampler );
+ void AddSampler(OwnerPointer<Render::Sampler>& sampler);
/**
* Removes an existing sampler from RenderManager
* @param[in] sampler The sampler to remove
* @post The sampler will be destroyed in the render thread
*/
- void RemoveSampler( Render::Sampler* sampler );
+ void RemoveSampler(Render::Sampler* sampler);
/**
* Sets the filter modes for an existing sampler
* @param[in] minFilterMode The filter to use under minification
* @param[in] magFilterMode The filter to use under magnification
*/
- void SetFilterMode( Render::Sampler* sampler, unsigned int minFilterMode, unsigned int magFilterMode );
+ void SetFilterMode(Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode);
/**
* Sets the wrap mode for an existing sampler
* @param[in] sWrapMode Wrapping mode in x direction
* @param[in] tWrapMode Wrapping mode in y direction
*/
- void SetWrapMode( Render::Sampler* sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode );
+ void SetWrapMode(Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode);
/**
* Add a new property buffer to RenderManager
* @post Sends a message to RenderManager to add the property buffer.
* The property buffer will be owned by RenderManager
*/
- void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertryBuffer );
+ void AddVertexBuffer(OwnerPointer<Render::VertexBuffer>& propertryBuffer);
/**
- * Removes an existing PropertyBuffer from RenderManager
+ * Removes an existing VertexBuffer from RenderManager
* @param[in] propertryBuffer The property buffer to remove
* @post The property buffer will be destroyed in the render thread
*/
- void RemovePropertyBuffer( Render::PropertyBuffer* propertryBuffer );
+ void RemoveVertexBuffer(Render::VertexBuffer* propertryBuffer);
/**
* Sets the format of an existing property buffer
- * @param[in] propertyBuffer The property buffer.
+ * @param[in] vertexBuffer The property buffer.
* @param[in] format The new format of the buffer
* @post Sends a message to RenderManager to set the new format to the property buffer.
*/
- void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format );
+ void SetVertexBufferFormat(Render::VertexBuffer* vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format);
/**
* Sets the data of an existing property buffer
- * @param[in] propertyBuffer The property buffer.
+ * @param[in] vertexBuffer The property buffer.
* @param[in] data The new data of the buffer
* @param[in] size The new size of the buffer
* @post Sends a message to RenderManager to set the new data to the property buffer.
*/
- void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size );
+ void SetVertexBufferData(Render::VertexBuffer* vertexBuffer, OwnerPointer<Vector<uint8_t> >& data, uint32_t size);
/**
* Adds a geometry to the RenderManager
* @post Sends a message to RenderManager to add the Geometry
* The geometry will be owned by RenderManager
*/
- void AddGeometry( OwnerPointer< Render::Geometry >& geometry );
+ void AddGeometry(OwnerPointer<Render::Geometry>& geometry);
/**
* Removes an existing Geometry from RenderManager
* @param[in] geometry The geometry to remove
* @post The geometry will be destroyed in the render thread
*/
- void RemoveGeometry( Render::Geometry* geometry );
+ void RemoveGeometry(Render::Geometry* geometry);
/**
* Sets the geometry type of an existing Geometry
* @param[in] geometry The geometry
* @param[in] geometryType The type of the geometry
*/
- void SetGeometryType( Render::Geometry* geometry, unsigned int geometryType );
+ void SetGeometryType(Render::Geometry* geometry, uint32_t geometryType);
/**
* Sets the index buffer to be used by a geometry
* @param[in] geometry The geometry
* @param[in] indices A vector containing the indices for the geometry
*/
- void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<unsigned short>& indices );
+ void SetIndexBuffer(Render::Geometry* geometry, Dali::Vector<uint16_t>& indices);
/**
* Adds a vertex buffer to a geometry
* @param[in] geometry The geometry
- * @param[in] propertyBuffer The property buffer
+ * @param[in] vertexBuffer The property buffer
*/
- void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
+ void AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
/**
* Removes a vertex buffer from a geometry
* @param[in] geometry The geometry
- * @param[in] propertyBuffer The property buffer
+ * @param[in] vertexBuffer The property buffer
*/
- void RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
+ void RemoveVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer);
/**
* Adds a texture to the render manager
* @param[in] texture The texture to add
* The texture will be owned by RenderManager
*/
- void AddTexture( OwnerPointer< Render::Texture >& texture );
+ void AddTexture(OwnerPointer<Render::Texture>& texture);
/**
* Removes a texture from the render manager
* @param[in] texture The texture to remove
* @post The texture will be destroyed in the render thread
*/
- void RemoveTexture( Render::Texture* texture );
+ void RemoveTexture(Render::Texture* texture);
/**
* Uploads data to a texture owned by the RenderManager
* @param[in] pixelData The pixel data object
* @param[in] params The parameters for the upload
*/
- void UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params );
+ void UploadTexture(Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params);
/**
* Generates mipmaps for a texture owned by the RenderManager
* @param[in] texture The texture
*/
- void GenerateMipmaps( Render::Texture* texture );
+ void GenerateMipmaps(Render::Texture* texture);
/**
* Adds a framebuffer to the render manager
* @param[in] frameBuffer The framebuffer to add
* The framebuffer will be owned by RenderManager
*/
- void AddFrameBuffer( Render::FrameBuffer* frameBuffer );
+ void AddFrameBuffer(OwnerPointer<Render::FrameBuffer>& frameBuffer);
/**
* Removes a FrameBuffer from the render manager
* @param[in] frameBuffer The FrameBuffer to remove
* @post The FrameBuffer will be destroyed in the render thread
*/
- void RemoveFrameBuffer( Render::FrameBuffer* frameBuffer );
+ void RemoveFrameBuffer(Render::FrameBuffer* frameBuffer);
/**
* Attach a texture as color output to an existing FrameBuffer
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
*/
- void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int face );
+ void AttachColorTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t face);
-public:
+ /**
+ * Attach a texture as depth output to an existing FrameBuffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
+
+ /**
+ * Attach a texture as depth/stencil output to an existing FrameBuffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthStencilTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel);
+
+ /**
+ * This is called when the surface of the scene has been replaced.
+ * @param[in] scene The scene.
+ */
+ void SurfaceReplaced(Scene* scene);
+public:
/**
* Performs an Update traversal on the scene-graph.
* @param[in] elapsedSeconds The elapsed time that should be applied to animations.
* @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object.
* @return True if further updates are required e.g. during animations.
*/
- unsigned int Update( float elapsedSeconds,
- unsigned int lastVSyncTimeMilliseconds,
- unsigned int nextVSyncTimeMilliseconds,
- bool renderToFboEnabled,
- bool isRenderingToFbo );
+ uint32_t Update(float elapsedSeconds,
+ uint32_t lastVSyncTimeMilliseconds,
+ uint32_t nextVSyncTimeMilliseconds,
+ bool renderToFboEnabled,
+ bool isRenderingToFbo);
/**
- * Set the background color i.e. the glClear color used at the beginning of each frame.
- * @param[in] color The new background color.
+ * @copydoc Dali::Stage::KeepRendering()
*/
- void SetBackgroundColor(const Vector4& color);
+ void KeepRendering(float durationSeconds);
/**
- * Set the default surface rect.
- * @param[in] rect The rect value representing the surface.
+ * @copydoc Dali::DevelStage::SetRenderingBehavior()
*/
- void SetDefaultSurfaceRect( const Rect<int>& rect );
+ void SetRenderingBehavior(DevelStage::Rendering renderingBehavior);
/**
- * @copydoc Dali::Stage::KeepRendering()
+ * Request to render the current frame
+ * @note This is a temporary workaround (to be removed in the future) to request the rendering of
+ * the current frame if the color or visibility of any actor is updated. It MUST NOT be used
+ * for any other purposes.
*/
- void KeepRendering( float durationSeconds );
+ void RequestRendering();
/**
* Sets the depths of all layers.
* @param layers The layers in depth order.
- * @param[in] systemLevel True if using the system-level overlay.
+ * @param[in] rootLayer The root layer of the sorted layers.
*/
- void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
+ void SetLayerDepths(const std::vector<Layer*>& layers, const Layer* rootLayer);
/**
* Set the depth indices of all nodes (in LayerUI's)
* @param[in] nodeDepths A vector of nodes and associated depth indices
*/
- void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths );
+ void SetDepthIndices(OwnerPointer<NodeDepths>& nodeDepths);
-private:
+ /**
+ * Adds an implementation of the FrameCallbackInterface.
+ * @param[in] frameCallback An OwnerPointer to the SceneGraph FrameCallback object
+ * @param[in] rootNode A pointer to the root node to apply the FrameCallback to
+ */
+ void AddFrameCallback(OwnerPointer<FrameCallback>& frameCallback, const Node* rootNode);
+
+ /**
+ * Removes the specified implementation of FrameCallbackInterface.
+ * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface to remove.
+ */
+ void RemoveFrameCallback(FrameCallbackInterface* frameCallback);
+private:
// Undefined
UpdateManager(const UpdateManager&);
* @param[in] elapsedSeconds The time in seconds since the previous update.
* @return True if the update-thread should keep going.
*/
- unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
+ uint32_t KeepUpdatingCheck(float elapsedSeconds) const;
/**
* Helper to reset all Node properties
* @param[in] bufferIndex to use
*/
- void ResetProperties( BufferIndex bufferIndex );
+ void ResetProperties(BufferIndex bufferIndex);
/**
* Perform gesture updates.
* @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
* @return true, if any properties were updated.
*/
- bool ProcessGestures( BufferIndex bufferIndex, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
+ bool ProcessGestures(BufferIndex bufferIndex, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds);
/**
* Perform animation updates
* @param[in] bufferIndex to use
* @param[in] elapsedSeconds time since last frame
+ * @return true if at least one animations is currently active or false otherwise
*/
- void Animate( BufferIndex bufferIndex, float elapsedSeconds );
+ bool Animate(BufferIndex bufferIndex, float elapsedSeconds);
/**
* Applies constraints to CustomObjects
* @param[in] bufferIndex to use
*/
- void ConstrainCustomObjects( BufferIndex bufferIndex );
+ void ConstrainCustomObjects(BufferIndex bufferIndex);
/**
* Applies constraints to RenderTasks
* @param[in] bufferIndex to use
*/
- void ConstrainRenderTasks( BufferIndex bufferIndex );
+ void ConstrainRenderTasks(BufferIndex bufferIndex);
/**
* Applies constraints to Shaders
* @param[in] bufferIndex to use
*/
- void ConstrainShaders( BufferIndex bufferIndex );
+ void ConstrainShaders(BufferIndex bufferIndex);
/**
* Perform property notification updates
* @param[in] bufferIndex to use
*/
- void ProcessPropertyNotifications( BufferIndex bufferIndex );
+ void ProcessPropertyNotifications(BufferIndex bufferIndex);
/**
* Pass shader binaries queued here on to event thread.
* Update node shaders, opacity, geometry etc.
* @param[in] bufferIndex to use
*/
- void UpdateNodes( BufferIndex bufferIndex );
+ void UpdateNodes(BufferIndex bufferIndex);
/**
* Update Renderers
* @param[in] bufferIndex to use
*/
- void UpdateRenderers( BufferIndex bufferIndex );
+ void UpdateRenderers(BufferIndex bufferIndex);
private:
-
// needs to be direct member so that getter for event buffer can be inlined
SceneGraphBuffers mSceneGraphBuffers;
struct Impl;
Impl* mImpl;
-
};
// Messages for UpdateManager
-inline void InstallRootMessage( UpdateManager& manager, OwnerPointer<Layer>& root, bool systemLevel )
+inline void InstallRootMessage(UpdateManager& manager, OwnerPointer<Layer>& root)
{
// Message has ownership of Layer while in transit from event -> update
- typedef MessageValue2< UpdateManager, OwnerPointer<Layer>, bool > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Layer> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root, systemLevel );
+ new(slot) LocalType(&manager, &UpdateManager::InstallRoot, root);
}
-inline void AddNodeMessage( UpdateManager& manager, OwnerPointer<Node>& node )
+inline void UninstallRootMessage(UpdateManager& manager, const Layer* constRoot)
+{
+ // Scene graph thread can destroy this object.
+ Layer* root = const_cast<Layer*>(constRoot);
+
+ using LocalType = MessageValue1<UpdateManager, Layer*>;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::UninstallRoot, root);
+}
+
+inline void AddNodeMessage(UpdateManager& manager, OwnerPointer<Node>& node)
{
// Message has ownership of Node while in transit from event -> update
- typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Node> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddNode, node );
+ new(slot) LocalType(&manager, &UpdateManager::AddNode, node);
}
-inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
+inline void ConnectNodeMessage(UpdateManager& manager, const Node& constParent, const Node& constChild)
{
// Update thread can edit the object
- Node& parent = const_cast< Node& >( constParent );
- Node& child = const_cast< Node& >( constChild );
+ Node& parent = const_cast<Node&>(constParent);
+ Node& child = const_cast<Node&>(constChild);
- typedef MessageValue2< UpdateManager, Node*, Node* > LocalType;
+ using LocalType = MessageValue2<UpdateManager, Node*, Node*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
+ new(slot) LocalType(&manager, &UpdateManager::ConnectNode, &parent, &child);
}
-inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
+inline void DisconnectNodeMessage(UpdateManager& manager, const Node& constNode)
{
// Scene graph thread can modify this object.
- Node& node = const_cast< Node& >( constNode );
+ Node& node = const_cast<Node&>(constNode);
- typedef MessageValue1< UpdateManager, Node* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Node*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
+ new(slot) LocalType(&manager, &UpdateManager::DisconnectNode, &node);
}
-inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
+inline void DestroyNodeMessage(UpdateManager& manager, const Node& constNode)
{
// Scene graph thread can destroy this object.
- Node& node = const_cast< Node& >( constNode );
+ Node& node = const_cast<Node&>(constNode);
- typedef MessageValue1< UpdateManager, Node* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Node*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
+ new(slot) LocalType(&manager, &UpdateManager::DestroyNode, &node);
}
-inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& camera )
+inline void AddCameraMessage(UpdateManager& manager, OwnerPointer<Camera>& camera)
{
// Message has ownership of Camera while in transit from event -> update
- typedef MessageValue1< UpdateManager, OwnerPointer< Camera > > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Camera> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddCamera, camera );
+ new(slot) LocalType(&manager, &UpdateManager::AddCamera, camera);
}
-inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera )
+inline void RemoveCameraMessage(UpdateManager& manager, const Camera* camera)
{
- typedef MessageValue1< UpdateManager, const Camera* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Camera*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, camera );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveCamera, const_cast<Camera*>(camera));
}
-inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner>& object )
+inline void AddObjectMessage(UpdateManager& manager, OwnerPointer<PropertyOwner>& object)
{
// Message has ownership of object while in transit from event -> update
- typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyOwner> >;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::AddObject, object);
+}
+
+inline void RemoveObjectMessage(UpdateManager& manager, const PropertyOwner* object)
+{
+ using LocalType = MessageValue1<UpdateManager, PropertyOwner*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveObject, const_cast<PropertyOwner*>(object));
}
-inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
+inline void AddAnimationMessage(UpdateManager& manager, OwnerPointer<SceneGraph::Animation>& animation)
{
- typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Animation> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
+ new(slot) LocalType(&manager, &UpdateManager::AddAnimation, animation);
}
-inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation )
+inline void StopAnimationMessage(UpdateManager& manager, const Animation& constAnimation)
{
- typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::Animation > > LocalType;
+ // The scene-graph thread owns this object so it can safely edit it.
+ Animation& animation = const_cast<Animation&>(constAnimation);
+
+ using LocalType = MessageValue1<UpdateManager, Animation*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
+ new(slot) LocalType(&manager, &UpdateManager::StopAnimation, &animation);
}
-inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
+inline void RemoveAnimationMessage(UpdateManager& manager, const Animation& constAnimation)
{
// The scene-graph thread owns this object so it can safely edit it.
- Animation& animation = const_cast< Animation& >( constAnimation );
+ Animation& animation = const_cast<Animation&>(constAnimation);
+
+ using LocalType = MessageValue1<UpdateManager, Animation*>;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::RemoveAnimation, &animation);
+}
+
+inline void AddRenderTaskListMessage(UpdateManager& manager, OwnerPointer<SceneGraph::RenderTaskList>& taskList)
+{
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::RenderTaskList> >;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::AddRenderTaskList, taskList);
+}
+
+inline void RemoveRenderTaskListMessage(UpdateManager& manager, const RenderTaskList& constTaskList)
+{
+ // The scene-graph thread owns this object so it can safely edit it.
+ RenderTaskList& taskList = const_cast<RenderTaskList&>(constTaskList);
+
+ using LocalType = MessageValue1<UpdateManager, RenderTaskList*>;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::RemoveRenderTaskList, &taskList);
+}
- typedef MessageValue1< UpdateManager, Animation* > LocalType;
+inline void AddSceneMessage(UpdateManager& manager, OwnerPointer<SceneGraph::Scene>& scene)
+{
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<SceneGraph::Scene> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
+ new(slot) LocalType(&manager, &UpdateManager::AddScene, scene);
}
-inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
+inline void RemoveSceneMessage(UpdateManager& manager, const SceneGraph::Scene& constScene)
{
// The scene-graph thread owns this object so it can safely edit it.
- Animation& animation = const_cast< Animation& >( constAnimation );
+ Scene& scene = const_cast<Scene&>(constScene);
- typedef MessageValue1< UpdateManager, Animation* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Scene*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveScene, &scene);
}
-inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification )
+inline void AddPropertyNotificationMessage(UpdateManager& manager, OwnerPointer<PropertyNotification>& propertyNotification)
{
// Message has ownership of PropertyNotification while in transit from event -> update
- typedef MessageValue1< UpdateManager, OwnerPointer< PropertyNotification > > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyNotification> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
+ new(slot) LocalType(&manager, &UpdateManager::AddPropertyNotification, propertyNotification);
}
-inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
+inline void RemovePropertyNotificationMessage(UpdateManager& manager, const PropertyNotification& constPropertyNotification)
{
// The scene-graph thread owns this object so it can safely edit it.
- PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
+ PropertyNotification& propertyNotification = const_cast<PropertyNotification&>(constPropertyNotification);
- typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, PropertyNotification*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
+ new(slot) LocalType(&manager, &UpdateManager::RemovePropertyNotification, &propertyNotification);
}
-inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
- const PropertyNotification* constPropertyNotification,
- PropertyNotification::NotifyMode notifyMode )
+inline void PropertyNotificationSetNotifyModeMessage(UpdateManager& manager,
+ const PropertyNotification* constPropertyNotification,
+ PropertyNotification::NotifyMode notifyMode)
{
// The scene-graph thread owns this object so it can safely edit it.
- PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
+ PropertyNotification* propertyNotification = const_cast<PropertyNotification*>(constPropertyNotification);
- typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
+ using LocalType = MessageValue2<UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
+ new(slot) LocalType(&manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode);
}
// The render thread can safely change the Shader
-inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& shader )
+inline void AddShaderMessage(UpdateManager& manager, OwnerPointer<Shader>& shader)
{
- typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Shader> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddShader, shader );
+ new(slot) LocalType(&manager, &UpdateManager::AddShader, shader);
}
// The render thread can safely change the Shader
-inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
+inline void RemoveShaderMessage(UpdateManager& manager, const Shader* shader)
{
- typedef MessageValue1< UpdateManager, Shader* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Shader*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveShader, const_cast<Shader*>(shader));
}
-inline void SetShaderProgramMessage( UpdateManager& manager,
- Shader& shader,
- Internal::ShaderDataPtr shaderData,
- bool modifiesGeometry )
+inline void SurfaceReplacedMessage(UpdateManager& manager, const SceneGraph::Scene& constScene)
{
- typedef MessageValue3< UpdateManager, Shader*, Internal::ShaderDataPtr, bool > LocalType;
+ // The scene-graph thread owns this object so it can safely edit it.
+ Scene& scene = const_cast<Scene&>(constScene);
+
+ using LocalType = MessageValue1<UpdateManager, Scene*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, shaderData, modifiesGeometry );
+ new(slot) LocalType(&manager, &UpdateManager::SurfaceReplaced, &scene);
}
-inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
+inline void KeepRenderingMessage(UpdateManager& manager, float durationSeconds)
{
- typedef MessageValue1< UpdateManager, Vector4 > LocalType;
+ using LocalType = MessageValue1<UpdateManager, float>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
+ new(slot) LocalType(&manager, &UpdateManager::KeepRendering, durationSeconds);
}
-inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
+inline void SetRenderingBehaviorMessage(UpdateManager& manager, DevelStage::Rendering renderingBehavior)
{
- typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
+ using LocalType = MessageValue1<UpdateManager, DevelStage::Rendering>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
+ new(slot) LocalType(&manager, &UpdateManager::SetRenderingBehavior, renderingBehavior);
}
-inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
+inline void RequestRenderingMessage(UpdateManager& manager)
{
- typedef MessageValue1< UpdateManager, float > LocalType;
+ using LocalType = Message<UpdateManager>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
+ new(slot) LocalType(&manager, &UpdateManager::RequestRendering);
}
/**
* Create a message for setting the depth of a layer
* @param[in] manager The update manager
* @param[in] layers list of layers
- * @param[in] systemLevel True if the layers are added via the SystemOverlay API
+ * @param[in] rootLayer The rool layer
*/
-inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
+inline void SetLayerDepthsMessage(UpdateManager& manager, const std::vector<Layer*>& layers, const Layer* rootLayer)
{
- typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
+ using LocalType = MessageValue2<UpdateManager, std::vector<Layer*>, const Layer*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
+ new(slot) LocalType(&manager, &UpdateManager::SetLayerDepths, layers, rootLayer);
+}
+
+inline void AddRendererMessage(UpdateManager& manager, OwnerPointer<Renderer>& object)
+{
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Renderer> >;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::AddRenderer, object);
}
-inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >& object )
+inline void RemoveRendererMessage(UpdateManager& manager, const Renderer& object)
{
- typedef MessageValue1< UpdateManager, OwnerPointer< Renderer > > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Renderer*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveRenderer, const_cast<Renderer*>(&object));
}
-inline void RemoveRendererMessage( UpdateManager& manager, Renderer& object )
+inline void AttachRendererMessage(UpdateManager& manager, const Node& node, const Renderer& renderer)
{
- typedef MessageValue1< UpdateManager, Renderer* > LocalType;
+ using LocalType = MessageValue2<UpdateManager, Node*, Renderer*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, &object );
+ new(slot) LocalType(&manager, &UpdateManager::AttachRenderer, const_cast<Node*>(&node), const_cast<Renderer*>(&renderer));
}
// The render thread can safely change the Shader
-inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureSet >& textureSet )
+inline void AddTextureSetMessage(UpdateManager& manager, OwnerPointer<TextureSet>& textureSet)
{
- typedef MessageValue1< UpdateManager, OwnerPointer< TextureSet > > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<TextureSet> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, textureSet );
+ new(slot) LocalType(&manager, &UpdateManager::AddTextureSet, textureSet);
}
// The render thread can safely change the Shader
-inline void RemoveTextureSetMessage( UpdateManager& manager, TextureSet& textureSet )
+inline void RemoveTextureSetMessage(UpdateManager& manager, TextureSet& textureSet)
{
- typedef MessageValue1< UpdateManager, TextureSet* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, TextureSet*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveTextureSet, &textureSet );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveTextureSet, &textureSet);
}
-inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sampler >& sampler )
+inline void AddSamplerMessage(UpdateManager& manager, OwnerPointer<Render::Sampler>& sampler)
{
// Message has ownership of Sampler while in transit from event -> update
- typedef MessageValue1< UpdateManager, OwnerPointer< Render::Sampler > > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Sampler> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddSampler, sampler );
+ new(slot) LocalType(&manager, &UpdateManager::AddSampler, sampler);
}
-inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
+inline void RemoveSamplerMessage(UpdateManager& manager, Render::Sampler& sampler)
{
- typedef MessageValue1< UpdateManager, Render::Sampler* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Render::Sampler*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveSampler, &sampler );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveSampler, &sampler);
}
-inline void SetFilterModeMessage( UpdateManager& manager, Render::Sampler& sampler, unsigned int minFilterMode, unsigned int magFilterMode )
+inline void SetFilterModeMessage(UpdateManager& manager, Render::Sampler& sampler, uint32_t minFilterMode, uint32_t magFilterMode)
{
- typedef MessageValue3< UpdateManager, Render::Sampler*, unsigned int, unsigned int > LocalType;
+ using LocalType = MessageValue3<UpdateManager, Render::Sampler*, uint32_t, uint32_t>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode );
+ new(slot) LocalType(&manager, &UpdateManager::SetFilterMode, &sampler, minFilterMode, magFilterMode);
}
-inline void SetWrapModeMessage( UpdateManager& manager, Render::Sampler& sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode )
+inline void SetWrapModeMessage(UpdateManager& manager, Render::Sampler& sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode)
{
- typedef MessageValue4< UpdateManager, Render::Sampler*, unsigned int, unsigned int, unsigned int > LocalType;
+ using LocalType = MessageValue4<UpdateManager, Render::Sampler*, uint32_t, uint32_t, uint32_t>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode );
+ new(slot) LocalType(&manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode);
}
-inline void AddPropertyBuffer( UpdateManager& manager, OwnerPointer< Render::PropertyBuffer >& propertyBuffer )
+inline void AddVertexBuffer(UpdateManager& manager, OwnerPointer<Render::VertexBuffer>& vertexBuffer)
{
- // Message has ownership of propertyBuffer while in transit from event -> update
- typedef MessageValue1< UpdateManager, OwnerPointer< Render::PropertyBuffer > > LocalType;
+ // Message has ownership of vertexBuffer while in transit from event -> update
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::VertexBuffer> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, propertyBuffer );
+ new(slot) LocalType(&manager, &UpdateManager::AddVertexBuffer, vertexBuffer);
}
-inline void RemovePropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer )
+inline void RemoveVertexBuffer(UpdateManager& manager, Render::VertexBuffer& vertexBuffer)
{
- typedef MessageValue1< UpdateManager, Render::PropertyBuffer* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Render::VertexBuffer*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemovePropertyBuffer, &propertyBuffer );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveVertexBuffer, &vertexBuffer);
}
-inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format )
+inline void SetVertexBufferFormat(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer<Render::VertexBuffer::Format>& format)
{
- // Message has ownership of PropertyBuffer::Format while in transit from event -> update
- typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format> > LocalType;
+ // Message has ownership of VertexBuffer::Format while in transit from event -> update
+ using LocalType = MessageValue2<UpdateManager, Render::VertexBuffer*, OwnerPointer<Render::VertexBuffer::Format> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferFormat, &propertyBuffer, format );
+ new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferFormat, &vertexBuffer, format);
}
-inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size )
+inline void SetVertexBufferData(UpdateManager& manager, Render::VertexBuffer& vertexBuffer, OwnerPointer<Vector<uint8_t> >& data, uint32_t size)
{
- // Message has ownership of PropertyBuffer data while in transit from event -> update
- typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector<char> >, size_t > LocalType;
+ // Message has ownership of VertexBuffer data while in transit from event -> update
+ using LocalType = MessageValue3<UpdateManager, Render::VertexBuffer*, OwnerPointer<Vector<uint8_t> >, uint32_t>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data, size );
+ new(slot) LocalType(&manager, &UpdateManager::SetVertexBufferData, &vertexBuffer, data, size);
}
-inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry >& geometry )
+inline void AddGeometry(UpdateManager& manager, OwnerPointer<Render::Geometry>& geometry)
{
// Message has ownership of Geometry while in transit from event -> update
- typedef MessageValue1< UpdateManager, OwnerPointer< Render::Geometry > > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Geometry> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddGeometry, geometry );
+ new(slot) LocalType(&manager, &UpdateManager::AddGeometry, geometry);
}
-inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry )
+inline void RemoveGeometry(UpdateManager& manager, Render::Geometry& geometry)
{
- typedef MessageValue1< UpdateManager, Render::Geometry* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Render::Geometry*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveGeometry, &geometry);
}
-inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
+inline void AttachVertexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer)
{
- typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
+ using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
+ new(slot) LocalType(&manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer));
}
-inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
+inline void RemoveVertexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, const Render::VertexBuffer& vertexBuffer)
{
- typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
+ using LocalType = MessageValue2<UpdateManager, Render::Geometry*, Render::VertexBuffer*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveVertexBuffer, &geometry, const_cast<Render::VertexBuffer*>(&vertexBuffer));
}
// Custom message type for SetIndexBuffer() used to move data with Vector::Swap()
-template< typename T >
+template<typename T>
class IndexBufferMessage : public MessageBase
{
public:
-
/**
* Constructor which does a Vector::Swap()
*/
- IndexBufferMessage( T* manager, Render::Geometry* geometry, Dali::Vector<unsigned short>& indices )
+ IndexBufferMessage(T* manager, Render::Geometry* geometry, Dali::Vector<uint16_t>& indices)
: MessageBase(),
- mManager( manager ),
- mRenderGeometry( geometry )
+ mManager(manager),
+ mRenderGeometry(geometry)
{
- mIndices.Swap( indices );
+ mIndices.Swap(indices);
}
/**
* Virtual destructor
*/
- virtual ~IndexBufferMessage()
- {
- }
+ ~IndexBufferMessage() override = default;
/**
* @copydoc MessageBase::Process
*/
- virtual void Process( BufferIndex /*bufferIndex*/ )
+ void Process(BufferIndex /*bufferIndex*/) override
{
- DALI_ASSERT_DEBUG( mManager && "Message does not have an object" );
- mManager->SetIndexBuffer( mRenderGeometry, mIndices );
+ DALI_ASSERT_DEBUG(mManager && "Message does not have an object");
+ mManager->SetIndexBuffer(mRenderGeometry, mIndices);
}
private:
-
- T* mManager;
- Render::Geometry* mRenderGeometry;
- Dali::Vector<unsigned short> mIndices;
+ T* mManager;
+ Render::Geometry* mRenderGeometry;
+ Dali::Vector<uint16_t> mIndices;
};
-inline void SetIndexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<unsigned short>& indices )
+inline void SetIndexBufferMessage(UpdateManager& manager, Render::Geometry& geometry, Dali::Vector<uint16_t>& indices)
{
- typedef IndexBufferMessage< UpdateManager > LocalType;
+ using LocalType = IndexBufferMessage<UpdateManager>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &geometry, indices );
+ new(slot) LocalType(&manager, &geometry, indices);
}
-inline void SetGeometryTypeMessage( UpdateManager& manager, Render::Geometry& geometry, unsigned int geometryType )
+inline void SetGeometryTypeMessage(UpdateManager& manager, Render::Geometry& geometry, uint32_t geometryType)
{
- typedef MessageValue2< UpdateManager, Render::Geometry*, unsigned int > LocalType;
+ using LocalType = MessageValue2<UpdateManager, Render::Geometry*, uint32_t>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetGeometryType, &geometry, geometryType );
+ new(slot) LocalType(&manager, &UpdateManager::SetGeometryType, &geometry, geometryType);
}
-inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& texture )
+inline void AddTexture(UpdateManager& manager, OwnerPointer<Render::Texture>& texture)
{
// Message has ownership of Texture while in transit from event -> update
- typedef MessageValue1< UpdateManager, OwnerPointer< Render::Texture > > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::Texture> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddTexture, texture );
+ new(slot) LocalType(&manager, &UpdateManager::AddTexture, texture);
}
-inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture )
+inline void RemoveTexture(UpdateManager& manager, Render::Texture& texture)
{
- typedef MessageValue1< UpdateManager, Render::Texture* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Render::Texture*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveTexture, &texture );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveTexture, &texture);
}
-inline void UploadTextureMessage( UpdateManager& manager, Render::Texture& texture, PixelDataPtr pixelData, const Texture::UploadParams& params )
+inline void UploadTextureMessage(UpdateManager& manager, Render::Texture& texture, PixelDataPtr pixelData, const Texture::UploadParams& params)
{
- typedef MessageValue3< UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams > LocalType;
+ using LocalType = MessageValue3<UpdateManager, Render::Texture*, PixelDataPtr, Texture::UploadParams>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::UploadTexture, &texture, pixelData, params );
+ new(slot) LocalType(&manager, &UpdateManager::UploadTexture, &texture, pixelData, params);
}
-inline void GenerateMipmapsMessage( UpdateManager& manager, Render::Texture& texture )
+inline void GenerateMipmapsMessage(UpdateManager& manager, Render::Texture& texture)
{
- typedef MessageValue1< UpdateManager, Render::Texture* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Render::Texture*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::GenerateMipmaps, &texture );
+ new(slot) LocalType(&manager, &UpdateManager::GenerateMipmaps, &texture);
}
+inline void AddFrameBuffer(UpdateManager& manager, OwnerPointer<Render::FrameBuffer>& frameBuffer)
+{
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<Render::FrameBuffer> >;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::AddFrameBuffer, frameBuffer);
+}
-inline void AddFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
+inline void RemoveFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer)
{
- typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType;
+ using LocalType = MessageValue1<UpdateManager, Render::FrameBuffer*>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, &frameBuffer );
+ new(slot) LocalType(&manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer);
}
-inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
+inline void AttachColorTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer)
{
- typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType;
+ using LocalType = MessageValue4<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t, uint32_t>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveFrameBuffer, &frameBuffer );
+ new(slot) LocalType(&manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer);
}
-inline void AttachColorTextureToFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
+inline void AttachDepthTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
{
- typedef MessageValue4< UpdateManager, Render::FrameBuffer*, Render::Texture*, unsigned int, unsigned int > LocalType;
+ using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
+ new(slot) LocalType(&manager, &UpdateManager::AttachDepthTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel);
}
-inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDepths >& nodeDepths )
+inline void AttachDepthStencilTextureToFrameBuffer(UpdateManager& manager, Render::FrameBuffer& frameBuffer, Render::Texture* texture, uint32_t mipmapLevel)
{
- typedef MessageValue1< UpdateManager, OwnerPointer< NodeDepths > > LocalType;
+ using LocalType = MessageValue3<UpdateManager, Render::FrameBuffer*, Render::Texture*, uint32_t>;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetDepthIndices, nodeDepths );
+ new(slot) LocalType(&manager, &UpdateManager::AttachDepthStencilTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel);
}
-inline void AddResetterMessage( UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter )
+inline void SetDepthIndicesMessage(UpdateManager& manager, OwnerPointer<NodeDepths>& nodeDepths)
{
- typedef MessageValue1< UpdateManager, OwnerPointer<PropertyResetterBase> > LocalType;
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<NodeDepths> >;
// Reserve some memory inside the message queue
- unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddPropertyResetter, resetter );
+ new(slot) LocalType(&manager, &UpdateManager::SetDepthIndices, nodeDepths);
}
+inline void AddResetterMessage(UpdateManager& manager, OwnerPointer<PropertyResetterBase> resetter)
+{
+ using LocalType = MessageValue1<UpdateManager, OwnerPointer<PropertyResetterBase> >;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::AddPropertyResetter, resetter);
+}
+
+inline void AddFrameCallbackMessage(UpdateManager& manager, OwnerPointer<FrameCallback>& frameCallback, const Node& rootNode)
+{
+ using LocalType = MessageValue2<UpdateManager, OwnerPointer<FrameCallback>, const Node*>;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::AddFrameCallback, frameCallback, &rootNode);
+}
+
+inline void RemoveFrameCallbackMessage(UpdateManager& manager, FrameCallbackInterface& frameCallback)
+{
+ using LocalType = MessageValue1<UpdateManager, FrameCallbackInterface*>;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot(sizeof(LocalType));
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new(slot) LocalType(&manager, &UpdateManager::RemoveFrameCallback, &frameCallback);
+}
} // namespace SceneGraph