/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
// INTERNAL INCLUDES
#include <dali/internal/event/actors/renderable-actor-impl.h>
+#include <dali/internal/event/effects/shader-effect-impl.h>
namespace Dali
{
{
}
+RenderableActor::RenderableActor(const RenderableActor& copy)
+: Actor(copy)
+{
+}
+
+RenderableActor& RenderableActor::operator=(const RenderableActor& rhs)
+{
+ BaseHandle::operator=(rhs);
+ return *this;
+}
+
void RenderableActor::SetSortModifier(float modifier)
{
GetImplementation(*this).SetSortModifier(modifier);
return GetImplementation(*this).GetBlendMode();
}
-void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba )
-{
- GetImplementation(*this).SetBlendFunc( srcFactorRgba, destFactorRgba );
-}
-
void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb,
BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha )
{
GetImplementation(*this).GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
}
-void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgba )
+void RenderableActor::SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter )
{
- GetImplementation(*this).SetBlendEquation( equationRgba );
+ GetImplementation(*this).SetFilterMode( minFilter, magFilter );
}
-void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha )
+void RenderableActor::GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter ) const
{
- GetImplementation(*this).SetBlendEquation( equationRgb, equationAlpha );
+ GetImplementation(*this).GetFilterMode( minFilter, magFilter );
}
-void RenderableActor::GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const
+void RenderableActor::SetShaderEffect(ShaderEffect effect)
{
- GetImplementation(*this).GetBlendEquation( equationRgb, equationAlpha );
+ GetImplementation(*this).SetShaderEffect(GetImplementation(effect));
}
-void RenderableActor::SetBlendColor( const Vector4& color )
+ShaderEffect RenderableActor::GetShaderEffect() const
{
- GetImplementation(*this).SetBlendColor( color );
+ Internal::ShaderEffectPtr internal = GetImplementation(*this).GetShaderEffect();
+
+ return ShaderEffect(internal.Get());
}
-const Vector4& RenderableActor::GetBlendColor() const
+void RenderableActor::RemoveShaderEffect()
{
- return GetImplementation(*this).GetBlendColor();
+ GetImplementation(*this).RemoveShaderEffect();
}
RenderableActor::RenderableActor(Internal::RenderableActor* internal)
{
}
+void SetShaderEffectRecursively( Actor actor, ShaderEffect effect )
+{
+ // only do something if the actor and effect are valid
+ if( actor && effect )
+ {
+ // first remove from this actor
+ RenderableActor renderable = RenderableActor::DownCast( actor );
+ if( renderable )
+ {
+ renderable.SetShaderEffect( effect );
+ }
+ // then all children recursively
+ const unsigned int count = actor.GetChildCount();
+ for( unsigned int index = 0; index < count; ++index )
+ {
+ Actor child( actor.GetChildAt( index ) );
+ SetShaderEffectRecursively( child, effect );
+ }
+ }
+}
+
+void RemoveShaderEffectRecursively( Actor actor )
+{
+ // only do something if the actor is valid
+ if( actor )
+ {
+ // first remove from this actor
+ RenderableActor renderable = RenderableActor::DownCast( actor );
+ if( renderable )
+ {
+ renderable.RemoveShaderEffect();
+ }
+ // then all children recursively
+ const unsigned int count = actor.GetChildCount();
+ for( unsigned int index = 0; index < count; ++index )
+ {
+ Actor child( actor.GetChildAt( index ) );
+ RemoveShaderEffectRecursively( child );
+ }
+ }
+}
+
} // namespace Dali