From 0db2affb5b891cf73b32925fd9a91f31ea5fc583 Mon Sep 17 00:00:00 2001 From: Paul Wisbey Date: Fri, 22 Apr 2016 10:53:54 +0100 Subject: [PATCH] Blending enum clean-up We were previously using a mixture of BLEND and BLENDING in enums. The order of the BLEND_FACTOR enums & string names was also inconsistent. As a rule of thumb always use Blend & BLEND for namespaces & enums/constants (not Blending or BLENDING) Change-Id: Iff60f4ce5c6fd59991a060fcf19fe7151d65ec5c --- .../src/dali-devel/utc-Dali-Renderer.cpp | 202 +++++++------- dali/devel-api/rendering/renderer.cpp | 39 --- dali/devel-api/rendering/renderer.h | 289 +++++++++++++-------- dali/internal/common/blending-options.cpp | 172 +++++++----- dali/internal/common/blending-options.h | 26 +- dali/internal/common/type-abstraction-enums.h | 9 +- dali/internal/event/actors/image-actor-impl.cpp | 17 +- dali/internal/event/rendering/renderer-impl.cpp | 176 ++++++------- dali/internal/event/rendering/renderer-impl.h | 40 +-- dali/internal/render/common/render-algorithms.cpp | 6 +- dali/internal/render/gl-resources/context.cpp | 4 +- dali/internal/render/gl-resources/context.h | 12 +- dali/internal/render/renderers/render-renderer.cpp | 14 +- dali/internal/render/renderers/render-renderer.h | 20 +- .../update/manager/prepare-render-instructions.cpp | 4 +- .../update/rendering/scene-graph-renderer.cpp | 28 +- .../update/rendering/scene-graph-renderer.h | 20 +- 17 files changed, 580 insertions(+), 498 deletions(-) diff --git a/automated-tests/src/dali-devel/utc-Dali-Renderer.cpp b/automated-tests/src/dali-devel/utc-Dali-Renderer.cpp index bfd2ab9..7b26c80 100644 --- a/automated-tests/src/dali-devel/utc-Dali-Renderer.cpp +++ b/automated-tests/src/dali-devel/utc-Dali-Renderer.cpp @@ -24,13 +24,23 @@ using namespace Dali; #include -namespace +namespace // unnamed namespace { + +const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_RGB( BlendFactor::SRC_ALPHA ); +const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_RGB( BlendFactor::ONE_MINUS_SRC_ALPHA ); +const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_ALPHA( BlendFactor::ONE ); +const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_ALPHA( BlendFactor::ONE_MINUS_SRC_ALPHA ); + +const BlendEquation::Type DEFAULT_BLEND_EQUATION_RGB( BlendEquation::ADD ); +const BlendEquation::Type DEFAULT_BLEND_EQUATION_ALPHA( BlendEquation::ADD ); + void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs ) { current.b = 0.0f; } -} + +} // unnamed namespace void renderer_test_startup(void) { @@ -242,7 +252,7 @@ int UtcDaliRendererSetGetFaceCullingMode(void) // By default, none of the faces should be culled unsigned int cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< Dali::Renderer::FaceCullingMode >( cullFace ) == Renderer::CULL_NONE ); + DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::NONE ); TestGlAbstraction& gl = application.GetGlAbstraction(); TraceCallStack& cullFaceStack = gl.GetCullFaceTrace(); @@ -250,7 +260,7 @@ int UtcDaliRendererSetGetFaceCullingMode(void) { cullFaceStack.Reset(); - renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::CULL_BACK_AND_FRONT ); + renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT_AND_BACK ); application.SendNotification(); application.Render(); @@ -261,12 +271,12 @@ int UtcDaliRendererSetGetFaceCullingMode(void) DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) ); cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< Dali::Renderer::FaceCullingMode >( cullFace ) == Renderer::CULL_BACK_AND_FRONT); + DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::FRONT_AND_BACK ); } { cullFaceStack.Reset(); - renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::CULL_BACK ); + renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK ); application.SendNotification(); application.Render(); @@ -277,12 +287,12 @@ int UtcDaliRendererSetGetFaceCullingMode(void) DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) ); cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< Dali::Renderer::FaceCullingMode >( cullFace ) == Renderer::CULL_BACK ); + DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::BACK ); } { cullFaceStack.Reset(); - renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::CULL_FRONT ); + renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT ); application.SendNotification(); application.Render(); @@ -293,28 +303,28 @@ int UtcDaliRendererSetGetFaceCullingMode(void) DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) ); cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< Dali::Renderer::FaceCullingMode >( cullFace ) == Renderer::CULL_FRONT ); + DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::FRONT ); } { cullFaceStack.Reset(); - renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::CULL_NONE ); + renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE ); application.SendNotification(); application.Render(); DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 0, TEST_LOCATION ); cullFace = renderer.GetProperty( Renderer::Property::FACE_CULLING_MODE ); - DALI_TEST_CHECK( static_cast< Dali::Renderer::FaceCullingMode >( cullFace ) == Renderer::CULL_NONE ); + DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::NONE ); } END_TEST; } -int UtcDaliRendererBlendingOptions01(void) +int UtcDaliRendererBlendOptions01(void) { TestApplication application; - tet_infoline("Test SetBlendFunc(src, dest) "); + tet_infoline("Test BLEND_FACTOR properties "); Geometry geometry = CreateQuadGeometry(); Shader shader = CreateShader(); @@ -327,19 +337,21 @@ int UtcDaliRendererBlendingOptions01(void) actor.SetSize(400, 400); Stage::GetCurrent().Add(actor); - renderer.SetBlendFunc(BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE); + renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE_MINUS_SRC_COLOR ); + renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::SRC_ALPHA_SATURATE ); + renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_COLOR ); + renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::SRC_ALPHA_SATURATE ); // Test that Set was successful: - BlendingFactor::Type srcFactorRgb( BlendingFactor::ZERO ); - BlendingFactor::Type destFactorRgb( BlendingFactor::ZERO ); - BlendingFactor::Type srcFactorAlpha( BlendingFactor::ZERO ); - BlendingFactor::Type destFactorAlpha( BlendingFactor::ZERO ); - renderer.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); + int srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); + int destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); + int srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); + int destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); - DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE, destFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE, destFactorAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::SRC_ALPHA_SATURATE, destFactorRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::SRC_ALPHA_SATURATE, destFactorAlpha, TEST_LOCATION ); application.SendNotification(); application.Render(); @@ -354,11 +366,11 @@ int UtcDaliRendererBlendingOptions01(void) END_TEST; } -int UtcDaliRendererBlendingOptions02(void) +int UtcDaliRendererBlendOptions02(void) { TestApplication application; - tet_infoline("Test SetBlendFunc(srcRgb, destRgb, srcAlpha, destAlpha) "); + tet_infoline("Test BLEND_FACTOR properties "); Geometry geometry = CreateQuadGeometry(); Shader shader = CreateShader(); @@ -370,21 +382,22 @@ int UtcDaliRendererBlendingOptions02(void) actor.SetSize(400, 400); Stage::GetCurrent().Add(actor); - renderer.SetBlendFunc( BlendingFactor::CONSTANT_COLOR, BlendingFactor::ONE_MINUS_CONSTANT_COLOR, - BlendingFactor::CONSTANT_ALPHA, BlendingFactor::ONE_MINUS_CONSTANT_ALPHA ); + renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::CONSTANT_COLOR ); + renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_CONSTANT_COLOR ); + renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::CONSTANT_ALPHA ); + renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_CONSTANT_ALPHA ); // Test that Set was successful: { - BlendingFactor::Type srcFactorRgb( BlendingFactor::ZERO ); - BlendingFactor::Type destFactorRgb( BlendingFactor::ZERO ); - BlendingFactor::Type srcFactorAlpha( BlendingFactor::ZERO ); - BlendingFactor::Type destFactorAlpha( BlendingFactor::ZERO ); - renderer.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); - - DALI_TEST_EQUALS( BlendingFactor::CONSTANT_COLOR, srcFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_CONSTANT_COLOR, destFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingFactor::CONSTANT_ALPHA, srcFactorAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_CONSTANT_ALPHA, destFactorAlpha, TEST_LOCATION ); + int srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); + int destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); + int srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); + int destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); + + DALI_TEST_EQUALS( (int)BlendFactor::CONSTANT_COLOR, srcFactorRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_CONSTANT_COLOR, destFactorRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::CONSTANT_ALPHA, srcFactorAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_CONSTANT_ALPHA, destFactorAlpha, TEST_LOCATION ); } application.SendNotification(); @@ -399,7 +412,7 @@ int UtcDaliRendererBlendingOptions02(void) END_TEST; } -int UtcDaliRendererBlendingOptions03(void) +int UtcDaliRendererBlendOptions03(void) { TestApplication application; @@ -415,16 +428,16 @@ int UtcDaliRendererBlendingOptions03(void) Stage::GetCurrent().Add(actor); // Test the defaults as documented in blending.h - BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT ); - BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT ); - renderer.GetBlendEquation( equationRgb, equationAlpha ); - DALI_TEST_EQUALS( BlendingEquation::ADD, equationRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingEquation::ADD, equationAlpha, TEST_LOCATION ); + int equationRgb = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_RGB ); + int equationAlpha = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_ALPHA ); + + DALI_TEST_EQUALS( (int)BlendEquation::ADD, equationRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendEquation::ADD, equationAlpha, TEST_LOCATION ); END_TEST; } -int UtcDaliRendererBlendingOptions04(void) +int UtcDaliRendererBlendOptions04(void) { TestApplication application; @@ -442,21 +455,20 @@ int UtcDaliRendererBlendingOptions04(void) // Test the single blending equation setting { - renderer.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT ); - BlendingEquation::Type equationRgba( BlendingEquation::SUBTRACT ); - renderer.GetBlendEquation( equationRgba, equationRgba ); - DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgba, TEST_LOCATION ); + renderer.SetProperty( Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT ); + int equationRgb = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_RGB ); + DALI_TEST_EQUALS( (int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION ); } - renderer.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT, BlendingEquation::REVERSE_SUBTRACT ); + renderer.SetProperty( Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT ); + renderer.SetProperty( Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::REVERSE_SUBTRACT ); // Test that Set was successful { - BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT ); - BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT ); - renderer.GetBlendEquation( equationRgb, equationAlpha ); - DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION ); + int equationRgb = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_RGB ); + int equationAlpha = renderer.GetProperty( Renderer::Property::BLEND_EQUATION_ALPHA ); + DALI_TEST_EQUALS( (int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION ); } // Render & check GL commands @@ -486,7 +498,7 @@ int UtcDaliRendererSetBlendMode01(void) actor.SetSize(400, 400); Stage::GetCurrent().Add(actor); - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -518,7 +530,7 @@ int UtcDaliRendererSetBlendMode02(void) actor.SetSize(400, 400); Stage::GetCurrent().Add(actor); - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::OFF); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -550,7 +562,7 @@ int UtcDaliRendererSetBlendMode03(void) actor.SetSize(400, 400); Stage::GetCurrent().Add(actor); - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::AUTO); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -581,7 +593,7 @@ int UtcDaliRendererSetBlendMode04(void) actor.SetSize(400, 400); Stage::GetCurrent().Add(actor); - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::AUTO); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -613,7 +625,7 @@ int UtcDaliRendererSetBlendMode04b(void) actor.SetColor( Vector4(1.0f, 0.0f, 1.0f, 0.5f) ); Stage::GetCurrent().Add(actor); - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::AUTO); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -645,7 +657,7 @@ int UtcDaliRendererSetBlendMode04c(void) actor.SetColor( Color::MAGENTA ); Stage::GetCurrent().Add(actor); - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::AUTO); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -680,7 +692,7 @@ int UtcDaliRendererSetBlendMode05(void) actor.SetSize(400, 400); Stage::GetCurrent().Add(actor); - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::AUTO); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -711,7 +723,7 @@ int UtcDaliRendererSetBlendMode06(void) actor.SetSize(400, 400); Stage::GetCurrent().Add(actor); - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::AUTO); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -745,7 +757,7 @@ int UtcDaliRendererSetBlendMode07(void) actor.SetSize(400, 400); Stage::GetCurrent().Add(actor); - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::AUTO); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO); TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); glAbstraction.EnableEnableDisableCallTrace(true); @@ -770,18 +782,18 @@ int UtcDaliRendererGetBlendMode(void) Renderer renderer = Renderer::New( geometry, shader ); // default value - unsigned int mode = renderer.GetProperty( Renderer::Property::BLENDING_MODE ); - DALI_TEST_EQUALS( static_cast< BlendingMode::Type >( mode ), BlendingMode::AUTO, TEST_LOCATION ); + unsigned int mode = renderer.GetProperty( Renderer::Property::BLEND_MODE ); + DALI_TEST_EQUALS( static_cast< BlendMode::Type >( mode ), BlendMode::AUTO, TEST_LOCATION ); // ON - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON ); - mode = renderer.GetProperty( Renderer::Property::BLENDING_MODE ); - DALI_TEST_EQUALS( static_cast< BlendingMode::Type >( mode ), BlendingMode::ON, TEST_LOCATION ); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); + mode = renderer.GetProperty( Renderer::Property::BLEND_MODE ); + DALI_TEST_EQUALS( static_cast< BlendMode::Type >( mode ), BlendMode::ON, TEST_LOCATION ); // OFF - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::OFF ); - mode = renderer.GetProperty( Renderer::Property::BLENDING_MODE ); - DALI_TEST_EQUALS( static_cast< BlendingMode::Type >( mode ), BlendingMode::OFF, TEST_LOCATION ); + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF ); + mode = renderer.GetProperty( Renderer::Property::BLEND_MODE ); + DALI_TEST_EQUALS( static_cast< BlendMode::Type >( mode ), BlendMode::OFF, TEST_LOCATION ); END_TEST; } @@ -807,18 +819,18 @@ int UtcDaliRendererSetBlendColor(void) TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - renderer.SetProperty( Renderer::Property::BLENDING_COLOR, Color::TRANSPARENT ); + renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::TRANSPARENT ); application.SendNotification(); application.Render(); DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::TRANSPARENT, TEST_LOCATION ); - renderer.SetProperty( Renderer::Property::BLENDING_COLOR, Color::MAGENTA ); + renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA ); application.SendNotification(); application.Render(); DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::MAGENTA, TEST_LOCATION ); Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f ); - renderer.SetProperty( Renderer::Property::BLENDING_COLOR, color ); + renderer.SetProperty( Renderer::Property::BLEND_COLOR, color ); application.SendNotification(); application.Render(); DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), color, TEST_LOCATION ); @@ -836,18 +848,18 @@ int UtcDaliRendererGetBlendColor(void) Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); Renderer renderer = Renderer::New( geometry, shader ); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLENDING_COLOR ), Color::TRANSPARENT, TEST_LOCATION ); + DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), Color::TRANSPARENT, TEST_LOCATION ); - renderer.SetProperty( Renderer::Property::BLENDING_COLOR, Color::MAGENTA ); + renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA ); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLENDING_COLOR ), Color::MAGENTA, TEST_LOCATION ); + DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION ); Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f ); - renderer.SetProperty( Renderer::Property::BLENDING_COLOR, color ); + renderer.SetProperty( Renderer::Property::BLEND_COLOR, color ); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLENDING_COLOR ), color, TEST_LOCATION ); + DALI_TEST_EQUALS( renderer.GetProperty( Renderer::Property::BLEND_COLOR ), color, TEST_LOCATION ); END_TEST; } @@ -873,15 +885,15 @@ int UtcDaliRendererPreMultipledAlpha(void) DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) ); DALI_TEST_CHECK( !preMultipliedAlpha ); - BlendingFactor::Type srcFactorRgb( BlendingFactor::ZERO ); - BlendingFactor::Type destFactorRgb( BlendingFactor::ZERO ); - BlendingFactor::Type srcFactorAlpha( BlendingFactor::ZERO ); - BlendingFactor::Type destFactorAlpha( BlendingFactor::ZERO ); - renderer.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); - DALI_TEST_EQUALS( DEFAULT_BLENDING_SRC_FACTOR_RGB, srcFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( DEFAULT_BLENDING_DEST_FACTOR_RGB, destFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( DEFAULT_BLENDING_SRC_FACTOR_ALPHA, srcFactorAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( DEFAULT_BLENDING_DEST_FACTOR_ALPHA, destFactorAlpha, TEST_LOCATION ); + int srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); + int destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); + int srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); + int destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); + + DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_SRC_RGB, srcFactorRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_DEST_RGB, destFactorRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_SRC_ALPHA, srcFactorAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_DEST_ALPHA, destFactorAlpha, TEST_LOCATION ); application.SendNotification(); application.Render(); @@ -900,11 +912,15 @@ int UtcDaliRendererPreMultipledAlpha(void) DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) ); DALI_TEST_CHECK( preMultipliedAlpha ); - renderer.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); - DALI_TEST_EQUALS( BlendingFactor::ONE, srcFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingFactor::ONE, srcFactorAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingFactor::ONE, destFactorAlpha, TEST_LOCATION ); + srcFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB ); + destFactorRgb = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB ); + srcFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA ); + destFactorAlpha = renderer.GetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA ); + + DALI_TEST_EQUALS( (int)BlendFactor::ONE, srcFactorRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::ONE, srcFactorAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS( (int)BlendFactor::ONE, destFactorAlpha, TEST_LOCATION ); DALI_TEST_CHECK( gl.GetUniformValue( "uColor", actualValue ) ); DALI_TEST_EQUALS( actualValue, Vector4(0.5f, 0.0f, 0.5f, 0.5f), TEST_LOCATION ); diff --git a/dali/devel-api/rendering/renderer.cpp b/dali/devel-api/rendering/renderer.cpp index ec408c0..b2078a2 100644 --- a/dali/devel-api/rendering/renderer.cpp +++ b/dali/devel-api/rendering/renderer.cpp @@ -92,45 +92,6 @@ Shader Renderer::GetShader() const return Dali::Shader( shaderPtr ); } -void Renderer::SetBlendFunc( BlendingFactor::Type srcFactorRgba, - BlendingFactor::Type destFactorRgba ) -{ - GetImplementation(*this).SetBlendFunc( srcFactorRgba, destFactorRgba ); -} - -void Renderer::SetBlendFunc( BlendingFactor::Type srcFactorRgb, - BlendingFactor::Type destFactorRgb, - BlendingFactor::Type srcFactorAlpha, - BlendingFactor::Type destFactorAlpha ) -{ - GetImplementation(*this).SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); -} - -void Renderer::GetBlendFunc( BlendingFactor::Type& srcFactorRgb, - BlendingFactor::Type& destFactorRgb, - BlendingFactor::Type& srcFactorAlpha, - BlendingFactor::Type& destFactorAlpha ) const -{ - GetImplementation(*this).GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); -} - -void Renderer::SetBlendEquation( BlendingEquation::Type equationRgba ) -{ - GetImplementation(*this).SetBlendEquation( equationRgba ); -} - -void Renderer::SetBlendEquation( BlendingEquation::Type equationRgb, - BlendingEquation::Type equationAlpha ) -{ - GetImplementation(*this).SetBlendEquation( equationRgb, equationAlpha ); -} - -void Renderer::GetBlendEquation( BlendingEquation::Type& equationRgb, - BlendingEquation::Type& equationAlpha ) const -{ - GetImplementation(*this).GetBlendEquation( equationRgb, equationAlpha ); -} - Renderer::Renderer( Internal::Renderer* pointer ) : Handle( pointer ) { diff --git a/dali/devel-api/rendering/renderer.h b/dali/devel-api/rendering/renderer.h index b5535ed..3d8efed 100644 --- a/dali/devel-api/rendering/renderer.h +++ b/dali/devel-api/rendering/renderer.h @@ -19,7 +19,6 @@ */ // INTERNAL INCLUDES -#include // Dali::BlendingMode, Dali::BlendingEquation, Dali::BlendingFactor #include // Dali::Handle #include // DEFAULT_OBJECT_PROPERTY_START_INDEX #include // Dali::Geometry @@ -33,6 +32,102 @@ namespace Internal DALI_INTERNAL class Renderer; } +namespace FaceCullingMode +{ + +/** + * @brief Set face culling mode. + * @SINCE_1_1.33 + */ +enum Type +{ + NONE, ///< None of the faces should be culled + FRONT, ///< Cull front face, back face should never be shown + BACK, ///< Cull back face, back face should never be shown + FRONT_AND_BACK, ///< Cull front and back faces; if the geometry is composed of triangles none of the faces will be shown +}; + +} // namespace FaceCullingMode + +namespace BlendMode +{ + +/** + * @brief Blend mode. + * @SINCE_1_1.33 + */ +enum Type +{ + OFF, ///< Blending is disabled. @SINCE_1_1.33 + AUTO, ///< Blending is enabled if there is alpha channel. This is the default mode. @SINCE_1_1.33 + ON ///< Blending is enabled. @SINCE_1_1.33 +}; + +} // namespace BlendMode + +namespace BlendEquation +{ +/** + * @brief Blend Equation. + * + * @SINCE_1_0.0 + * @remarks This is an experimental feature and might not be supported in the next release. + * We do recommend not to use it. + */ +enum Type +{ + ADD = 0x8006, ///< The source and destination colors are added to each other. @SINCE_1_0.0 + SUBTRACT = 0x800A, ///< Subtracts the destination from the source. @SINCE_1_0.0 + REVERSE_SUBTRACT = 0x800B ///< Subtracts the source from the destination. @SINCE_1_0.0 +}; + +} // namespace BlendEquation + +namespace BlendFactor +{ +/** + * @brief Blend Factor. + * + * @SINCE_1_0.0 + * @remarks This is an experimental feature and might not be supported in the next release. + * We do recommend not to use it. + */ +enum Type +{ + ZERO = 0, ///< ZERO @SINCE_1_0.0 + ONE = 1, ///< ONE @SINCE_1_0.0 + SRC_COLOR = 0x0300, ///< SRC_COLOR @SINCE_1_0.0 + ONE_MINUS_SRC_COLOR = 0x0301, ///< ONE_MINUS_SRC_COLOR @SINCE_1_0.0 + SRC_ALPHA = 0x0302, ///< SRC_ALPHA @SINCE_1_0.0 + ONE_MINUS_SRC_ALPHA = 0x0303, ///< ONE_MINUS_SRC_ALPHA @SINCE_1_0.0 + DST_ALPHA = 0x0304, ///< DST_ALPHA @SINCE_1_0.0 + ONE_MINUS_DST_ALPHA = 0x0305, ///< ONE_MINUS_DST_ALPHA @SINCE_1_0.0 + DST_COLOR = 0x0306, ///< DST_COLOR @SINCE_1_0.0 + ONE_MINUS_DST_COLOR = 0x0307, ///< ONE_MINUS_DST_COLOR @SINCE_1_0.0 + SRC_ALPHA_SATURATE = 0x0308, ///< SRC_ALPHA_SATURATE @SINCE_1_0.0 + CONSTANT_COLOR = 0x8001, ///< CONSTANT_COLOR @SINCE_1_0.0 + ONE_MINUS_CONSTANT_COLOR = 0x8002, ///< ONE_MINUS_CONSTANT_COLOR @SINCE_1_0.0 + CONSTANT_ALPHA = 0x8003, ///< CONSTANT_ALPHA @SINCE_1_0.0 + ONE_MINUS_CONSTANT_ALPHA = 0x8004 ///< ONE_MINUS_CONSTANT_ALPHA @SINCE_1_0.0 +}; + +} // namespace BlendFactor + +namespace DepthWriteMode +{ + +/** + * @brief Depth buffer write modes + */ +enum Type +{ + OFF, ///< Renderer doesn't write to the depth buffer + AUTO, ///< Renderer only writes to the depth buffer if it's opaque + ON ///< Renderer writes to the depth buffer +}; + +} // namespace DepthWriteMode + /** * @brief Renderer is a handle to an object used to show content by combining a Geometry, a TextureSet and a shader */ @@ -41,47 +136,96 @@ class DALI_IMPORT_API Renderer : public Handle public: /** - * @brief Set face culling mode. - */ - enum FaceCullingMode - { - CULL_NONE, ///< None of the faces should be culled - CULL_FRONT, ///< Cull front face, back face should never be shown - CULL_BACK, ///< Cull back face, back face should never be shown - CULL_BACK_AND_FRONT, ///< Cull back and front faces, if the geometry is composed of triangles none of the faces will be shown - }; - - /** - * @brief Depth buffer write modes - */ - enum DepthWriteMode - { - DEPTH_WRITE_OFF, ///< Renderer doesn't write to the depth buffer - DEPTH_WRITE_AUTO, ///< Renderer only writes to the depth buffer if it's opaque - DEPTH_WRITE_ON ///< Renderer writes to the depth buffer - }; - - /** * @brief An enumeration of properties belonging to the Renderer class. */ struct Property { enum { - DEPTH_INDEX = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "depthIndex", type INTEGER - FACE_CULLING_MODE, ///< name "faceCullingMode", type INTEGER @see FaceCullingMode - BLENDING_MODE, ///< name "blendingMode", type INTEGER - BLEND_EQUATION_RGB, ///< name "blendEquationRgb", type INTEGER - BLEND_EQUATION_ALPHA, ///< name "blendEquationAlpha", type INTEGER - BLENDING_SRC_FACTOR_RGB, ///< name "sourceBlendFactorRgb", type INTEGER - BLENDING_DEST_FACTOR_RGB, ///< name "destinationBlendFactorRgb", type INTEGER - BLENDING_SRC_FACTOR_ALPHA, ///< name "sourceBlendFactorAlpha", type INTEGER - BLENDING_DEST_FACTOR_ALPHA, ///< name "destinationBlendFactorAlpha", type INTEGER - BLENDING_COLOR, ///< name "blendingColor", type VECTOR4 - BLEND_PRE_MULTIPLIED_ALPHA, ///< name "blendPreMultipledAlpha", type BOOLEAN - INDEX_RANGE_FIRST, ///< name "indexRangeFirst", type INTEGER - INDEX_RANGE_COUNT, ///< name "indexRangeCount", type INTEGER - DEPTH_WRITE_MODE ///< name "depthWriteMode", type INTEGER @see DepthWriteMode + /** + * @brief name "depthIndex", type INTEGER + * @note The default value is 0 + */ + DEPTH_INDEX = DEFAULT_OBJECT_PROPERTY_START_INDEX, + + /** + * @brief name "faceCullingMode", type INTEGER + * @note The default value is FaceCullingMode::NONE + */ + FACE_CULLING_MODE, + + /** + * @brief name "blendMode", type INTEGER + * @note The default value is BlendMode::AUTO + */ + BLEND_MODE, + + /** + * @brief name "blendEquationRgb", type INTEGER + * @note The default value is BlendEquation::ADD + */ + BLEND_EQUATION_RGB, + + /** + * @brief name "blendEquationAlpha", type INTEGER + * @note The default value is BlendEquation::ADD + */ + BLEND_EQUATION_ALPHA, + + /** + * @brief name "blendFactorSrcRgb", type INTEGER + * @note The default value is BlendFactor::SRC_ALPHA + */ + BLEND_FACTOR_SRC_RGB, + + /** + * @brief name "blendFactorDestRgb", type INTEGER + * @note The default value is BlendFactor::ONE_MINUS_SRC_ALPHA + */ + BLEND_FACTOR_DEST_RGB, + + /** + * @brief name "blendFactorSrcAlpha", type INTEGER + * @note The default value is BlendFactor::ONE + */ + BLEND_FACTOR_SRC_ALPHA, + + /** + * @brief name "blendFactorDestAlpha", type INTEGER + * @note The default value is BlendFactor::ONE_MINUS_SRC_ALPHA + */ + BLEND_FACTOR_DEST_ALPHA, + + /** + * @brief name "blendColor", type VECTOR4 + * @note The default value is Color::TRANSPARENT + */ + BLEND_COLOR, + + /** + * @brief name "blendPreMultipledAlpha", type BOOLEAN + * @note The default value is false + */ + BLEND_PRE_MULTIPLIED_ALPHA, + + /** + * @brief name "indexRangeFirst", type INTEGER + * @note The default value is 0 + */ + INDEX_RANGE_FIRST, + + /** + * @brief name "indexRangeCount", type INTEGER + * @note The default (0) means that whole range of indices will be used + */ + INDEX_RANGE_COUNT, + + /** + * @brief name "depthWriteMode", type INTEGER + * @see DepthWriteMode + * @note The default value is DepthWriteMode::AUTO + */ + DEPTH_WRITE_MODE }; }; @@ -178,79 +322,6 @@ public: */ Shader GetShader() const; - /** - * @brief Specify the pixel arithmetic used when the actor is blended. - * - * @param[in] srcFactorRgba Specifies how the red, green, blue, and alpha source blending factors are computed. - * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, - * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, - * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, and GL_SRC_ALPHA_SATURATE. - * - * @param[in] destFactorRgba Specifies how the red, green, blue, and alpha destination blending factors are computed. - * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, - * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, - * GL_CONSTANT_ALPHA, and GL_ONE_MINUS_CONSTANT_ALPHA. - */ - void SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba ); - - /** - * @brief Specify the pixel arithmetic used when the actor is blended. - * - * @param[in] srcFactorRgb Specifies how the red, green, and blue source blending factors are computed. - * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, - * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, - * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, and GL_SRC_ALPHA_SATURATE. - * - * @param[in] destFactorRgb Specifies how the red, green, blue, and alpha destination blending factors are computed. - * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, - * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, - * GL_CONSTANT_ALPHA, and GL_ONE_MINUS_CONSTANT_ALPHA. - * - * @param[in] srcFactorAlpha Specifies how the alpha source blending factor is computed. - * The options are the same as for srcFactorRgb. - * - * @param[in] destFactorAlpha Specifies how the alpha source blending factor is computed. - * The options are the same as for destFactorRgb. - */ - void SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb, - BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha ); - - /** - * @brief Query the pixel arithmetic used when the actor is blended. - * - * @param[out] srcFactorRgb Specifies how the red, green, blue, and alpha source blending factors are computed. - * @param[out] destFactorRgb Specifies how the red, green, blue, and alpha destination blending factors are computed. - * @param[out] srcFactorAlpha Specifies how the red, green, blue, and alpha source blending factors are computed. - * @param[out] destFactorAlpha Specifies how the red, green, blue, and alpha destination blending factors are computed. - */ - void GetBlendFunc( BlendingFactor::Type& srcFactorRgb, BlendingFactor::Type& destFactorRgb, - BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const; - - /** - * @brief Specify the equation used when the actor is blended. - * - * The options are BlendingEquation::ADD, SUBTRACT, or REVERSE_SUBTRACT. - * @param[in] equationRgba The equation used for combining red, green, blue, and alpha components. - */ - void SetBlendEquation( BlendingEquation::Type equationRgba ); - - /** - * @brief Specify the equation used when the actor is blended. - * - * @param[in] equationRgb The equation used for combining red, green, and blue components. - * @param[in] equationAlpha The equation used for combining the alpha component. - * The options are BlendingEquation::ADD, SUBTRACT, or REVERSE_SUBTRACT. - */ - void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha ); - - /** - * @brief Query the equation used when the actor is blended. - * - * @param[out] equationRgb The equation used for combining red, green, and blue components. - * @param[out] equationAlpha The equation used for combining the alpha component. - */ - void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const; - public: /** * @brief The constructor diff --git a/dali/internal/common/blending-options.cpp b/dali/internal/common/blending-options.cpp index 23810e4..17668a0 100644 --- a/dali/internal/common/blending-options.cpp +++ b/dali/internal/common/blending-options.cpp @@ -46,69 +46,99 @@ static unsigned int CLEAR_BLEND_EQUATION_MASK = 0xFF00FFFF; // 8 bits cleared * @param[in] factor The BlendFunc value. * @param[in] bitshift Used to shift to the correct part of options. */ -void StoreBlendingFactor( unsigned int& options, BlendingFactor::Type factor, int bitShift ) +void StoreBlendFactor( unsigned int& options, BlendFactor::Type factor, int bitShift ) { - switch ( factor ) + switch( factor ) { - case BlendingFactor::ZERO: + case BlendFactor::ZERO: + { options |= ( 0u << bitShift ); break; + } - case BlendingFactor::ONE: + case BlendFactor::ONE: + { options |= ( 1u << bitShift ); break; + } - case BlendingFactor::SRC_COLOR: + case BlendFactor::SRC_COLOR: + { options |= ( 2u << bitShift ); break; + } - case BlendingFactor::ONE_MINUS_SRC_COLOR: + case BlendFactor::ONE_MINUS_SRC_COLOR: + { options |= ( 3u << bitShift ); break; + } - case BlendingFactor::SRC_ALPHA: + case BlendFactor::SRC_ALPHA: + { options |= ( 4u << bitShift ); break; + } - case BlendingFactor::ONE_MINUS_SRC_ALPHA: + case BlendFactor::ONE_MINUS_SRC_ALPHA: + { options |= ( 5u << bitShift ); break; + } - case BlendingFactor::DST_ALPHA: + case BlendFactor::DST_ALPHA: + { options |= ( 6u << bitShift ); break; + } - case BlendingFactor::ONE_MINUS_DST_ALPHA: + case BlendFactor::ONE_MINUS_DST_ALPHA: + { options |= ( 7u << bitShift ); break; + } - case BlendingFactor::DST_COLOR: + case BlendFactor::DST_COLOR: + { options |= ( 8u << bitShift ); break; + } - case BlendingFactor::ONE_MINUS_DST_COLOR: + case BlendFactor::ONE_MINUS_DST_COLOR: + { options |= ( 9u << bitShift ); break; + } - case BlendingFactor::SRC_ALPHA_SATURATE: + case BlendFactor::SRC_ALPHA_SATURATE: + { options |= ( 10u << bitShift ); break; + } - case BlendingFactor::CONSTANT_COLOR: + case BlendFactor::CONSTANT_COLOR: + { options |= ( 11u << bitShift ); break; + } - case BlendingFactor::ONE_MINUS_CONSTANT_COLOR: + case BlendFactor::ONE_MINUS_CONSTANT_COLOR: + { options |= ( 12u << bitShift ); break; + } - case BlendingFactor::CONSTANT_ALPHA: + case BlendFactor::CONSTANT_ALPHA: + { options |= ( 13u << bitShift ); break; + } - case BlendingFactor::ONE_MINUS_CONSTANT_ALPHA: + case BlendFactor::ONE_MINUS_CONSTANT_ALPHA: + { options |= ( 14u << bitShift ); break; + } } } @@ -118,48 +148,54 @@ void StoreBlendingFactor( unsigned int& options, BlendingFactor::Type factor, in * @param[in] factor The BlendEquation value. * @param[in] bitshift Used to shift to the correct part of options. */ -void StoreBlendingEquation( unsigned int& options, BlendingEquation::Type factor, int bitShift ) +void StoreBlendEquation( unsigned int& options, BlendEquation::Type factor, int bitShift ) { switch ( factor ) { - case BlendingEquation::ADD: + case BlendEquation::ADD: + { options |= ( 0u << bitShift ); break; + } - case BlendingEquation::SUBTRACT: + case BlendEquation::SUBTRACT: + { options |= ( 1u << bitShift ); break; + } - case BlendingEquation::REVERSE_SUBTRACT: + case BlendEquation::REVERSE_SUBTRACT: + { options |= ( 2u << bitShift ); break; + } } } const unsigned int BLENDING_FACTOR_COUNT = 15; const unsigned int BLENDING_EQUATION_COUNT = 3; -BlendingFactor::Type BLENDING_FACTORS[ BLENDING_FACTOR_COUNT ] = - { BlendingFactor::ZERO, - BlendingFactor::ONE, - BlendingFactor::SRC_COLOR, - BlendingFactor::ONE_MINUS_SRC_COLOR, - BlendingFactor::SRC_ALPHA, - BlendingFactor::ONE_MINUS_SRC_ALPHA, - BlendingFactor::DST_ALPHA, - BlendingFactor::ONE_MINUS_DST_ALPHA, - BlendingFactor::DST_COLOR, - BlendingFactor::ONE_MINUS_DST_COLOR, - BlendingFactor::SRC_ALPHA_SATURATE, - BlendingFactor::CONSTANT_COLOR, - BlendingFactor::ONE_MINUS_CONSTANT_COLOR, - BlendingFactor::CONSTANT_ALPHA, - BlendingFactor::ONE_MINUS_CONSTANT_ALPHA }; - -BlendingEquation::Type BLENDING_EQUATIONS[ BLENDING_EQUATION_COUNT ] = - { BlendingEquation::ADD, - BlendingEquation::SUBTRACT, - BlendingEquation::REVERSE_SUBTRACT }; +BlendFactor::Type BLENDING_FACTORS[ BLENDING_FACTOR_COUNT ] = + { BlendFactor::ZERO, + BlendFactor::ONE, + BlendFactor::SRC_COLOR, + BlendFactor::ONE_MINUS_SRC_COLOR, + BlendFactor::SRC_ALPHA, + BlendFactor::ONE_MINUS_SRC_ALPHA, + BlendFactor::DST_ALPHA, + BlendFactor::ONE_MINUS_DST_ALPHA, + BlendFactor::DST_COLOR, + BlendFactor::ONE_MINUS_DST_COLOR, + BlendFactor::SRC_ALPHA_SATURATE, + BlendFactor::CONSTANT_COLOR, + BlendFactor::ONE_MINUS_CONSTANT_COLOR, + BlendFactor::CONSTANT_ALPHA, + BlendFactor::ONE_MINUS_CONSTANT_ALPHA }; + +BlendEquation::Type BLENDING_EQUATIONS[ BLENDING_EQUATION_COUNT ] = + { BlendEquation::ADD, + BlendEquation::SUBTRACT, + BlendEquation::REVERSE_SUBTRACT }; /** * Utility to retrieve one of the BlendFunc values. @@ -168,7 +204,7 @@ BlendingEquation::Type BLENDING_EQUATIONS[ BLENDING_EQUATION_COUNT ] = * @param[in] bitshift Used to shift to the correct part of options. * @return The blending factor. */ -BlendingFactor::Type RetrieveBlendingFactor( unsigned int options, int mask, int bitShift ) +BlendFactor::Type RetrieveBlendFactor( unsigned int options, int mask, int bitShift ) { unsigned int index = options & mask; index = index >> bitShift; @@ -185,7 +221,7 @@ BlendingFactor::Type RetrieveBlendingFactor( unsigned int options, int mask, int * @param[in] bitshift Used to shift to the correct part of options. * @return The blending equation. */ -BlendingEquation::Type RetrieveBlendingEquation( unsigned int options, int mask, int bitShift ) +BlendEquation::Type RetrieveBlendEquation( unsigned int options, int mask, int bitShift ) { unsigned int index = options & mask; index = index >> bitShift; @@ -207,10 +243,10 @@ BlendingOptions::BlendingOptions() : mBitmask( 0u ), mBlendColor( NULL ) { - SetBlendFunc( DEFAULT_BLENDING_SRC_FACTOR_RGB, DEFAULT_BLENDING_DEST_FACTOR_RGB, - DEFAULT_BLENDING_SRC_FACTOR_ALPHA, DEFAULT_BLENDING_DEST_FACTOR_ALPHA ); + SetBlendFunc( BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, + BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA ); - SetBlendEquation( DEFAULT_BLENDING_EQUATION_RGB, DEFAULT_BLENDING_EQUATION_ALPHA ); + SetBlendEquation( BlendEquation::ADD, BlendEquation::ADD ); } BlendingOptions::~BlendingOptions() @@ -228,53 +264,53 @@ unsigned int BlendingOptions::GetBitmask() const return mBitmask; } -void BlendingOptions::SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb, - BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha ) +void BlendingOptions::SetBlendFunc( BlendFactor::Type srcFactorRgb, BlendFactor::Type destFactorRgb, + BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha ) { mBitmask &= CLEAR_BLEND_FUNC_MASK; // Clear the BlendFunc values - StoreBlendingFactor( mBitmask, srcFactorRgb, SHIFT_TO_SRC_FACTOR_RGB ); - StoreBlendingFactor( mBitmask, destFactorRgb, SHIFT_TO_DEST_FACTOR_RGB ); - StoreBlendingFactor( mBitmask, srcFactorAlpha, SHIFT_TO_SRC_FACTOR_ALPHA ); - StoreBlendingFactor( mBitmask, destFactorAlpha, SHIFT_TO_DEST_FACTOR_ALPHA ); + StoreBlendFactor( mBitmask, srcFactorRgb, SHIFT_TO_SRC_FACTOR_RGB ); + StoreBlendFactor( mBitmask, destFactorRgb, SHIFT_TO_DEST_FACTOR_RGB ); + StoreBlendFactor( mBitmask, srcFactorAlpha, SHIFT_TO_SRC_FACTOR_ALPHA ); + StoreBlendFactor( mBitmask, destFactorAlpha, SHIFT_TO_DEST_FACTOR_ALPHA ); } -BlendingFactor::Type BlendingOptions::GetBlendSrcFactorRgb() const +BlendFactor::Type BlendingOptions::GetBlendSrcFactorRgb() const { - return RetrieveBlendingFactor( mBitmask, MASK_SRC_FACTOR_RGB, SHIFT_TO_SRC_FACTOR_RGB ); + return RetrieveBlendFactor( mBitmask, MASK_SRC_FACTOR_RGB, SHIFT_TO_SRC_FACTOR_RGB ); } -BlendingFactor::Type BlendingOptions::GetBlendDestFactorRgb() const +BlendFactor::Type BlendingOptions::GetBlendDestFactorRgb() const { - return RetrieveBlendingFactor( mBitmask, MASK_DEST_FACTOR_RGB, SHIFT_TO_DEST_FACTOR_RGB ); + return RetrieveBlendFactor( mBitmask, MASK_DEST_FACTOR_RGB, SHIFT_TO_DEST_FACTOR_RGB ); } -BlendingFactor::Type BlendingOptions::GetBlendSrcFactorAlpha() const +BlendFactor::Type BlendingOptions::GetBlendSrcFactorAlpha() const { - return RetrieveBlendingFactor( mBitmask, MASK_SRC_FACTOR_ALPHA, SHIFT_TO_SRC_FACTOR_ALPHA ); + return RetrieveBlendFactor( mBitmask, MASK_SRC_FACTOR_ALPHA, SHIFT_TO_SRC_FACTOR_ALPHA ); } -BlendingFactor::Type BlendingOptions::GetBlendDestFactorAlpha() const +BlendFactor::Type BlendingOptions::GetBlendDestFactorAlpha() const { - return RetrieveBlendingFactor( mBitmask, MASK_DEST_FACTOR_ALPHA, SHIFT_TO_DEST_FACTOR_ALPHA ); + return RetrieveBlendFactor( mBitmask, MASK_DEST_FACTOR_ALPHA, SHIFT_TO_DEST_FACTOR_ALPHA ); } -void BlendingOptions::SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha ) +void BlendingOptions::SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha ) { mBitmask &= CLEAR_BLEND_EQUATION_MASK; // Clear the BlendEquation values - StoreBlendingEquation( mBitmask, equationRgb, SHIFT_TO_EQUATION_RGB ); - StoreBlendingEquation( mBitmask, equationAlpha, SHIFT_TO_EQUATION_ALPHA ); + StoreBlendEquation( mBitmask, equationRgb, SHIFT_TO_EQUATION_RGB ); + StoreBlendEquation( mBitmask, equationAlpha, SHIFT_TO_EQUATION_ALPHA ); } -BlendingEquation::Type BlendingOptions::GetBlendEquationRgb() const +BlendEquation::Type BlendingOptions::GetBlendEquationRgb() const { - return RetrieveBlendingEquation( mBitmask, MASK_EQUATION_RGB, SHIFT_TO_EQUATION_RGB ); + return RetrieveBlendEquation( mBitmask, MASK_EQUATION_RGB, SHIFT_TO_EQUATION_RGB ); } -BlendingEquation::Type BlendingOptions::GetBlendEquationAlpha() const +BlendEquation::Type BlendingOptions::GetBlendEquationAlpha() const { - return RetrieveBlendingEquation( mBitmask, MASK_EQUATION_ALPHA, SHIFT_TO_EQUATION_ALPHA ); + return RetrieveBlendEquation( mBitmask, MASK_EQUATION_ALPHA, SHIFT_TO_EQUATION_ALPHA ); } void BlendingOptions::SetBlendColor( const Vector4& color ) diff --git a/dali/internal/common/blending-options.h b/dali/internal/common/blending-options.h index 07f149f..6eb2882 100644 --- a/dali/internal/common/blending-options.h +++ b/dali/internal/common/blending-options.h @@ -1,5 +1,5 @@ -#ifndef __DALI_BLENDING_OPTIONS_H__ -#define __DALI_BLENDING_OPTIONS_H__ +#ifndef DALI_BLENDING_OPTIONS_H +#define DALI_BLENDING_OPTIONS_H /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -19,7 +19,7 @@ */ // INTERNAL INCLUDES -#include +#include #include namespace Dali @@ -56,43 +56,43 @@ struct BlendingOptions /** * @copydoc Dali::RenderableActor::SetBlendFunc() */ - void SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb, - BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha ); + void SetBlendFunc( BlendFactor::Type srcFactorRgb, BlendFactor::Type destFactorRgb, + BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha ); /** * @copydoc Dali::RenderableActor::GetBlendFunc() */ - BlendingFactor::Type GetBlendSrcFactorRgb() const; + BlendFactor::Type GetBlendSrcFactorRgb() const; /** * @copydoc Dali::RenderableActor::GetBlendFunc() */ - BlendingFactor::Type GetBlendDestFactorRgb() const; + BlendFactor::Type GetBlendDestFactorRgb() const; /** * @copydoc Dali::RenderableActor::GetBlendFunc() */ - BlendingFactor::Type GetBlendSrcFactorAlpha() const; + BlendFactor::Type GetBlendSrcFactorAlpha() const; /** * @copydoc Dali::RenderableActor::GetBlendFunc() */ - BlendingFactor::Type GetBlendDestFactorAlpha() const; + BlendFactor::Type GetBlendDestFactorAlpha() const; /** * @copydoc Dali::RenderableActor::SetBlendEquation() */ - void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha ); + void SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha ); /** * @copydoc Dali::RenderableActor::GetBlendEquation() */ - BlendingEquation::Type GetBlendEquationRgb() const; + BlendEquation::Type GetBlendEquationRgb() const; /** * @copydoc Dali::RenderableActor::GetBlendEquation() */ - BlendingEquation::Type GetBlendEquationAlpha() const; + BlendEquation::Type GetBlendEquationAlpha() const; /** * Set the blend color. @@ -127,4 +127,4 @@ private: } // namespace Dali -#endif // __DALI_BLENDING_OPTIONS_H__ +#endif // DALI_BLENDING_OPTIONS_H diff --git a/dali/internal/common/type-abstraction-enums.h b/dali/internal/common/type-abstraction-enums.h index 64cedef..0b65d0a 100644 --- a/dali/internal/common/type-abstraction-enums.h +++ b/dali/internal/common/type-abstraction-enums.h @@ -19,11 +19,8 @@ */ // INTERNAL INCLUDES -#include -#include #include #include -#include namespace Dali { @@ -31,9 +28,9 @@ namespace Dali namespace Internal { -template <> struct ParameterType< Dali::Renderer::FaceCullingMode > : public BasicType< Dali::Renderer::FaceCullingMode > {}; -template <> struct ParameterType< BlendingMode::Type > : public BasicType< BlendingMode::Type > {}; -template <> struct ParameterType< Dali::Renderer::DepthWriteMode > : public BasicType< Dali::Renderer::DepthWriteMode > {}; +template <> struct ParameterType< Dali::FaceCullingMode::Type > : public BasicType< Dali::FaceCullingMode::Type > {}; +template <> struct ParameterType< Dali::BlendMode::Type > : public BasicType< Dali::BlendMode::Type > {}; +template <> struct ParameterType< Dali::DepthWriteMode::Type > : public BasicType< Dali::DepthWriteMode::Type > {}; } //namespace Internal diff --git a/dali/internal/event/actors/image-actor-impl.cpp b/dali/internal/event/actors/image-actor-impl.cpp index 9ebf015..d3aa357 100644 --- a/dali/internal/event/actors/image-actor-impl.cpp +++ b/dali/internal/event/actors/image-actor-impl.cpp @@ -25,6 +25,7 @@ #include // for EqualToConstraint #include #include +#include #include #include #include @@ -606,44 +607,44 @@ float ImageActor::GetSortModifier() const void ImageActor::SetBlendMode( BlendingMode::Type mode ) { - mRenderer->SetBlendMode( mode ); + mRenderer->SetBlendMode( static_cast( mode ) ); } BlendingMode::Type ImageActor::GetBlendMode() const { - return mRenderer->GetBlendMode(); + return static_cast( mRenderer->GetBlendMode() ); } void ImageActor::SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba ) { - mRenderer->SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba ); + mRenderer->SetBlendFunc( static_cast(srcFactorRgba), static_cast(destFactorRgba), static_cast(srcFactorRgba), static_cast(destFactorRgba) ); } void ImageActor::SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb, BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha ) { - mRenderer->SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); + mRenderer->SetBlendFunc( static_cast(srcFactorRgb), static_cast(destFactorRgb), static_cast(srcFactorAlpha), static_cast(destFactorAlpha) ); } void ImageActor::GetBlendFunc( BlendingFactor::Type& srcFactorRgb, BlendingFactor::Type& destFactorRgb, BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const { - mRenderer->GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); + mRenderer->GetBlendFunc( reinterpret_cast(srcFactorRgb), reinterpret_cast(destFactorRgb), reinterpret_cast(srcFactorAlpha), reinterpret_cast(destFactorAlpha) ); } void ImageActor::SetBlendEquation( BlendingEquation::Type equationRgba ) { - mRenderer->SetBlendEquation( equationRgba, equationRgba ); + mRenderer->SetBlendEquation( static_cast(equationRgba), static_cast(equationRgba) ); } void ImageActor::SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha ) { - mRenderer->SetBlendEquation( equationRgb, equationAlpha ); + mRenderer->SetBlendEquation( static_cast(equationRgb), static_cast(equationAlpha) ); } void ImageActor::GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const { - mRenderer->GetBlendEquation( equationRgb, equationAlpha ); + mRenderer->GetBlendEquation( reinterpret_cast(equationRgb), reinterpret_cast(equationAlpha) ); } void ImageActor::SetBlendColor( const Vector4& color ) diff --git a/dali/internal/event/rendering/renderer-impl.cpp b/dali/internal/event/rendering/renderer-impl.cpp index a044737..e2367ea 100644 --- a/dali/internal/event/rendering/renderer-impl.cpp +++ b/dali/internal/event/rendering/renderer-impl.cpp @@ -42,14 +42,14 @@ namespace 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 ) @@ -125,7 +125,7 @@ int Renderer::GetDepthIndex() const return mDepthIndex; } -void Renderer::SetFaceCullingMode( Dali::Renderer::FaceCullingMode cullingMode ) +void Renderer::SetFaceCullingMode( FaceCullingMode::Type cullingMode ) { if( mFaceCullingMode != cullingMode ) { @@ -135,45 +135,45 @@ void Renderer::SetFaceCullingMode( Dali::Renderer::FaceCullingMode 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(); @@ -181,21 +181,21 @@ void Renderer::GetBlendFunc( BlendingFactor::Type& srcFactorRgb, 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(); @@ -249,7 +249,7 @@ void Renderer::EnablePreMultipliedAlpha( bool preMultipled ) { 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 ); @@ -321,16 +321,16 @@ void Renderer::SetDefaultProperty( Property::Index index, 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; } @@ -339,8 +339,8 @@ void Renderer::SetDefaultProperty( Property::Index index, int blendingEquation; if( propertyValue.Get( blendingEquation ) ) { - BlendingEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha(); - mBlendingOptions.SetBlendEquation( static_cast( blendingEquation ), alphaEquation ); + BlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha(); + mBlendingOptions.SetBlendEquation( static_cast( blendingEquation ), alphaEquation ); SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() ); } break; @@ -350,81 +350,81 @@ void Renderer::SetDefaultProperty( Property::Index index, int blendingEquation; if( propertyValue.Get( blendingEquation ) ) { - BlendingEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb(); - mBlendingOptions.SetBlendEquation( rgbEquation, static_cast( blendingEquation ) ); + BlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb(); + mBlendingOptions.SetBlendEquation( rgbEquation, static_cast( 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 ), + SetBlendFunc( static_cast( 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 ), + static_cast( 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 ), + static_cast( 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 ) ); + static_cast( blendingFactor ) ); } break; } - case Dali::Renderer::Property::BLENDING_COLOR: + case Dali::Renderer::Property::BLEND_COLOR: { Vector4 blendColor; if( propertyValue.Get( blendColor ) ) @@ -464,7 +464,7 @@ void Renderer::SetDefaultProperty( Property::Index index, { int value; propertyValue.Get( value ); - Dali::Renderer::DepthWriteMode mode = static_cast(value); + DepthWriteMode::Type mode = static_cast(value); if( mode != mDepthWriteMode ) { mDepthWriteMode = mode; @@ -499,9 +499,9 @@ Property::Value Renderer::GetDefaultProperty( Property::Index index ) const 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: @@ -514,47 +514,47 @@ Property::Value Renderer::GetDefaultProperty( Property::Index index ) const value = static_cast( 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( 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( 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( 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( destFactorAlpha ); break; } - case Dali::Renderer::Property::BLENDING_COLOR: + case Dali::Renderer::Property::BLEND_COLOR: { if( mBlendColor ) { @@ -671,10 +671,10 @@ Renderer::Renderer() mOnStageCount( 0 ), mIndexedDrawFirstElement( 0 ), mIndexedDrawElementCount( 0 ), - mFaceCullingMode( Dali::Renderer::CULL_NONE ), - mBlendingMode( Dali::BlendingMode::AUTO ), + mFaceCullingMode( FaceCullingMode::NONE ), + mBlendMode( BlendMode::AUTO ), mBlendingOptions(), - mDepthWriteMode( Dali::Renderer::DEPTH_WRITE_AUTO ), + mDepthWriteMode( DepthWriteMode::AUTO ), mPremultipledAlphaEnabled( false ) { } diff --git a/dali/internal/event/rendering/renderer-impl.h b/dali/internal/event/rendering/renderer-impl.h index 55d8109..b43a582 100644 --- a/dali/internal/event/rendering/renderer-impl.h +++ b/dali/internal/event/rendering/renderer-impl.h @@ -98,54 +98,54 @@ public: /** * @copydoc Dali::Renderer::SetFaceCullingMode() */ - void SetFaceCullingMode( Dali::Renderer::FaceCullingMode cullingMode ); + void SetFaceCullingMode( FaceCullingMode::Type cullingMode ); /** * @copydoc Dali::Renderer::GetFaceCullingMode() */ - Dali::Renderer::FaceCullingMode GetFaceCullingMode(); + FaceCullingMode::Type GetFaceCullingMode(); /** * @copydoc Dali::Renderer::SetBlendMode() */ - void SetBlendMode( BlendingMode::Type mode ); + void SetBlendMode( BlendMode::Type mode ); /** * @copydoc Dali::Renderer::GetBlendMode() */ - BlendingMode::Type GetBlendMode() const; + BlendMode::Type GetBlendMode() const; /** * @copydoc Dali::Renderer::SetBlendFunc() */ - void SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba ); + void SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba ); /** * @copydoc Dali::Renderer::SetBlendFunc() */ - void SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb, - BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha ); + void SetBlendFunc( BlendFactor::Type srcFactorRgb, BlendFactor::Type destFactorRgb, + BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha ); /** * @copydoc Dali::Renderer::GetBlendFunc() */ - void GetBlendFunc( BlendingFactor::Type& srcFactorRgb, BlendingFactor::Type& destFactorRgb, - BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const; + void GetBlendFunc( BlendFactor::Type& srcFactorRgb, BlendFactor::Type& destFactorRgb, + BlendFactor::Type& srcFactorAlpha, BlendFactor::Type& destFactorAlpha ) const; /** * @copydoc Dali::Renderer::SetBlendEquation() */ - void SetBlendEquation( BlendingEquation::Type equationRgba ); + void SetBlendEquation( BlendEquation::Type equationRgba ); /** * @copydoc Dali::Renderer::SetBlendEquation() */ - void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha ); + void SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha ); /** * @copydoc Dali::Renderer::GetBlendEquation() */ - void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const; + void GetBlendEquation( BlendEquation::Type& equationRgb, BlendEquation::Type& equationAlpha ) const; /** * @copydoc Dali::Renderer::SetBlendColor() @@ -303,21 +303,21 @@ private: // unimplemented methods private: // data SceneGraph::Renderer* mSceneObject; - Vector4* mBlendColor; ///< Local copy of blend color, pointer only as its rarely used - GeometryPtr mGeometry; ///< Connector that holds the geometry used by this renderer + Vector4* mBlendColor; ///< Local copy of blend color, pointer only as its rarely used + GeometryPtr mGeometry; ///< Connector that holds the geometry used by this renderer ObjectConnector mTextureSetConnector; ///< Connector that holds the texture set used by this renderer - IntrusivePtr mShader; ///< Connector that holds the shader used by this renderer + IntrusivePtr mShader; ///< Connector that holds the shader used by this renderer int mDepthIndex; int mOnStageCount; - size_t mIndexedDrawFirstElement; ///< Offset of first element to draw from bound index buffer - size_t mIndexedDrawElementCount; ///< Number of elements to draw + size_t mIndexedDrawFirstElement; ///< Offset of first element to draw from bound index buffer + size_t mIndexedDrawElementCount; ///< Number of elements to draw - Dali::Renderer::FaceCullingMode mFaceCullingMode; ///< Local copy of face culling mode - BlendingMode::Type mBlendingMode; ///< Local copy of blending mode + Dali::FaceCullingMode::Type mFaceCullingMode; ///< Local copy of face culling mode + BlendMode::Type mBlendMode; ///< Local copy of blending mode BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask - Dali:: Renderer::DepthWriteMode mDepthWriteMode; ///< Local copy of depth write mode + Dali::DepthWriteMode::Type mDepthWriteMode; ///< Local copy of depth write mode bool mPremultipledAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required }; diff --git a/dali/internal/render/common/render-algorithms.cpp b/dali/internal/render/common/render-algorithms.cpp index bb51831..255af8d 100644 --- a/dali/internal/render/common/render-algorithms.cpp +++ b/dali/internal/render/common/render-algorithms.cpp @@ -145,9 +145,9 @@ inline void ProcessRenderList( DALI_PRINT_RENDER_ITEM( item ); Renderer& renderer = item.GetRenderer(); - Dali::Renderer::DepthWriteMode depthWriteMode = renderer.GetDepthWriteMode(); - context.DepthMask( ( depthWriteMode == Dali::Renderer::DEPTH_WRITE_AUTO && item.IsOpaque() ) || - ( depthWriteMode == Dali::Renderer::DEPTH_WRITE_ON ) ); + DepthWriteMode::Type depthWriteMode = renderer.GetDepthWriteMode(); + context.DepthMask( ( depthWriteMode == DepthWriteMode::AUTO && item.IsOpaque() ) || + ( depthWriteMode == DepthWriteMode::ON ) ); renderer.Render( context, textureCache, bufferIndex, item.GetNode(), defaultShader, item.GetModelViewMatrix(), viewMatrix, projectionMatrix, item.GetSize(), !item.IsOpaque() ); } diff --git a/dali/internal/render/gl-resources/context.cpp b/dali/internal/render/gl-resources/context.cpp index e3741a8..29b7758 100644 --- a/dali/internal/render/gl-resources/context.cpp +++ b/dali/internal/render/gl-resources/context.cpp @@ -93,7 +93,7 @@ Context::Context(Integration::GlAbstraction& glAbstraction) mBlendEquationSeparateModeAlpha( GL_FUNC_ADD ), mMaxTextureSize(0), mClearColor(Color::WHITE), // initial color, never used until it's been set by the user - mCullFaceMode( Dali::Renderer::CULL_NONE ), + mCullFaceMode( FaceCullingMode::NONE ), mViewPort( 0, 0, 0, 0 ) { } @@ -227,7 +227,7 @@ void Context::InitializeGlState() mBlendEquationSeparateModeRGB = GL_FUNC_ADD; mBlendEquationSeparateModeAlpha = GL_FUNC_ADD; - mCullFaceMode = Dali::Renderer::CULL_NONE; //By default cullface is disabled, front face is set to CCW and cull face is set to back + mCullFaceMode = FaceCullingMode::NONE; //By default cullface is disabled, front face is set to CCW and cull face is set to back // get maximum texture size mGlAbstraction.GetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); diff --git a/dali/internal/render/gl-resources/context.h b/dali/internal/render/gl-resources/context.h index 42e90c7..8d6747d 100644 --- a/dali/internal/render/gl-resources/context.h +++ b/dali/internal/render/gl-resources/context.h @@ -537,7 +537,7 @@ public: * enables GL_CULL_FACE if in any of the face culling modes * otherwise disables GL_CULL_FACE */ - void CullFace( Dali::Renderer::FaceCullingMode mode ) + void CullFace( Dali::FaceCullingMode::Type mode ) { // Avoid unnecessary calls to gl if(mCullFaceMode != mode) @@ -545,14 +545,14 @@ public: mCullFaceMode = mode; switch(mode) { - case Dali::Renderer::CULL_NONE: + case Dali::FaceCullingMode::NONE: { LOG_GL("Disable GL_CULL_FACE\n"); CHECK_GL( mGlAbstraction, mGlAbstraction.Disable(GL_CULL_FACE) ); break; } - case Dali::Renderer::CULL_FRONT: + case Dali::FaceCullingMode::FRONT: { LOG_GL("Enable GL_CULL_FACE\n"); CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_CULL_FACE) ); @@ -561,7 +561,7 @@ public: break; } - case Dali::Renderer::CULL_BACK: + case Dali::FaceCullingMode::BACK: { LOG_GL("Enable GL_CULL_FACE\n"); CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_CULL_FACE) ); @@ -570,7 +570,7 @@ public: break; } - case Dali::Renderer::CULL_BACK_AND_FRONT: + case Dali::FaceCullingMode::FRONT_AND_BACK: { LOG_GL("Enable GL_CULL_FACE\n"); CHECK_GL( mGlAbstraction, mGlAbstraction.Enable(GL_CULL_FACE) ); @@ -1725,7 +1725,7 @@ private: // Data Vector4 mClearColor; ///< clear color // Face culling mode - Dali::Renderer::FaceCullingMode mCullFaceMode; + Dali::FaceCullingMode::Type mCullFaceMode; // cached viewport size Rect< int > mViewPort; diff --git a/dali/internal/render/renderers/render-renderer.cpp b/dali/internal/render/renderers/render-renderer.cpp index f87cfbb..4c176af 100644 --- a/dali/internal/render/renderers/render-renderer.cpp +++ b/dali/internal/render/renderers/render-renderer.cpp @@ -114,9 +114,9 @@ Renderer* Renderer::New( SceneGraph::RenderDataProvider* dataProvider, 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 ) { return new Renderer( dataProvider, geometry, blendingBitmask, blendColor, faceCullingMode, preMultipliedAlphaEnabled, depthWriteMode ); } @@ -125,9 +125,9 @@ Renderer::Renderer( SceneGraph::RenderDataProvider* dataProvider, 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 ) : mRenderDataProvider( dataProvider ), mContext(NULL), mTextureCache( NULL ), @@ -398,7 +398,7 @@ bool Renderer::BindTextures( SceneGraph::TextureCache& textureCache, Program& pr return result; } -void Renderer::SetFaceCullingMode( Dali::Renderer::FaceCullingMode mode ) +void Renderer::SetFaceCullingMode( FaceCullingMode::Type mode ) { mFaceCullingMode = mode; } @@ -428,12 +428,12 @@ void Renderer::EnablePreMultipliedAlpha( bool enable ) mPremultipledAlphaEnabled = enable; } -void Renderer::SetDepthWriteMode( Dali::Renderer::DepthWriteMode depthWriteMode ) +void Renderer::SetDepthWriteMode( DepthWriteMode::Type depthWriteMode ) { mDepthWriteMode = depthWriteMode; } -Dali::Renderer::DepthWriteMode Renderer::GetDepthWriteMode() const +DepthWriteMode::Type Renderer::GetDepthWriteMode() const { return mDepthWriteMode; } diff --git a/dali/internal/render/renderers/render-renderer.h b/dali/internal/render/renderers/render-renderer.h index 764c09f..11482af 100644 --- a/dali/internal/render/renderers/render-renderer.h +++ b/dali/internal/render/renderers/render-renderer.h @@ -88,9 +88,9 @@ public: 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 ); /** * Constructor. @@ -106,9 +106,9 @@ public: 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 ); /** * Change the data providers of the renderer @@ -139,7 +139,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 @@ -176,13 +176,13 @@ public: * 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 */ - void SetDepthWriteMode( Dali::Renderer::DepthWriteMode depthWriteMode ); + void SetDepthWriteMode( DepthWriteMode::Type depthWriteMode ); /** * Called to render during RenderManager::Render(). @@ -276,9 +276,9 @@ private: Vector 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 + DepthWriteMode::Type mDepthWriteMode; /// Depth write mode size_t mIndexedDrawFirstElement; /// Offset of first element to draw size_t mIndexedDrawElementsCount; /// Number of elements to draw diff --git a/dali/internal/update/manager/prepare-render-instructions.cpp b/dali/internal/update/manager/prepare-render-instructions.cpp index 0dbbeda..0ba1729 100644 --- a/dali/internal/update/manager/prepare-render-instructions.cpp +++ b/dali/internal/update/manager/prepare-render-instructions.cpp @@ -375,8 +375,8 @@ inline void AddColorRenderers( BufferIndex updateBufferIndex, // and this renderer is not writing to the depth buffer there is no point on enabling // depth buffering if ( ( renderList.Count() == 1 ) && - (( renderList.GetRenderer( 0 ).GetDepthWriteMode() == Dali::Renderer::DEPTH_WRITE_OFF ) || - ( renderList.GetRenderer( 0 ).GetDepthWriteMode() == Dali::Renderer::DEPTH_WRITE_AUTO && !renderList.GetItem(0).IsOpaque() ))) + (( renderList.GetRenderer( 0 ).GetDepthWriteMode() == DepthWriteMode::OFF ) || + ( renderList.GetRenderer( 0 ).GetDepthWriteMode() == DepthWriteMode::AUTO && !renderList.GetItem(0).IsOpaque() ))) { //Nothing to do here } diff --git a/dali/internal/update/rendering/scene-graph-renderer.cpp b/dali/internal/update/rendering/scene-graph-renderer.cpp index 3c0595c..d293775 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.cpp +++ b/dali/internal/update/rendering/scene-graph-renderer.cpp @@ -122,9 +122,9 @@ Renderer::Renderer() mShader( NULL ), mBlendColor( NULL ), mBlendBitmask( 0u ), - mFaceCullingMode( Dali::Renderer::CULL_NONE ), - mBlendingMode( Dali::BlendingMode::AUTO ), - mDepthWriteMode( Dali::Renderer::DEPTH_WRITE_AUTO ), + mFaceCullingMode( FaceCullingMode::NONE ), + mBlendMode( BlendMode::AUTO ), + mDepthWriteMode( DepthWriteMode::AUTO ), mIndexedDrawFirstElement( 0 ), mIndexedDrawElementsCount( 0 ), mReferenceCount( 0 ), @@ -236,7 +236,7 @@ void Renderer::PrepareRender( BufferIndex updateBufferIndex ) if( mResendFlag & RESEND_FACE_CULLING_MODE ) { - typedef MessageValue1< Render::Renderer, Dali::Renderer::FaceCullingMode > DerivedType; + typedef MessageValue1< Render::Renderer, FaceCullingMode::Type > DerivedType; unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) ); new (slot) DerivedType( mRenderer, &Render::Renderer::SetFaceCullingMode, mFaceCullingMode ); } @@ -278,7 +278,7 @@ void Renderer::PrepareRender( BufferIndex updateBufferIndex ) if( mResendFlag & RESEND_DEPTH_WRITE_MODE ) { - typedef MessageValue1< Render::Renderer, Dali::Renderer::DepthWriteMode > DerivedType; + typedef MessageValue1< Render::Renderer, DepthWriteMode::Type > DerivedType; unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) ); new (slot) DerivedType( mRenderer, &Render::Renderer::SetDepthWriteMode, mDepthWriteMode ); } @@ -335,13 +335,13 @@ void Renderer::SetDepthIndex( int depthIndex ) void Renderer::SetFaceCullingMode( unsigned int faceCullingMode ) { - mFaceCullingMode = static_cast(faceCullingMode); + mFaceCullingMode = static_cast< FaceCullingMode::Type >( faceCullingMode ); mResendFlag |= RESEND_FACE_CULLING_MODE; } -void Renderer::SetBlendingMode( unsigned int blendingMode ) +void Renderer::SetBlendMode( unsigned int blendingMode ) { - mBlendingMode = static_cast< BlendingMode::Type >( blendingMode ); + mBlendMode = static_cast< BlendMode::Type >( blendingMode ); } void Renderer::SetBlendingOptions( unsigned int options ) @@ -387,7 +387,7 @@ void Renderer::EnablePreMultipliedAlpha( bool preMultipled ) void Renderer::SetDepthWriteMode( unsigned int depthWriteMode ) { - mDepthWriteMode = static_cast(depthWriteMode); + mDepthWriteMode = static_cast< DepthWriteMode::Type >( depthWriteMode ); mResendFlag |= RESEND_DEPTH_WRITE_MODE; } @@ -401,7 +401,7 @@ void Renderer::OnStageConnect() mRenderer = Render::Renderer::New( dataProvider, mGeometry, mBlendBitmask, mBlendColor, - static_cast< Dali::Renderer::FaceCullingMode >( mFaceCullingMode ), + static_cast< FaceCullingMode::Type >( mFaceCullingMode ), mPremultipledAlphaEnabled, mDepthWriteMode ); @@ -482,14 +482,14 @@ Renderer::Opacity Renderer::GetOpacity( BufferIndex updateBufferIndex, const Nod { Renderer::Opacity opacity = Renderer::OPAQUE; - switch( mBlendingMode ) + switch( mBlendMode ) { - case BlendingMode::ON: // If the renderer should always be use blending + case BlendMode::ON: // If the renderer should always be use blending { opacity = Renderer::TRANSLUCENT; break; } - case BlendingMode::AUTO: + case BlendMode::AUTO: { bool shaderRequiresBlending( mShader->HintEnabled( Dali::Shader::HINT_OUTPUT_IS_TRANSPARENT ) ); if( shaderRequiresBlending || ( mTextureSet && mTextureSet->HasAlpha() ) ) @@ -510,7 +510,7 @@ Renderer::Opacity Renderer::GetOpacity( BufferIndex updateBufferIndex, const Nod } break; } - case BlendingMode::OFF: // the renderer should never use blending + case BlendMode::OFF: // the renderer should never use blending default: { opacity = Renderer::OPAQUE; diff --git a/dali/internal/update/rendering/scene-graph-renderer.h b/dali/internal/update/rendering/scene-graph-renderer.h index 627e29e..5745b98 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.h +++ b/dali/internal/update/rendering/scene-graph-renderer.h @@ -133,7 +133,7 @@ public: * Set the blending mode * @param[in] blendingMode to use */ - void SetBlendingMode( unsigned int blendingMode ); + void SetBlendMode( unsigned int blendingMode ); /** * Set the blending options. This should only be called from the update thread. @@ -318,11 +318,11 @@ private: Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned) Shader* mShader; - Vector4* mBlendColor; ///< The blend color for blending operation - unsigned int mBlendBitmask; ///< The bitmask of blending options - Dali::Renderer::FaceCullingMode mFaceCullingMode; ///< The mode of face culling - BlendingMode::Type mBlendingMode; ///< The mode of blending - Dali::Renderer::DepthWriteMode mDepthWriteMode; ///< The depth write mode + Vector4* mBlendColor; ///< The blend color for blending operation + unsigned int mBlendBitmask; ///< The bitmask of blending options + FaceCullingMode::Type mFaceCullingMode; ///< The mode of face culling + BlendMode::Type mBlendMode; ///< The mode of blending + DepthWriteMode::Type mDepthWriteMode; ///< The depth write mode CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps collected by the renderer @@ -387,7 +387,7 @@ inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, cons new (slot) LocalType( &attachment, &Renderer::SetDepthIndex, depthIndex ); } -inline void SetFaceCullingModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::Renderer::FaceCullingMode faceCullingMode ) +inline void SetFaceCullingModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::FaceCullingMode::Type faceCullingMode ) { typedef MessageValue1< Renderer, unsigned int > LocalType; @@ -397,14 +397,14 @@ inline void SetFaceCullingModeMessage( EventThreadServices& eventThreadServices, new (slot) LocalType( &renderer, &Renderer::SetFaceCullingMode, faceCullingMode ); } -inline void SetBlendingModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, BlendingMode::Type blendingMode ) +inline void SetBlendModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode ) { typedef MessageValue1< Renderer, unsigned int > LocalType; // Reserve some memory inside the message queue unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - new (slot) LocalType( &renderer, &Renderer::SetBlendingMode, blendingMode ); + new (slot) LocalType( &renderer, &Renderer::SetBlendMode, blendingMode ); } inline void SetBlendingOptionsMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, unsigned int options ) @@ -457,7 +457,7 @@ inline void SetEnablePreMultipliedAlphaMessage( EventThreadServices& eventThread new (slot) LocalType( &renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied ); } -inline void SetDepthWriteModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::Renderer::DepthWriteMode depthWriteMode ) +inline void SetDepthWriteModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::DepthWriteMode::Type depthWriteMode ) { typedef MessageValue1< Renderer, unsigned int > LocalType; -- 2.7.4