Merge branch 'devel/master' (1.1.28) into tizen
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-renderer.h
index 6d83053..2a86c5b 100644 (file)
@@ -76,15 +76,33 @@ public:
    * Create a new renderer instance
    * @param[in] dataProviders The data providers for the renderer
    * @param[in] renderGeometry The geometry for the renderer
+   * @param[in] blendingBitmask A bitmask of blending options.
+   * @param[in] blendColor The blend color to pass to GL
+   * @param[in] faceCullingMode The face-culling mode.
+   * @param[in] preMultipliedAlphaEnabled whether alpha is pre-multiplied.
    */
-  static Renderer* New( SceneGraph::RenderDataProvider* dataProviders, SceneGraph::RenderGeometry* renderGeometry );
+  static Renderer* New( SceneGraph::RenderDataProvider* dataProviders,
+                        SceneGraph::RenderGeometry* renderGeometry,
+                        unsigned int blendingBitmask,
+                        const Vector4* blendColor,
+                        Dali::Renderer::FaceCullingMode faceCullingMode,
+                        bool preMultipliedAlphaEnabled);
 
   /**
    * Constructor.
    * @param[in] dataProviders The data providers for the renderer
    * @param[in] renderGeometry The geometry for the renderer
+   * @param[in] blendingBitmask A bitmask of blending options.
+   * @param[in] blendColor The blend color to pass to GL
+   * @param[in] faceCullingMode The face-culling mode.
+   * @param[in] preMultipliedAlphaEnabled whether alpha is pre-multiplied.
    */
-  Renderer( SceneGraph::RenderDataProvider* dataProviders, SceneGraph::RenderGeometry* renderGeometry );
+  Renderer( SceneGraph::RenderDataProvider* dataProviders,
+            SceneGraph::RenderGeometry* renderGeometry,
+            unsigned int blendingBitmask,
+            const Vector4* blendColor,
+            Dali::Renderer::FaceCullingMode faceCullingMode,
+            bool preMultipliedAlphaEnabled);
 
   /**
    * Change the data providers of the renderer
@@ -115,7 +133,26 @@ public:
    * Set the face-culling mode.
    * @param[in] mode The face-culling mode.
    */
-  void SetCullFace( Dali::Material::FaceCullingMode mode );
+  void SetFaceCullingMode( Dali::Renderer::FaceCullingMode mode );
+
+  /**
+   * Set the bitmask for blending options
+   * @param[in] bitmask A bitmask of blending options.
+   */
+  void SetBlendingBitMask( unsigned int bitmask );
+
+  /**
+   * Set the blend color for blending options
+   * @param[in] blendColor The blend color to pass to GL
+   */
+  void SetBlendColor( const Vector4* color );
+
+  /**
+   * @brief Set whether the Pre-multiplied Alpha Blending is required
+   *
+   * @param[in] preMultipled whether alpha is pre-multiplied.
+   */
+  void EnablePreMultipliedAlpha( bool preMultipled );
 
   /**
    * Set the sampler used to render the set texture.
@@ -148,6 +185,7 @@ public:
                const Matrix& modelViewMatrix,
                const Matrix& viewMatrix,
                const Matrix& projectionMatrix,
+               const Vector3& size,
                bool blend);
 
   /**
@@ -177,10 +215,12 @@ private:
 
   /**
    * Set the uniforms from properties according to the uniform map
+   * @param[in] bufferIndex The index of the previous update buffer.
    * @param[in] node The node using the renderer
+   * @param[in] size The size of the renderer
    * @param[in] program The shader program on which to set the uniforms.
    */
-  void SetUniforms( BufferIndex bufferIndex, const SceneGraph::NodeDataProvider& node, Program& program );
+  void SetUniforms( BufferIndex bufferIndex, const SceneGraph::NodeDataProvider& node, const Vector3& size, Program& program );
 
   /**
    * Set the program uniform in the map from the mapped property
@@ -191,8 +231,9 @@ private:
    * Bind the material textures in the samplers and setup the samplers
    * @param[in] textureCache The texture cache
    * @param[in] program The shader program
+   * @return False if create or bind failed, true if success.
    */
-  void BindTextures( SceneGraph::TextureCache& textureCache, Program& program );
+  bool BindTextures( SceneGraph::TextureCache& textureCache, Program& program );
 
 public:
 
@@ -216,9 +257,12 @@ private:
 
   Vector<GLint> mAttributesLocation;
 
+  BlendingOptions                 mBlendingOptions; /// Blending options including blend color, blend func and blend equation
+  Dali::Renderer::FaceCullingMode mFaceCullingMode; /// Mode of face culling
+
   unsigned int mSamplerBitfield;                    ///< Sampler options used for texture filtering
   bool mUpdateAttributesLocation:1;                 ///< Indicates attribute locations have changed
-  Dali::Material::FaceCullingMode mCullFaceMode:2;  ///< cullface enum, 3 bits is enough
+  bool mPremultipledAlphaEnabled:1;      ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
 };
 
 } // namespace SceneGraph