// INTERNAL INCLUDES
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/devel-api/rendering/material.h>
+#include <dali/devel-api/rendering/texture-set.h>
#include <dali/internal/common/blending-options.h>
#include <dali/internal/common/message.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/renderers/render-geometry.h>
namespace Dali
/**
* Create a new renderer instance
* @param[in] dataProviders The data providers for the renderer
- * @param[in] renderGeometry The geometry for the renderer
+ * @param[in] geometry 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.
+ * @param[in] depthWriteMode Depth buffer write mode
*/
static Renderer* New( SceneGraph::RenderDataProvider* dataProviders,
- SceneGraph::RenderGeometry* renderGeometry,
+ Render::Geometry* geometry,
unsigned int blendingBitmask,
const Vector4* blendColor,
Dali::Renderer::FaceCullingMode faceCullingMode,
- bool preMultipliedAlphaEnabled);
+ bool preMultipliedAlphaEnabled,
+ Dali::Renderer::DepthWriteMode depthWriteMode );
/**
* Constructor.
* @param[in] dataProviders The data providers for the renderer
- * @param[in] renderGeometry The geometry for the renderer
+ * @param[in] geometry 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.
+ * @param[in] depthWriteMode Depth buffer write mode
*/
Renderer( SceneGraph::RenderDataProvider* dataProviders,
- SceneGraph::RenderGeometry* renderGeometry,
+ Render::Geometry* geometry,
unsigned int blendingBitmask,
const Vector4* blendColor,
Dali::Renderer::FaceCullingMode faceCullingMode,
- bool preMultipliedAlphaEnabled);
+ bool preMultipliedAlphaEnabled,
+ Dali::Renderer::DepthWriteMode depthWriteMode );
/**
* Change the data providers of the renderer
/**
* Change the geometry used by the renderer
- * @param[in] renderGeometry The new geometry
+ * @param[in] geometry The new geometry
*/
- void SetGeometry( SceneGraph::RenderGeometry* renderGeometry );
+ void SetGeometry( Render::Geometry* geometry );
/**
* Second-phase construction.
* This is called when the renderer is inside render thread
void SetBlendColor( const Vector4* color );
/**
+ * Set the first element index to draw by the indexed draw
+ * @param[in] firstElement index of first element to draw
+ */
+ void SetIndexedDrawFirstElement( size_t firstElement );
+
+ /**
+ * Set the number of elements to draw by the indexed draw
+ * @param[in] elementsCount number of elements to draw
+ */
+ 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 );
/**
- * Set the sampler used to render the set texture.
- * @param[in] samplerBitfield The packed sampler options used to render.
+ * Query the Renderer's depth write mode
+ * @return The renderer depth write mode
*/
- void SetSampler( unsigned int samplerBitfield );
+ Dali::Renderer::DepthWriteMode GetDepthWriteMode() const;
/**
- * Query whether the derived type of Renderer requires depth testing.
- * @return True if the renderer requires depth testing.
+ * Sets the depth write mode
+ * @param[in] depthWriteMode The depth write mode
*/
- bool RequiresDepthTest() const;
+ void SetDepthWriteMode( Dali::Renderer::DepthWriteMode depthWriteMode );
/**
* Called to render during RenderManager::Render().
const Matrix& modelViewMatrix,
const Matrix& viewMatrix,
const Matrix& projectionMatrix,
+ const Vector3& size,
bool blend);
/**
/**
* 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
+ * @param[in] bufferIndex The index of the previous update buffer.
+ * @param[in] program The shader program
+ * @param[in] map The uniform
*/
void SetUniformFromProperty( BufferIndex bufferIndex, Program& program, UniformIndexMap& map );
/**
- * Bind the material textures in the samplers and setup the samplers
+ * Bind the textures 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:
+private:
OwnerPointer< SceneGraph::RenderDataProvider > mRenderDataProvider;
-private:
-
Context* mContext;
SceneGraph::TextureCache* mTextureCache;
Render::UniformNameCache* mUniformNameCache;
- SceneGraph::RenderGeometry* mRenderGeometry;
+ Render::Geometry* mGeometry;
struct UniformIndexMap
{
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
+
+ size_t mIndexedDrawFirstElement; /// Offset of first element to draw
+ size_t mIndexedDrawElementsCount; /// Number of elements to draw
- unsigned int mSamplerBitfield; ///< Sampler options used for texture filtering
bool mUpdateAttributesLocation:1; ///< Indicates attribute locations have changed
- bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
+ bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
};
} // namespace SceneGraph