/*
- * 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/object/type-registry.h>
-#include <dali/devel-api/rendering/renderer.h> // Dali::Renderer
#include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
#include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
#include <dali/internal/event/common/property-input-impl.h>
DALI_PROPERTY_TABLE_BEGIN
DALI_PROPERTY( "depthIndex", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX )
DALI_PROPERTY( "faceCullingMode", INTEGER, true, false, false, Dali::Renderer::Property::FACE_CULLING_MODE )
-DALI_PROPERTY( "blendingMode", INTEGER, true, false, false, Dali::Renderer::Property::BLENDING_MODE )
+DALI_PROPERTY( "blendMode", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_MODE )
DALI_PROPERTY( "blendEquationRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_EQUATION_RGB )
DALI_PROPERTY( "blendEquationAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_EQUATION_ALPHA )
-DALI_PROPERTY( "sourceBlendFactorRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLENDING_SRC_FACTOR_RGB )
-DALI_PROPERTY( "destinationBlendFactorRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLENDING_DEST_FACTOR_RGB )
-DALI_PROPERTY( "sourceBlendFactorAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLENDING_SRC_FACTOR_ALPHA )
-DALI_PROPERTY( "destinationBlendFactorAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLENDING_DEST_FACTOR_ALPHA )
-DALI_PROPERTY( "blendingColor", VECTOR4, true, false, false, Dali::Renderer::Property::BLENDING_COLOR )
+DALI_PROPERTY( "blendFactorSrcRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB )
+DALI_PROPERTY( "blendFactorDestRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB )
+DALI_PROPERTY( "blendFactorSrcAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA )
+DALI_PROPERTY( "blendFactorDestAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA )
+DALI_PROPERTY( "blendColor", VECTOR4, true, false, false, Dali::Renderer::Property::BLEND_COLOR )
DALI_PROPERTY( "blendPreMultipliedAlpha", BOOLEAN, true, false, false, Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA )
DALI_PROPERTY( "indexRangeFirst", INTEGER, true, false, false, Dali::Renderer::Property::INDEX_RANGE_FIRST )
DALI_PROPERTY( "indexRangeCount", INTEGER, true, false, false, Dali::Renderer::Property::INDEX_RANGE_COUNT )
-DALI_PROPERTY_TABLE_END( DEFAULT_OBJECT_PROPERTY_START_INDEX )
+DALI_PROPERTY( "depthWriteMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_WRITE_MODE )
+DALI_PROPERTY( "depthFunction", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_FUNCTION )
+DALI_PROPERTY( "depthTestMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_TEST_MODE )
+DALI_PROPERTY( "stencilFunction", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION )
+DALI_PROPERTY( "stencilFunctionMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK )
+DALI_PROPERTY( "stencilFunctionReference", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE )
+DALI_PROPERTY( "stencilMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_MASK )
+DALI_PROPERTY( "stencilMode", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_MODE )
+DALI_PROPERTY( "stencilOperationOnFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL )
+DALI_PROPERTY( "stencilOperationOnZFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL )
+DALI_PROPERTY( "stencilOperationOnZPass", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
+DALI_PROPERTY( "writeToColorBuffer", BOOLEAN, true, false, false, Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER )
+DALI_PROPERTY_TABLE_END( DEFAULT_RENDERER_PROPERTY_START_INDEX )
const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS };
return mDepthIndex;
}
-void Renderer::SetFaceCullingMode( Dali::Renderer::FaceCullingMode cullingMode )
+void Renderer::SetFaceCullingMode( FaceCullingMode::Type cullingMode )
{
if( mFaceCullingMode != cullingMode )
{
}
}
-Dali::Renderer::FaceCullingMode Renderer::GetFaceCullingMode()
+FaceCullingMode::Type Renderer::GetFaceCullingMode()
{
return mFaceCullingMode;
}
-void Renderer::SetBlendMode( BlendingMode::Type mode )
+void Renderer::SetBlendMode( BlendMode::Type mode )
{
- if( mBlendingMode != mode )
+ if( mBlendMode != mode )
{
- mBlendingMode = mode;
+ mBlendMode = mode;
- SetBlendingModeMessage( GetEventThreadServices(), *mSceneObject, mBlendingMode );
+ SetBlendModeMessage( GetEventThreadServices(), *mSceneObject, mBlendMode );
}
}
-BlendingMode::Type Renderer::GetBlendMode() const
+BlendMode::Type Renderer::GetBlendMode() const
{
- return mBlendingMode;
+ return mBlendMode;
}
-void Renderer::SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba )
+void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba )
{
mBlendingOptions.SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba );
SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
}
-void Renderer::SetBlendFunc( BlendingFactor::Type srcFactorRgb,
- BlendingFactor::Type destFactorRgb,
- BlendingFactor::Type srcFactorAlpha,
- BlendingFactor::Type destFactorAlpha )
+void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgb,
+ BlendFactor::Type destFactorRgb,
+ BlendFactor::Type srcFactorAlpha,
+ BlendFactor::Type destFactorAlpha )
{
mBlendingOptions.SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
}
-void Renderer::GetBlendFunc( BlendingFactor::Type& srcFactorRgb,
- BlendingFactor::Type& destFactorRgb,
- BlendingFactor::Type& srcFactorAlpha,
- BlendingFactor::Type& destFactorAlpha ) const
+void Renderer::GetBlendFunc( BlendFactor::Type& srcFactorRgb,
+ BlendFactor::Type& destFactorRgb,
+ BlendFactor::Type& srcFactorAlpha,
+ BlendFactor::Type& destFactorAlpha ) const
{
srcFactorRgb = mBlendingOptions.GetBlendSrcFactorRgb();
destFactorRgb = mBlendingOptions.GetBlendDestFactorRgb();
destFactorAlpha = mBlendingOptions.GetBlendDestFactorAlpha();
}
-void Renderer::SetBlendEquation( BlendingEquation::Type equationRgba )
+void Renderer::SetBlendEquation( BlendEquation::Type equationRgba )
{
mBlendingOptions.SetBlendEquation( equationRgba, equationRgba );
SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
}
-void Renderer::SetBlendEquation( BlendingEquation::Type equationRgb,
- BlendingEquation::Type equationAlpha )
+void Renderer::SetBlendEquation( BlendEquation::Type equationRgb,
+ BlendEquation::Type equationAlpha )
{
mBlendingOptions.SetBlendEquation( equationRgb, equationAlpha );
SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
}
-void Renderer::GetBlendEquation( BlendingEquation::Type& equationRgb,
- BlendingEquation::Type& equationAlpha ) const
+void Renderer::GetBlendEquation( BlendEquation::Type& equationRgb,
+ BlendEquation::Type& equationAlpha ) const
{
// These are not animatable, the cached values are up-to-date.
equationRgb = mBlendingOptions.GetBlendEquationRgb();
{
if( preMultipled )
{
- SetBlendFunc( BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA, BlendingFactor::ONE, BlendingFactor::ONE );
+ SetBlendFunc( BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE );
}
mPremultipledAlphaEnabled = preMultipled;
SetEnablePreMultipliedAlphaMessage( GetEventThreadServices(), *mSceneObject, mPremultipledAlphaEnabled );
int faceCullingMode;
if( propertyValue.Get( faceCullingMode ) )
{
- SetFaceCullingMode( Dali::Renderer::FaceCullingMode( faceCullingMode ) );
+ SetFaceCullingMode( FaceCullingMode::Type( faceCullingMode ) );
}
break;
}
- case Dali::Renderer::Property::BLENDING_MODE:
+ case Dali::Renderer::Property::BLEND_MODE:
{
int blendingMode;
if( propertyValue.Get( blendingMode ) )
{
- SetBlendMode( BlendingMode::Type( blendingMode ) );
+ SetBlendMode( BlendMode::Type( blendingMode ) );
}
break;
}
int blendingEquation;
if( propertyValue.Get( blendingEquation ) )
{
- BlendingEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
- mBlendingOptions.SetBlendEquation( static_cast<BlendingEquation::Type>( blendingEquation ), alphaEquation );
+ BlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
+ mBlendingOptions.SetBlendEquation( static_cast<BlendEquation::Type>( blendingEquation ), alphaEquation );
SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
}
break;
int blendingEquation;
if( propertyValue.Get( blendingEquation ) )
{
- BlendingEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
- mBlendingOptions.SetBlendEquation( rgbEquation, static_cast<BlendingEquation::Type>( blendingEquation ) );
+ BlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
+ mBlendingOptions.SetBlendEquation( rgbEquation, static_cast<BlendEquation::Type>( blendingEquation ) );
SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
}
break;
}
- case Dali::Renderer::Property::BLENDING_SRC_FACTOR_RGB:
+ case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
{
int blendingFactor;
if( propertyValue.Get( blendingFactor ) )
{
- BlendingFactor::Type srcFactorRgb;
- BlendingFactor::Type destFactorRgb;
- BlendingFactor::Type srcFactorAlpha;
- BlendingFactor::Type destFactorAlpha;
+ BlendFactor::Type srcFactorRgb;
+ BlendFactor::Type destFactorRgb;
+ BlendFactor::Type srcFactorAlpha;
+ BlendFactor::Type destFactorAlpha;
GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
- SetBlendFunc( static_cast<BlendingFactor::Type>( blendingFactor ),
+ SetBlendFunc( static_cast<BlendFactor::Type>( blendingFactor ),
destFactorRgb,
srcFactorAlpha,
destFactorAlpha );
}
break;
}
- case Dali::Renderer::Property::BLENDING_DEST_FACTOR_RGB:
+ case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
{
int blendingFactor;
if( propertyValue.Get( blendingFactor ) )
{
- BlendingFactor::Type srcFactorRgb;
- BlendingFactor::Type destFactorRgb;
- BlendingFactor::Type srcFactorAlpha;
- BlendingFactor::Type destFactorAlpha;
+ BlendFactor::Type srcFactorRgb;
+ BlendFactor::Type destFactorRgb;
+ BlendFactor::Type srcFactorAlpha;
+ BlendFactor::Type destFactorAlpha;
GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
SetBlendFunc( srcFactorRgb,
- static_cast<BlendingFactor::Type>( blendingFactor ),
+ static_cast<BlendFactor::Type>( blendingFactor ),
srcFactorAlpha,
destFactorAlpha );
}
break;
}
- case Dali::Renderer::Property::BLENDING_SRC_FACTOR_ALPHA:
+ case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
{
int blendingFactor;
if( propertyValue.Get( blendingFactor ) )
{
- BlendingFactor::Type srcFactorRgb;
- BlendingFactor::Type destFactorRgb;
- BlendingFactor::Type srcFactorAlpha;
- BlendingFactor::Type destFactorAlpha;
+ BlendFactor::Type srcFactorRgb;
+ BlendFactor::Type destFactorRgb;
+ BlendFactor::Type srcFactorAlpha;
+ BlendFactor::Type destFactorAlpha;
GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
SetBlendFunc( srcFactorRgb,
destFactorRgb,
- static_cast<BlendingFactor::Type>( blendingFactor ),
+ static_cast<BlendFactor::Type>( blendingFactor ),
destFactorAlpha );
}
break;
}
- case Dali::Renderer::Property::BLENDING_DEST_FACTOR_ALPHA:
+ case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
{
int blendingFactor;
if( propertyValue.Get( blendingFactor ) )
{
- BlendingFactor::Type srcFactorRgb;
- BlendingFactor::Type destFactorRgb;
- BlendingFactor::Type srcFactorAlpha;
- BlendingFactor::Type destFactorAlpha;
+ BlendFactor::Type srcFactorRgb;
+ BlendFactor::Type destFactorRgb;
+ BlendFactor::Type srcFactorAlpha;
+ BlendFactor::Type destFactorAlpha;
GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
SetBlendFunc( srcFactorRgb,
destFactorRgb,
srcFactorAlpha,
- static_cast<BlendingFactor::Type>( blendingFactor ) );
+ static_cast<BlendFactor::Type>( blendingFactor ) );
}
break;
}
- case Dali::Renderer::Property::BLENDING_COLOR:
+ case Dali::Renderer::Property::BLEND_COLOR:
{
Vector4 blendColor;
if( propertyValue.Get( blendColor ) )
}
break;
}
+ case Dali::Renderer::Property::DEPTH_WRITE_MODE:
+ {
+ int value;
+ propertyValue.Get( value );
+ DepthWriteMode::Type mode = static_cast<DepthWriteMode::Type>(value);
+ if( mode != mDepthWriteMode )
+ {
+ mDepthWriteMode = mode;
+ SetDepthWriteModeMessage( GetEventThreadServices(), *mSceneObject, mode );
+ }
+ break;
+ }
+ case Dali::Renderer::Property::DEPTH_FUNCTION:
+ {
+ int value;
+ propertyValue.Get( value );
+ DepthFunction::Type depthFunction = static_cast<DepthFunction::Type>(value);
+ if( depthFunction != mDepthFunction )
+ {
+ mDepthFunction = depthFunction;
+ SetDepthFunctionMessage( GetEventThreadServices(), *mSceneObject, depthFunction );
+ }
+ break;
+ }
+ case Dali::Renderer::Property::DEPTH_TEST_MODE:
+ {
+ int value;
+ propertyValue.Get( value );
+ DepthTestMode::Type mode = static_cast<DepthTestMode::Type>(value);
+ if( mode != mDepthTestMode )
+ {
+ mDepthTestMode = mode;
+ SetDepthTestModeMessage( GetEventThreadServices(), *mSceneObject, mode );
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
}
}
value = mFaceCullingMode;
break;
}
- case Dali::Renderer::Property::BLENDING_MODE:
+ case Dali::Renderer::Property::BLEND_MODE:
{
- value = mBlendingMode;
+ value = mBlendMode;
break;
}
case Dali::Renderer::Property::BLEND_EQUATION_RGB:
value = static_cast<int>( mBlendingOptions.GetBlendEquationAlpha() );
break;
}
- case Dali::Renderer::Property::BLENDING_SRC_FACTOR_RGB:
+ case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
{
- BlendingFactor::Type srcFactorRgb;
- BlendingFactor::Type destFactorRgb;
- BlendingFactor::Type srcFactorAlpha;
- BlendingFactor::Type destFactorAlpha;
+ BlendFactor::Type srcFactorRgb;
+ BlendFactor::Type destFactorRgb;
+ BlendFactor::Type srcFactorAlpha;
+ BlendFactor::Type destFactorAlpha;
GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
value = static_cast<int>( srcFactorRgb );
break;
}
- case Dali::Renderer::Property::BLENDING_DEST_FACTOR_RGB:
+ case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
{
- BlendingFactor::Type srcFactorRgb;
- BlendingFactor::Type destFactorRgb;
- BlendingFactor::Type srcFactorAlpha;
- BlendingFactor::Type destFactorAlpha;
+ BlendFactor::Type srcFactorRgb;
+ BlendFactor::Type destFactorRgb;
+ BlendFactor::Type srcFactorAlpha;
+ BlendFactor::Type destFactorAlpha;
GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
value = static_cast<int>( destFactorRgb );
break;
}
- case Dali::Renderer::Property::BLENDING_SRC_FACTOR_ALPHA:
+ case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
{
- BlendingFactor::Type srcFactorRgb;
- BlendingFactor::Type destFactorRgb;
- BlendingFactor::Type srcFactorAlpha;
- BlendingFactor::Type destFactorAlpha;
+ BlendFactor::Type srcFactorRgb;
+ BlendFactor::Type destFactorRgb;
+ BlendFactor::Type srcFactorAlpha;
+ BlendFactor::Type destFactorAlpha;
GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
value = static_cast<int>( srcFactorAlpha );
break;
}
- case Dali::Renderer::Property::BLENDING_DEST_FACTOR_ALPHA:
+ case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
{
- BlendingFactor::Type srcFactorRgb;
- BlendingFactor::Type destFactorRgb;
- BlendingFactor::Type srcFactorAlpha;
- BlendingFactor::Type destFactorAlpha;
+ BlendFactor::Type srcFactorRgb;
+ BlendFactor::Type destFactorRgb;
+ BlendFactor::Type srcFactorAlpha;
+ BlendFactor::Type destFactorAlpha;
GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
value = static_cast<int>( destFactorAlpha );
break;
}
- case Dali::Renderer::Property::BLENDING_COLOR:
+ case Dali::Renderer::Property::BLEND_COLOR:
{
if( mBlendColor )
{
value = static_cast<int>( mIndexedDrawElementCount );
break;
}
+ case Dali::Renderer::Property::DEPTH_WRITE_MODE:
+ {
+ value = mDepthWriteMode;
+ break;
+ }
+ case Dali::Renderer::Property::DEPTH_FUNCTION:
+ {
+ value = mDepthFunction;
+ break;
+ }
+ case Dali::Renderer::Property::DEPTH_TEST_MODE:
+ {
+ value = mDepthTestMode;
+ break;
+ }
}
return value;
}
{
if( mOnStageCount == 0 )
{
- OnStageConnectMessage( GetEventThreadServices(), *mSceneObject );
mTextureSetConnector.OnStageConnect();
}
++mOnStageCount;
--mOnStageCount;
if( mOnStageCount == 0 )
{
- OnStageDisconnectMessage( GetEventThreadServices(), *mSceneObject);
mTextureSetConnector.OnStageDisconnect();
}
}
mOnStageCount( 0 ),
mIndexedDrawFirstElement( 0 ),
mIndexedDrawElementCount( 0 ),
- mFaceCullingMode( Dali::Renderer::NONE ),
- mBlendingMode( Dali::BlendingMode::AUTO ),
+ mFaceCullingMode( FaceCullingMode::NONE ),
+ mBlendMode( BlendMode::AUTO ),
mBlendingOptions(),
+ mDepthWriteMode( DepthWriteMode::AUTO ),
+ mDepthFunction( DepthFunction::LESS ),
+ mDepthTestMode( DepthTestMode::AUTO ),
mPremultipledAlphaEnabled( false )
{
}