#define DALI_INTERNAL_RENDERER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
#include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
-#include <dali/devel-api/rendering/renderer.h> // Dali::Renderer
+#include <dali/public-api/rendering/renderer.h> // Dali::Renderer
+#include <dali/internal/common/blending-options.h>
#include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
#include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
#include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
-#include <dali/internal/event/rendering/material-impl.h> // Dali::Internal::Material
+#include <dali/internal/event/rendering/texture-set-impl.h> // Dali::Internal::TextureSet
#include <dali/internal/event/rendering/geometry-impl.h> // Dali::Internal::Geometry
+#include <dali/internal/render/renderers/render-renderer.h> // Dali::Render::Renderer::StencilParameters
namespace Dali
{
{
namespace SceneGraph
{
-class RendererAttachment;
+class Renderer;
}
class Renderer;
typedef IntrusivePtr<Renderer> RendererPtr;
/**
- * Renderer is an object that can be used to show content by combining a Geometry with a material.
+ * Renderer is an object that can be used to show content by combining a Geometry with a shader and textures.
*/
-class Renderer : public Object, public Connectable
+class Renderer : public Object
{
public:
Geometry* GetGeometry() const;
/**
- * @copydoc Dali::Renderer::SetMaterial()
+ * @copydoc Dali::Renderer::SetTextures()
+ */
+ void SetTextures( TextureSet& textureSet );
+
+ /**
+ * @copydoc Dali::Renderer::GetTextures()
+ */
+ TextureSet* GetTextures() const;
+
+ /**
+ * @copydoc Dali::Renderer::SetShader()
*/
- void SetMaterial( Material& material );
+ void SetShader( Shader& shader );
/**
- * @copydoc Dali::Renderer::GetMaterial()
+ * @copydoc Dali::Renderer::GetShader()
*/
- Material* GetMaterial() const;
+ Shader* GetShader() const;
/**
* @copydoc Dali::Renderer::SetDepthIndex()
*/
int GetDepthIndex() const;
+ /**
+ * @copydoc Dali::Renderer::SetBlendMode()
+ */
+ void SetBlendMode( BlendMode::Type mode );
+
+ /**
+ * @copydoc Dali::Renderer::GetBlendMode()
+ */
+ BlendMode::Type GetBlendMode() const;
+
+ /**
+ * @copydoc Dali::Renderer::SetBlendFunc()
+ */
+ void SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba );
+
+ /**
+ * @copydoc Dali::Renderer::SetBlendFunc()
+ */
+ void SetBlendFunc( BlendFactor::Type srcFactorRgb, BlendFactor::Type destFactorRgb,
+ BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha );
+
+ /**
+ * @copydoc Dali::Renderer::GetBlendFunc()
+ */
+ void GetBlendFunc( BlendFactor::Type& srcFactorRgb, BlendFactor::Type& destFactorRgb,
+ BlendFactor::Type& srcFactorAlpha, BlendFactor::Type& destFactorAlpha ) const;
+
+ /**
+ * @copydoc Dali::Renderer::SetBlendEquation()
+ */
+ void SetBlendEquation( BlendEquation::Type equationRgba );
+
+ /**
+ * @copydoc Dali::Renderer::SetBlendEquation()
+ */
+ void SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha );
+
+ /**
+ * @copydoc Dali::Renderer::GetBlendEquation()
+ */
+ void GetBlendEquation( BlendEquation::Type& equationRgb, BlendEquation::Type& equationAlpha ) const;
+
+ /**
+ * @copydoc Dali::Renderer::SetBlendColor()
+ */
+ void SetBlendColor( const Vector4& color );
+
+ /**
+ * @copydoc Dali::Renderer::GetBlendColor()
+ */
+ Vector4 GetBlendColor() const;
+
+ /**
+ * @copydoc Dali::Renderer::SetIndexedDrawFirstElement
+ */
+ void SetIndexedDrawFirstElement( size_t firstElement );
+
+ /**
+ * @copydoc Dali::Renderer::SetIndexedDrawElementsCount
+ */
+ void SetIndexedDrawElementsCount( size_t elementsCount );
+
+ /**
+ * @brief Set whether the Pre-multiplied Alpha Blending is required
+ *
+ * @param[in] preMultipled whether alpha is pre-multiplied.
+ */
+ void EnablePreMultipliedAlpha( bool preMultipled );
+
+ /**
+ * @brief Query whether alpha is pre-multiplied.
+ *
+ * @return True is alpha is pre-multiplied, false otherwise.
+ */
+ bool IsPreMultipliedAlphaEnabled() const;
+
/**
- * @brief Get the scene graph object ( the node attachment )
+ * @brief Get the scene graph object
*
* @return the scene object
*/
- SceneGraph::RendererAttachment* GetRendererSceneObject();
+ SceneGraph::Renderer* GetRendererSceneObject();
public: // Default property extensions from Object
Renderer& operator=( const Renderer& );
private: // data
- SceneGraph::RendererAttachment* mSceneObject;
- ObjectConnector<Geometry> mGeometryConnector; ///< Connector that holds the geometry used by this renderer
- ObjectConnector<Material> mMaterialConnector; ///< Connector that holds the material used by this renderer
+ SceneGraph::Renderer* mSceneObject;
+ Vector4* mBlendColor; ///< Local copy of blend color, pointer only as its rarely used
+ GeometryPtr mGeometry; ///< Connector that holds the geometry used by this renderer
+ ObjectConnector<TextureSet> mTextureSetConnector; ///< Connector that holds the texture set used by this renderer
+ IntrusivePtr<Shader> mShader; ///< Connector that holds the shader used by this renderer
+
int mDepthIndex;
- bool mOnStage;
+ int mOnStageCount;
+
+ size_t mIndexedDrawFirstElement; ///< Offset of first element to draw from bound index buffer
+ size_t mIndexedDrawElementCount; ///< Number of elements to draw
+
+ Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
+ BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask
+
+ DepthFunction::Type mDepthFunction:3; ///< Local copy of the depth function
+ FaceCullingMode::Type mFaceCullingMode:2; ///< Local copy of the mode of face culling
+ BlendMode::Type mBlendMode:2; ///< Local copy of the mode of blending
+ DepthWriteMode::Type mDepthWriteMode:2; ///< Local copy of the depth write mode
+ DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode
+ bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
};
} // namespace Internal