Added VisualRenderer (for visual default properties)
[platform/core/uifw/dali-core.git] / dali / public-api / rendering / renderer.h
index 353dd28..d434f72 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_RENDERER_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
 
 namespace Dali
 {
+/**
+ * @addtogroup dali_core_rendering_effects
+ * @{
+ */
 
 namespace Internal DALI_INTERNAL
 {
@@ -34,58 +38,55 @@ class Renderer;
 
 namespace FaceCullingMode
 {
-
 /**
- * @brief Face culling mode.
+ * @brief Enumeration for face culling mode.
  * @SINCE_1_1.43
  */
 enum Type
 {
-  NONE,                ///< None of the faces should be culled                 @SINCE_1_1.43
-  FRONT,               ///< Cull front face, front faces should never be shown @SINCE_1_1.43
-  BACK,                ///< Cull back face, back faces should never be shown   @SINCE_1_1.43
-  FRONT_AND_BACK,      ///< Cull front and back faces; if the geometry is composed of triangles none of the faces will be shown @SINCE_1_1.43
+  NONE,           ///< None of the faces should be culled                 @SINCE_1_1.43
+  FRONT,          ///< Cull front face, front faces should never be shown @SINCE_1_1.43
+  BACK,           ///< Cull back face, back faces should never be shown   @SINCE_1_1.43
+  FRONT_AND_BACK, ///< Cull front and back faces; if the geometry is composed of triangles none of the faces will be shown @SINCE_1_1.43
 };
 
 } // namespace FaceCullingMode
 
 namespace BlendMode
 {
-
 /**
- * @brief Blend mode.
+ * @brief Enumeration for blend mode.
  * @SINCE_1_1.43
  */
 enum Type
 {
-  OFF,  ///< Blending is disabled.                                                    @SINCE_1_1.43
-  AUTO, ///< Blending is enabled if there is alpha channel. This is the default mode. @SINCE_1_1.43
-  ON    ///< Blending is enabled.                                                     @SINCE_1_1.43
+  OFF,            ///< Blending is disabled.                                                    @SINCE_1_1.43
+  AUTO,           ///< Blending is enabled if there is alpha channel. This is the default mode. @SINCE_1_1.43
+  ON,             ///< Blending is enabled.                                                     @SINCE_1_1.43
+  ON_WITHOUT_CULL ///< Blending is enabled, and don't cull the renderer                         @SINCE_2_0.43
 };
 
 } // namespace BlendMode
 
 namespace BlendEquation
 {
-
 /**
- * @brief Blend Equation.
+ * @brief Enumeration for blend equation.
  * @SINCE_1_1.43
  */
 enum Type
 {
-  ADD              = 0x8006,  ///< The source and destination colors are added to each other. @SINCE_1_1.43
-  SUBTRACT         = 0x800A,  ///< Subtracts the destination from the source.                 @SINCE_1_1.43
-  REVERSE_SUBTRACT = 0x800B   ///< Subtracts the source from the destination.                 @SINCE_1_1.43
+  ADD              = 0x8006, ///< The source and destination colors are added to each other. @SINCE_1_1.43
+  SUBTRACT         = 0x800A, ///< Subtracts the destination from the source.                 @SINCE_1_1.43
+  REVERSE_SUBTRACT = 0x800B  ///< Subtracts the source from the destination.                 @SINCE_1_1.43
 };
 
 } // namespace BlendEquation
 
 namespace BlendFactor
 {
-
 /**
- * @brief Blend Factor.
+ * @brief Enumeration for blend factor.
  * @SINCE_1_1.43
  */
 enum Type
@@ -111,9 +112,8 @@ enum Type
 
 namespace DepthWriteMode
 {
-
 /**
- * @brief Depth buffer write modes.
+ * @brief Enumeration for depth buffer write modes.
  * @SINCE_1_1.43
  */
 enum Type
@@ -127,9 +127,8 @@ enum Type
 
 namespace DepthTestMode
 {
-
 /**
- * @brief Depth buffer test (read) modes.
+ * @brief Enumeration for depth buffer test (read) modes.
  * @SINCE_1_1.43
  */
 enum Type
@@ -143,9 +142,8 @@ enum Type
 
 namespace DepthFunction
 {
-
 /**
- * @brief Depth functions.
+ * @brief Enumeration for depth functions.
  * @SINCE_1_1.43
  */
 enum Type
@@ -162,11 +160,27 @@ enum Type
 
 } // namespace DepthFunction
 
-namespace StencilFunction
+namespace RenderMode
+{
+/**
+ * @brief Enumeration for the controls of how this renderer uses its stencil properties and writes to the color buffer.
+ * @SINCE_1_2_5
+ */
+enum Type
 {
+  NONE,         ///< Do not write to either color or stencil buffer (But will potentially render to depth buffer). @SINCE_1_2_5
+  AUTO,         ///< Managed by the Actor Clipping API. This is the default.                                       @SINCE_1_2_5
+  COLOR,        ///< Ingore stencil properties.  Write to the color buffer.                                        @SINCE_1_2_5
+  STENCIL,      ///< Use the stencil properties. Do not write to the color buffer.                                 @SINCE_1_2_5
+  COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer.                                     @SINCE_1_2_5
+};
+
+} // namespace RenderMode
 
+namespace StencilFunction
+{
 /**
- * @brief The comparison function used on the stencil buffer.
+ * @brief Enumeration for the comparison function used on the stencil buffer.
  * @SINCE_1_1.43
  */
 enum Type
@@ -183,27 +197,10 @@ enum Type
 
 } // namespace StencilFunction
 
-namespace StencilMode
-{
-
-/**
- * @brief How the stencil buffer will be managed.
- * @SINCE_1_1.43
- */
-enum Type
-{
-  OFF,       ///< Off for this renderer                                  @SINCE_1_1.43
-  AUTO,      ///< Managed by the Actor clipping API. This is the default @SINCE_1_1.43
-  ON         ///< On for this renderer. Select this to use the Renderer stencil properties to manage behavior. Note that Actor clipping management is bypassed for this renderer @SINCE_1_1.43
-};
-
-} // namespace StencilMode
-
 namespace StencilOperation
 {
-
 /**
- * @brief Specifies the action to take when the stencil (or depth) test fails during stencil test.
+ * @brief Enumeration for specifying the action to take when the stencil (or depth) test fails during stencil test.
  * @SINCE_1_1.43
  */
 enum Type
@@ -220,225 +217,213 @@ enum Type
 
 } // namespace StencilOperation
 
-
 /**
- * @brief Renderer is a handle to an object used to show content by combining a Geometry, a TextureSet and a shader
+ * @brief Renderer is a handle to an object used to show content by combining a Geometry, a TextureSet and a shader.
  *
  * @SINCE_1_1.43
  */
-class DALI_IMPORT_API Renderer : public Handle
+class DALI_CORE_API Renderer : public Handle
 {
 public:
-
   /**
-   * @brief An enumeration of properties belonging to the Renderer class.
+   * @brief Enumeration for instances of properties belonging to the Renderer class.
+   * @SINCE_1_1.43
    */
   struct Property
   {
+    /**
+     * @brief Enumeration for instances of properties belonging to the Renderer class.
+     * @SINCE_1_1.43
+     */
     enum
     {
       /**
-       * @brief name "depthIndex", type INTEGER
-       * @note The default value is 0
+       * @brief Name "depthIndex", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is 0.
        */
       DEPTH_INDEX = DEFAULT_RENDERER_PROPERTY_START_INDEX,
 
       /**
-       * @brief name "faceCullingMode", type INTEGER
-       * @note The default value is FaceCullingMode::NONE
+       * @brief Name "faceCullingMode", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is FaceCullingMode::NONE.
        */
       FACE_CULLING_MODE,
 
       /**
-       * @brief name "blendMode", type INTEGER
-       * @note The default value is BlendMode::AUTO
+       * @brief Name "blendMode", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is BlendMode::AUTO.
        */
       BLEND_MODE,
 
       /**
-       * @brief name "blendEquationRgb", type INTEGER
-       * @note The default value is BlendEquation::ADD
+       * @brief Name "blendEquationRgb", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is BlendEquation::ADD.
        */
       BLEND_EQUATION_RGB,
 
       /**
-       * @brief name "blendEquationAlpha", type INTEGER
-       * @note The default value is BlendEquation::ADD
+       * @brief Name "blendEquationAlpha", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is BlendEquation::ADD.
        */
       BLEND_EQUATION_ALPHA,
 
       /**
-       * @brief name "blendFactorSrcRgb", type INTEGER
-       * @note The default value is BlendFactor::SRC_ALPHA
+       * @brief Name "blendFactorSrcRgb", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is BlendFactor::SRC_ALPHA.
        */
       BLEND_FACTOR_SRC_RGB,
 
       /**
-       * @brief name "blendFactorDestRgb", type INTEGER
-       * @note The default value is BlendFactor::ONE_MINUS_SRC_ALPHA
+       * @brief Name "blendFactorDestRgb", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is BlendFactor::ONE_MINUS_SRC_ALPHA.
        */
       BLEND_FACTOR_DEST_RGB,
 
       /**
-       * @brief name "blendFactorSrcAlpha", type INTEGER
-       * @note The default value is BlendFactor::ONE
+       * @brief Name "blendFactorSrcAlpha", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is BlendFactor::ONE.
        */
       BLEND_FACTOR_SRC_ALPHA,
 
       /**
-       * @brief name "blendFactorDestAlpha", type INTEGER
-       * @note The default value is BlendFactor::ONE_MINUS_SRC_ALPHA
+       * @brief Name "blendFactorDestAlpha", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is BlendFactor::ONE_MINUS_SRC_ALPHA.
        */
       BLEND_FACTOR_DEST_ALPHA,
 
       /**
-       * @brief name "blendColor", type VECTOR4
-       * @note The default value is Color::TRANSPARENT
+       * @brief Name "blendColor", type VECTOR4.
        * @SINCE_1_1.43
+       * @note The default value is Color::TRANSPARENT.
        */
       BLEND_COLOR,
 
       /**
-       * @brief name "blendPreMultipledAlpha", type BOOLEAN
-       * @note The default value is false
+       * @brief Name "blendPreMultipledAlpha", type BOOLEAN.
        * @SINCE_1_1.43
+       * @note The default value is false.
        */
       BLEND_PRE_MULTIPLIED_ALPHA,
 
       /**
-       * @brief name "indexRangeFirst", type INTEGER
-       * @note The default value is 0
+       * @brief Name "indexRangeFirst", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is 0.
        */
       INDEX_RANGE_FIRST,
 
       /**
-       * @brief name "indexRangeCount", type INTEGER
-       * @note The default (0) means that whole range of indices will be used
+       * @brief Name "indexRangeCount", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default (0) means that whole range of indices will be used.
        */
       INDEX_RANGE_COUNT,
 
       /**
-       * @brief name "depthWriteMode", type INTEGER
-       * @see DepthWriteMode
-       * @note The default value is DepthWriteMode::AUTO
+       * @brief Name "depthWriteMode", type INTEGER.
        * @SINCE_1_1.43
+       * @see DepthWriteMode
+       * @note The default value is DepthWriteMode::AUTO.
        */
       DEPTH_WRITE_MODE,
 
       /**
-       * @brief name "depthFunction", type INTEGER
-       * @see DepthFunction
-       * @note The default value is DepthFunction::LESS
+       * @brief Name "depthFunction", type INTEGER.
        * @SINCE_1_1.43
+       * @see DepthFunction
+       * @note The default value is DepthFunction::LESS.
        */
       DEPTH_FUNCTION,
 
       /**
-       * @brief name "depthTestMode", type INTEGER
-       * @see DepthTestMode
-       * @note The default value is DepthTestMode::AUTO
+       * @brief Name "depthTestMode", type INTEGER.
        * @SINCE_1_1.43
+       * @see DepthTestMode
+       * @note The default value is DepthTestMode::AUTO.
        */
       DEPTH_TEST_MODE,
 
       /**
-       * @brief name "stencilFunction", type INTEGER
-       * @see StencilFunction
-       * @note The default value is StencilFunction::ALWAYS
+       * @brief Name "renderMode", type INTEGER.
+       * @SINCE_1_2_5
+       * @see RenderMode
+       * @note The default value is RenderMode::AUTO.
+       */
+      RENDER_MODE,
+
+      /**
+       * @brief Name "stencilFunction", type INTEGER.
        * @SINCE_1_1.43
+       * @see StencilFunction
+       * @note The default value is StencilFunction::ALWAYS.
        */
       STENCIL_FUNCTION,
 
       /**
-       * @brief name "stencilFunctionMask", type INTEGER
-       * @note The default value is 0xFF
+       * @brief Name "stencilFunctionMask", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is 0xFF.
        */
       STENCIL_FUNCTION_MASK,
 
       /**
-       * @brief name "stencilFunctionReference", type INTEGER
-       * @note The default value is 0
+       * @brief Name "stencilFunctionReference", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is 0.
        */
       STENCIL_FUNCTION_REFERENCE,
 
       /**
-       * @brief name "stencilMask", type INTEGER
-       * @note The default value is 0xFF
+       * @brief Name "stencilMask", type INTEGER.
        * @SINCE_1_1.43
+       * @note The default value is 0xFF.
        */
       STENCIL_MASK,
 
       /**
-       * @brief name "stencilMode", type INTEGER
-       * @see StencilMode
-       * @note The default value is StencilMode::AUTO
+       * @brief Name "stencilOperationOnFail", type INTEGER.
        * @SINCE_1_1.43
-       */
-      STENCIL_MODE,
-
-      /**
-       * @brief name "stencilOperationOnFail", type INTEGER
        * @see StencilOperation
        * @note The default value is StencilOperation::KEEP
-       * @SINCE_1_1.43
        */
       STENCIL_OPERATION_ON_FAIL,
 
       /**
-       * @brief name "stencilOperationOnZFail", type INTEGER
-       * @see StencilOperation
-       * @note The default value is StencilOperation::KEEP
+       * @brief Name "stencilOperationOnZFail", type INTEGER.
        * @SINCE_1_1.43
+       * @see StencilOperation
+       * @note The default value is StencilOperation::KEEP.
        */
       STENCIL_OPERATION_ON_Z_FAIL,
 
       /**
-       * @brief name "stencilOperationOnZPass", type INTEGER
-       * @see StencilOperation
-       * @note The default value is StencilOperation::KEEP
+       * @brief Name "stencilOperationOnZPass", type INTEGER.
        * @SINCE_1_1.43
+       * @see StencilOperation
+       * @note The default value is StencilOperation::KEEP.
        */
       STENCIL_OPERATION_ON_Z_PASS,
-
-      /**
-       * @brief name "writeToColorBuffer", type BOOLEAN
-       * This allows per-renderer control of writing to the color buffer.
-       * For example: This can be turned off to write to the stencil or depth buffers only.
-       * @note The default value is True
-       * @SINCE_1_1.43
-       */
-      WRITE_TO_COLOR_BUFFER,
-
-      /**
-       * @brief name "batchingEnabled", type BOOLEAN
-       * @see Batching
-       * @note The default value is 'false'
-       */
-      BATCHING_ENABLED
     };
   };
 
   /**
-   * @brief Creates a new Renderer object
+   * @brief Creates a new Renderer object.
    *
    * @SINCE_1_1.43
    * @param[in] geometry Geometry to be used by this renderer
    * @param[in] shader Shader to be used by this renderer
+   * @return A handle to the Renderer
    */
-  static Renderer New( Geometry& geometry, Shader& shader );
+  static Renderer New(Geometry& geometry, Shader& shader);
 
   /**
    * @brief Default constructor, creates an empty handle
@@ -448,49 +433,66 @@ public:
   Renderer();
 
   /**
-   * @brief Destructor
+   * @brief Destructor.
    *
    * @SINCE_1_1.43
    */
   ~Renderer();
 
   /**
-   * @brief Copy constructor, creates a new handle to the same object
+   * @brief Copy constructor, creates a new handle to the same object.
    *
    * @SINCE_1_1.43
    * @param[in] handle Handle to an object
    */
-  Renderer( const Renderer& handle );
+  Renderer(const Renderer& handle);
 
   /**
-   * @brief Downcast to a renderer handle.
-   * If not a renderer the returned renderer handle is left uninitialized.
+   * @brief Downcasts to a renderer handle.
+   * If not, a renderer the returned renderer handle is left uninitialized.
    *
    * @SINCE_1_1.43
    * @param[in] handle Handle to an object
    * @return Renderer handle or an uninitialized handle
    */
-  static Renderer DownCast( BaseHandle handle );
+  static Renderer DownCast(BaseHandle handle);
 
   /**
-   * @brief Assignment operator, changes this handle to point at the same object
+   * @brief Assignment operator, changes this handle to point at the same object.
    *
    * @SINCE_1_1.43
    * @param[in] handle Handle to an object
    * @return Reference to the assigned object
    */
-  Renderer& operator=( const Renderer& handle );
+  Renderer& operator=(const Renderer& handle);
 
   /**
-   * @brief Sets the geometry to be used by this renderer
+   * @brief Move constructor.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   */
+  Renderer(Renderer&& rhs);
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
+   */
+  Renderer& operator=(Renderer&& rhs);
+
+  /**
+   * @brief Sets the geometry to be used by this renderer.
    *
    * @SINCE_1_1.43
    * @param[in] geometry The geometry to be used by this renderer
    */
-  void SetGeometry( Geometry& geometry );
+  void SetGeometry(Geometry& geometry);
 
   /**
-   * @brief Gets the geometry used by this renderer
+   * @brief Gets the geometry used by this renderer.
    *
    * @SINCE_1_1.43
    * @return The geometry used by the renderer
@@ -498,28 +500,28 @@ public:
   Geometry GetGeometry() const;
 
   /**
-   * @brief Sets effective range of indices to draw from bound index buffer
+   * @brief Sets effective range of indices to draw from bound index buffer.
    *
    * @SINCE_1_1.43
    * @param[in] firstElement The First element to draw
    * @param[in] elementsCount The number of elements to draw
    */
-  inline void SetIndexRange( int firstElement, int elementsCount )
+  inline void SetIndexRange(int firstElement, int elementsCount)
   {
-    SetProperty( Property::INDEX_RANGE_FIRST, firstElement );
-    SetProperty( Property::INDEX_RANGE_COUNT, elementsCount );
+    SetProperty(Property::INDEX_RANGE_FIRST, firstElement);
+    SetProperty(Property::INDEX_RANGE_COUNT, elementsCount);
   }
 
   /**
-   * @brief Sets the texture set to be used by this renderer
+   * @brief Sets the texture set to be used by this renderer.
    *
    * @SINCE_1_1.43
    * @param[in] textureSet The texture set to be used by this renderer
    */
-  void SetTextures( TextureSet& textureSet );
+  void SetTextures(TextureSet& textureSet);
 
   /**
-   * @brief Gets the texture set used by this renderer
+   * @brief Gets the texture set used by this renderer.
    *
    * @SINCE_1_1.43
    * @return The texture set used by the renderer
@@ -527,15 +529,15 @@ public:
   TextureSet GetTextures() const;
 
   /**
-   * @brief Set the shader used by this renderer
+   * @brief Sets the shader used by this renderer.
    *
    * @SINCE_1_1.43
    * @param[in] shader The shader to be used by this renderer
    */
-  void SetShader( Shader& shader );
+  void SetShader(Shader& shader);
 
   /**
-   * @brief Get the shader used by this renderer
+   * @brief Gets the shader used by this renderer.
    *
    * @SINCE_1_1.43
    * @return The shader used by the renderer
@@ -543,16 +545,20 @@ public:
   Shader GetShader() const;
 
 public:
-
+  /// @cond internal
   /**
    * @brief The constructor.
    * @note  Not intended for application developers.
    * @SINCE_1_1.43
    * @param[in] pointer A pointer to a newly allocated Renderer
    */
-  explicit DALI_INTERNAL Renderer( Internal::Renderer* pointer );
+  explicit DALI_INTERNAL Renderer(Internal::Renderer* pointer);
+  /// @endcond
 };
 
+/**
+ * @}
+ */
 } //namespace Dali
 
 #endif // DALI_RENDERER_H