From: Tom Robinson Date: Fri, 29 Jul 2016 15:29:40 +0000 (+0100) Subject: [3.0] Renderer to support enum and string properties X-Git-Tag: accepted/tizen/common/20160830.150426~6 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=2c01ff92c5894aa368225bdbf29a29f5220dd832 [3.0] Renderer to support enum and string properties Change-Id: Ief5da875bab5aad2729dd966db27d0a7b4f8eb3a --- diff --git a/automated-tests/src/dali/utc-Dali-Renderer.cpp b/automated-tests/src/dali/utc-Dali-Renderer.cpp index aecffc8..3bfbacf 100644 --- a/automated-tests/src/dali/utc-Dali-Renderer.cpp +++ b/automated-tests/src/dali/utc-Dali-Renderer.cpp @@ -2045,6 +2045,59 @@ int UtcDaliRendererSetDepthFunction(void) END_TEST; } +/** + * @brief This templatized function checks an enumeration property is setting and getting correctly. + * The checks performed are as follows: + * - Check the initial/default value. + * - Set a different value via enum. + * - Check it was set. + * - Set a different value via string. + * - Check it was set. + */ +template< typename T > +void CheckEnumerationProperty( Renderer& renderer, Property::Index propertyIndex, T initialValue, T firstCheckEnumeration, T secondCheckEnumeration, std::string secondCheckString ) +{ + DALI_TEST_CHECK( renderer.GetProperty( propertyIndex ) == static_cast( initialValue ) ); + renderer.SetProperty( propertyIndex, firstCheckEnumeration ); + DALI_TEST_CHECK( renderer.GetProperty( propertyIndex ) == static_cast( firstCheckEnumeration ) ); + renderer.SetProperty( propertyIndex, secondCheckString ); + DALI_TEST_CHECK( renderer.GetProperty( propertyIndex ) == static_cast( secondCheckEnumeration ) ); +} + +int UtcDaliRendererEnumProperties(void) +{ + TestApplication application; + tet_infoline( "Test Renderer enumeration properties can be set with both integer and string values" ); + + Geometry geometry = CreateQuadGeometry(); + Shader shader = CreateShader(); + Renderer renderer = Renderer::New( geometry, shader ); + + /* + * Here we use a templatized function to perform several checks on each enumeration property. + * @see CheckEnumerationProperty for details of the checks performed. + */ + + CheckEnumerationProperty< FaceCullingMode::Type >( renderer, Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE, FaceCullingMode::FRONT, FaceCullingMode::BACK, "BACK" ); + CheckEnumerationProperty< BlendMode::Type >( renderer, Renderer::Property::BLEND_MODE, BlendMode::AUTO, BlendMode::OFF, BlendMode::ON, "ON" ); + CheckEnumerationProperty< BlendEquation::Type >( renderer, Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT" ); + CheckEnumerationProperty< BlendEquation::Type >( renderer, Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT" ); + CheckEnumerationProperty< BlendFactor::Type >( renderer, Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" ); + CheckEnumerationProperty< BlendFactor::Type >( renderer, Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" ); + CheckEnumerationProperty< BlendFactor::Type >( renderer, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::SRC_COLOR, "SRC_COLOR" ); + CheckEnumerationProperty< BlendFactor::Type >( renderer, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" ); + CheckEnumerationProperty< DepthWriteMode::Type >( renderer, Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO, DepthWriteMode::OFF, DepthWriteMode::ON, "ON" ); + CheckEnumerationProperty< DepthFunction::Type >( renderer, Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS, DepthFunction::ALWAYS, DepthFunction::GREATER, "GREATER" ); + CheckEnumerationProperty< DepthTestMode::Type >( renderer, Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO, DepthTestMode::OFF, DepthTestMode::ON, "ON" ); + CheckEnumerationProperty< StencilFunction::Type >( renderer, Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS, StencilFunction::LESS, StencilFunction::EQUAL, "EQUAL" ); + CheckEnumerationProperty< StencilMode::Type >( renderer, Renderer::Property::STENCIL_MODE, StencilMode::AUTO, StencilMode::OFF, StencilMode::ON, "ON" ); + CheckEnumerationProperty< StencilOperation::Type >( renderer, Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" ); + CheckEnumerationProperty< StencilOperation::Type >( renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" ); + CheckEnumerationProperty< StencilOperation::Type >( renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" ); + + END_TEST; +} + Renderer RendererTestFixture( TestApplication& application ) { Geometry geometry = CreateQuadGeometry(); diff --git a/dali/internal/event/rendering/renderer-impl.cpp b/dali/internal/event/rendering/renderer-impl.cpp index 0bd59c7..7ee14a0 100644 --- a/dali/internal/event/rendering/renderer-impl.cpp +++ b/dali/internal/event/rendering/renderer-impl.cpp @@ -19,6 +19,7 @@ #include // Dali::Internal::Renderer // INTERNAL INCLUDES +#include #include #include // Dali::Internal::ObjectHelper #include // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END @@ -36,7 +37,7 @@ namespace { /** - * |name |type |writable|animatable|constraint-input|enum for index-checking| + * Properties: |name |type |writable|animatable|constraint-input|enum for index-checking| */ DALI_PROPERTY_TABLE_BEGIN DALI_PROPERTY( "depthIndex", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX ) @@ -66,6 +67,96 @@ DALI_PROPERTY( "stencilOperationOnZPass", INTEGER, true, false, false DALI_PROPERTY( "writeToColorBuffer", BOOLEAN, true, false, false, Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER ) DALI_PROPERTY_TABLE_END( DEFAULT_RENDERER_PROPERTY_START_INDEX ) +// Property string to enumeration tables: + +DALI_ENUM_TO_STRING_TABLE_BEGIN( FACE_CULLING_MODE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, NONE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, FRONT ) +DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, BACK ) +DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, FRONT_AND_BACK ) +DALI_ENUM_TO_STRING_TABLE_END( FACE_CULLING_MODE ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_MODE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, OFF ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, AUTO ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, ON ) +DALI_ENUM_TO_STRING_TABLE_END( BLEND_MODE ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_EQUATION ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, ADD ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, SUBTRACT ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, REVERSE_SUBTRACT ) +DALI_ENUM_TO_STRING_TABLE_END( BLEND_EQUATION ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_FACTOR ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ZERO ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_COLOR ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_SRC_COLOR ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_ALPHA ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_SRC_ALPHA ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, DST_ALPHA ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_DST_ALPHA ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, DST_COLOR ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_DST_COLOR ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_ALPHA_SATURATE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, CONSTANT_COLOR ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_CONSTANT_COLOR ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, CONSTANT_ALPHA ) +DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_CONSTANT_ALPHA ) +DALI_ENUM_TO_STRING_TABLE_END( BLEND_FACTOR ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_WRITE_MODE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, OFF ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, AUTO ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, ON ) +DALI_ENUM_TO_STRING_TABLE_END( DEPTH_WRITE_MODE ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_TEST_MODE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, OFF ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, AUTO ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, ON ) +DALI_ENUM_TO_STRING_TABLE_END( DEPTH_TEST_MODE ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_FUNCTION ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, NEVER ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, ALWAYS ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, LESS ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, GREATER ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, EQUAL ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, NOT_EQUAL ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, LESS_EQUAL ) +DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, GREATER_EQUAL ) +DALI_ENUM_TO_STRING_TABLE_END( DEPTH_FUNCTION ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_FUNCTION ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, NEVER ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, LESS ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, EQUAL ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, LESS_EQUAL ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, GREATER ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, NOT_EQUAL ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, GREATER_EQUAL ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, ALWAYS ) +DALI_ENUM_TO_STRING_TABLE_END( STENCIL_FUNCTION ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_MODE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilMode, OFF ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilMode, AUTO ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilMode, ON ) +DALI_ENUM_TO_STRING_TABLE_END( STENCIL_MODE ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_OPERATION ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, ZERO ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, KEEP ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, REPLACE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INCREMENT ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, DECREMENT ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INVERT ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INCREMENT_WRAP ) +DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, DECREMENT_WRAP ) +DALI_ENUM_TO_STRING_TABLE_END( STENCIL_OPERATION ) + const ObjectImplHelper RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS }; BaseHandle Create() @@ -135,21 +226,6 @@ int Renderer::GetDepthIndex() const return mDepthIndex; } -void Renderer::SetFaceCullingMode( FaceCullingMode::Type cullingMode ) -{ - if( mFaceCullingMode != cullingMode ) - { - mFaceCullingMode = cullingMode; - - SetFaceCullingModeMessage( GetEventThreadServices(), *mSceneObject, mFaceCullingMode ); - } -} - -FaceCullingMode::Type Renderer::GetFaceCullingMode() -{ - return mFaceCullingMode; -} - void Renderer::SetBlendMode( BlendMode::Type mode ) { if( mBlendMode != mode ) @@ -328,109 +404,88 @@ void Renderer::SetDefaultProperty( Property::Index index, } case Dali::Renderer::Property::FACE_CULLING_MODE: { - int faceCullingMode; - if( propertyValue.Get( faceCullingMode ) ) + FaceCullingMode::Type convertedValue = mFaceCullingMode; + if( Scripting::GetEnumerationProperty< FaceCullingMode::Type >( propertyValue, FACE_CULLING_MODE_TABLE, FACE_CULLING_MODE_TABLE_COUNT, convertedValue ) ) { - SetFaceCullingMode( FaceCullingMode::Type( faceCullingMode ) ); + mFaceCullingMode = convertedValue; + SetFaceCullingModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue ); } break; } case Dali::Renderer::Property::BLEND_MODE: { - int blendingMode; - if( propertyValue.Get( blendingMode ) ) + BlendMode::Type convertedValue = mBlendMode; + if( Scripting::GetEnumerationProperty< BlendMode::Type >( propertyValue, BLEND_MODE_TABLE, BLEND_MODE_TABLE_COUNT, convertedValue ) ) { - SetBlendMode( BlendMode::Type( blendingMode ) ); + SetBlendMode( convertedValue ); } break; } case Dali::Renderer::Property::BLEND_EQUATION_RGB: { - int blendingEquation; - if( propertyValue.Get( blendingEquation ) ) + BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationRgb(); + + if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) ) { BlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha(); - mBlendingOptions.SetBlendEquation( static_cast( blendingEquation ), alphaEquation ); + mBlendingOptions.SetBlendEquation( convertedValue, alphaEquation ); SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() ); } break; } case Dali::Renderer::Property::BLEND_EQUATION_ALPHA: { - int blendingEquation; - if( propertyValue.Get( blendingEquation ) ) + BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationAlpha(); + + if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) ) { BlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb(); - mBlendingOptions.SetBlendEquation( rgbEquation, static_cast( blendingEquation ) ); + mBlendingOptions.SetBlendEquation( rgbEquation, convertedValue ); SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() ); } break; } case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB: { - int blendingFactor; - if( propertyValue.Get( blendingFactor ) ) + BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha; + GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha ); + + if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorRgb ) ) { - BlendFactor::Type srcFactorRgb; - BlendFactor::Type destFactorRgb; - BlendFactor::Type srcFactorAlpha; - BlendFactor::Type destFactorAlpha; - GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); - SetBlendFunc( static_cast( blendingFactor ), - destFactorRgb, - srcFactorAlpha, - destFactorAlpha ); + SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha ); } break; } case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB: { - int blendingFactor; - if( propertyValue.Get( blendingFactor ) ) + BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha; + GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha ); + + if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorRgb ) ) { - BlendFactor::Type srcFactorRgb; - BlendFactor::Type destFactorRgb; - BlendFactor::Type srcFactorAlpha; - BlendFactor::Type destFactorAlpha; - GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); - SetBlendFunc( srcFactorRgb, - static_cast( blendingFactor ), - srcFactorAlpha, - destFactorAlpha ); + SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha ); } break; } case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA: { - int blendingFactor; - if( propertyValue.Get( blendingFactor ) ) + BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha; + GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha ); + + if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorAlpha ) ) { - BlendFactor::Type srcFactorRgb; - BlendFactor::Type destFactorRgb; - BlendFactor::Type srcFactorAlpha; - BlendFactor::Type destFactorAlpha; - GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); - SetBlendFunc( srcFactorRgb, - destFactorRgb, - static_cast( blendingFactor ), - destFactorAlpha ); + SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha ); } break; } case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA: { - int blendingFactor; - if( propertyValue.Get( blendingFactor ) ) + BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha; + GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha ); + + if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorAlpha ) ) { - BlendFactor::Type srcFactorRgb; - BlendFactor::Type destFactorRgb; - BlendFactor::Type srcFactorAlpha; - BlendFactor::Type destFactorAlpha; - GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); - SetBlendFunc( srcFactorRgb, - destFactorRgb, - srcFactorAlpha, - static_cast( blendingFactor ) ); + SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha ); } break; } @@ -472,61 +527,51 @@ void Renderer::SetDefaultProperty( Property::Index index, } case Dali::Renderer::Property::DEPTH_WRITE_MODE: { - int value; - propertyValue.Get( value ); - DepthWriteMode::Type mode = static_cast(value); - if( mode != mDepthWriteMode ) + DepthWriteMode::Type convertedValue = mDepthWriteMode; + if( Scripting::GetEnumerationProperty< DepthWriteMode::Type >( propertyValue, DEPTH_WRITE_MODE_TABLE, DEPTH_WRITE_MODE_TABLE_COUNT, convertedValue ) ) { - mDepthWriteMode = mode; - SetDepthWriteModeMessage( GetEventThreadServices(), *mSceneObject, mode ); + mDepthWriteMode = convertedValue; + SetDepthWriteModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue ); } break; } case Dali::Renderer::Property::DEPTH_FUNCTION: { - int value; - propertyValue.Get( value ); - DepthFunction::Type depthFunction = static_cast(value); - if( depthFunction != mDepthFunction ) + DepthFunction::Type convertedValue = mDepthFunction; + if( Scripting::GetEnumerationProperty< DepthFunction::Type >( propertyValue, DEPTH_FUNCTION_TABLE, DEPTH_FUNCTION_TABLE_COUNT, convertedValue ) ) { - mDepthFunction = depthFunction; - SetDepthFunctionMessage( GetEventThreadServices(), *mSceneObject, depthFunction ); + mDepthFunction = convertedValue; + SetDepthFunctionMessage( GetEventThreadServices(), *mSceneObject, convertedValue ); } break; } case Dali::Renderer::Property::DEPTH_TEST_MODE: { - int value; - propertyValue.Get( value ); - DepthTestMode::Type mode = static_cast(value); - if( mode != mDepthTestMode ) + DepthTestMode::Type convertedValue = mDepthTestMode; + if( Scripting::GetEnumerationProperty< DepthTestMode::Type >( propertyValue, DEPTH_TEST_MODE_TABLE, DEPTH_TEST_MODE_TABLE_COUNT, convertedValue ) ) { - mDepthTestMode = mode; - SetDepthTestModeMessage( GetEventThreadServices(), *mSceneObject, mode ); + mDepthTestMode = convertedValue; + SetDepthTestModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue ); } break; } case Dali::Renderer::Property::STENCIL_MODE: { - int value; - propertyValue.Get( value ); - StencilMode::Type stencilMode = static_cast( value ); - if( stencilMode != mStencilParameters.stencilMode ) + StencilMode::Type convertedValue = mStencilParameters.stencilMode; + if( Scripting::GetEnumerationProperty< StencilMode::Type >( propertyValue, STENCIL_MODE_TABLE, STENCIL_MODE_TABLE_COUNT, convertedValue ) ) { - mStencilParameters.stencilMode = stencilMode; - SetStencilModeMessage( GetEventThreadServices(), *mSceneObject, stencilMode ); + mStencilParameters.stencilMode = convertedValue; + SetStencilModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue ); } break; } case Dali::Renderer::Property::STENCIL_FUNCTION: { - int value; - propertyValue.Get( value ); - StencilFunction::Type stencilFunction = static_cast( value ); - if( stencilFunction != mStencilParameters.stencilFunction ) + StencilFunction::Type convertedValue = mStencilParameters.stencilFunction; + if( Scripting::GetEnumerationProperty< StencilFunction::Type >( propertyValue, STENCIL_FUNCTION_TABLE, STENCIL_FUNCTION_TABLE_COUNT, convertedValue ) ) { - mStencilParameters.stencilFunction = stencilFunction; - SetStencilFunctionMessage( GetEventThreadServices(), *mSceneObject, stencilFunction ); + mStencilParameters.stencilFunction = convertedValue; + SetStencilFunctionMessage( GetEventThreadServices(), *mSceneObject, convertedValue ); } break; } @@ -571,37 +616,31 @@ void Renderer::SetDefaultProperty( Property::Index index, } case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL: { - int value; - propertyValue.Get( value ); - StencilOperation::Type stencilOperation = static_cast( value ); - if( stencilOperation != mStencilParameters.stencilOperationOnFail ) + StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnFail; + if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) ) { - mStencilParameters.stencilOperationOnFail = stencilOperation; - SetStencilOperationOnFailMessage( GetEventThreadServices(), *mSceneObject, stencilOperation ); + mStencilParameters.stencilOperationOnFail = convertedValue; + SetStencilOperationOnFailMessage( GetEventThreadServices(), *mSceneObject, convertedValue ); } break; } case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL: { - int value; - propertyValue.Get( value ); - StencilOperation::Type stencilOperation = static_cast( value ); - if( stencilOperation != mStencilParameters.stencilOperationOnZFail ) + StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZFail; + if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) ) { - mStencilParameters.stencilOperationOnZFail = stencilOperation; - SetStencilOperationOnZFailMessage( GetEventThreadServices(), *mSceneObject, stencilOperation ); + mStencilParameters.stencilOperationOnZFail = convertedValue; + SetStencilOperationOnZFailMessage( GetEventThreadServices(), *mSceneObject, convertedValue ); } break; } case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS: { - int value; - propertyValue.Get( value ); - StencilOperation::Type stencilOperation = static_cast( value ); - if( stencilOperation != mStencilParameters.stencilOperationOnZPass ) + StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZPass; + if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) ) { - mStencilParameters.stencilOperationOnZPass = stencilOperation; - SetStencilOperationOnZPassMessage( GetEventThreadServices(), *mSceneObject, stencilOperation ); + mStencilParameters.stencilOperationOnZPass = convertedValue; + SetStencilOperationOnZPassMessage( GetEventThreadServices(), *mSceneObject, convertedValue ); } break; } diff --git a/dali/internal/event/rendering/renderer-impl.h b/dali/internal/event/rendering/renderer-impl.h index 64d99ba..745159b 100644 --- a/dali/internal/event/rendering/renderer-impl.h +++ b/dali/internal/event/rendering/renderer-impl.h @@ -95,16 +95,6 @@ public: */ int GetDepthIndex() const; - /** - * @copydoc Dali::Renderer::SetFaceCullingMode() - */ - void SetFaceCullingMode( FaceCullingMode::Type cullingMode ); - - /** - * @copydoc Dali::Renderer::GetFaceCullingMode() - */ - FaceCullingMode::Type GetFaceCullingMode(); - /** * @copydoc Dali::Renderer::SetBlendMode() */