/*
- * 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-toolkit/dali-toolkit.h>
#include <toolkit-text-utils.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
+#include <dali-toolkit/internal/visuals/color/color-visual.h>
#include <dummy-visual.h>
#include <../dali-toolkit/dali-toolkit-test-utils/dummy-control.h>
END_TEST;
}
+
+int UtcDaliVisualSetProperties(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "Register a visual and SetProperties" );
+
+ Toolkit::Internal::VisualFactoryCache* factoryCache = new Toolkit::Internal::VisualFactoryCache(false);
+
+ //Created ColorVisual
+ Property::Map propertyMap1;
+ propertyMap1.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap1.Insert(ColorVisual::Property::MIX_COLOR, Color::RED);
+ Toolkit::Internal::ColorVisualPtr colorVisualPtr = Toolkit::Internal::ColorVisual::New( *factoryCache, propertyMap1 );
+
+ DummyControl dummyControl = DummyControl::New( true );
+ Impl::DummyControl& dummyImpl = static_cast< Impl::DummyControl& >( dummyControl.GetImplementation() );
+
+ Toolkit::Visual::Base visualBaseHandle = Toolkit::Visual::Base( colorVisualPtr.Get() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visualBaseHandle );
+ dummyControl.SetSize( 200.f, 200.f );
+ Stage::GetCurrent().Add( dummyControl );
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::MIX_COLOR, Color::BLUE );
+
+ colorVisualPtr->SetProperties( propertyMap );
+ application.SendNotification();
+ application.Render();
+
+ Property::Map resultMap;
+ visualBaseHandle.CreatePropertyMap( resultMap );
+
+ Property::Value* colorValue = resultMap.Find( Visual::Property::MIX_COLOR, Property::VECTOR4 );
+ DALI_TEST_CHECK( colorValue );
+ DALI_TEST_CHECK( colorValue->Get< Vector4 >() == Color::BLUE );
+
+ delete factoryCache;
+
+ END_TEST;
+}
/*
- * 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.
application.SendNotification();
application.Render(0); // Ensure animation starts
application.Render(2000u); // Halfway point
- Vector4 testColor(1.0f, 0.0f, 0.5f, 0.75f );
+ Vector3 testColor( 1.0f, 0.0f, 0.5f );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor)), true, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a), true, TEST_LOCATION );
+ // uColor.a should be actor's alpha * mixColor.a.
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>( "uColor", Vector4( 0.5f, 0.5f, 0.5f, 0.75f ) ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>( "mixColor", testColor ), true, TEST_LOCATION );
application.Render(2000u); // Halfway point between blue and white
DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR)), true, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", TARGET_MIX_COLOR.a), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>( "uColor", Vector4( 1.0f, 1.0f, 1.0f, 0.5f ) ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>( "mixColor", Vector3( TARGET_MIX_COLOR ) ), true, TEST_LOCATION );
TestMixColor( visual, Visual::Property::MIX_COLOR, TARGET_MIX_COLOR );
DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
Renderer renderer = actor.GetRendererAt(0);
- tet_infoline("Test that the renderer has the opacity property");
- Property::Index index = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
- DALI_TEST_CHECK( index != Property::INVALID_INDEX );
-
-
Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
application.Render(2000u); // Halfway point through animation
application.SendNotification(); // Handle any signals
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.75f), true, TEST_LOCATION );
+ Vector4 color;
+ DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", color ) );
+ DALI_TEST_EQUALS( color.a, 0.75f, TEST_LOCATION );
application.Render(2001u); // end
application.SendNotification(); // ensure animation finished signal is sent
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 1.0f), true, TEST_LOCATION );
+ DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", color ) );
+ DALI_TEST_EQUALS( color.a, 1.0f, TEST_LOCATION );
blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
application.Render(2000u); // Halfway point
application.SendNotification();
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.55f), true, TEST_LOCATION );
+ Vector4 color;
+ DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", color ) );
+ DALI_TEST_EQUALS( color.a, 0.55f, TEST_LOCATION );
application.Render(2016u); // end
application.SendNotification();
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.1f), true, TEST_LOCATION );
+ DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", color ) );
+ DALI_TEST_EQUALS( color.a, 0.1f, TEST_LOCATION );
blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
/*
- * 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-toolkit-test-suite-utils.h>
#include <dali.h>
#include <dali/devel-api/object/handle-devel.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
Renderer renderer = actor.GetRendererAt(0);
Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
- Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
application.SendNotification();
application.Render(0);
DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
anim.Play();
application.Render(500); // Halfway thru anim
application.SendNotification();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
application.Render(500); // End of anim
application.SendNotification();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::RED), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
END_TEST;
}
Renderer renderer = actor.GetRendererAt(0);
Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
- Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
application.SendNotification();
application.Render(0);
DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
anim.Play();
application.Render(500); // Halfway thru anim
application.SendNotification();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION);
application.Render(500); // End of anim
application.SendNotification();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::RED), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
Renderer renderer = actor.GetRendererAt(0);
Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, PrimitiveVisual::Property::MIX_COLOR );
- Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
application.SendNotification();
application.Render(0);
DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
anim.Play();
application.Render(500); // Halfway thru anim
application.SendNotification();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA+Color::RED)*0.5f, TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION);
application.Render(500); // End of anim
application.SendNotification();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::RED), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
Renderer renderer = actor.GetRendererAt(0);
Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
- Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
application.SendNotification();
application.Render(0);
DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 0.0f, 0.001f, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::BLEND_MODE), (int)BlendMode::ON, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.0f, 0.001f, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
anim.Play();
application.Render(500); // Halfway thru anim
application.SendNotification();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 0.5f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.5f, 0.001f, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
application.Render(501); // End of anim
application.SendNotification();
+ application.Render();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::AUTO, TEST_LOCATION );
END_TEST;
Renderer renderer = actor.GetRendererAt(0);
Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
- Property::Index opacityIndex = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
application.SendNotification();
application.Render(0);
DALI_TEST_EQUALS( renderer.GetProperty<Vector3>(mixColorIndex), Vector3(Color::MAGENTA), TEST_LOCATION);
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetProperty<float>(opacityIndex), 1.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 1.0f, 0.001f, TEST_LOCATION );
// Note, This should be testing for AUTO
// this is the same problem as C# target value being set before Play is called.
application.Render(500); // Halfway thru anim
application.SendNotification();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 0.5f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.5f, 0.001f, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
application.Render(500); // End of anim
application.SendNotification();
DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector3 >( mixColorIndex ), Vector3(Color::MAGENTA), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( opacityIndex ), 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetCurrentProperty< float >( DevelRenderer::Property::OPACITY ), 0.0f, 0.001f, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetCurrentProperty< int >( Renderer::Property::BLEND_MODE ), (int)BlendMode::ON, TEST_LOCATION );
END_TEST;
Renderer renderer = actor.GetRendererAt(0);
Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
- Property::Index opacityIdx = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
tet_printf( "Test that the property has been set to target value\n");
DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(renderer.GetProperty<float>(opacityIdx), 1.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001, TEST_LOCATION);
END_TEST;
}
Renderer renderer = actor.GetRendererAt(0);
Property::Index mixColorIdx = DevelHandle::GetPropertyIndex( renderer, ColorVisual::Property::MIX_COLOR );
- Property::Index opacityIdx = DevelHandle::GetPropertyIndex( renderer, Visual::Property::OPACITY );
tet_printf( "Test that the property has been set to target value\n");
DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(mixColorIdx), Vector3(Color::RED), 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(renderer.GetProperty<float>(opacityIdx), 1.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetProperty<float>( DevelRenderer::Property::OPACITY ), 1.0f, 0.001, TEST_LOCATION);
END_TEST;
}
Property::Map map;
map["target"] = "testVisual";
map["property"] = "mixColor";
- map["targetValue"] = Vector4(1,1,1,0);
+ map["targetValue"] = Vector4(1,1,1,0.1);
map["animator"] = Property::Map()
.Add("alphaFunction", "LINEAR")
.Add("timePeriod", Property::Map()
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("borderColor", testColor ), true, TEST_LOCATION );
color = renderer.GetCurrentProperty< Vector3 >( mixColorIndex );
- testColor = Vector4( 1,1,1,0.4f );
+ testColor = Vector4( 1,1,1,0.45f );
DALI_TEST_EQUALS( Vector3(color), Vector3(testColor), 0.0001f, TEST_LOCATION );
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor) ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a ) , true, TEST_LOCATION );
+
+ Vector4 uColor;
+ DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", uColor ) );
+ DALI_TEST_EQUALS( uColor.a, testColor.a, TEST_LOCATION );
application.Render(2000u);
DALI_TEST_EQUALS( color, Color::WHITE, TEST_LOCATION );
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("borderColor", Color::WHITE ), true, TEST_LOCATION );
- color = renderer.GetCurrentProperty< Vector4 >( mixColorIndex );
- testColor = Vector4(1,1,1,0);
- DALI_TEST_EQUALS( color, testColor, TEST_LOCATION );
+ color = renderer.GetCurrentProperty< Vector3 >( mixColorIndex );
+ testColor = Vector4(1,1,1,0.1);
+ DALI_TEST_EQUALS( Vector3(color), Vector3(testColor), TEST_LOCATION );
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor) ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a ), true, TEST_LOCATION );
+
+ DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue< Vector4 >( "uColor", uColor ) );
+ DALI_TEST_EQUALS( uColor.a, testColor.a, TEST_LOCATION );
END_TEST;
}
application.Render(2000u); // halfway point
application.SendNotification();
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
-
Vector4 halfwayColor = (INITIAL_MIX_COLOR + TARGET_MIX_COLOR)*0.5;
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, halfwayColor.a )), true, TEST_LOCATION );
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(halfwayColor) ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", halfwayColor.a ), true, TEST_LOCATION );
application.Render(2001u); // go past end
application.SendNotification(); // Trigger signals
DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4( 1.0f, 1.0f, 1.0f, TARGET_MIX_COLOR.a ) ), true, TEST_LOCATION );
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR) ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", TARGET_MIX_COLOR.a ), true, TEST_LOCATION );
blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
/*
- * 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.
TestVisualRender( application, actor, visual );
Vector3 actualValue(Vector4::ZERO);
- float opacity=0.0f;
+ Vector4 actualColor(Vector4::ZERO);
TestGlAbstraction& gl = application.GetGlAbstraction();
DALI_TEST_CHECK( gl.GetUniformValue<Vector3>( "mixColor", actualValue ) );
- DALI_TEST_CHECK( gl.GetUniformValue<float>( "opacity", opacity ) );
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uColor", actualColor ) );
DALI_TEST_EQUALS( actualValue, Vector3(testColor), TEST_LOCATION );
- DALI_TEST_EQUALS( opacity, testColor.a, TEST_LOCATION );
+ DALI_TEST_EQUALS( actualColor.a, testColor.a, TEST_LOCATION );
END_TEST;
}
TestVisualRender( application, actor, visual );
Vector3 actualValue;
- float opacity;
+ Vector4 actualColor;
TestGlAbstraction& gl = application.GetGlAbstraction();
DALI_TEST_CHECK( gl.GetUniformValue<Vector3>( "mixColor", actualValue ) );
- DALI_TEST_CHECK( gl.GetUniformValue<float>( "opacity", opacity ) );
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uColor", actualColor ) );
DALI_TEST_EQUALS( actualValue, Vector3(testColor), TEST_LOCATION );
- DALI_TEST_EQUALS( opacity, testColor.a, TEST_LOCATION );
+ DALI_TEST_EQUALS( actualColor.a, testColor.a, TEST_LOCATION );
Stage::GetCurrent().Remove(actor);
DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
/*
- * 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.
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
\n
void main()\n
{\n
- gl_FragColor = vec4(mixColor, opacity)*uColor;\n
+ gl_FragColor = vec4(mixColor, 1.0)*uColor;\n
}\n
);
/*
- * 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.
uniform sampler2D sTexture;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- \n
void main()\n
{\n
if ( vTexCoord.y > 1.0 )\n
mediump vec4 textTexture = texture2D( sTexture, vTexCoord );\n
textTexture.rgb *= mix( 1.0, textTexture.a, preMultipliedAlpha );\n
\n
- gl_FragColor = textTexture * uColor * visualMixColor();
+ gl_FragColor = textTexture * uColor * vec4( mixColor, 1.0 );
}\n
);
uniform lowp vec4 uColor;\n
uniform lowp vec4 borderColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
\n
void main()\n
{\n
- gl_FragColor = vec4(mixColor, opacity)*borderColor*uColor;\n
+ gl_FragColor = vec4(mixColor, 1.0)*borderColor*uColor;\n
}\n
);
uniform lowp vec4 uColor;\n
uniform lowp vec4 borderColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform mediump float borderSize;\n
varying mediump float vAlpha;\n
\n
void main()\n
{\n
- gl_FragColor = vec4(mixColor, opacity)*borderColor*uColor;\n
+ gl_FragColor = vec4(mixColor, 1.0)*borderColor*uColor;\n
gl_FragColor.a *= smoothstep(0.0, 1.5, vAlpha)*smoothstep( borderSize+1.5, borderSize, vAlpha );\n
}\n
);
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
\n
void main()\n
{\n
- gl_FragColor = vec4(mixColor, opacity)*uColor;\n
+ gl_FragColor = vec4(mixColor, 1.0)*uColor;\n
}\n
);
}
uniform sampler2D sTexture;\n // sampler1D?
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
varying mediump vec2 vTexCoord;\n
\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * vec4(mixColor*opacity, opacity) * uColor;\n
+ gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * vec4(mixColor, 1.0) * uColor;\n
}\n
),
uniform sampler2D sTexture;\n // sampler1D?
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
varying mediump vec2 vTexCoord;\n
\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * vec4(mixColor*opacity, opacity) * uColor;\n
+ gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * vec4(mixColor, 1.0) * uColor;\n
}\n
)
};
uniform sampler2D sTexture;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4( mixColor, 1.0 );\n
}\n
);
uniform mediump vec4 uAtlasRect;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- \n
void main()\n
{\n
mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
- gl_FragColor = texture2D( sTexture, texCoord ) * uColor * visualMixColor();\n
+ gl_FragColor = texture2D( sTexture, texCoord ) * uColor * vec4( mixColor, 1.0 );\n
}\n
);
uniform lowp vec2 wrapMode;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
mediump float wrapCoordinate( mediump vec2 range, mediump float coordinate, lowp float wrap )\n
return clamp( mix(range.x, range.y, coord), range.x, range.y );
}\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- \n
void main()\n
{\n
mediump vec2 texCoord = vec2( wrapCoordinate( uAtlasRect.xz, vTexCoord.x, wrapMode.x ),
wrapCoordinate( uAtlasRect.yw, vTexCoord.y, wrapMode.y ) );\n
- gl_FragColor = texture2D( sTexture, texCoord ) * uColor * visualMixColor();\n
+ gl_FragColor = texture2D( sTexture, texCoord ) * uColor * vec4( mixColor, 1.0 );\n
}\n
);
varying mediump vec3 vIllumination;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
void main()\n
{\n
- gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a ) * visualMixColor();\n
+ gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a ) * vec4( mixColor, 1.0 );\n
}\n
);
uniform sampler2D sDiffuse;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
void main()\n
{\n
vec4 texture = texture2D( sDiffuse, vTexCoord );\n
- vec4 visualMixColor = visualMixColor();\n
+ vec4 visualMixColor = vec4( mixColor, 1.0 );\n
gl_FragColor = vec4( vIllumination.rgb * texture.rgb * uColor.rgb * visualMixColor.rgb + vSpecular * 0.3, texture.a * uColor.a * visualMixColor.a );\n
}\n
);
uniform sampler2D sGloss;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
void main()\n
{\n
vec4 texture = texture2D( sDiffuse, vTexCoord );\n
vec3 normal = normalize( texture2D( sNormal, vTexCoord ).xyz * 2.0 - 1.0 );\n
vec4 glossMap = texture2D( sGloss, vTexCoord );\n
- vec4 visualMixColor = visualMixColor();\n
+ vec4 visualMixColor = vec4( mixColor, 1.0 );\n
float lightDiffuse = max( 0.0, dot( normal, normalize( vLightDirection ) ) );\n
lightDiffuse = lightDiffuse * 0.5 + 0.5;\n
uniform sampler2D sTexture;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
+ \n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4( mixColor, 1.0 );\n
}\n
);
uniform sampler2D sMask;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
uniform mediump float auxiliaryImageAlpha;\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
+ \n
void main()\n
{\n
// Where mask image is transparent, all of background image must show through.
mediump vec3 mixedColor = color.rgb * mix( 1.0-mask.a, 1.0, 1.0-auxiliaryImageAlpha)
+ mask.rgb*mask.a * auxiliaryImageAlpha;\n
- gl_FragColor = vec4(mixedColor,1.0) * uColor * visualMixColor();\n
+ gl_FragColor = vec4(mixedColor,1.0) * uColor * vec4( mixColor, 1.0 );\n
}\n
);
varying mediump vec3 vIllumination;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
void main()\n
{\n
- vec4 baseColor = vec4(mixColor, opacity) * uColor;\n
+ vec4 baseColor = vec4(mixColor, 1.0) * uColor;\n
gl_FragColor = vec4( vIllumination.rgb * baseColor.rgb, baseColor.a );\n
}\n
);
// EXTERNAL INCLUDES
#include <dali/public-api/animation/constraints.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
// INTERNAL HEADER
uniform mediump vec4 uAtlasRect;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- \n
void main()\n
{\n
mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
mediump float textTexture = texture2D( sTexture, texCoord ).r;\n
// Set the color of the text to what it is animated to.
- gl_FragColor = uTextColorAnimatable * textTexture * uColor * visualMixColor();
+ gl_FragColor = uTextColorAnimatable * textTexture * uColor * vec4( mixColor, 1.0 );
}\n
);
uniform mediump vec4 uAtlasRect;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- \n
void main()\n
{\n
mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
mediump vec4 textTexture = texture2D( sTexture, texCoord );\n
textTexture.rgb *= mix( 1.0, textTexture.a, preMultipliedAlpha );\n
- gl_FragColor = textTexture * uColor * visualMixColor();
+ gl_FragColor = textTexture * uColor * vec4( mixColor, 1.0 );
}\n
);
uniform mediump vec4 uAtlasRect;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- \n
void main()\n
{\n
mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
mediump vec4 styleTexture = texture2D( sStyle, texCoord );\n
// Draw the text as overlay above the style
- gl_FragColor = ( uTextColorAnimatable * textTexture + styleTexture * ( 1.0 - textTexture ) ) * uColor * visualMixColor();\n
+ gl_FragColor = ( uTextColorAnimatable * textTexture + styleTexture * ( 1.0 - textTexture ) ) * uColor * vec4( mixColor, 1.0 );\n
}\n
);
uniform mediump vec4 uAtlasRect;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- \n
void main()\n
{\n
mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
textTexture.rgb *= mix( 1.0, textTexture.a, preMultipliedAlpha );\n
// Draw the text as overlay above the style
- gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * visualMixColor();\n
+ gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * vec4( mixColor, 1.0 );\n
}\n
);
uniform mediump vec4 uAtlasRect;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- \n
void main()\n
{\n
mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture ) * mix( 1.0, textTexture.a, preMultipliedAlpha );\n
// Draw the text as overlay above the style
- gl_FragColor = textTexture * uColor * visualMixColor();\n
+ gl_FragColor = textTexture * uColor * vec4( mixColor, 1.0 );\n
}\n
);
uniform mediump vec4 uAtlasRect;\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
uniform lowp float preMultipliedAlpha;\n
\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
- }\n
- \n
void main()\n
{\n
mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) ) * mix( 1.0, textTexture.a, preMultipliedAlpha );\n
// Draw the text as overlay above the style
- gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * visualMixColor();\n
+ gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * vec4( mixColor, 1.0 );\n
}\n
);
return result;
}
+void OpacityConstraint( float& current, const PropertyInputContainer& inputs )
+{
+ current = inputs[0]->GetVector4().a;
+}
+
} // unnamed namespace
TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
// Create constraint for the animatable text's color Property with uTextColorAnimatable in the renderer.
if( shaderTextColorIndex != Property::INVALID_INDEX )
{
- Constraint constraint = Constraint::New<Vector4>( mImpl->mRenderer, shaderTextColorIndex, EqualToConstraint() );
- constraint.AddSource( Source( actor, mAnimatableTextColorPropertyIndex ) );
- constraint.Apply();
+ Constraint colorConstraint = Constraint::New<Vector4>( mImpl->mRenderer, shaderTextColorIndex, EqualToConstraint() );
+ colorConstraint.AddSource( Source( actor, mAnimatableTextColorPropertyIndex ) );
+ colorConstraint.Apply();
+
+ Constraint opacityConstraint = Constraint::New< float >( mImpl->mRenderer, Dali::DevelRenderer::Property::OPACITY, OpacityConstraint );
+ opacityConstraint.AddSource( Source( actor, mAnimatableTextColorPropertyIndex ) );
+ opacityConstraint.Apply();
}
}
mControlSize( Vector2::ZERO ),
mDepthIndex( 0.0f ),
mMixColorIndex( Property::INVALID_INDEX ),
- mOpacityIndex( Property::INVALID_INDEX ),
mFittingMode( fittingMode ),
mFlags( 0 ),
mResourceStatus( Toolkit::Visual::ResourceStatus::PREPARING )
Size mControlSize;
int mDepthIndex;
Property::Index mMixColorIndex;
- Property::Index mOpacityIndex;
FittingMode mFittingMode; //< How the contents should fit the view
int mFlags;
Toolkit::Visual::ResourceStatus mResourceStatus;
#include <dali/public-api/common/dali-common.h>
#include <dali/devel-api/object/handle-devel.h>
#include <dali/devel-api/scripting/enum-helper.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/integration-api/debug.h>
//INTERNAL HEARDER
{
DoSetOffStage( actor );
mImpl->mMixColorIndex = Property::INVALID_INDEX;
- mImpl->mOpacityIndex = Property::INVALID_INDEX;
mImpl->mFlags &= ~Impl::IS_ON_STAGE;
}
}
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
- if( mImpl->mOpacityIndex == Property::INVALID_INDEX )
- {
- mImpl->mOpacityIndex = DevelHandle::RegisterProperty(
- mImpl->mRenderer,
- Toolkit::Visual::Property::OPACITY,
- OPACITY,
- mImpl->mMixColor.a );
- }
+ mImpl->mRenderer.SetProperty( DevelRenderer::Property::OPACITY, mImpl->mMixColor.a );
float preMultipliedAlpha = 0.0f;
if( IsPreMultipliedAlphaEnabled() )
if( mImpl->mRenderer )
{
mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, Vector3(color) );
- mImpl->mRenderer.SetProperty( mImpl->mOpacityIndex, color.a );
+ mImpl->mRenderer.SetProperty( DevelRenderer::Property::OPACITY, color.a );
if( color.a < 1.f )
{
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
Dali::Animation& transition,
Internal::TransitionData::Animator& animator )
{
- Property::Index index = mImpl->mOpacityIndex;
-
bool isOpaque = mImpl->mMixColor.a >= 1.0f;
- if( index != Property::INVALID_INDEX )
+ float initialOpacity;
+ if( animator.initialValue.Get( initialOpacity ) )
{
- float initialOpacity;
- if( animator.initialValue.Get( initialOpacity ) )
- {
- isOpaque = (initialOpacity >= 1.0f);
- }
-
- float targetOpacity;
- if( animator.targetValue.Get( targetOpacity ) )
- {
- mImpl->mMixColor.a = targetOpacity;
- }
+ isOpaque = (initialOpacity >= 1.0f);
+ }
- SetupTransition( transition, animator, index, animator.initialValue, animator.targetValue );
- SetupBlendMode( transition, isOpaque, animator.animate );
+ float targetOpacity;
+ if( animator.targetValue.Get( targetOpacity ) )
+ {
+ mImpl->mMixColor.a = targetOpacity;
}
+
+ SetupTransition( transition, animator, DevelRenderer::Property::OPACITY, animator.initialValue, animator.targetValue );
+ SetupBlendMode( transition, isOpaque, animator.animate );
}
void Visual::Base::AnimateRendererProperty(
SetupTransition( transition, animator, index, initialMixColor, targetMixColor );
if( animateOpacity )
{
- SetupTransition( transition, animator, mImpl->mOpacityIndex, initialOpacity, targetOpacity );
+ SetupTransition( transition, animator, DevelRenderer::Property::OPACITY, initialOpacity, targetOpacity );
SetupBlendMode( transition, isOpaque, animator.animate );
}
}
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(\n
uniform lowp vec4 uColor;\n
uniform lowp vec3 mixColor;\n
- uniform lowp float opacity;\n
\n
void main()\n
{\n
- gl_FragColor = uColor * vec4( mixColor, opacity );\n
+ gl_FragColor = uColor * vec4( mixColor, 1.0 );\n
}\n
);