-#ifndef __DALI_RENDER_TASK_H__
-#define __DALI_RENDER_TASK_H__
+#ifndef DALI_RENDER_TASK_H
+#define DALI_RENDER_TASK_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
/**
* @brief RenderTasks describe how the Dali scene should be rendered.
*
- * The Stage::GetRenderTaskList() method provides access to an ordered list of render-tasks.
+ * The Scene provides access to an ordered list of render-tasks.
*
* Each RenderTask must specify the source actors to be rendered, and a camera actor from
* which the scene is viewed.
class DALI_CORE_API RenderTask : public Handle
{
public:
-
/**
* @brief Enumeration for instances of properties belonging to the RenderTask class.
* @SINCE_1_0.0
* @brief Typedef for signals sent by this class.
* @SINCE_1_0.0
*/
- typedef Signal< void (RenderTask& source) > RenderTaskSignalType;
+ using RenderTaskSignalType = Signal<void(RenderTask&)>;
/**
* @brief A pointer to a function for converting screen to frame-buffer coordinates.
* @param[in,out] coordinates The screen coordinates to convert where (0,0) is the top-left of the screen
* @return True if the conversion was successful, otherwise coordinates should be unmodified
*/
- typedef bool (* ScreenToFrameBufferFunction)( Vector2& coordinates );
+ using ScreenToFrameBufferFunction = bool (*)(Vector2&);
/**
* @brief A pointer to a function for converting screen to frame-buffer coordinates.
* @param[in,out] coordinates The screen coordinates to convert where (0,0) is the top-left of the screen
* @return True if the conversion was successful, otherwise coordinates should be unmodified
*/
- typedef bool (* const ConstScreenToFrameBufferFunction)( Vector2& coordinates );
+ using ConstScreenToFrameBufferFunction = bool (*const)(Vector2&);
/**
* @brief The default conversion function returns false for any screen coordinates.
* @param[in] handle A handle to an object
* @return A handle to a RenderTask or an uninitialized handle
*/
- static RenderTask DownCast( BaseHandle handle );
+ static RenderTask DownCast(BaseHandle handle);
/**
* @brief Destructor.
RenderTask& operator=(const RenderTask& rhs);
/**
+ * @brief Move constructor.
+ *
+ * @SINCE_1_9.22
+ * @param[in] rhs A reference to the moved handle
+ */
+ RenderTask(RenderTask&& rhs) noexcept;
+
+ /**
+ * @brief Move assignment operator.
+ *
+ * @SINCE_1_9.22
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
+ */
+ RenderTask& operator=(RenderTask&& rhs) noexcept;
+
+ /**
* @brief Sets the actors to be rendered.
* @SINCE_1_0.0
* @param[in] actor This actor and its children will be rendered.
* If actor is an empty handle, then nothing will be rendered
*/
- void SetSourceActor( Actor actor );
+ void SetSourceActor(Actor actor);
/**
* @brief Retrieves the actors to be rendered.
* @SINCE_1_0.0
* @param[in] exclusive True if the source actors will only be rendered by this render-task
*/
- void SetExclusive( bool exclusive );
+ void SetExclusive(bool exclusive);
/**
* @brief Queries whether the RenderTask has exclusive access to the source actors.
* @SINCE_1_0.0
* @param[in] enabled True if the render-task should be considered for input handling
*/
- void SetInputEnabled( bool enabled );
+ void SetInputEnabled(bool enabled);
/**
* @brief Queries whether the render-task should be considered for input handling.
* @SINCE_1_0.0
* @param[in] cameraActor The scene is viewed from the perspective of this actor
*/
- void SetCameraActor( CameraActor cameraActor );
+ void SetCameraActor(CameraActor cameraActor);
/**
* @brief Retrieves the actor from which the scene is viewed.
/**
* @brief Sets the frame-buffer used as a render target.
- * @SINCE_1_0.0
- * @param[in] frameBuffer A valid frame-buffer handle to enable off-screen rendering, or an uninitialized handle to disable
- */
- void SetTargetFrameBuffer( FrameBufferImage frameBuffer );
-
- /**
- * @brief Retrieves the frame-buffer used as a render target.
- * @SINCE_1_0.0
- * @return A valid frame-buffer handle, or an uninitialised handle if off-screen rendering is disabled
- */
- FrameBufferImage GetTargetFrameBuffer() const;
-
- /**
- * @brief Sets the frame-buffer used as a render target.
* @SINCE_1_1.38
* @param[in] frameBuffer A valid FrameBuffer handle to enable off-screen rendering, or an uninitialized handle to disable it
*/
- void SetFrameBuffer( FrameBuffer frameBuffer );
+ void SetFrameBuffer(FrameBuffer frameBuffer);
/**
* @brief Retrieves the frame-buffer used as a render target.
* @SINCE_1_0.0
* @param[in] conversionFunction The conversion function
*/
- void SetScreenToFrameBufferFunction( ScreenToFrameBufferFunction conversionFunction );
+ void SetScreenToFrameBufferFunction(ScreenToFrameBufferFunction conversionFunction);
/**
* @brief Retrieves the function used to convert screen coordinates to frame-buffer coordinates.
* @param[in] mappingActor The actor used for conversion
* @note The mapping actor needs to be rendered by the default render task to make the mapping work properly.
*/
- void SetScreenToFrameBufferMappingActor( Actor mappingActor );
+ void SetScreenToFrameBufferMappingActor(Actor mappingActor);
/**
* @brief Retrieves the actor used to convert screen coordinates to frame-buffer coordinates.
Actor GetScreenToFrameBufferMappingActor() const;
/**
+ * @brief Sets the actor to compute viewport of this render task.
+ * Actor should be added on Scene.
+ * @SINCE_2_1.36
+ * @param[in] actor This actor is used to compute viewport of the render task.
+ * @note If window default camera is rotated and the actor is no longer a rectangle on the screen, Viewport may be computed incorrectly.
+ * The Viewport properties VIEWPORT_POSITION and VIEWPORT_SIZE is kept during using ViewportGuideActor, but only current value is changed.
+ */
+ void SetViewportGuideActor(Actor actor);
+
+ /**
+ * @brief Retrieves the actor to compute viewport of this render task.
+ * @SINCE_2_1.36
+ * @return This actor is used to compute viewport of the render task.
+ */
+ Actor GetViewportGuideActor() const;
+
+ /**
+ * @brief Resets the actor to compute viewport of this render task.
+ * @SINCE_2_1.36
+ * @note The Viewport properties VIEWPORT_POSITION and VIEWPORT_SIZE is still kept.
+ */
+ void ResetViewportGuideActor();
+
+ /**
* @brief Sets the GL viewport position used when rendering.
*
* This specifies the transformation between normalized device coordinates and target window (or frame-buffer) coordinates.
* @param[in] position The viewports position (x,y)
* @note Unlike the glViewport method, the x & y coordinates refer to the top-left of the viewport rectangle.
*/
- void SetViewportPosition( Vector2 position );
+ void SetViewportPosition(Vector2 position);
/**
* @brief Retrieves the GL viewport position used when rendering.
* @SINCE_1_0.0
* @param[in] size The viewports size (width,height)
*/
- void SetViewportSize( Vector2 size );
+ void SetViewportSize(Vector2 size);
/**
* @brief Retrieves the GL viewport size used when rendering.
* @param[in] viewport The new viewport
* @note Unlike the glViewport method, the x & y coordinates refer to the top-left of the viewport rectangle.
*/
- void SetViewport( Viewport viewport );
+ void SetViewport(Viewport viewport);
/**
* @brief Retrieves the GL viewport used when rendering.
* @SINCE_1_0.0
* @param[in] color The new clear color
*/
- void SetClearColor( const Vector4& color );
+ void SetClearColor(const Vector4& color);
/**
* @brief Retrieves the clear color used when SetClearEnabled(true) is used.
* be (partially) cleared before rendering the second.
*
*/
- void SetClearEnabled( bool enabled );
+ void SetClearEnabled(bool enabled);
/**
* @brief Queries whether the render-task will clear the results of previous render-tasks.
* @note If the shader uses @ref Shader::Hint::MODIFIES_GEOMETRY then culling optimizations are disabled.
* @see Shader::Hint
*/
- void SetCullMode( bool cullMode );
+ void SetCullMode(bool cullMode);
/**
* @brief Gets the cull mode.
* @SINCE_1_0.0
* @param[in] refreshRate The new refresh rate
*/
- void SetRefreshRate( uint32_t refreshRate );
+ void SetRefreshRate(uint32_t refreshRate);
/**
* @brief Queries the refresh-rate of the RenderTask.
* @param[out] viewportY The viewport y position
* @return true if the position has a screen coordinate
*/
- bool WorldToViewport(const Vector3 &position, float& viewportX, float& viewportY) const;
+ bool WorldToViewport(const Vector3& position, float& viewportX, float& viewportY) const;
/**
* @brief Gets actor local coordinates for given viewport coordinates.
* @param[out] localY The local y position
* @return true if the screen position has a local coordinate
*/
- bool ViewportToLocal(Actor actor, float viewportX, float viewportY, float &localX, float &localY) const;
+ bool ViewportToLocal(Actor actor, float viewportX, float viewportY, float& localX, float& localY) const;
public: // Signals
-
/**
* @brief If the refresh rate is REFRESH_ONCE, connect to this signal to be notified when a RenderTask has finished.
* @SINCE_1_0.0
RenderTaskSignalType& FinishedSignal();
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Dali New() methods.
* @SINCE_1_0.0
* @param[in] renderTask A pointer to a newly allocated render-task
*/
- explicit DALI_INTERNAL RenderTask( Internal::RenderTask* renderTask );
+ explicit DALI_INTERNAL RenderTask(Internal::RenderTask* renderTask);
/// @endcond
};
*/
} // namespace Dali
-#endif //__DALI_RENDER_TASK_H__
+#endif //DALI_RENDER_TASK_H