);
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(\n
-uniform lowp vec4 uColor;\n
+ uniform lowp vec4 uColor;\n
+ uniform lowp vec3 mixColor;\n
+ uniform lowp float opacity;\n
\n
void main()\n
{\n
- gl_FragColor = uColor;\n
+ gl_FragColor = uColor * vec4( mixColor, opacity );\n
}\n
);
}
-WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache )
+WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
{
- return new WireframeVisual( factoryCache );
+ Visual::BasePtr emtptyVisual;
+
+ return New(factoryCache, emtptyVisual, properties);
+}
+
+WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual )
+{
+ return new WireframeVisual( factoryCache, actualVisual );
+}
+
+WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual, const Property::Map& properties )
+{
+ WireframeVisualPtr wireframeVisual( new WireframeVisual( factoryCache, actualVisual ) );
+
+ // Instead of calling SetProperties, looking for the only valid property 'transform'
+ Property::Value* transformValue = properties.Find( DevelVisual::Property::TRANSFORM, TRANSFORM );
+ Property::Map transformMap;
+ if( transformValue && transformValue->Get( transformMap ) )
+ {
+ wireframeVisual->SetTransformAndSize( transformMap, Vector2::ZERO );
+ }
+
+ return wireframeVisual;
}
-WireframeVisual::WireframeVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache )
+WireframeVisual::WireframeVisual( VisualFactoryCache& factoryCache, Visual::BasePtr actualVisual )
+: Visual::Base( factoryCache ),
+ mActualVisual( actualVisual )
{
}
{
}
+float WireframeVisual::GetHeightForWidth( float width )
+{
+ if( mActualVisual )
+ {
+ return mActualVisual->GetHeightForWidth( width );
+ }
+ else
+ {
+ return Visual::Base::GetHeightForWidth( width );
+ }
+}
+
+void WireframeVisual::GetNaturalSize( Vector2& naturalSize )
+{
+ if( mActualVisual )
+ {
+ mActualVisual->GetNaturalSize( naturalSize );
+ }
+ else
+ {
+ Visual::Base::GetNaturalSize( naturalSize );
+ }
+}
+
+void WireframeVisual::DoCreatePropertyMap( Property::Map& map ) const
+{
+ if( mActualVisual )
+ {
+ mActualVisual->CreatePropertyMap( map );
+ }
+ else
+ {
+ map.Clear();
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::WIREFRAME );
+ }
+}
+
+void WireframeVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
+{
+ // Do nothing
+}
+
void WireframeVisual::DoSetProperties( const Property::Map& propertyMap )
{
- // no properties supported at the moment
+ Property::Value* mixValue = propertyMap.Find( Toolkit::DevelVisual::Property::MIX_COLOR, MIX_COLOR );
+ if( mixValue )
+ {
+ Vector4 mixColor;
+ mixValue->Get( mixColor );
+ SetMixColor( mixColor );
+ }
}
void WireframeVisual::DoSetOnStage( Actor& actor )
InitializeRenderer();
actor.AddRenderer( mImpl->mRenderer );
-}
-void WireframeVisual::DoCreatePropertyMap( Property::Map& map ) const
-{
- map.Clear();
- map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::WIREFRAME );
+ // Wireframe generated and ready to display
+ ResourceReady();
}
void WireframeVisual::InitializeRenderer()