Alpha function changes
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / bubble-effect / bubble-emitter-impl.cpp
index 1faf68c..ae17a0d 100644 (file)
@@ -22,6 +22,7 @@
 #include <cmath>
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/images/resource-image.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/shader-effects/bubble-effect/color-adjuster.h>
@@ -38,7 +39,7 @@ BubbleEmitter::BubbleEmitter( const Vector2& movementArea,
                               Image shapeImage,
                               unsigned int maximumNumberOfBubble,
                               const Vector2& bubbleSizeRange )
-: Control( REQUIRES_TOUCH_EVENTS ),
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
   mMovementArea( movementArea ),
   mShapeImage( shapeImage ),
   mTotalNumOfBubble( maximumNumberOfBubble ),
@@ -89,7 +90,7 @@ void BubbleEmitter::OnInitialize()
   mBubbleRoot.SetSize(mMovementArea);
 
   // Prepare the frame buffer to store the color adjusted background image
-  mEffectImage = FrameBufferImage::New( mMovementArea.width/4.f, mMovementArea.height/4.f, Pixel::RGBA8888, Dali::Image::Unused );
+  mEffectImage = FrameBufferImage::New( mMovementArea.width/4.f, mMovementArea.height/4.f, Pixel::RGBA8888, Dali::Image::UNUSED );
 
   // Generate the material object, which is used by all meshActors
   GenMaterial();
@@ -105,9 +106,8 @@ void BubbleEmitter::OnInitialize()
   {
     mMesh[i] = Mesh::New( meshData );
     mMeshActor[i] = MeshActor::New( mMesh[i] );
-    mMeshActor[i].SetAffectedByLighting( false );
     mMeshActor[i].SetParentOrigin(ParentOrigin::TOP_LEFT);
-    mEffect[i] = BubbleEffect::New( mNumBubblePerShader, mShapeImage.GetFilename() );
+    mEffect[i] = BubbleEffect::New( mNumBubblePerShader );
     mEffect[i].SetEffectImage( mEffectImage );
     mEffect[i].SetMovementArea( mMovementArea );
     mMeshActor[i].SetShaderEffect( mEffect[i] );
@@ -118,9 +118,8 @@ void BubbleEmitter::OnInitialize()
   MeshData meshDataForNoise;
   ConstructBubbleMesh( meshDataForNoise, mNumBubblePerShader);
   mMeshActorForNoise = MeshActor::New( Mesh::New(meshDataForNoise) );
-  mMeshActorForNoise.SetAffectedByLighting( false );
   mMeshActorForNoise.SetParentOrigin(ParentOrigin::TOP_LEFT);
-  mEffectForNoise = BubbleEffect::New( mNumBubblePerShader, mShapeImage.GetFilename() );
+  mEffectForNoise = BubbleEffect::New( mNumBubblePerShader );
   mEffectForNoise.SetMovementArea( mMovementArea );
   mEffectForNoise.SetEffectImage( mEffectImage );
   mMeshActorForNoise.SetShaderEffect( mEffectForNoise );
@@ -169,15 +168,6 @@ void BubbleEmitter::SetBackground( Image bgImage, const Vector3& hsvDelta )
 void BubbleEmitter::SetShapeImage( Image shapeImage )
 {
   mCustomMaterial.SetDiffuseTexture( shapeImage );
-
-  //Get pixel width of the shape
-  float width = Image::GetImageSize(shapeImage.GetFilename()).width;
-
-  for(unsigned int i=0; i < mNumShader; i++ )
-  {
-    mEffect[i].SetShapeImageWidth(width);
-  }
-  mEffectForNoise.SetShapeImageWidth(width);
 }
 
 void BubbleEmitter::SetBubbleScale( float scale )
@@ -271,14 +261,14 @@ void BubbleEmitter::EmitBubble( Animation& animation, const Vector2& emitPositio
   unsigned int groupIdx = mCurrentUniform / mNumBubblePerShader;
   SetBubbleParameter( mEffect[groupIdx], curUniform, emitPosition, direction, displacement);
   animation.AnimateTo( Property( mEffect[groupIdx], mEffect[groupIdx].GetPercentagePropertyName(curUniform) ),
-                       1.f, AlphaFunctions::Linear );
+                       1.f, AlphaFunction::LINEAR );
 
   if( mCurrentUniform % mNumShader == 0 )
   {
     unsigned int uniform = mCurrentUniform / mNumShader;
     SetBubbleParameter(mEffectForNoise, uniform, emitPosition, displacement);
     animation.AnimateTo( Property( mEffectForNoise, mEffectForNoise.GetPercentagePropertyName(uniform) ),
-                         1.f, AlphaFunctions::Linear );
+                         1.f, AlphaFunction::LINEAR );
   }
 
   mCurrentUniform = (mCurrentUniform + 1) % mTotalNumOfBubble;
@@ -290,10 +280,10 @@ void BubbleEmitter::StartExplosion( float duration, float multiple )
   for(unsigned int i=0; i < mNumShader; i++ )
   {
     animation.AnimateTo( Property( mEffect[i], mEffect[i].GetMagnificationPropertyName() ),
-                         multiple, AlphaFunctions::EaseOut);
+                         multiple, AlphaFunction::EASE_OUT);
   }
   animation.AnimateTo( Property( mEffectForNoise, mEffectForNoise.GetMagnificationPropertyName() ),
-                       multiple, AlphaFunctions::EaseOut);
+                       multiple, AlphaFunction::EASE_OUT);
   animation.Play();
 
   animation.FinishedSignal().Connect(this, &BubbleEmitter::OnExplosionFinished);