Moved Core Rendering API from devel-api to public-api
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-renderer.h
index 11482af..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,6 +83,8 @@ 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,
@@ -90,7 +92,9 @@ public:
                         const Vector4* blendColor,
                         FaceCullingMode::Type faceCullingMode,
                         bool preMultipliedAlphaEnabled,
-                        DepthWriteMode::Type depthWriteMode );
+                        DepthWriteMode::Type depthWriteMode,
+                        DepthTestMode::Type depthTestMode,
+                        DepthFunction::Type depthFunction );
 
   /**
    * Constructor.
@@ -101,6 +105,8 @@ 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,
@@ -108,7 +114,9 @@ public:
             const Vector4* blendColor,
             FaceCullingMode::Type faceCullingMode,
             bool preMultipliedAlphaEnabled,
-            DepthWriteMode::Type depthWriteMode );
+            DepthWriteMode::Type depthWriteMode,
+            DepthTestMode::Type depthTestMode,
+            DepthFunction::Type depthFunction );
 
   /**
    * Change the data providers of the renderer
@@ -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
    */
   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 SetDepthWriteMode( DepthWriteMode::Type depthWriteMode );
+  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
+   */
+  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:
 
@@ -278,13 +312,16 @@ private:
 
   BlendingOptions       mBlendingOptions; /// Blending options including blend color, blend func and blend equation
   FaceCullingMode::Type mFaceCullingMode; /// Mode of face culling
-  DepthWriteMode::Type  mDepthWriteMode;  /// Depth write mode
+  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