Commit ded6f853c2260a9d46a2724b82d38eb762d04f0c
Committed by
Paul Wisbey
1 parent
f3f0570a
fix cluster example to work after shader inheritance removal
requires https://review.tizen.org/gerrit/#/c/25415/ Change-Id: I768e7bd57e2250fd16580b85886250591599f159
Showing
1 changed file
with
10 additions
and
5 deletions
examples/cluster/cluster-example.cpp
| @@ -713,7 +713,6 @@ public: | @@ -713,7 +713,6 @@ public: | ||
| 713 | mScrollView.SetActorAutoSnap(false); | 713 | mScrollView.SetActorAutoSnap(false); |
| 714 | 714 | ||
| 715 | // Remove all shader-effects from mScrollView and it's children (the clusters) | 715 | // Remove all shader-effects from mScrollView and it's children (the clusters) |
| 716 | - mScrollView.RemoveShaderEffect(); | ||
| 717 | mScrollView.SetPosition(Vector3::ZERO); | 716 | mScrollView.SetPosition(Vector3::ZERO); |
| 718 | 717 | ||
| 719 | mLayoutButton.SetBackgroundImage( mLayoutButtonImages[ type ] ); | 718 | mLayoutButton.SetBackgroundImage( mLayoutButtonImages[ type ] ); |
| @@ -721,7 +720,7 @@ public: | @@ -721,7 +720,7 @@ public: | ||
| 721 | for( vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) | 720 | for( vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) |
| 722 | { | 721 | { |
| 723 | Cluster cluster = i->mCluster; | 722 | Cluster cluster = i->mCluster; |
| 724 | - cluster.RemoveShaderEffect(); | 723 | + RemoveShaderEffectRecursively( cluster ); |
| 725 | if( i->mEffectConstraint ) | 724 | if( i->mEffectConstraint ) |
| 726 | { | 725 | { |
| 727 | cluster.RemoveConstraint(i->mEffectConstraint); | 726 | cluster.RemoveConstraint(i->mEffectConstraint); |
| @@ -759,7 +758,7 @@ public: | @@ -759,7 +758,7 @@ public: | ||
| 759 | ShearEffectCenterConstraint(stageSize, shearCenter) ); | 758 | ShearEffectCenterConstraint(stageSize, shearCenter) ); |
| 760 | shaderEffect.ApplyConstraint(constraint); | 759 | shaderEffect.ApplyConstraint(constraint); |
| 761 | 760 | ||
| 762 | - cluster.SetShaderEffect(shaderEffect); | 761 | + SetShaderEffectRecursively( cluster,shaderEffect ); |
| 763 | 762 | ||
| 764 | // Apply Constraint to Shader Effect | 763 | // Apply Constraint to Shader Effect |
| 765 | Property::Index scrollOvershootProperty = /*targetGroup*/mScrollView.GetPropertyIndex(ScrollViewWobbleEffect::EFFECT_OVERSHOOT); | 764 | Property::Index scrollOvershootProperty = /*targetGroup*/mScrollView.GetPropertyIndex(ScrollViewWobbleEffect::EFFECT_OVERSHOOT); |
| @@ -787,7 +786,12 @@ public: | @@ -787,7 +786,12 @@ public: | ||
| 787 | // Apply Carousel Shader Effect to scrollView | 786 | // Apply Carousel Shader Effect to scrollView |
| 788 | CarouselEffect shaderEffect = CarouselEffect::New(); | 787 | CarouselEffect shaderEffect = CarouselEffect::New(); |
| 789 | shaderEffect.SetRadius( -CAROUSEL_EFFECT_RADIUS ); | 788 | shaderEffect.SetRadius( -CAROUSEL_EFFECT_RADIUS ); |
| 790 | - mScrollView.SetShaderEffect( shaderEffect ); | 789 | + // dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc |
| 790 | + for( vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) | ||
| 791 | + { | ||
| 792 | + Cluster cluster = i->mCluster; | ||
| 793 | + SetShaderEffectRecursively( cluster, shaderEffect ); | ||
| 794 | + } | ||
| 791 | mScrollView.SetPosition( Vector3( 0.0f, 0.0f, CAROUSEL_EFFECT_RADIUS ) ); | 795 | mScrollView.SetPosition( Vector3( 0.0f, 0.0f, CAROUSEL_EFFECT_RADIUS ) ); |
| 792 | 796 | ||
| 793 | const Vector2 angleSweep( CAROUSEL_EFFECT_ANGLE_SWEEP / stageSize.width, | 797 | const Vector2 angleSweep( CAROUSEL_EFFECT_ANGLE_SWEEP / stageSize.width, |
| @@ -819,12 +823,13 @@ public: | @@ -819,12 +823,13 @@ public: | ||
| 819 | 823 | ||
| 820 | shaderEffect.SetRadius( SPHERE_EFFECT_RADIUS ); | 824 | shaderEffect.SetRadius( SPHERE_EFFECT_RADIUS ); |
| 821 | shaderEffect.SetAnglePerUnit( Vector2( SPHERE_EFFECT_ANGLE_SWEEP / stageSize.y, SPHERE_EFFECT_ANGLE_SWEEP / stageSize.y ) ); | 825 | shaderEffect.SetAnglePerUnit( Vector2( SPHERE_EFFECT_ANGLE_SWEEP / stageSize.y, SPHERE_EFFECT_ANGLE_SWEEP / stageSize.y ) ); |
| 822 | - mScrollView.SetShaderEffect( shaderEffect ); | 826 | + // dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc |
| 823 | for( vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) | 827 | for( vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) |
| 824 | { | 828 | { |
| 825 | Constraint constraint = Constraint::New<float>(Actor::POSITION_Z, SphereEffectOffsetConstraint(SPHERE_EFFECT_POSITION_Z)); | 829 | Constraint constraint = Constraint::New<float>(Actor::POSITION_Z, SphereEffectOffsetConstraint(SPHERE_EFFECT_POSITION_Z)); |
| 826 | constraint.SetRemoveAction(Constraint::Discard); | 830 | constraint.SetRemoveAction(Constraint::Discard); |
| 827 | Cluster cluster = i->mCluster; | 831 | Cluster cluster = i->mCluster; |
| 832 | + SetShaderEffectRecursively( cluster, shaderEffect ); | ||
| 828 | i->mEffectConstraint = cluster.ApplyConstraint(constraint); | 833 | i->mEffectConstraint = cluster.ApplyConstraint(constraint); |
| 829 | } | 834 | } |
| 830 | break; | 835 | break; |