Moved Core Rendering API from devel-api to public-api
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-renderer.h
index 764c09f..f766024 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_RENDER_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/math/matrix.h>
 #include <dali/public-api/math/vector4.h>
-#include <dali/devel-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/texture-set.h>
 #include <dali/internal/common/blending-options.h>
 #include <dali/internal/common/message.h>
+#include <dali/internal/common/type-abstraction-enums.h>
 #include <dali/internal/event/common/property-input-impl.h>
 #include <dali/internal/event/effects/shader-declarations.h>
-#include <dali/internal/render/gl-resources/gl-resource-owner.h>
-#include <dali/integration-api/debug.h>
-#include <dali/internal/common/type-abstraction-enums.h>
-#include <dali/internal/update/manager/prepare-render-instructions.h>
 #include <dali/internal/render/data-providers/render-data-provider.h>
+#include <dali/internal/render/gl-resources/gl-resource-owner.h>
 #include <dali/internal/render/renderers/render-geometry.h>
+#include <dali/internal/update/manager/prepare-render-instructions.h>
+#include <dali/integration-api/debug.h>
 
 namespace Dali
 {
@@ -83,14 +83,18 @@ public:
    * @param[in] faceCullingMode The face-culling mode.
    * @param[in] preMultipliedAlphaEnabled whether alpha is pre-multiplied.
    * @param[in] depthWriteMode Depth buffer write mode
+   * @param[in] depthTestMode Depth buffer test mode
+   * @param[in] depthFunction Depth function
    */
   static Renderer* New( SceneGraph::RenderDataProvider* dataProviders,
                         Render::Geometry* geometry,
                         unsigned int blendingBitmask,
                         const Vector4* blendColor,
-                        Dali::Renderer::FaceCullingMode faceCullingMode,
+                        FaceCullingMode::Type faceCullingMode,
                         bool preMultipliedAlphaEnabled,
-                        Dali::Renderer::DepthWriteMode depthWriteMode );
+                        DepthWriteMode::Type depthWriteMode,
+                        DepthTestMode::Type depthTestMode,
+                        DepthFunction::Type depthFunction );
 
   /**
    * Constructor.
@@ -101,14 +105,18 @@ public:
    * @param[in] faceCullingMode The face-culling mode.
    * @param[in] preMultipliedAlphaEnabled whether alpha is pre-multiplied.
    * @param[in] depthWriteMode Depth buffer write mode
+   * @param[in] depthTestMode Depth buffer test mode
+   * @param[in] depthFunction Depth function
    */
   Renderer( SceneGraph::RenderDataProvider* dataProviders,
             Render::Geometry* geometry,
             unsigned int blendingBitmask,
             const Vector4* blendColor,
-            Dali::Renderer::FaceCullingMode faceCullingMode,
+            FaceCullingMode::Type faceCullingMode,
             bool preMultipliedAlphaEnabled,
-            Dali::Renderer::DepthWriteMode depthWriteMode );
+            DepthWriteMode::Type depthWriteMode,
+            DepthTestMode::Type depthTestMode,
+            DepthFunction::Type depthFunction );
 
   /**
    * Change the data providers of the renderer
@@ -139,7 +147,7 @@ public:
    * Set the face-culling mode.
    * @param[in] mode The face-culling mode.
    */
-  void SetFaceCullingMode( Dali::Renderer::FaceCullingMode mode );
+  void SetFaceCullingMode( FaceCullingMode::Type mode );
 
   /**
    * Set the bitmask for blending options
@@ -173,16 +181,40 @@ public:
   void EnablePreMultipliedAlpha( bool preMultipled );
 
   /**
+   * Sets the depth write mode
+   * @param[in] depthWriteMode The depth write mode
+   */
+  void SetDepthWriteMode( DepthWriteMode::Type depthWriteMode );
+
+  /**
    * Query the Renderer's depth write mode
    * @return The renderer depth write mode
    */
-  Dali::Renderer::DepthWriteMode GetDepthWriteMode() const;
+  DepthWriteMode::Type GetDepthWriteMode() const;
 
   /**
-   * Sets the depth write mode
-   * @param[in] depthWriteMode The depth write mode
+   * Sets the depth test mode
+   * @param[in] depthTestMode The depth test mode
+   */
+  void SetDepthTestMode( DepthTestMode::Type depthTestMode );
+
+  /**
+   * Query the Renderer's depth test mode
+   * @return The renderer depth test mode
+   */
+  DepthTestMode::Type GetDepthTestMode() const;
+
+  /**
+   * Sets the depth function
+   * @param[in] depthFunction The depth function
+   */
+  void SetDepthFunction( DepthFunction::Type depthFunction );
+
+  /**
+   * Query the Renderer's depth function
+   * @return The renderer depth function
    */
-  void SetDepthWriteMode( Dali::Renderer::DepthWriteMode depthWriteMode );
+  DepthFunction::Type GetDepthFunction() const;
 
   /**
    * Called to render during RenderManager::Render().
@@ -200,6 +232,7 @@ public:
                BufferIndex bufferIndex,
                const SceneGraph::NodeDataProvider& node,
                SceneGraph::Shader& defaultShader,
+               const Matrix& modelMatrix,
                const Matrix& modelViewMatrix,
                const Matrix& viewMatrix,
                const Matrix& projectionMatrix,
@@ -250,11 +283,12 @@ private:
 
   /**
    * Bind the textures and setup the samplers
+   * @param[in] context The GL context
    * @param[in] textureCache The texture cache
    * @param[in] program The shader program
    * @return False if create or bind failed, true if success.
    */
-  bool BindTextures( SceneGraph::TextureCache& textureCache, Program& program );
+  bool BindTextures( Context& context, SceneGraph::TextureCache& textureCache, Program& program );
 
 private:
 
@@ -276,15 +310,18 @@ private:
 
   Vector<GLint> mAttributesLocation;
 
-  BlendingOptions                 mBlendingOptions; /// Blending options including blend color, blend func and blend equation
-  Dali::Renderer::FaceCullingMode mFaceCullingMode; /// Mode of face culling
-  Dali::Renderer::DepthWriteMode  mDepthWriteMode;  /// Depth write mode
+  BlendingOptions       mBlendingOptions; /// Blending options including blend color, blend func and blend equation
+  FaceCullingMode::Type mFaceCullingMode; /// Mode of face culling
+  DepthFunction::Type   mDepthFunction;   /// Depth function
+
+  size_t mIndexedDrawFirstElement;        /// Offset of first element to draw
+  size_t mIndexedDrawElementsCount;       /// Number of elements to draw
 
-  size_t mIndexedDrawFirstElement;                  /// Offset of first element to draw
-  size_t mIndexedDrawElementsCount;                 /// Number of elements to draw
+  DepthWriteMode::Type mDepthWriteMode:2; /// Depth write mode
+  DepthTestMode::Type mDepthTestMode:2;   /// Depth test mode
 
-  bool mUpdateAttributesLocation:1;                 ///< Indicates attribute locations have changed
-  bool mPremultipledAlphaEnabled:1;                 ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
+  bool mUpdateAttributesLocation:1;       ///< Indicates attribute locations have changed
+  bool mPremultipledAlphaEnabled:1;       ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
 };
 
 } // namespace SceneGraph