// special field 'effect' references the shader effect instances
if(key == "effect")
{
- Actor actor = Actor::DownCast(handle);
- OptionalString s = constant.IsString( keyChild.second );
- if(actor && s)
+ RenderableActor actor = RenderableActor::DownCast(handle);
+ if( actor )
{
- ShaderEffect e = GetShaderEffect(*s, constant);
- actor.SetShaderEffect(e);
+ OptionalString str = constant.IsString( keyChild.second );
+ if( str )
+ {
+ ShaderEffect effect = GetShaderEffect( *str, constant );
+ actor.SetShaderEffect(effect);
+ }
}
else
{
if( Property::INVALID_INDEX == index )
{
- Actor actor = Actor::DownCast(propertyObject);
+ RenderableActor actor = RenderableActor::DownCast(handle);
if( actor )
{
if( ShaderEffect effect = actor.GetShaderEffect() )
{
mHighlightMeshActor = MeshActor::New( mTextHighlight.CreateHighLightMesh() );
mHighlightMeshActor.SetName( "HighlightMeshActor" );
- mHighlightMeshActor.SetInheritShaderEffect( false );
mHighlightMeshActor.SetAffectedByLighting(false);
parent.Add( mHighlightMeshActor );
}
mHighlightMeshActor = MeshActor::New( mHighlightMesh );
mHighlightMeshActor.SetName( "HighlightMeshActor" );
- mHighlightMeshActor.SetInheritShaderEffect( false );
mHighlightMeshActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
// clear the resources created for the off screen rendering
void BubbleEmitter::OnRenderFinished(RenderTask& source)
{
- Actor sourceActor = source.GetSourceActor();
- sourceActor.RemoveShaderEffect();
+ Actor sourceActor = source.GetSourceActor();
+ if( sourceActor )
+ {
+ RenderableActor renderable = RenderableActor::DownCast( sourceActor );
+ if( renderable )
+ {
+ renderable.RemoveShaderEffect();
+ }
+ }
Stage::GetCurrent().Remove(sourceActor);
- sourceActor.Reset();
Stage::GetCurrent().GetRenderTaskList().RemoveTask(source);
}
mImageActor.SetImage( image );
DistanceFieldEffect effect = DistanceFieldEffect::New();
- Self().SetShaderEffect( effect );
+ mImageActor.SetShaderEffect( effect );
}
void ImageView::SetImage(Image image)
}
}
-void PageTurnLandscapeView::SetSpineEffect(Actor actor, bool isLeftSide)
+void PageTurnLandscapeView::SetSpineEffect(ImageActor actor, bool isLeftSide)
{
if(isLeftSide)
{
/**
* @copydoc PageTurnView::SetSpineEffect
*/
- virtual void SetSpineEffect(Actor actor, bool isLeftSide);
+ virtual void SetSpineEffect(ImageActor actor, bool isLeftSide);
private:
}
}
-void PageTurnPortraitView::SetSpineEffect(Actor actor, bool isLeftSide)
+void PageTurnPortraitView::SetSpineEffect(ImageActor actor, bool isLeftSide)
{
if(isLeftSide)
{
// There is previous page and an outwards flick is detected
if( mCurrentPageIndex > 0 && gestureSpeed > GESTURE_SPEED_THRESHOLD && offset.x > fabs( offset.y ))
{
- Actor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ];
+ ImageActor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ];
if(actor.GetParent() != mRootOnScreen)
{
return;
/**
* @copydoc PageTurnView::SetSpineEffect
*/
- virtual void SetSpineEffect(Actor actor, bool isLeftSide);
+ virtual void SetSpineEffect(ImageActor actor, bool isLeftSide);
/**
* @copydoc PageTurnView::OnPossibleOutwardsFlick
mPagePanFinishedSignal.Emit( handle );
- Actor actor = mPanActor;
+ ImageActor actor = mPanActor;
if(mPress)
{
if(!mConstraints) // if with constraints, the pan finished position is near spine, set up an animation to turn the page over
void PageTurnView::TurnedOver( Animation& animation )
{
- Actor actor = mAnimationActorPair[animation];
+ ImageActor actor = mAnimationActorPair[animation];
mIsTurnBack[actor] = !mIsTurnBack[actor];
actor.RemoveConstraints();
mRootOnScreen.Add(actor);
void PageTurnView::SliddenBack( Animation& animation )
{
- Actor actor = mAnimationActorPair[animation];
+ ImageActor actor = mAnimationActorPair[animation];
mRootOnScreen.Add(actor);
int index = mAnimationIndexPair[animation];
mIsSliding[index] = false;
}
}
-void PageTurnView::SetShaderEffect( Actor actor, ShaderEffect shaderEffect )
+void PageTurnView::SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect )
{
- actor.SetShaderEffect( shaderEffect );
-
- if( actor.GetChildCount() > 0 )
- {
- actor.GetChildAt( 0 ).SetShaderEffect(shaderEffect);
- }
+ SetShaderEffectRecursively( actor, shaderEffect );
}
Toolkit::PageTurnView::PageTurnSignal& PageTurnView::PageTurnStartedSignal()
* @param[in] actor The actor which the shader effect would be applied onto
* @param[in] shaderEffect The shader effect to be set to the actor
*/
- void SetShaderEffect( Actor actor, ShaderEffect shaderEffect );
+ void SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect );
private:
* @param[in] actor The current page actor
* @param[in] isLeftSide Which side the current page is located
*/
- virtual void SetSpineEffect(Actor actor, bool isLeftSide) = 0;
+ virtual void SetSpineEffect(ImageActor actor, bool isLeftSide) = 0;
/**
* This method is called when pan finished to detect outwards flick
std::vector<ImageActor> mPageActors; ///< The vector of pages on stage
int mCurrentPageIndex; ///< The index of the current page, between 0 ~ mTotalPageCount-1
- std::map<Actor,bool> mIsTurnBack; ///< The map to keep track the page actor's turning direction
- std::map<Animation, Actor> mAnimationActorPair; ///< The map to keep track which page actor is the animation act on
+ std::map<ImageActor,bool> mIsTurnBack; ///< The map to keep track the page actor's turning direction
+ std::map<Animation,ImageActor> mAnimationActorPair; ///< The map to keep track which page actor is the animation act on
std::map<Animation, int> mAnimationIndexPair; ///< The map to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the animation
int mIndex; ///< The index to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the current panning page
std::vector<bool> mIsAnimating; ///< The boolean vector to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is available for using
{
}
-MotionBlurEffect MotionBlurEffect::Apply( Actor handle )
+MotionBlurEffect MotionBlurEffect::Apply( RenderableActor renderable )
{
MotionBlurEffect newEffect = New( MOTION_BLUR_NUM_SAMPLES );
- handle.SetShaderEffect( newEffect );
+ renderable.SetShaderEffect( newEffect );
Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_BLUR_MODEL_LASTFRAME );
Constraint constraint = Constraint::New<Matrix>( uModelProperty,
- Source( handle, Actor::WORLD_MATRIX ),
+ Source( renderable, Actor::WORLD_MATRIX ),
EqualToConstraint() );
// and set up constraint.
return New( MOTION_BLUR_NUM_SAMPLES );
}
-MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples )
+MotionBlurEffect MotionBlurEffect::New( unsigned int numBlurSamples )
{
// Dali vertexSource prefix for reference:
// precision highp float;
* Create a MotionBlurEffect and attach it to the specified actor
* The number of texture samples taken along the motion velocity vector of the
* actor, producing the blur, is set to a default of 8.
+ * @param renderable actor to apply the effect to
* @return A handle to a newly allocated Dali resource.
*/
- static MotionBlurEffect Apply( Actor handle );
+ static MotionBlurEffect Apply( RenderableActor renderable );
/**
* Create an initialized MotionBlurEffect
* @param numBlurSamples The number of texture samples taken along the motion
* velocity vector of the actor, producing the blur. A higher number gives a
* smoother blur but costs more in terms of performance.
+ * @param numBlurSamples to have
* @return A handle to a newly allocated Dali resource.
*/
- static MotionBlurEffect New( const unsigned int numBlurSamples );
+ static MotionBlurEffect New( unsigned int numBlurSamples );
/**
* Set texcoord scale property. This scales the offset for texture samples
{
}
-MotionStretchEffect MotionStretchEffect::Apply( Actor handle )
+MotionStretchEffect MotionStretchEffect::Apply( RenderableActor renderable )
{
MotionStretchEffect newEffect = New();
- handle.SetShaderEffect( newEffect );
+ renderable.SetShaderEffect( newEffect );
Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_STRETCH_MODELVIEW_LASTFRAME );
Constraint constraint = Constraint::New<Matrix>( uModelProperty,
- Source( handle, Actor::WORLD_MATRIX ),
+ Source( renderable, Actor::WORLD_MATRIX ),
EqualToConstraint() );
// and set up constraint.
/**
* Create a MotionStretchEffect and attach it to the specified actor
+ * @param renderable actor to apply the effect to
* @return A handle to a newly allocated Dali resource.
*/
- static MotionStretchEffect Apply( Actor handle );
+ static MotionStretchEffect Apply( RenderableActor renderable );
/**
* Set geometry stretch factor property. This scales the amount the geometry