#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
{
+class RenderCallback;
+
+/**
+ * @addtogroup dali_core_rendering_effects
+ * @{
+ */
namespace Internal DALI_INTERNAL
{
namespace FaceCullingMode
{
-
/**
* @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 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
+ USE_ACTOR_OPACITY ///< Blending is enabled when the actor is not opaque @SINCE_2_2.7
};
} // namespace BlendMode
namespace BlendEquation
{
-
/**
* @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 Enumeration for blend factor.
* @SINCE_1_1.43
namespace DepthWriteMode
{
-
/**
* @brief Enumeration for depth buffer write modes.
* @SINCE_1_1.43
namespace DepthTestMode
{
-
/**
* @brief Enumeration for depth buffer test (read) modes.
* @SINCE_1_1.43
namespace DepthFunction
{
-
/**
* @brief Enumeration for depth functions.
* @SINCE_1_1.43
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, ///< Don’t 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
+ 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 Enumeration for the comparison function used on the stencil buffer.
* @SINCE_1_1.43
namespace StencilOperation
{
-
/**
* @brief Enumeration for specifying the action to take when the stencil (or depth) test fails during stencil test.
* @SINCE_1_1.43
} // namespace StencilOperation
-
/**
* @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 Enumeration for instances of properties belonging to the Renderer class.
* @SINCE_1_1.43
* @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 Creates a new Renderer object with RenderCallback.
+ *
+ * @SINCE_2_1.18
+ * @param[in] renderCallback Valid RenderCallback
+ * @return A handle to the Renderer
+ */
+ static Renderer New(RenderCallback& renderCallback);
/**
* @brief Default constructor, creates an empty handle
* @SINCE_1_1.43
* @param[in] handle Handle to an object
*/
- Renderer( const Renderer& handle );
+ Renderer(const Renderer& handle);
/**
* @brief Downcasts to a renderer handle.
* @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.
* @param[in] handle Handle to an object
* @return Reference to the assigned object
*/
- Renderer& operator=( const Renderer& handle );
+ Renderer& operator=(const Renderer& handle);
+
+ /**
+ * @brief Move constructor.
+ *
+ * @SINCE_1_9.22
+ * @param[in] rhs A reference to the moved handle
+ */
+ Renderer(Renderer&& rhs) noexcept;
+
+ /**
+ * @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) noexcept;
/**
* @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.
* @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);
}
/**
* @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.
* @SINCE_1_1.43
* @param[in] shader The shader to be used by this renderer
*/
- void SetShader( Shader& shader );
+ void SetShader(Shader& shader);
/**
* @brief Gets the shader used by this renderer.
*/
Shader GetShader() const;
-public:
+ /**
+ * @brief Sets RenderCallback to be used for native rendering
+ *
+ * @SINCE_2_1.15
+ * @param[in] callback Pointer to a valid RenderCallback object
+ */
+ void SetRenderCallback(RenderCallback* callback);
+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