1 #ifndef DALI_RENDERER_DEVEL_H
2 #define DALI_RENDERER_DEVEL_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/rendering/renderer.h>
27 namespace DevelBlendEquation
31 * @brief Enumeration for blend equation.
35 ADD = Dali::BlendEquation::ADD,
36 SUBTRACT = Dali::BlendEquation::SUBTRACT,
37 REVERSE_SUBTRACT = Dali::BlendEquation::REVERSE_SUBTRACT,
39 // OpenGL es 3.0 enumeration
43 // OpenGL es 3.2 or KHR_Blend_Equation_Advanced enumeration
61 } // namespace DevelBlendEquation
63 namespace DevelRenderer
66 * The index of render queue used by the DrawCommand
68 using RenderQueueIndex = uint32_t;
70 constexpr RenderQueueIndex RENDER_QUEUE_OPAQUE = 0; ///< Queue for opaque elements
71 constexpr RenderQueueIndex RENDER_QUEUE_TRANSPARENT = 1; ///<Queue for transparent elements
72 constexpr RenderQueueIndex RENDER_QUEUE_MAX = 2;
75 * Enum describing way of rendering the primitives (indexed draw, array draw)
84 * Draw command can be attached to the Dali::Renderer and override the default
85 * rendering functionality. Renderer may have several DrawCommands attached to it
86 * and the will be executed sequentially in the order of the 'queue' index.
90 DrawType drawType; ///< Type of drawing (indexed, array)
91 uint32_t firstIndex; ///< First index into the geometry array
92 uint32_t elementCount; ///< Number of elements to draw
93 RenderQueueIndex queue; ///< Queue index
97 * @brief Adds a draw command to the renderer
98 * Once the draw command is added, the default Renderer's behaviour is overriden.
99 * @param[in] renderer a valid Renderer object
100 * @param[in] drawCommand Valid DrawCommand to add to the Renderer
102 DALI_CORE_API void AddDrawCommand(Dali::Renderer renderer, const DrawCommand& drawCommand);
108 DEPTH_INDEX = Dali::Renderer::Property::DEPTH_INDEX,
109 FACE_CULLING_MODE = Dali::Renderer::Property::FACE_CULLING_MODE,
110 BLEND_MODE = Dali::Renderer::Property::BLEND_MODE,
111 BLEND_EQUATION_RGB = Dali::Renderer::Property::BLEND_EQUATION_RGB,
112 BLEND_EQUATION_ALPHA = Dali::Renderer::Property::BLEND_EQUATION_ALPHA,
113 BLEND_FACTOR_SRC_RGB = Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB,
114 BLEND_FACTOR_DEST_RGB = Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB,
115 BLEND_FACTOR_SRC_ALPHA = Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA,
116 BLEND_FACTOR_DEST_ALPHA = Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA,
117 BLEND_COLOR = Dali::Renderer::Property::BLEND_COLOR,
118 BLEND_PRE_MULTIPLIED_ALPHA = Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA,
119 INDEX_RANGE_FIRST = Dali::Renderer::Property::INDEX_RANGE_FIRST,
120 INDEX_RANGE_COUNT = Dali::Renderer::Property::INDEX_RANGE_COUNT,
121 DEPTH_WRITE_MODE = Dali::Renderer::Property::DEPTH_WRITE_MODE,
122 DEPTH_FUNCTION = Dali::Renderer::Property::DEPTH_FUNCTION,
123 DEPTH_TEST_MODE = Dali::Renderer::Property::DEPTH_TEST_MODE,
124 RENDER_MODE = Dali::Renderer::Property::RENDER_MODE,
125 STENCIL_FUNCTION = Dali::Renderer::Property::STENCIL_FUNCTION,
126 STENCIL_FUNCTION_MASK = Dali::Renderer::Property::STENCIL_FUNCTION_MASK,
127 STENCIL_FUNCTION_REFERENCE = Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE,
128 STENCIL_MASK = Dali::Renderer::Property::STENCIL_MASK,
129 STENCIL_OPERATION_ON_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL,
130 STENCIL_OPERATION_ON_Z_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL,
131 STENCIL_OPERATION_ON_Z_PASS = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS,
134 * @brief The opacity of the renderer.
135 * @details Name "opacity", type Property::FLOAT.
137 OPACITY = STENCIL_OPERATION_ON_Z_PASS + 1,
140 * @brief The rendering behavior of the renderer.
141 * @details Name "renderingBehavior", type Property::INTEGER.
143 RENDERING_BEHAVIOR = STENCIL_OPERATION_ON_Z_PASS + 2,
146 * @brief name "blendEquation", type INTEGER
147 * @note The default value is BlendEquation::ADD
151 } // namespace Property
156 * @brief Enumeration for the rendering behavior
160 IF_REQUIRED, ///< Default. Will only render if required to do so.
161 CONTINUOUSLY ///< Will render continuously.
164 } // namespace Rendering
168 * @brief Query whether current blend equation is advanced option.
169 * @param[in] renderer to be checked whether it has been applied advanced blend equation or not
170 * @return True if current blend equation is advanced.
172 DALI_CORE_API bool IsAdvancedBlendEquationApplied( const Renderer& renderer );
174 } // namespace DevelRenderer
178 #endif // DALI_RENDERER_DEVEL_H