X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Frender-tasks%2Frender-task.h;h=5d6be1ae82a5847ce5e42846e70a69a825f055b4;hb=HEAD;hp=fa4d9da7606f6b2872b9f0bb4cd3e68709673e7e;hpb=e2fca778e7c7a1ab6e414b1fe436f8d4dd65fb09;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/render-tasks/render-task.h b/dali/public-api/render-tasks/render-task.h index fa4d9da..1835d06 100644 --- a/dali/public-api/render-tasks/render-task.h +++ b/dali/public-api/render-tasks/render-task.h @@ -2,7 +2,7 @@ #define DALI_RENDER_TASK_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -87,7 +87,6 @@ class RenderTask; class DALI_CORE_API RenderTask : public Handle { public: - /** * @brief Enumeration for instances of properties belonging to the RenderTask class. * @SINCE_1_0.0 @@ -131,7 +130,7 @@ public: * @brief Typedef for signals sent by this class. * @SINCE_1_0.0 */ - using RenderTaskSignalType = Signal; + using RenderTaskSignalType = Signal; /** * @brief A pointer to a function for converting screen to frame-buffer coordinates. @@ -139,7 +138,7 @@ public: * @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 */ - using ScreenToFrameBufferFunction = bool ( * )( Vector2& ); + using ScreenToFrameBufferFunction = bool (*)(Vector2&); /** * @brief A pointer to a function for converting screen to frame-buffer coordinates. @@ -147,7 +146,7 @@ public: * @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 */ - using ConstScreenToFrameBufferFunction = bool ( *const )( Vector2& ); + using ConstScreenToFrameBufferFunction = bool (*const)(Vector2&); /** * @brief The default conversion function returns false for any screen coordinates. @@ -198,7 +197,7 @@ public: * @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. @@ -231,7 +230,7 @@ public: * @SINCE_1_9.22 * @param[in] rhs A reference to the moved handle */ - RenderTask( RenderTask&& rhs ); + RenderTask(RenderTask&& rhs) noexcept; /** * @brief Move assignment operator. @@ -240,7 +239,7 @@ public: * @param[in] rhs A reference to the moved handle * @return A reference to this */ - RenderTask& operator=( RenderTask&& rhs ); + RenderTask& operator=(RenderTask&& rhs) noexcept; /** * @brief Sets the actors to be rendered. @@ -248,7 +247,7 @@ public: * @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. @@ -258,11 +257,18 @@ public: Actor GetSourceActor() const; /** + * @brief Retrives stopper actor. + * @SINCE_2_3.23 + * @return The actor that marks where to stop rendering. + */ + Actor GetStopperActor() const; + + /** * @brief Sets whether the RenderTask has exclusive access to the source actors; the default is false. * @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. @@ -281,7 +287,7 @@ public: * @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. @@ -295,7 +301,7 @@ public: * @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. @@ -309,7 +315,7 @@ public: * @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. @@ -325,7 +331,7 @@ public: * @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. @@ -343,7 +349,7 @@ public: * @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. @@ -353,6 +359,30 @@ public: 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. @@ -361,7 +391,7 @@ public: * @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. @@ -378,7 +408,7 @@ public: * @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. @@ -396,7 +426,7 @@ public: * @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. @@ -410,7 +440,7 @@ public: * @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. @@ -433,7 +463,7 @@ public: * 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. @@ -451,7 +481,7 @@ public: * @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. @@ -479,7 +509,7 @@ public: * @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. @@ -497,7 +527,7 @@ public: * @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. @@ -510,11 +540,62 @@ public: * @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 + /** + * Sets Render Pass key for this RenderTask. + * Shader code that matches this render pass is used for rendering. + * If no matching shader is found, the code with a render pass of 0 is used. + * In other cases, operation is not guaranteed. + * @param[in] renderPassTag RenderPassTag value for this render task. + * @note RenderPassTag of default RenderTask is 0u. + */ + void SetRenderPassTag(uint32_t renderPassTag); + + /** + * Gets Render Pass key for this RenderTask. + * @return RenderPassTag value for this render task. + */ + uint32_t GetRenderPassTag() const; + + /** + * Sets Order Index to define rendering order for this RenderTask. + * In the DALi, offscreen renderTasks are rendered earlier than onscreen renderTask. + * In each category of OffScreen RenderTask and OnScreen RenderTask, + * a RenderTask with a smaller orderIndex is rendered first. + * The RenderTasks in RenderTaskList is always sorted as acending order of the OrderIndex. + * The OrderIndex value is needed to be set between [-1000, 1000]. + * Default orderIndex is 0. + * @param[in] orderIndex the order index for this render task. + * @note The order among RenderTasks whose OrderIndex has not changed follows the order in which they were created. + * @note Rendering order among RenderTasks those have same OrderIndex cannot be guaranteed after the OrderIndex is changed + */ + void SetOrderIndex(int32_t orderIndex); /** + * Gets Order Index for this RenderTask. + * @return OrderIndex value for this render task. + */ + int32_t GetOrderIndex() const; + + /** + * @brief Get the unique id of RenderTask. It could be 0 given render task is invalid. + * + * @SINCE_2_3.10 + * @return The unique id of RenderTask, or 0 if invalid. + */ + uint32_t GetRenderTaskId() const; + + /** + * @brief Stop rendering from given actor. The actor is not included. + * @SINCE_2_3.23 + * @param[in] stopperActor A marker to stop rendering. + * If actor is an empty handle, or stopperActor is not a child of sourceActor, then full scene will be rendered + */ + void RenderUntil(Actor stopperActor); + +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 * @return The signal to connect to @@ -522,14 +603,13 @@ public: // Signals 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 };