//INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/renderers/renderer-factory-impl.h>
#include <dali-toolkit/internal/controls/renderers/renderer-factory-cache.h>
+#include <dali-toolkit/internal/controls/renderers/renderer-string-constants.h>
#include <dali-toolkit/internal/controls/renderers/control-renderer-data-impl.h>
namespace Dali
namespace
{
-const char * const RENDERER_TYPE("rendererType");
-const char * const RENDERER_TYPE_VALUE("colorRenderer");
-const char * const COLOR_NAME("blendColor");
+const char * const COLOR_NAME("mixColor");
const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
uniform lowp vec4 uColor;\n
- uniform lowp vec4 blendColor;\n
+ uniform lowp vec4 mixColor;\n
\n
void main()\n
{\n
- gl_FragColor = blendColor*uColor;\n
+ gl_FragColor = mixColor*uColor;\n
}\n
);
}
ColorRenderer::ColorRenderer( RendererFactoryCache& factoryCache )
: ControlRenderer( factoryCache ),
- mBlendColorIndex( Property::INVALID_INDEX )
+ mMixColorIndex( Property::INVALID_INDEX )
{
}
void ColorRenderer::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
Property::Value* color = propertyMap.Find( COLOR_NAME );
- if( !( color && color->Get(mBlendColor) ) )
+ if( !( color && color->Get(mMixColor) ) )
{
DALI_LOG_ERROR( "Fail to provide a color to the ColorRenderer object" );
}
void ColorRenderer::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, RENDERER_TYPE_VALUE );
- map.Insert( COLOR_NAME, mBlendColor );
+ map.Insert( RENDERER_TYPE, COLOR_RENDERER );
+ map.Insert( COLOR_NAME, mMixColor );
}
void ColorRenderer::InitializeRenderer()
mFactoryCache.SaveShader( RendererFactoryCache::COLOR_SHADER, shader );
}
- Material material = Material::New( shader );
- mImpl->mRenderer = Renderer::New( geometry, material );
+ mImpl->mRenderer = Renderer::New( geometry, shader );
- mBlendColorIndex = mImpl->mRenderer.RegisterProperty( COLOR_NAME, mBlendColor );
- if( mBlendColor.a < 1.f )
+ mMixColorIndex = mImpl->mRenderer.RegisterProperty( COLOR_NAME, mMixColor );
+ if( mMixColor.a < 1.f )
{
- mImpl->mRenderer.GetMaterial().SetBlendMode( BlendingMode::ON );
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
}
void ColorRenderer::SetColor(const Vector4& color)
{
- mBlendColor = color;
+ mMixColor = color;
if( mImpl->mRenderer )
{
- (mImpl->mRenderer).SetProperty( mBlendColorIndex, color );
- if( color.a < 1.f && (mImpl->mRenderer).GetMaterial().GetBlendMode() != BlendingMode::ON)
+ (mImpl->mRenderer).SetProperty( mMixColorIndex, color );
+ if( color.a < 1.f )
{
- (mImpl->mRenderer).GetMaterial().SetBlendMode( BlendingMode::ON );
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
}
}