#include <dali/public-api/object/property-array.h>
#include <dali/devel-api/scripting/enum-helper.h>
#include <dali/devel-api/scripting/scripting.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
uniform highp mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
+ uniform highp vec3 uSize;\n
uniform mediump mat3 uAlignmentMatrix;\n
varying mediump vec2 vTexCoord;\n
\n
//Visual size and offset
uniform mediump vec2 offset;\n
- uniform mediump vec2 size;\n
+ uniform highp vec2 size;\n
uniform mediump vec4 offsetSizeMode;\n
uniform mediump vec2 origin;\n
uniform mediump vec2 anchorPoint;\n
DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
uniform highp mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
+ uniform highp vec3 uSize;\n
uniform mediump mat3 uAlignmentMatrix;\n
varying mediump vec2 vTexCoord;\n
\n
//Visual size and offset
uniform mediump vec2 offset;\n
- uniform mediump vec2 size;\n
+ uniform highp vec2 size;\n
uniform mediump vec4 offsetSizeMode;\n
uniform mediump vec2 origin;\n
uniform mediump vec2 anchorPoint;\n
DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
uniform highp mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
+ uniform highp vec3 uSize;\n
uniform mediump mat3 uAlignmentMatrix;\n
varying mediump vec2 vTexCoord;\n
varying mediump vec2 vPosition;\n
\n
//Visual size and offset
uniform mediump vec2 offset;\n
- uniform mediump vec2 size;\n
+ uniform highp vec2 size;\n
uniform mediump vec4 offsetSizeMode;\n
uniform mediump vec2 origin;\n
uniform mediump vec2 anchorPoint;\n
DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
uniform highp mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
+ uniform highp vec3 uSize;\n
uniform mediump mat3 uAlignmentMatrix;\n
varying mediump vec2 vTexCoord;\n
varying mediump vec2 vPosition;\n
\n
//Visual size and offset
uniform mediump vec2 offset;\n
- uniform mediump vec2 size;\n
+ uniform highp vec2 size;\n
uniform mediump vec4 offsetSizeMode;\n
uniform mediump vec2 origin;\n
uniform mediump vec2 anchorPoint;\n
}
}
-void GradientVisual::DoSetOnStage( Actor& actor )
+void GradientVisual::DoSetOnScene( Actor& actor )
{
InitializeRenderer();
ResourceReady( Toolkit::Visual::ResourceStatus::READY );
}
+void GradientVisual::UpdateShader()
+{
+ if(mImpl->mRenderer)
+ {
+ Shader shader = GetShader();
+ mImpl->mRenderer.SetShader(shader);
+ }
+}
+
void GradientVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
void GradientVisual::InitializeRenderer()
{
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
-
- Toolkit::GradientVisual::Units::Type gradientUnits = mGradient->GetGradientUnits();
- int roundedCorner = IsRoundedCornerRequired() ? 1 : 0;
- VisualFactoryCache::ShaderType shaderType = SHADER_TYPE_TABLE[mGradientType][gradientUnits + roundedCorner * 2];
- Shader shader = mFactoryCache.GetShader( shaderType );
- if( !shader )
- {
- shader = Shader::New( VERTEX_SHADER[gradientUnits + roundedCorner * 2], FRAGMENT_SHADER[ mGradientType + roundedCorner * 2 ] );
- mFactoryCache.SaveShader( shaderType, shader );
- }
+ Shader shader = GetShader();
//Set up the texture set
TextureSet textureSet = TextureSet::New();
mImpl->mRenderer = Renderer::New( geometry, shader );
mImpl->mRenderer.SetTextures( textureSet );
- // If opaque then no need to have blending
+ // If opaque and then no need to have blending
if( mIsOpaque )
{
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
return true;
}
+Shader GradientVisual::GetShader()
+{
+ Toolkit::GradientVisual::Units::Type gradientUnits = mGradient->GetGradientUnits();
+ int roundedCorner = IsRoundedCornerRequired() ? 1 : 0;
+ VisualFactoryCache::ShaderType shaderType = SHADER_TYPE_TABLE[mGradientType][gradientUnits + roundedCorner * 2];
+ Shader shader = mFactoryCache.GetShader(shaderType);
+ if(!shader)
+ {
+ shader = Shader::New(VERTEX_SHADER[gradientUnits + roundedCorner * 2], FRAGMENT_SHADER[mGradientType + roundedCorner * 2]);
+ mFactoryCache.SaveShader(shaderType, shader);
+ }
+
+ return shader;
+}
+
void GradientVisual::GetStopOffsets(const Property::Value* value, Vector<float>& stopOffsets)
{
}
case Property::ARRAY:
{
- Property::Array* offsetArray = value->GetArray();
+ const Property::Array* offsetArray = value->GetArray();
if( offsetArray )
{
unsigned int numStop = offsetArray->Count();