[dali_2.3.42] Merge branch 'devel/master'
[platform/core/uifw/dali-demo.git] / examples / sparkle / sparkle-effect.h
index c78d09c..2f0247a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SPARKLE_EFFECT_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -21,8 +21,8 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/dali.h>
 
-#include "generated/sparkle-effect-vert.h"
 #include "generated/sparkle-effect-frag.h"
+#include "generated/sparkle-effect-vert.h"
 
 using namespace Dali;
 using Dali::Toolkit::ImageView;
@@ -191,33 +191,26 @@ MovingPath PATHS[] =
     {339, 348, 361, 465, 382, 477, 406, 442, 430, 406, 269, 369}};
 const unsigned int NUM_PARTICLE(sizeof(PATHS) / sizeof(PATHS[0]));
 
-const float PARTICLE_SIZE = 13.f;
+constexpr float PARTICLE_SIZE = 13.f;
+
+// These values are mainly used to set the size of the actor, the shader draws outside the values set
+constexpr float   ACTOR_DIMENSION_SIZE(500.0f);
+constexpr float   ACTOR_SCALE = 0.704f; // resize 500*500 to 352*352, a bit smaller than 360*360
+constexpr float   ACTOR_POSITION_VALUE(176.0f);
+constexpr Vector3 ACTOR_POSITION(-ACTOR_POSITION_VALUE, -ACTOR_POSITION_VALUE, 1.f);
 
-const float   ACTOR_SCALE = 0.704f; // resize 500*500 to 352*352, a bit smaller than 360*360
-const Vector3 ACTOR_POSITION(-176.f, -176.f, 1.f);
+// Need to remove scale in the update-size-hint
+constexpr Vector4 ACTOR_UPDATE_AREA_HINT(
+  ACTOR_POSITION_VALUE,
+  ACTOR_POSITION_VALUE,
+  ACTOR_DIMENSION_SIZE / ACTOR_SCALE,
+  ACTOR_DIMENSION_SIZE / ACTOR_SCALE);
 
-const int MAXIMUM_ANIMATION_COUNT = 30;
+constexpr int MAXIMUM_ANIMATION_COUNT = 30;
 
 // Geometry format used by the SparkeEffect
 struct Vertex
 {
-  Vertex(const Vector2& texCoord,
-         const Vector2& aParticlePath0,
-         const Vector2& aParticlePath1,
-         const Vector2& aParticlePath2,
-         const Vector2& aParticlePath3,
-         const Vector2& aParticlePath4,
-         const Vector2& aParticlePath5)
-  : aTexCoord(texCoord),
-    aParticlePath0(aParticlePath0),
-    aParticlePath1(aParticlePath1),
-    aParticlePath2(aParticlePath2),
-    aParticlePath3(aParticlePath3),
-    aParticlePath4(aParticlePath4),
-    aParticlePath5(aParticlePath5)
-  {
-  }
-
   Vector2 aTexCoord;
   Vector2 aParticlePath0;
   Vector2 aParticlePath1;