Fixed sparkle demo uniform to be unique 56/320256/3
authorDavid Steele <david.steele@samsung.com>
Mon, 11 Nov 2024 17:24:45 +0000 (17:24 +0000)
committerDavid Steele <david.steele@samsung.com>
Mon, 18 Nov 2024 15:32:27 +0000 (15:32 +0000)
Change-Id: Ia80afeac6686a87126cee65b7f502dff2169666d

examples/sparkle/shaders/sparkle-effect.vert
examples/sparkle/sparkle-effect-example.cpp
examples/sparkle/sparkle-effect.h

index bc72f99442f5c21e854590b770dbb321bd8e96f0..45689ab8a3409b84271ccba5881f2f626531fa77 100644 (file)
@@ -24,7 +24,7 @@ UNIFORM float uTapOffset[MAXIMUM_ANIMATION_COUNT];
 UNIFORM vec2  uTapPoint[MAXIMUM_ANIMATION_COUNT];
 UNIFORM float uAcceleration;
 UNIFORM float uRadius;
-UNIFORM float uScale;
+UNIFORM float uEffectScale;
 UNIFORM float uBreak;
 };
 
@@ -78,8 +78,8 @@ void main()
   position = mix( position, vec2( 250.0,250.0 ),uBreak*(1.0-uOpacity[int(idx)]) ) ;
 
   // vertex position on the mesh: (sign(aTexCoord.x), sign(aTexCoord.y))*PARTICLE_HALF_SIZE
-  gl_Position = uMvpMatrix * vec4( position.x+sign(aTexCoord.x)*PARTICLE_HALF_SIZE/uScale,
-                                   position.y+sign(aTexCoord.y)*PARTICLE_HALF_SIZE/uScale,
+  gl_Position = uMvpMatrix * vec4( position.x+sign(aTexCoord.x)*PARTICLE_HALF_SIZE/uEffectScale,
+                                   position.y+sign(aTexCoord.y)*PARTICLE_HALF_SIZE/uEffectScale,
                                    0.0, 1.0 );
 
   // we store the color index inside texCoord attribute
index a6c7a83c98f917d06a5138c6c084ba9959b1314d..3f7d9ebb7bff7973992bc2ad9c40ec18ccc98743 100644 (file)
@@ -356,12 +356,12 @@ private:
     // prepare the animation by setting the uniform to the required value
     mEffect.SetProperty(mEffect.GetPropertyIndex(BREAK_UNIFORM_NAME), 1.f);
     mMeshActor.SetProperty(Actor::Property::SCALE, 0.01f);
-    mEffect.SetProperty(mEffect.GetPropertyIndex("uScale"), 0.01f);
+    mEffect.SetProperty(mEffect.GetPropertyIndex("uEffectScale"), 0.01f);
     mMeshActor.SetProperty(Actor::Property::POSITION, Vector3(0.f, 0.f, 1.f));
 
     Animation breakAnimation = Animation::New(duration * 1.5f);
     breakAnimation.AnimateTo(Property(mMeshActor, Actor::Property::SCALE), Vector3(ACTOR_SCALE, ACTOR_SCALE, ACTOR_SCALE), EaseOutSquare);
-    breakAnimation.AnimateTo(Property(mEffect, "uScale"), ACTOR_SCALE, EaseOutSquare);
+    breakAnimation.AnimateTo(Property(mEffect, "uEffectScale"), ACTOR_SCALE, EaseOutSquare);
     breakAnimation.AnimateTo(Property(mMeshActor, Actor::Property::POSITION), ACTOR_POSITION, EaseOutSquare);
     breakAnimation.FinishedSignal().Connect(this, &SparkleEffectExample::OnBreakAnimationFinished);
 
index 2f0247ad961a96dfd66bcf4376712377e4bc5727..2deee478d380116aa2e0abd944343da40feb775c 100644 (file)
@@ -244,7 +244,7 @@ Shader New()
     handle.RegisterProperty(oss.str(), PARTICLE_COLORS[i].RGB);
   }
   handle.RegisterProperty("uRadius", 250.f);
-  handle.RegisterProperty("uScale", ACTOR_SCALE);
+  handle.RegisterProperty("uEffectScale", ACTOR_SCALE);
 
   // set the initial uniform values