/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/public-api/dali-core.h>
#include <dali/devel-api/images/texture-set-image.h>
renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 1 );
+ DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION );
+
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION );
renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 10 );
+ DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION );
+
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION );
END_TEST;
}
END_TEST;
}
+int UtcDaliRendererSetBlendMode01b(void)
+{
+ TestApplication application;
+
+ tet_infoline("Test setting the blend mode to on with an transparent color renders with blending enabled");
+
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New( geometry, shader );
+
+ Actor actor = Actor::New();
+ actor.SetOpacity( 0.0f );
+ actor.AddRenderer(renderer);
+ actor.SetSize(400, 400);
+ Stage::GetCurrent().Add(actor);
+
+ renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON);
+
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ glAbstraction.EnableEnableDisableCallTrace(true);
+ glAbstraction.EnableDrawCallTrace( true );
+
+ application.SendNotification();
+ application.Render();
+
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ std::ostringstream blendStr;
+ blendStr << GL_BLEND;
+ DALI_TEST_CHECK( !glEnableStack.FindMethod( "Enable" ) );
+
+ DALI_TEST_CHECK( !glAbstraction.GetDrawTrace().FindMethod( "DrawElements" ) );
+
+ END_TEST;
+}
+
int UtcDaliRendererSetBlendMode02(void)
{
TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::TRANSPARENT );
+
application.SendNotification();
application.Render();
+
+ DALI_TEST_EQUALS( renderer.GetProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION );
DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::TRANSPARENT, TEST_LOCATION );
renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA );
+
+ DALI_TEST_EQUALS( renderer.GetProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION );
+
application.SendNotification();
application.Render();
+
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION );
DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::MAGENTA, TEST_LOCATION );
Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f );
DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) );
DALI_TEST_CHECK( preMultipliedAlpha );
+ value = renderer.GetCurrentProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) );
+ DALI_TEST_CHECK( preMultipliedAlpha );
+
srcFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
destFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
srcFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
renderer.SetIndexRange( 0, 5 );
application.SendNotification();
application.Render();
+
+ Property::Value value = renderer.GetProperty( Renderer::Property::INDEX_RANGE_FIRST );
+ int convertedValue;
+ DALI_TEST_CHECK( value.Get( convertedValue ) );
+ DALI_TEST_CHECK( convertedValue == 0 );
+
+ value = renderer.GetCurrentProperty( Renderer::Property::INDEX_RANGE_FIRST );
+ DALI_TEST_CHECK( value.Get( convertedValue ) );
+ DALI_TEST_CHECK( convertedValue == 0 );
+
+ value = renderer.GetProperty( Renderer::Property::INDEX_RANGE_COUNT );
+ DALI_TEST_CHECK( value.Get( convertedValue ) );
+ DALI_TEST_CHECK( convertedValue == 5 );
+
+ value = renderer.GetCurrentProperty( Renderer::Property::INDEX_RANGE_COUNT );
+ DALI_TEST_CHECK( value.Get( convertedValue ) );
+ DALI_TEST_CHECK( convertedValue == 5 );
+
sprintf( buffer, "%u, 5, %u, indices", GL_LINE_LOOP, GL_UNSIGNED_SHORT );
bool result = gl.GetDrawTrace().FindMethodAndParams( "DrawElements" , buffer );
DALI_TEST_CHECK( result );
* - Check it was set.
*/
template< typename T >
-void CheckEnumerationProperty( Renderer& renderer, Property::Index propertyIndex, T initialValue, T firstCheckEnumeration, T secondCheckEnumeration, std::string secondCheckString )
+void CheckEnumerationProperty( TestApplication& application, Renderer& renderer, Property::Index propertyIndex, T initialValue, T firstCheckEnumeration, T secondCheckEnumeration, std::string secondCheckString )
{
+ application.SendNotification();
+ application.Render();
+
DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( initialValue ) );
DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast<int>( initialValue ) );
renderer.SetProperty( propertyIndex, firstCheckEnumeration );
DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( firstCheckEnumeration ) );
+ DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) != static_cast<int>( firstCheckEnumeration ) );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( firstCheckEnumeration ) );
DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast<int>( firstCheckEnumeration ) );
+
renderer.SetProperty( propertyIndex, secondCheckString );
DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( secondCheckEnumeration ) );
+ DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) != static_cast<int>( secondCheckEnumeration ) );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( secondCheckEnumeration ) );
DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast<int>( secondCheckEnumeration ) );
}
Shader shader = CreateShader();
Renderer renderer = Renderer::New( geometry, shader );
+ Actor actor = Actor::New();
+ actor.AddRenderer(renderer);
+ actor.SetSize(400, 400);
+ Stage::GetCurrent().Add(actor);
+
/*
* 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< RenderMode::Type >( renderer, Renderer::Property::RENDER_MODE, RenderMode::AUTO, RenderMode::NONE, RenderMode::STENCIL, "STENCIL" );
- 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" );
+ CheckEnumerationProperty< FaceCullingMode::Type >( application, renderer, Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE, FaceCullingMode::FRONT, FaceCullingMode::BACK, "BACK" );
+ CheckEnumerationProperty< BlendMode::Type >( application, renderer, Renderer::Property::BLEND_MODE, BlendMode::AUTO, BlendMode::OFF, BlendMode::ON, "ON" );
+ CheckEnumerationProperty< BlendEquation::Type >( application, renderer, Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT" );
+ CheckEnumerationProperty< BlendEquation::Type >( application, renderer, Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT" );
+ CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" );
+ CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" );
+ CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::SRC_COLOR, "SRC_COLOR" );
+ CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" );
+ CheckEnumerationProperty< DepthWriteMode::Type >( application, renderer, Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO, DepthWriteMode::OFF, DepthWriteMode::ON, "ON" );
+ CheckEnumerationProperty< DepthFunction::Type >( application, renderer, Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS, DepthFunction::ALWAYS, DepthFunction::GREATER, "GREATER" );
+ CheckEnumerationProperty< DepthTestMode::Type >( application, renderer, Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO, DepthTestMode::OFF, DepthTestMode::ON, "ON" );
+ CheckEnumerationProperty< StencilFunction::Type >( application, renderer, Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS, StencilFunction::LESS, StencilFunction::EQUAL, "EQUAL" );
+ CheckEnumerationProperty< RenderMode::Type >( application, renderer, Renderer::Property::RENDER_MODE, RenderMode::AUTO, RenderMode::NONE, RenderMode::STENCIL, "STENCIL" );
+ CheckEnumerationProperty< StencilOperation::Type >( application, renderer, Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" );
+ CheckEnumerationProperty< StencilOperation::Type >( application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" );
+ CheckEnumerationProperty< StencilOperation::Type >( application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" );
END_TEST;
}
ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetCurrentProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE ).Get<int>() ), testValueReference, TEST_LOCATION );
+
std::stringstream parameterStream;
parameterStream << StencilFunctionLookupTable[ StencilOperation::DECREMENT_WRAP ] << ", " << testValueReference << ", 255";
ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetCurrentProperty( Renderer::Property::STENCIL_FUNCTION_MASK ).Get<int>() ), testValueMask, TEST_LOCATION );
+
// Clear the stringstream.
parameterStream.str( std::string() );
parameterStream << StencilFunctionLookupTable[ StencilOperation::DECREMENT_WRAP ] << ", " << testValueReference << ", " << testValueMask;
ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetCurrentProperty( Renderer::Property::STENCIL_MASK ).Get<int>() ), 0x00, TEST_LOCATION );
+
std::string methodString( "StencilMask" );
std::string parameterString = "0";
ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetCurrentProperty( Renderer::Property::STENCIL_MASK ).Get<int>() ), 0xFF, TEST_LOCATION );
+
parameterString = "255";
// Check the function was called and the parameters were correct.
END_TEST;
}
+
+int UtcDaliRendererOpacity(void)
+{
+ TestApplication application;
+
+ tet_infoline( "Test OPACITY property" );
+
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
+ Renderer renderer = Renderer::New( geometry, shader );
+
+ Actor actor = Actor::New();
+ actor.AddRenderer( renderer );
+ actor.SetSize( 400, 400 );
+ actor.SetColor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
+ Stage::GetCurrent().Add( actor );
+
+ Property::Value value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
+ float opacity;
+ DALI_TEST_CHECK( value.Get( opacity ) );
+ DALI_TEST_EQUALS( opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector4 actualValue;
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ DALI_TEST_CHECK( gl.GetUniformValue< Vector4 >( "uColor", actualValue ) );
+ DALI_TEST_EQUALS( actualValue.a, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::OPACITY, 0.5f );
+
+ application.SendNotification();
+ application.Render();
+
+ value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
+ DALI_TEST_CHECK( value.Get( opacity ) );
+ DALI_TEST_EQUALS( opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ value = renderer.GetCurrentProperty( DevelRenderer::Property::OPACITY );
+ DALI_TEST_CHECK( value.Get( opacity ) );
+ DALI_TEST_EQUALS( opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ DALI_TEST_CHECK( gl.GetUniformValue< Vector4 >( "uColor", actualValue ) );
+ DALI_TEST_EQUALS( actualValue.a, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliRendererOpacityAnimation(void)
+{
+ TestApplication application;
+
+ tet_infoline( "Test OPACITY property animation" );
+
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
+ Renderer renderer = Renderer::New( geometry, shader );
+
+ Actor actor = Actor::New();
+ actor.AddRenderer( renderer );
+ actor.SetSize( 400, 400 );
+ actor.SetColor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render(0);
+
+ Property::Value value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
+ float opacity;
+ DALI_TEST_CHECK( value.Get( opacity ) );
+ DALI_TEST_EQUALS( opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ Animation animation = Animation::New( 1.0f );
+ animation.AnimateTo( Property( renderer, DevelRenderer::Property::OPACITY ), 0.0f );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render( 1000 );
+
+ value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
+ DALI_TEST_CHECK( value.Get( opacity ) );
+ DALI_TEST_EQUALS( opacity, 0.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ renderer.SetProperty( DevelRenderer::Property::OPACITY, 0.1f );
+
+ animation.Clear();
+ animation.AnimateBy( Property( renderer, DevelRenderer::Property::OPACITY ), 0.5f );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render( 1000 );
+
+ value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
+ DALI_TEST_CHECK( value.Get( opacity ) );
+ DALI_TEST_EQUALS( opacity, 0.6f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliRendererInvalidProperty(void)
+{
+ TestApplication application;
+
+ tet_infoline( "Test invalid property" );
+
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
+ Renderer renderer = Renderer::New( geometry, shader );
+
+ Actor actor = Actor::New();
+ actor.AddRenderer( renderer );
+ actor.SetSize( 400, 400 );
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render(0);
+
+ Property::Value value = renderer.GetProperty( Renderer::Property::DEPTH_INDEX + 100 );
+ DALI_TEST_CHECK( value.GetType() == Property::Type::NONE );
+
+ value = renderer.GetCurrentProperty( Renderer::Property::DEPTH_INDEX + 100 );
+ DALI_TEST_CHECK( value.GetType() == Property::Type::NONE );
+
+ END_TEST;
+}
#define DALI_RENDERER_DEVEL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
STENCIL_OPERATION_ON_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL,
STENCIL_OPERATION_ON_Z_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL,
STENCIL_OPERATION_ON_Z_PASS = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS,
+
+ /**
+ * @brief The opacity of the renderer.
+ * @details Name "opacity", type Property::FLOAT.
+ */
+ OPACITY = STENCIL_OPERATION_ON_Z_PASS + 1,
};
} // namespace Property
#define DALI_INTERNAL_OBJECT_IMPL_HELPER_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct ObjectImplHelper
{
const PropertyDetails* DEFAULT_PROPERTY_DETAILS;
+ const int DEFAULT_PROPERTY_START_INDEX;
unsigned int GetDefaultPropertyCount() const
{
for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
- indices.PushBack( DEFAULT_OBJECT_PROPERTY_START_INDEX + i );
+ indices.PushBack( DEFAULT_PROPERTY_START_INDEX + i );
}
}
{
const char* name = NULL;
- if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
+ if( index >= DEFAULT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_START_INDEX + DEFAULT_PROPERTY_MAX_COUNT )
{
- name = DEFAULT_PROPERTY_DETAILS[index].name;
+ name = DEFAULT_PROPERTY_DETAILS[index - DEFAULT_PROPERTY_START_INDEX].name;
}
return name;
{
bool isWritable = false;
- if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
+ if( index >= DEFAULT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_START_INDEX + DEFAULT_PROPERTY_MAX_COUNT )
{
- isWritable = DEFAULT_PROPERTY_DETAILS[index].writable;
+ isWritable = DEFAULT_PROPERTY_DETAILS[index - DEFAULT_PROPERTY_START_INDEX].writable;
}
return isWritable;
{
bool isAnimatable = false;
- if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
+ if( index >= DEFAULT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_START_INDEX + DEFAULT_PROPERTY_MAX_COUNT )
{
- isAnimatable = DEFAULT_PROPERTY_DETAILS[index].animatable;
+ isAnimatable = DEFAULT_PROPERTY_DETAILS[index - DEFAULT_PROPERTY_START_INDEX].animatable;
}
return isAnimatable;
{
bool isConstraintInput = false;
- if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
+ if( index >= DEFAULT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_START_INDEX + DEFAULT_PROPERTY_MAX_COUNT )
{
- isConstraintInput = DEFAULT_PROPERTY_DETAILS[index].constraintInput;
+ isConstraintInput = DEFAULT_PROPERTY_DETAILS[index - DEFAULT_PROPERTY_START_INDEX].constraintInput;
}
return isConstraintInput;
{
Property::Type type = Property::NONE;
- if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
+ if( index >= DEFAULT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_START_INDEX + DEFAULT_PROPERTY_MAX_COUNT )
{
- type = DEFAULT_PROPERTY_DETAILS[index].type;
+ type = DEFAULT_PROPERTY_DETAILS[index - DEFAULT_PROPERTY_START_INDEX].type;
}
return type;
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_PROPERTY( "stencilOperationOnFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL )
DALI_PROPERTY( "stencilOperationOnZFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL )
DALI_PROPERTY( "stencilOperationOnZPass", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
+DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::DevelRenderer::Property::OPACITY )
DALI_PROPERTY_TABLE_END( DEFAULT_RENDERER_PROPERTY_START_INDEX )
// Property string to enumeration tables:
DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, DECREMENT_WRAP )
DALI_ENUM_TO_STRING_TABLE_END( STENCIL_OPERATION )
-const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS };
+const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS, DEFAULT_RENDERER_PROPERTY_START_INDEX };
BaseHandle Create()
{
}
break;
}
+ case Dali::DevelRenderer::Property::OPACITY:
+ {
+ float opacity;
+ if( propertyValue.Get( opacity ) )
+ {
+ if( !Equals( mOpacity, opacity ) )
+ {
+ mOpacity = opacity;
+ BakeOpacityMessage( GetEventThreadServices(), *mSceneObject, mOpacity );
+ }
+ }
+ break;
+ }
}
}
Property::Value Renderer::GetDefaultProperty( Property::Index index ) const
{
Property::Value value;
+
+ if( ! GetCachedPropertyValue( index, value ) )
+ {
+ // If property value is not stored in the event-side, then it must be a scene-graph only property
+ GetCurrentPropertyValue( index, value );
+ }
+
+ return value;
+}
+
+Property::Value Renderer::GetDefaultPropertyCurrentValue( Property::Index index ) const
+{
+ Property::Value value;
+
+ if( ! GetCurrentPropertyValue( index, value ) )
+ {
+ // If unable to retrieve scene-graph property value, then it must be an event-side only property
+ GetCachedPropertyValue( index, value );
+ }
+
+ return value;
+}
+
+void Renderer::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType )
+{
+ switch( animationType )
+ {
+ case Animation::TO:
+ case Animation::BETWEEN:
+ {
+ switch( index )
+ {
+ case Dali::DevelRenderer::Property::OPACITY:
+ {
+ value.Get( mOpacity );
+ break;
+ }
+ }
+ break;
+ }
+
+ case Animation::BY:
+ {
+ switch( index )
+ {
+ case Dali::DevelRenderer::Property::OPACITY:
+ {
+ AdjustValue< float >( mOpacity, value );
+ break;
+ }
+ }
+ break;
+ }
+ }
+}
+
+const SceneGraph::PropertyOwner* Renderer::GetPropertyOwner() const
+{
+ return mSceneObject;
+}
+
+const SceneGraph::PropertyOwner* Renderer::GetSceneObject() const
+{
+ return mSceneObject;
+}
+
+const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty( Property::Index index ) const
+{
+ DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
+ const SceneGraph::PropertyBase* property = NULL;
+
+ property = RENDERER_IMPL.GetRegisteredSceneGraphProperty(
+ this,
+ &Renderer::FindAnimatableProperty,
+ &Renderer::FindCustomProperty,
+ index );
+
+ if( !property )
+ {
+ if( index == DevelRenderer::Property::OPACITY )
+ {
+ property = &mSceneObject->mOpacity;
+ }
+ }
+
+ return property;
+}
+
+const PropertyInputImpl* Renderer::GetSceneObjectInputProperty( Property::Index index ) const
+{
+ const PropertyInputImpl* property = NULL;
+
+ const SceneGraph::PropertyBase* baseProperty =
+ RENDERER_IMPL.GetRegisteredSceneGraphProperty( this,
+ &Renderer::FindAnimatableProperty,
+ &Renderer::FindCustomProperty,
+ index );
+ property = static_cast<const PropertyInputImpl*>( baseProperty );
+
+ return property;
+}
+
+int Renderer::GetPropertyComponentIndex( Property::Index index ) const
+{
+ return Property::INVALID_COMPONENT_INDEX;
+}
+
+Renderer::Renderer()
+: mSceneObject(NULL ),
+ mDepthIndex( 0 ),
+ mIndexedDrawFirstElement( 0 ),
+ mIndexedDrawElementCount( 0 ),
+ mStencilParameters( RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
+ mBlendingOptions(),
+ mOpacity( 1.0f ),
+ mDepthFunction( DepthFunction::LESS ),
+ mFaceCullingMode( FaceCullingMode::NONE ),
+ mBlendMode( BlendMode::AUTO ),
+ mDepthWriteMode( DepthWriteMode::AUTO ),
+ mDepthTestMode( DepthTestMode::AUTO ),
+ mPremultipledAlphaEnabled( false )
+{
+}
+
+void Renderer::Initialize()
+{
+ EventThreadServices& eventThreadServices = GetEventThreadServices();
+ SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
+
+ mSceneObject = SceneGraph::Renderer::New();
+ OwnerPointer< SceneGraph::Renderer > transferOwnership( mSceneObject );
+ AddRendererMessage( updateManager, transferOwnership );
+
+ eventThreadServices.RegisterObject( this );
+}
+
+void Renderer::SetBlendColor( const Vector4& blendColor )
+{
+ mBlendingOptions.SetBlendColor( blendColor );
+ SetBlendColorMessage( GetEventThreadServices(), *mSceneObject, GetBlendColor() );
+}
+
+const Vector4& Renderer::GetBlendColor() const
+{
+ const Vector4* blendColor = mBlendingOptions.GetBlendColor();
+ if( blendColor )
+ {
+ return *blendColor;
+ }
+ return Color::TRANSPARENT; // GL default
+}
+
+Renderer::~Renderer()
+{
+ if( EventThreadServices::IsCoreRunning() )
+ {
+ EventThreadServices& eventThreadServices = GetEventThreadServices();
+ SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
+ RemoveRendererMessage( updateManager, *mSceneObject );
+
+ eventThreadServices.UnregisterObject( this );
+ }
+}
+
+bool Renderer::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const
+{
+ bool valueSet = true;
+
switch( index )
{
case Dali::Renderer::Property::DEPTH_INDEX:
value = mStencilParameters.stencilOperationOnZPass;
break;
}
+ case Dali::DevelRenderer::Property::OPACITY:
+ {
+ value = mOpacity;
+ break;
+ }
+ default:
+ {
+ // Must be a scene-graph only property
+ valueSet = false;
+ break;
+ }
}
- return value;
-}
-
-Property::Value Renderer::GetDefaultPropertyCurrentValue( Property::Index index ) const
-{
- return GetDefaultProperty( index ); // Event-side only properties
-}
-
-const SceneGraph::PropertyOwner* Renderer::GetPropertyOwner() const
-{
- return mSceneObject;
-}
-const SceneGraph::PropertyOwner* Renderer::GetSceneObject() const
-{
- return mSceneObject;
+ return valueSet;
}
-const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty( Property::Index index ) const
+bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const
{
- DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
- const SceneGraph::PropertyBase* property = NULL;
+ bool valueSet = true;
- property = RENDERER_IMPL.GetRegisteredSceneGraphProperty(
- this,
- &Renderer::FindAnimatableProperty,
- &Renderer::FindCustomProperty,
- index );
-
- return property;
-}
-
-const PropertyInputImpl* Renderer::GetSceneObjectInputProperty( Property::Index index ) const
-{
- const PropertyInputImpl* property = NULL;
-
- const SceneGraph::PropertyBase* baseProperty =
- RENDERER_IMPL.GetRegisteredSceneGraphProperty( this,
- &Renderer::FindAnimatableProperty,
- &Renderer::FindCustomProperty,
- index );
- property = static_cast<const PropertyInputImpl*>( baseProperty );
-
- return property;
-}
-
-int Renderer::GetPropertyComponentIndex( Property::Index index ) const
-{
- return Property::INVALID_COMPONENT_INDEX;
-}
-
-Renderer::Renderer()
-: mSceneObject(NULL ),
- mDepthIndex( 0 ),
- mIndexedDrawFirstElement( 0 ),
- mIndexedDrawElementCount( 0 ),
- mStencilParameters( RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
- mBlendingOptions(),
- mDepthFunction( DepthFunction::LESS ),
- mFaceCullingMode( FaceCullingMode::NONE ),
- mBlendMode( BlendMode::AUTO ),
- mDepthWriteMode( DepthWriteMode::AUTO ),
- mDepthTestMode( DepthTestMode::AUTO ),
- mPremultipledAlphaEnabled( false )
-{
-}
-
-void Renderer::Initialize()
-{
- EventThreadServices& eventThreadServices = GetEventThreadServices();
- SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
-
- mSceneObject = SceneGraph::Renderer::New();
- OwnerPointer< SceneGraph::Renderer > transferOwnership( mSceneObject );
- AddRendererMessage( updateManager, transferOwnership );
-
- eventThreadServices.RegisterObject( this );
-}
-
-void Renderer::SetBlendColor( const Vector4& blendColor )
-{
- mBlendingOptions.SetBlendColor( blendColor );
- SetBlendColorMessage( GetEventThreadServices(), *mSceneObject, GetBlendColor() );
-}
-
-const Vector4& Renderer::GetBlendColor() const
-{
- const Vector4* blendColor = mBlendingOptions.GetBlendColor();
- if( blendColor )
+ switch( index )
{
- return *blendColor;
+ case Dali::Renderer::Property::DEPTH_INDEX:
+ {
+ value = mSceneObject->GetDepthIndex();
+ break;
+ }
+ case Dali::Renderer::Property::FACE_CULLING_MODE:
+ {
+ value = mSceneObject->GetFaceCullingMode();
+ break;
+ }
+ case Dali::Renderer::Property::BLEND_MODE:
+ {
+ value = mSceneObject->GetBlendMode();
+ break;
+ }
+ case Dali::Renderer::Property::BLEND_EQUATION_RGB:
+ {
+ unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ BlendingOptions blendingOptions;
+ blendingOptions.SetBitmask( bitMask );
+ value = static_cast<int>( blendingOptions.GetBlendEquationRgb() );
+ break;
+ }
+ case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
+ {
+ unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ BlendingOptions blendingOptions;
+ blendingOptions.SetBitmask( bitMask );
+ value = static_cast<int>( blendingOptions.GetBlendEquationAlpha() );
+ break;
+ }
+ case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
+ {
+ unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ BlendingOptions blendingOptions;
+ blendingOptions.SetBitmask( bitMask );
+ value = static_cast<int>( blendingOptions.GetBlendSrcFactorRgb() );
+ break;
+ }
+ case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
+ {
+ unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ BlendingOptions blendingOptions;
+ blendingOptions.SetBitmask( bitMask );
+ value = static_cast<int>( blendingOptions.GetBlendDestFactorRgb() );
+ break;
+ }
+ case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
+ {
+ unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ BlendingOptions blendingOptions;
+ blendingOptions.SetBitmask( bitMask );
+ value = static_cast<int>( blendingOptions.GetBlendSrcFactorAlpha() );
+ break;
+ }
+ case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
+ {
+ unsigned int bitMask = mSceneObject->GetBlendingOptions();
+ BlendingOptions blendingOptions;
+ blendingOptions.SetBitmask( bitMask );
+ value = static_cast<int>( blendingOptions.GetBlendDestFactorAlpha() );
+ break;
+ }
+ case Dali::Renderer::Property::BLEND_COLOR:
+ {
+ value = mSceneObject->GetBlendColor();
+ break;
+ }
+ case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
+ {
+ value = mSceneObject->IsPreMultipliedAlphaEnabled();
+ break;
+ }
+ case Dali::Renderer::Property::INDEX_RANGE_FIRST:
+ {
+ value = static_cast<int>( mSceneObject->GetIndexedDrawFirstElement() );
+ break;
+ }
+ case Dali::Renderer::Property::INDEX_RANGE_COUNT:
+ {
+ value = static_cast<int>( mSceneObject->GetIndexedDrawElementsCount() );
+ break;
+ }
+ case Dali::Renderer::Property::DEPTH_WRITE_MODE:
+ {
+ value = mSceneObject->GetDepthWriteMode();
+ break;
+ }
+ case Dali::Renderer::Property::DEPTH_FUNCTION:
+ {
+ value = mSceneObject->GetDepthFunction();
+ break;
+ }
+ case Dali::Renderer::Property::DEPTH_TEST_MODE:
+ {
+ value = mSceneObject->GetDepthTestMode();
+ break;
+ }
+ case Dali::Renderer::Property::STENCIL_FUNCTION:
+ {
+ Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+ value = stencilParameters.stencilFunction;
+ break;
+ }
+ case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
+ {
+ Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+ value = stencilParameters.stencilFunctionMask;
+ break;
+ }
+ case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
+ {
+ Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+ value = stencilParameters.stencilFunctionReference;
+ break;
+ }
+ case Dali::Renderer::Property::STENCIL_MASK:
+ {
+ Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+ value = stencilParameters.stencilMask;
+ break;
+ }
+ case Dali::Renderer::Property::RENDER_MODE:
+ {
+ Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+ value = stencilParameters.renderMode;
+ break;
+ }
+ case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
+ {
+ Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+ value = stencilParameters.stencilOperationOnFail;
+ break;
+ }
+ case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
+ {
+ Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+ value = stencilParameters.stencilOperationOnZFail;
+ break;
+ }
+ case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
+ {
+ Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+ value = stencilParameters.stencilOperationOnZPass;
+ break;
+ }
+ case Dali::DevelRenderer::Property::OPACITY:
+ {
+ value = mSceneObject->GetOpacity( GetEventThreadServices().GetEventBufferIndex() );
+ break;
+ }
+ default:
+ {
+ // Must be an event-side only property
+ valueSet = false;
+ break;
+ }
}
- return Color::TRANSPARENT; // GL default
-}
-Renderer::~Renderer()
-{
- if( EventThreadServices::IsCoreRunning() )
- {
- EventThreadServices& eventThreadServices = GetEventThreadServices();
- SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
- RemoveRendererMessage( updateManager, *mSceneObject );
-
- eventThreadServices.UnregisterObject( this );
- }
+ return valueSet;
}
} // namespace Internal
#define DALI_INTERNAL_RENDERER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
+ /**
+ * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
+ */
+ virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
+
/**
* @copydoc Dali::Internal::Object::GetPropertyOwner()
*/
*/
const Vector4& GetBlendColor() const;
+ /**
+ * @brief Retrieves the cached event side value of a default property.
+ * @param[in] index The index of the property
+ * @param[out] value Is set with the cached value of the property if found.
+ * @return True if value set, false otherwise.
+ */
+ bool GetCachedPropertyValue( Property::Index index, Property::Value& value ) const;
+
+ /**
+ * @brief Retrieves the current value of a default property from the scene-graph.
+ * @param[in] index The index of the property
+ * @param[out] value Is set with the current scene-graph value of the property
+ * @return True if value set, false otherwise.
+ */
+ bool GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const;
+
protected:
/**
* A reference counted object may only be deleted by calling Unreference()
Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask
+ float mOpacity; ///< Local copy of the opacity
+
DepthFunction::Type mDepthFunction:3; ///< Local copy of the depth function
FaceCullingMode::Type mFaceCullingMode:2; ///< Local copy of the mode of face culling
BlendMode::Type mBlendMode:2; ///< Local copy of the mode of blending
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_PROPERTY( "program", MAP, true, false, false, Dali::Shader::Property::PROGRAM )
DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
-const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> SHADER_IMPL = { DEFAULT_PROPERTY_DETAILS };
+const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> SHADER_IMPL = { DEFAULT_PROPERTY_DETAILS, DEFAULT_ACTOR_PROPERTY_START_INDEX };
Dali::Scripting::StringEnum ShaderHintsTable[] =
{ { "NONE", Dali::Shader::Hint::NONE},
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace SceneGraph
{
-RenderDataProvider::RenderDataProvider()
+RenderDataProvider::RenderDataProvider( AnimatableProperty< float >& opacity )
: mUniformMapDataProvider( NULL ),
- mShader( NULL )
+ mShader( NULL ),
+ mOpacity( opacity )
{
}
return mTextures;
}
+float RenderDataProvider::GetOpacity( BufferIndex bufferIndex )
+{
+ return mOpacity[bufferIndex];
+}
+
} // SceneGraph
} // Internal
} // Dali
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_DATA_PROVIDER_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/internal/render/data-providers/uniform-map-data-provider.h>
#include <dali/internal/render/renderers/render-sampler.h>
#include <dali/internal/render/renderers/render-texture.h>
+#include <dali/internal/update/common/animatable-property.h>
namespace Dali
{
* The RendererAttachment that creates this object will initialize the members
* directly.
*/
- RenderDataProvider();
+ RenderDataProvider( AnimatableProperty< float >& opacity );
/**
* Destructor
*/
std::vector<Render::Texture*>& GetTextures();
+ /**
+ * Get the opacity
+ * @return The opacity
+ */
+ float GetOpacity( BufferIndex bufferIndex );
+
private:
- const UniformMapDataProvider* mUniformMapDataProvider;
- Shader* mShader;
+ const UniformMapDataProvider* mUniformMapDataProvider;
+ Shader* mShader;
std::vector<Render::Texture*> mTextures;
- Samplers mSamplers;
+ Samplers mSamplers;
+ AnimatableProperty< float >& mOpacity;
// Give Renderer access to our private data to reduce copying vectors on construction.
friend class Renderer;
{
}
-void Renderer::SetRenderDataProvider( OwnerPointer<SceneGraph::RenderDataProvider>& dataProvider )
-{
- mRenderDataProvider = dataProvider;
- mUpdateAttributesLocation = true;
-
- // Check that the number of textures match the number of samplers in the shader
- size_t textureCount = mRenderDataProvider->GetTextures().size();
- Program* program = mRenderDataProvider->GetShader().GetProgram();
- if( program && program->GetActiveSamplerCount() != textureCount )
- {
- DALI_LOG_WARNING("The number of active samplers in the shader(%lu) does not match the number of textures in the TextureSet(%lu)\n",
- program->GetActiveSamplerCount(),
- textureCount );
- }
-}
-
void Renderer::SetGeometry( Render::Geometry* geometry )
{
mGeometry = geometry;
const Vector4& color = node.GetRenderColor( bufferIndex );
if( mPremultipledAlphaEnabled )
{
- program->SetUniform4f( loc, color.r*color.a, color.g*color.a, color.b*color.a, color.a );
+ float alpha = color.a * mRenderDataProvider->GetOpacity( bufferIndex );
+ program->SetUniform4f( loc, color.r * alpha, color.g * alpha, color.b * alpha, alpha );
}
else
{
- program->SetUniform4f( loc, color.r, color.g, color.b, color.a );
+ program->SetUniform4f( loc, color.r, color.g, color.b, color.a * mRenderDataProvider->GetOpacity( bufferIndex ) );
}
}
#define DALI_INTERNAL_RENDER_RENDERER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
StencilParameters& stencilParameters );
/**
- * Change the data providers of the renderer
- * @param[in] dataProviders The data providers
- */
- void SetRenderDataProvider( OwnerPointer<SceneGraph::RenderDataProvider>& dataProviders );
-
- /**
* Change the geometry used by the renderer
* @param[in] geometry The new geometry
*/
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if( inside )
{
- Renderer::Opacity opacity = renderable.mRenderer ? renderable.mRenderer->GetOpacity( updateBufferIndex, *renderable.mNode ) : Renderer::OPAQUE;
- if( opacity != Renderer::TRANSPARENT )
+ Renderer::OpacityType opacityType = renderable.mRenderer ? renderable.mRenderer->GetOpacityType( updateBufferIndex, *renderable.mNode ) : Renderer::OPAQUE;
+ if( opacityType != Renderer::TRANSPARENT || node->GetClippingMode() == ClippingMode::CLIP_CHILDREN )
{
// Get the next free RenderItem.
RenderItem& item = renderList.GetNextFreeItem();
item.mNode = renderable.mNode;
- item.mIsOpaque = ( opacity == Renderer::OPAQUE );
+ item.mIsOpaque = ( opacityType == Renderer::OPAQUE );
if( !isLayer3d )
{
item.mDepthIndex = renderable.mNode->GetDepthIndex();
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Flags for re-sending data to renderer.
enum Flags
{
- RESEND_DATA_PROVIDER = 1 << 0,
- RESEND_GEOMETRY = 1 << 1,
- RESEND_FACE_CULLING_MODE = 1 << 2,
- RESEND_BLEND_COLOR = 1 << 3,
- RESEND_BLEND_BIT_MASK = 1 << 4,
- RESEND_PREMULTIPLIED_ALPHA = 1 << 5,
- RESEND_INDEXED_DRAW_FIRST_ELEMENT = 1 << 6,
- RESEND_INDEXED_DRAW_ELEMENTS_COUNT = 1 << 7,
- RESEND_DEPTH_WRITE_MODE = 1 << 8,
- RESEND_DEPTH_TEST_MODE = 1 << 9,
- RESEND_DEPTH_FUNCTION = 1 << 10,
- RESEND_RENDER_MODE = 1 << 11,
- RESEND_STENCIL_FUNCTION = 1 << 12,
- RESEND_STENCIL_FUNCTION_MASK = 1 << 13,
- RESEND_STENCIL_FUNCTION_REFERENCE = 1 << 14,
- RESEND_STENCIL_MASK = 1 << 15,
- RESEND_STENCIL_OPERATION_ON_FAIL = 1 << 16,
- RESEND_STENCIL_OPERATION_ON_Z_FAIL = 1 << 17,
- RESEND_STENCIL_OPERATION_ON_Z_PASS = 1 << 18,
- RESEND_WRITE_TO_COLOR_BUFFER = 1 << 19,
+ RESEND_GEOMETRY = 1 << 0,
+ RESEND_FACE_CULLING_MODE = 1 << 1,
+ RESEND_BLEND_COLOR = 1 << 2,
+ RESEND_BLEND_BIT_MASK = 1 << 3,
+ RESEND_PREMULTIPLIED_ALPHA = 1 << 4,
+ RESEND_INDEXED_DRAW_FIRST_ELEMENT = 1 << 5,
+ RESEND_INDEXED_DRAW_ELEMENTS_COUNT = 1 << 6,
+ RESEND_DEPTH_WRITE_MODE = 1 << 7,
+ RESEND_DEPTH_TEST_MODE = 1 << 8,
+ RESEND_DEPTH_FUNCTION = 1 << 9,
+ RESEND_RENDER_MODE = 1 << 10,
+ RESEND_STENCIL_FUNCTION = 1 << 11,
+ RESEND_STENCIL_FUNCTION_MASK = 1 << 12,
+ RESEND_STENCIL_FUNCTION_REFERENCE = 1 << 13,
+ RESEND_STENCIL_MASK = 1 << 14,
+ RESEND_STENCIL_OPERATION_ON_FAIL = 1 << 15,
+ RESEND_STENCIL_OPERATION_ON_Z_FAIL = 1 << 16,
+ RESEND_STENCIL_OPERATION_ON_Z_PASS = 1 << 17,
+ RESEND_WRITE_TO_COLOR_BUFFER = 1 << 18
};
} // Anonymous namespace
mTextureSet( NULL ),
mGeometry( NULL ),
mShader( NULL ),
+ mRenderDataProvider( NULL ),
mBlendColor( NULL ),
mStencilParameters( RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
mIndexedDrawFirstElement( 0u ),
mDepthWriteMode( DepthWriteMode::AUTO ),
mDepthTestMode( DepthTestMode::AUTO ),
mPremultipledAlphaEnabled( false ),
+ mOpacity( 1.0f ),
mDepthIndex( 0 )
{
mUniformMapChanged[0] = false;
if( mResendFlag != 0 )
{
- if( mResendFlag & RESEND_DATA_PROVIDER )
- {
- OwnerPointer<RenderDataProvider> dataProvider = NewRenderDataProvider();
-
- typedef MessageValue1< Render::Renderer, OwnerPointer<RenderDataProvider> > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
- new (slot) DerivedType( mRenderer, &Render::Renderer::SetRenderDataProvider, dataProvider );
- }
-
if( mResendFlag & RESEND_GEOMETRY )
{
typedef MessageValue1< Render::Renderer, Render::Geometry* > DerivedType;
mTextureSet = textureSet;
mTextureSet->AddObserver( this );
mRegenerateUniformMap = REGENERATE_UNIFORM_MAP;
- mResendFlag |= RESEND_DATA_PROVIDER;
+
+ UpdateTextureSet();
}
void Renderer::SetShader( Shader* shader )
mShader = shader;
mShader->AddConnectionObserver( *this );
mRegenerateUniformMap = REGENERATE_UNIFORM_MAP;
- mResendFlag |= RESEND_DATA_PROVIDER;
+
+ if( mRenderDataProvider )
+ {
+ mRenderDataProvider->mShader = mShader;
+ }
}
void Renderer::SetGeometry( Render::Geometry* geometry )
mResendFlag |= RESEND_FACE_CULLING_MODE;
}
+FaceCullingMode::Type Renderer::GetFaceCullingMode() const
+{
+ return mFaceCullingMode;
+}
+
void Renderer::SetBlendMode( BlendMode::Type blendingMode )
{
mBlendMode = blendingMode;
}
+BlendMode::Type Renderer::GetBlendMode() const
+{
+ return mBlendMode;
+}
+
void Renderer::SetBlendingOptions( unsigned int options )
{
if( mBlendBitmask != options)
}
}
+unsigned int Renderer::GetBlendingOptions() const
+{
+ return mBlendBitmask;
+}
+
void Renderer::SetBlendColor( const Vector4& blendColor )
{
if( blendColor == Color::TRANSPARENT )
mResendFlag |= RESEND_BLEND_COLOR;
}
+Vector4 Renderer::GetBlendColor() const
+{
+ if( mBlendColor )
+ {
+ return *mBlendColor;
+ }
+ return Color::TRANSPARENT;
+}
+
void Renderer::SetIndexedDrawFirstElement( size_t firstElement )
{
mIndexedDrawFirstElement = firstElement;
mResendFlag |= RESEND_INDEXED_DRAW_FIRST_ELEMENT;
}
+size_t Renderer::GetIndexedDrawFirstElement() const
+{
+ return mIndexedDrawFirstElement;
+}
+
void Renderer::SetIndexedDrawElementsCount( size_t elementsCount )
{
mIndexedDrawElementsCount = elementsCount;
mResendFlag |= RESEND_INDEXED_DRAW_ELEMENTS_COUNT;
}
+size_t Renderer::GetIndexedDrawElementsCount() const
+{
+ return mIndexedDrawElementsCount;
+}
+
void Renderer::EnablePreMultipliedAlpha( bool preMultipled )
{
mPremultipledAlphaEnabled = preMultipled;
mResendFlag |= RESEND_PREMULTIPLIED_ALPHA;
}
+bool Renderer::IsPreMultipliedAlphaEnabled() const
+{
+ return mPremultipledAlphaEnabled;
+}
+
void Renderer::SetDepthWriteMode( DepthWriteMode::Type depthWriteMode )
{
mDepthWriteMode = depthWriteMode;
mResendFlag |= RESEND_DEPTH_WRITE_MODE;
}
+DepthWriteMode::Type Renderer::GetDepthWriteMode() const
+{
+ return mDepthWriteMode;
+}
+
void Renderer::SetDepthTestMode( DepthTestMode::Type depthTestMode )
{
mDepthTestMode = depthTestMode;
mResendFlag |= RESEND_DEPTH_TEST_MODE;
}
+DepthTestMode::Type Renderer::GetDepthTestMode() const
+{
+ return mDepthTestMode;
+}
+
void Renderer::SetDepthFunction( DepthFunction::Type depthFunction )
{
mDepthFunction = depthFunction;
mResendFlag |= RESEND_DEPTH_FUNCTION;
}
+DepthFunction::Type Renderer::GetDepthFunction() const
+{
+ return mDepthFunction;
+}
+
void Renderer::SetRenderMode( RenderMode::Type mode )
{
mStencilParameters.renderMode = mode;
mResendFlag |= RESEND_STENCIL_OPERATION_ON_Z_PASS;
}
+const Render::Renderer::StencilParameters& Renderer::GetStencilParameters() const
+{
+ return mStencilParameters;
+}
+
+void Renderer::BakeOpacity( BufferIndex updateBufferIndex, float opacity )
+{
+ mOpacity.Bake( updateBufferIndex, opacity );
+}
+
+float Renderer::GetOpacity( BufferIndex updateBufferIndex ) const
+{
+ return mOpacity[updateBufferIndex];
+}
+
//Called when SceneGraph::Renderer is added to update manager ( that happens when an "event-thread renderer" is created )
void Renderer::ConnectToSceneGraph( SceneController& sceneController, BufferIndex bufferIndex )
{
mRegenerateUniformMap = REGENERATE_UNIFORM_MAP;
mSceneController = &sceneController;
- RenderDataProvider* dataProvider = NewRenderDataProvider();
- mRenderer = Render::Renderer::New( dataProvider, mGeometry, mBlendBitmask, GetBlendColor(), static_cast< FaceCullingMode::Type >( mFaceCullingMode ),
+ mRenderDataProvider = new RenderDataProvider( mOpacity );
+ mRenderDataProvider->mUniformMapDataProvider = this;
+
+ mRenderer = Render::Renderer::New( mRenderDataProvider, mGeometry, mBlendBitmask, GetBlendColor(), static_cast< FaceCullingMode::Type >( mFaceCullingMode ),
mPremultipledAlphaEnabled, mDepthWriteMode, mDepthTestMode, mDepthFunction, mStencilParameters );
OwnerPointer< Render::Renderer > transferOwnership( mRenderer );
mRenderer = NULL;
}
mSceneController = NULL;
+ mRenderDataProvider = NULL;
}
-RenderDataProvider* Renderer::NewRenderDataProvider()
+void Renderer::UpdateTextureSet()
{
- RenderDataProvider* dataProvider = new RenderDataProvider();
-
- dataProvider->mUniformMapDataProvider = this;
- dataProvider->mShader = mShader;
-
- if( mTextureSet )
+ if( mRenderDataProvider )
{
- size_t textureCount = mTextureSet->GetTextureCount();
- dataProvider->mTextures.resize( textureCount );
- dataProvider->mSamplers.resize( textureCount );
- for( unsigned int i(0); i<textureCount; ++i )
+ if( mTextureSet )
{
- dataProvider->mTextures[i] = mTextureSet->GetTexture(i);
- dataProvider->mSamplers[i] = mTextureSet->GetTextureSampler(i);
+ size_t textureCount = mTextureSet->GetTextureCount();
+ mRenderDataProvider->mTextures.resize( textureCount );
+ mRenderDataProvider->mSamplers.resize( textureCount );
+ for( unsigned int i(0); i<textureCount; ++i )
+ {
+ mRenderDataProvider->mTextures[i] = mTextureSet->GetTexture(i);
+ mRenderDataProvider->mSamplers[i] = mTextureSet->GetTextureSampler(i);
+ }
+ }
+ else
+ {
+ mRenderDataProvider->mTextures.clear();
+ mRenderDataProvider->mSamplers.clear();
}
}
-
- return dataProvider;
-}
-
-const Vector4& Renderer::GetBlendColor() const
-{
- if( mBlendColor )
- {
- return *mBlendColor;
- }
- return Color::TRANSPARENT;
}
Render::Renderer& Renderer::GetRenderer()
return mCollectedUniformMap[bufferIndex];
}
-Renderer::Opacity Renderer::GetOpacity( BufferIndex updateBufferIndex, const Node& node ) const
+Renderer::OpacityType Renderer::GetOpacityType( BufferIndex updateBufferIndex, const Node& node ) const
{
- Renderer::Opacity opacity = Renderer::OPAQUE;
+ Renderer::OpacityType opacityType = Renderer::OPAQUE;
switch( mBlendMode )
{
case BlendMode::ON: // If the renderer should always be use blending
{
- opacity = Renderer::TRANSLUCENT;
+ float alpha = node.GetWorldColor( updateBufferIndex ).a * mOpacity[updateBufferIndex];
+ if( alpha <= FULLY_TRANSPARENT )
+ {
+ opacityType = Renderer::TRANSPARENT;
+ }
+ else
+ {
+ opacityType = Renderer::TRANSLUCENT;
+ }
break;
}
case BlendMode::AUTO:
bool shaderRequiresBlending( mShader->HintEnabled( Dali::Shader::Hint::OUTPUT_IS_TRANSPARENT ) );
if( shaderRequiresBlending || ( mTextureSet && mTextureSet->HasAlpha() ) )
{
- opacity = Renderer::TRANSLUCENT;
+ opacityType = Renderer::TRANSLUCENT;
}
- else // renderer should determine opacity using the actor color
+
+ // renderer should determine opacity using the actor color
+ float alpha = node.GetWorldColor( updateBufferIndex ).a * mOpacity[updateBufferIndex];
+ if( alpha <= FULLY_TRANSPARENT )
{
- float alpha = node.GetWorldColor( updateBufferIndex ).a;
- if( alpha <= FULLY_TRANSPARENT )
- {
- opacity = TRANSPARENT;
- }
- else if( alpha <= FULLY_OPAQUE )
- {
- opacity = TRANSLUCENT;
- }
+ opacityType = Renderer::TRANSPARENT;
+ }
+ else if( alpha <= FULLY_OPAQUE )
+ {
+ opacityType = Renderer::TRANSLUCENT;
}
break;
}
case BlendMode::OFF: // the renderer should never use blending
default:
{
- opacity = Renderer::OPAQUE;
+ opacityType = Renderer::OPAQUE;
break;
}
}
- return opacity;
+ return opacityType;
}
void Renderer::TextureSetChanged()
{
mRegenerateUniformMap = REGENERATE_UNIFORM_MAP;
- mResendFlag |= RESEND_DATA_PROVIDER;
+
+ UpdateTextureSet();
}
void Renderer::TextureSetDeleted()
mTextureSet = NULL;
mRegenerateUniformMap = REGENERATE_UNIFORM_MAP;
- mResendFlag |= RESEND_DATA_PROVIDER;
+
+ UpdateTextureSet();
}
+
void Renderer::ConnectionsChanged( PropertyOwner& object )
{
// One of our child objects has changed it's connections. Ensure the uniform
// map gets regenerated during PrepareRender
mRegenerateUniformMap = REGENERATE_UNIFORM_MAP;
-
- // Ensure the child object pointers get re-sent to the renderer
- mResendFlag |= RESEND_DATA_PROVIDER;
}
void Renderer::ConnectedUniformMapChanged()
#define DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/internal/update/common/property-owner.h>
#include <dali/internal/update/common/uniform-map.h>
#include <dali/internal/update/common/scene-graph-connection-change-propagator.h>
+#include <dali/internal/update/common/animatable-property.h>
#include <dali/internal/render/data-providers/render-data-provider.h>
#include <dali/internal/render/renderers/render-renderer.h>
{
public:
- enum Opacity
+ enum OpacityType
{
OPAQUE,
TRANSPARENT,
void SetFaceCullingMode( FaceCullingMode::Type faceCullingMode );
/**
+ * Get face culling mode
+ * @return The face culling mode
+ */
+ FaceCullingMode::Type GetFaceCullingMode() const;
+
+ /**
* Set the blending mode
* @param[in] blendingMode to use
*/
void SetBlendMode( BlendMode::Type blendingMode );
/**
+ * Get the blending mode
+ * @return The the blending mode
+ */
+ BlendMode::Type GetBlendMode() const;
+
+ /**
* Set the blending options. This should only be called from the update thread.
* @param[in] options A bitmask of blending options.
*/
void SetBlendingOptions( unsigned int options );
/**
+ * Get the blending options
+ * @return The the blending mode
+ */
+ unsigned int GetBlendingOptions() const;
+
+ /**
* Set the blend color for blending operation
* @param blendColor to pass to GL
*/
void SetBlendColor( const Vector4& blendColor );
/**
+ * Get the blending color
+ * @return The blend color
+ */
+ Vector4 GetBlendColor() const;
+
+ /**
* Set the index of first element for indexed draw
* @param[in] firstElement index of first element to draw
*/
void SetIndexedDrawFirstElement( size_t firstElement );
/**
+ * Get the index of first element for indexed draw
+ * @return The index of first element for indexed draw
+ */
+ size_t GetIndexedDrawFirstElement() const;
+
+ /**
* Set the number of elements to draw by indexed draw
* @param[in] elementsCount number of elements to draw
*/
void SetIndexedDrawElementsCount( size_t elementsCount );
/**
+ * Get the number of elements to draw by indexed draw
+ * @return The number of elements to draw by indexed draw
+ */
+ size_t GetIndexedDrawElementsCount() const;
+
+ /**
* @brief Set whether the Pre-multiplied Alpha Blending is required
* @param[in] preMultipled whether alpha is pre-multiplied.
*/
void EnablePreMultipliedAlpha( bool preMultipled );
/**
+ * @brief Query whether alpha is pre-multiplied.
+ * @return True is alpha is pre-multiplied, false otherwise.
+ */
+ bool IsPreMultipliedAlphaEnabled() const;
+
+ /**
* Sets the depth buffer write mode
* @param[in] depthWriteMode The depth buffer write mode
*/
void SetDepthWriteMode( DepthWriteMode::Type depthWriteMode );
/**
+ * Get the depth buffer write mode
+ * @return The depth buffer write mode
+ */
+ DepthWriteMode::Type GetDepthWriteMode() const;
+
+ /**
* Sets the depth buffer test mode
* @param[in] depthTestMode The depth buffer test mode
*/
void SetDepthTestMode( DepthTestMode::Type depthTestMode );
/**
+ * Get the depth buffer test mode
+ * @return The depth buffer test mode
+ */
+ DepthTestMode::Type GetDepthTestMode() const;
+
+ /**
* Sets the depth function
* @param[in] depthFunction The depth function
*/
void SetDepthFunction( DepthFunction::Type depthFunction );
/**
+ * Get the depth function
+ * @return The depth function
+ */
+ DepthFunction::Type GetDepthFunction() const;
+
+ /**
* Sets the render mode
* @param[in] mode The render mode
*/
void SetStencilOperationOnZPass( StencilOperation::Type stencilOperationOnZPass );
/**
+ * Gets the stencil parameters
+ * @return The stencil parameters
+ */
+ const Render::Renderer::StencilParameters& GetStencilParameters() const;
+
+ /**
+ * Bakes the opacity
+ * @param[in] updateBufferIndex The current update buffer index.
+ * @param[in] opacity The opacity
+ */
+ void BakeOpacity( BufferIndex updateBufferIndex, float opacity );
+
+ /**
+ * Gets the opacity
+ * @param[in] bufferIndex The buffer to read from.
+ * @return The opacity
+ */
+ float GetOpacity( BufferIndex updateBufferIndex ) const;
+
+ /**
* Prepare the object for rendering.
* This is called by the UpdateManager when an object is due to be rendered in the current frame.
* @param[in] updateBufferIndex The current update buffer index.
*/
void PrepareRender( BufferIndex updateBufferIndex );
- /*
+ /**
* Retrieve the Render thread renderer
* @return The associated render thread renderer
*/
* @param[in] updateBufferIndex The current update buffer index.
* @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
*/
- Opacity GetOpacity( BufferIndex updateBufferIndex, const Node& node ) const;
+ OpacityType GetOpacityType( BufferIndex updateBufferIndex, const Node& node ) const;
/**
* Called by the TextureSet to notify to the renderer that it has changed
Renderer();
/**
- * Helper function to create a new render data provider
- * @return the new (initialized) data provider
+ * Update texture set to the render data provider
*/
- RenderDataProvider* NewRenderDataProvider();
-
- /**
- * Helper function to retrieve the blend color.
- * @return The blend color.
- */
- const Vector4& GetBlendColor() const;
+ void UpdateTextureSet();
private:
CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps collected by the renderer
+
SceneController* mSceneController; ///< Used for initializing renderers
Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager)
TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned)
Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned)
Shader* mShader; ///< The shader this renderer uses. (Not owned)
+ RenderDataProvider* mRenderDataProvider; ///< The render data provider
OwnerPointer< Vector4 > mBlendColor; ///< The blend color for blending operation
Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
public:
+ AnimatableProperty< float > mOpacity; ///< The opacity value
int mDepthIndex; ///< Used only in PrepareRenderInstructions
};
new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation );
}
+inline void BakeOpacityMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity )
+{
+ typedef MessageDoubleBuffered1< Renderer, float > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+ new (slot) LocalType( &renderer, &Renderer::BakeOpacity, opacity );
+}
+
} // namespace SceneGraph
} // namespace Internal
} // namespace Dali