Fix compile error. Non initialized variable.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / bubble-effect / bubble-emitter-impl.h
index 91158b2..30ccbbf 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H__
-#define __DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H__
+#ifndef DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H
+#define DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/camera-actor.h>
-#include <dali/public-api/actors/image-actor.h>
-#include <dali/public-api/common/stage.h>
-#include <dali/public-api/images/frame-buffer-image.h>
+#include <dali/devel-api/common/stage.h>
+#include <dali/public-api/rendering/frame-buffer.h>
 #include <dali/public-api/render-tasks/render-task.h>
-#include <dali/devel-api/object/property-buffer.h>
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/sampler.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/sampler.h>
+#include <dali/public-api/rendering/shader.h>
+#include <dali/public-api/rendering/vertex-buffer.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
@@ -43,8 +42,7 @@ namespace Toolkit
 namespace Internal
 {
 
-class BubbleActor;
-typedef IntrusivePtr<BubbleActor> BubbleActorPtr;
+class BubbleRenderer;
 
 /**
  * BubbleEmitter implementation class.
@@ -62,7 +60,7 @@ public:
    * @copydoc Toolkit::BubbleEmitter::New
    */
   static Toolkit::BubbleEmitter New( const Vector2& winSize,
-                                     Image shapeImage,
+                                     Texture shapeTexture,
                                      unsigned int maximumNumberOfBubble,
                                      const Vector2& bubbleSizeRange );
 
@@ -74,12 +72,12 @@ public:
   /**
    * @copydoc Toolkit::BubbleEmitter::SetBackground
    */
-  void SetBackground( Image bgImage, const Vector3& hsvDelta );
+  void SetBackground( Texture bgTexture, const Vector3& hsvDelta );
 
   /**
-   * @copydoc Toolkit::BubbleEmitter::SetShapeImage
+   * @copydoc Toolkit::BubbleEmitter::SetShape
    */
-  void SetShapeImage( Image shapeImage );
+  void SetBubbleShape( Texture shapeTexture );
 
   /**
    * @copydoc Toolkit::BubbleEmiter::SetBubbleScale
@@ -92,11 +90,6 @@ public:
   void SetBubbleDensity( unsigned int density );
 
   /**
-   * @copydoc Toolkit::BubbleEmitter::SetBlendMode
-   */
-  void SetBlendMode( bool enable );
-
-  /**
    * @copydoc Toolkit::BubbleEmitter::EmitBubble
    */
   void EmitBubble( Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement );
@@ -111,12 +104,12 @@ private:
   /**
    * Construct a new BubbleEmitter object.
    * @param[in] movementArea The size of the bubble moving area
-   * @param[in] shapeImage The alpha channnel of this texture defines the bubble shape.
+   * @param[in] shapeTexture The alpha channnel of this texture defines the bubble shape.
    * @param[in] maximumNumberOfBubble The maximum number of bubble needed.
    * @param[in] bubbleSizeRange The size range of the bubbles; x component is the minimal size, and y component is the maximum size.
    */
   BubbleEmitter( const Vector2& movementArea,
-                 Image shapeImage,
+                 Texture shapeTexture,
                  unsigned int maximumNumberOfBubble,
                  const Vector2& bubbleSizeRange );
 
@@ -135,7 +128,7 @@ private:
 
   /**
    * Callback function of the finished signal of off-screen render task.
-   * @param[in] source The render task used to create the color adjusted background image.
+   * @param[in] source The render task used to create the color adjusted background texture.
    */
   void OnRenderFinished(RenderTask& source);
 
@@ -146,38 +139,38 @@ private:
 
   /**
    * Set the uniform values to the shader effect to emit a bubble
-   * @param[in] bubbleActor The BubbleActor to render the current bubble
+   * @param[in] bubbleRenderer The BubbleRenderer
    * @param[in] curUniform The index of the uniform array in the shader
    * @param[in] emitPosition The start position of the bubble movement.
    * @param[in] direction The direction used to constrain the bubble to move in an adjacent direction around it.
    * @param[in] displacement The displacement used to bound the moving distance of the bubble.
    */
-  void SetBubbleParameter( BubbleActorPtr bubbleActor, unsigned int curUniform,
+  void SetBubbleParameter( BubbleRenderer& bubbleRenderer, unsigned int curUniform,
                            const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement );
 
 private:
 
   Actor                       mBubbleRoot;          ///<The bubble root actor. Need to add it to stage to get the bubbles rendered.
-  Image                       mShapeImage;          ///< The alpha channnel of this texture defines the bubble shape.
-  Image                       mBackgroundImage;     ///< The original background image
-  FrameBufferImage            mEffectImage;         ///< The image stores the adjusted color of the background image.The bubbles pick color from this image.
+  Texture                     mShapeTexture;        ///< The alpha channnel of this texture defines the bubble shape.
+  Texture                     mBackgroundTexture;   ///< The original background texture
+  Texture                     mEffectTexture;       ///< Texture which stores the adjusted color of the background image.The bubbles pick color from this image.
+  FrameBuffer                 mFrameBuffer;         ///< FrameBuffer used for offscreen rendering
   CameraActor                 mCameraActor;         ///< The render task views the scene from the perspective of this actor.
 
-  Sampler                     mSamplerBackground;    ///< The sampler which provides the background image to material
-  Sampler                     mSamplerBubbleShape;   ///< The sampler which provides the bubble shape image to material
   Geometry                    mMeshGeometry;         ///< The mesh geometry which contains the vertices and indices data
-  Material                    mMaterial;             ///< The material which controls the bubble display
-  std::vector<BubbleActorPtr> mBubbleActors;         ///< The meshActor vector, its size is mNumShader.
+  TextureSet                  mTextureSet;           ///< The texture set which controls the bubble display
+  std::vector<BubbleRenderer> mBubbleRenderers;      ///< The BubbleRenderer vector, its size is mNumShader.
 
-  Vector2                     mMovementArea;        ///< The size of the bubble moving area, usually the same size as the background image actor.
+  Vector2                     mMovementArea;        ///< The size of the bubble moving area, usually the same size as the background.
   Vector2                     mBubbleSizeRange;     ///< The size range of the bubbles; x component is the low bound, and y component is the up bound.
   Vector3                     mHSVDelta;            ///< The HSV difference used to adjust the background image color.
 
-  unsigned int                mNumBubblePerActor;   ///< How many bubbles for each BubbleActor.
-  unsigned int                mNumActor;            ///< How many BubbleActors are used.
+  unsigned int                mNumBubblePerRenderer;   ///< How many bubbles for each BubbleRenderer.
+  unsigned int                mNumRenderer;            ///< How many BubbleRenderers are used.
   unsigned int                mDensity;             ///< How many bubbles will emit at each time, they are controlled by same uniforms in the shader.
   unsigned int                mTotalNumOfBubble;    ///< mNumBubblePerShader*mNumShader.
   unsigned int                mCurrentBubble;       ///< Keep track of the index for the newly emitted bubble
+  unsigned int                mRandomSeed;          ///< Seed to generate random number.
 
   bool                        mRenderTaskRunning;   ///< If the background render task is currently running
 
@@ -204,4 +197,4 @@ inline const Internal::BubbleEmitter& GetImpl(const Dali::Toolkit::BubbleEmitter
 
 } // namespace Dali
 
-#endif /* __DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H__ */
+#endif // DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H