Updated all files to new format 19/253119/4
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 4 Feb 2021 16:16:52 +0000 (16:16 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 4 Feb 2021 17:51:30 +0000 (17:51 +0000)
Change-Id: I89ad98704eacedd18a0b50fd9d6511fc8e436416

65 files changed:
build/android/app/src/main/cpp/main.cpp
examples/animated-shapes/animated-shapes-example.cpp
examples/arc-visual/arc-visual-example.cpp
examples/benchmark/benchmark.cpp
examples/bezier-curve/bezier-curve-example.cpp
examples/builder/examples.cpp
examples/color-transition/color-transition-controller.cpp
examples/color-transition/color-transition-controller.h
examples/color-transition/color-transition.cpp
examples/color-transition/utils.cpp
examples/color-transition/utils.h
examples/color-visual/color-visual-example.cpp
examples/compressed-texture-formats/compressed-texture-formats-example.cpp
examples/contact-cards/clipped-image.cpp
examples/deferred-shading/deferred-shading.cpp
examples/fpp-game/game-renderer.cpp
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
examples/image-view-url/image-view-url-example.cpp
examples/line-mesh/line-mesh-example.cpp
examples/mesh-morph/mesh-morph-example.cpp
examples/mesh-visual/mesh-visual-example.cpp
examples/metaball-explosion/metaball-explosion-example.cpp
examples/metaball-refrac/metaball-refrac-example.cpp
examples/native-image-source/native-image-source-example.cpp
examples/particles/float-rand.h
examples/particles/particle-field.h
examples/particles/particle-view.cpp
examples/particles/particle-view.h
examples/particles/particles-example.cpp
examples/particles/utils.cpp
examples/particles/utils.h
examples/perf-scroll/perf-scroll.cpp
examples/point-mesh/point-mesh-example.cpp
examples/primitive-shapes/primitive-shapes-example.cpp
examples/reflection-demo/gltf-scene.cpp
examples/reflection-demo/gltf-scene.h
examples/reflection-demo/reflection-example.cpp
examples/refraction-effect/refraction-effect-example.cpp
examples/renderer-stencil/renderer-stencil-example.cpp
examples/rendering-basic-light/rendering-basic-light-example.cpp
examples/rendering-basic-pbr/ktx-loader.cpp
examples/rendering-basic-pbr/model-skybox.cpp
examples/rendering-cube/rendering-cube.cpp
examples/rendering-line/rendering-line.cpp
examples/rendering-radial-progress/radial-progress.cpp
examples/rendering-skybox/rendering-skybox.cpp
examples/rendering-textured-cube/rendering-textured-cube.cpp
examples/rendering-triangle/rendering-triangle.cpp
examples/scene-loader/main.cpp
examples/scene-loader/scene-loader-example.cpp
examples/scene-loader/scene-loader-example.h
examples/simple-text-field/simple-text-field.cpp
examples/simple-text-renderer/simple-text-renderer-example.cpp
examples/sparkle/sparkle-effect.h
examples/styling/image-channel-control-impl.cpp
examples/textured-mesh/textured-mesh-example.cpp
examples/waves/utils.cpp
examples/waves/utils.h
examples/waves/waves-example.cpp
shared/bubble-animator.cpp
shared/bubble-animator.h
shared/dali-table-view.cpp [changed mode: 0755->0644]
shared/dali-table-view.h
shared/example.h

index 7b1d624..0e1ac14 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -31,7 +31,7 @@
 // from android_native_app_glue.c
 
 #define TAG "dalidemo"
-#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR,   TAG, ##__VA_ARGS__))
+#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, TAG, ##__VA_ARGS__))
 #ifndef NDEBUG
 #define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, TAG, ##__VA_ARGS__))
 #else
@@ -156,7 +156,7 @@ void android_main(struct android_app* state)
   LOGV("android_main() >>");
 
   std::string filesDir = state->activity->internalDataPath;
-  LOGV("filesDir=%s", filesDir.c_str() );
+  LOGV("filesDir=%s", filesDir.c_str());
 
   std::string fontconfigPath = filesDir + "/fonts";
   setenv("FONTCONFIG_PATH", fontconfigPath.c_str(), 1);
@@ -186,13 +186,13 @@ void android_main(struct android_app* state)
 
   DaliDemoNativeActivity nativeActivity(state->activity);
 
-  int         status    = 0;
+  int status = 0;
 
   //dali requires Android 8 or higher
   //Android 6+ support loading library directly from apk,
   //therefore no need to extract to filesystem first then open by specifying full path
   //unless there is need to do profiling, or export libraries so that other packages can use
-  std::string libpath   = "libdali-demo.so";
+  std::string libpath = "libdali-demo.so";
 
   std::string callParam = nativeActivity.GetIntentStringExtra("start");
   if(callParam.empty())
@@ -217,16 +217,16 @@ void android_main(struct android_app* state)
   dlerror(); /* Clear any existing error */
 
   int (*main)(int, char**) = (int (*)(int, char**))dlsym(handle, "main");
-  LOGV("lib=%s handle=%p main=%p", libpath.c_str(), handle, main );
+  LOGV("lib=%s handle=%p main=%p", libpath.c_str(), handle, main);
   if(main)
   {
     status = main(0, nullptr);
   }
   else
   {
-      LOGE("lib %s doesn't have main()", libpath.c_str());
-      status = EFAULT;
-      std::exit(status);
+    LOGE("lib %s doesn't have main()", libpath.c_str());
+    status = EFAULT;
+    std::exit(status);
   }
 
   if(handle)
index 508a75f..204fcef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -17,9 +17,9 @@
 
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/dali.h>
-#include "shared/view.h"
-#include "generated/animated-shapes-vert.h"
 #include "generated/animated-shapes-frag.h"
+#include "generated/animated-shapes-vert.h"
+#include "shared/view.h"
 
 #include <sstream>
 
index ac60b7e..69d1a06 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -183,9 +183,12 @@ private:
   {
     if(touch.GetState(0) == PointState::UP)
     {
-      DevelControl::DoAction(mControl, Control::Property::BACKGROUND, DevelArcVisual::Action::UPDATE_PROPERTY,
-                             Property::Map().Add(DevelArcVisual::Property::START_ANGLE, START_ANGLE_INITIAL_VALUE)
-                                            .Add(DevelArcVisual::Property::SWEEP_ANGLE, SWEEP_ANGLE_INITIAL_VALUE));
+      DevelControl::DoAction(mControl,
+                             Control::Property::BACKGROUND,
+                             DevelArcVisual::Action::UPDATE_PROPERTY,
+                             Property::Map()
+                               .Add(DevelArcVisual::Property::START_ANGLE, START_ANGLE_INITIAL_VALUE)
+                               .Add(DevelArcVisual::Property::SWEEP_ANGLE, SWEEP_ANGLE_INITIAL_VALUE));
 
       Animation animation = Animation::New(ANIMATION_DURATION);
       animation.AnimateTo(DevelControl::GetVisualProperty(mControl, Control::Property::BACKGROUND, DevelArcVisual::Property::START_ANGLE), START_ANGLE_TARGET_VALUE);
index 4dc1e0a..2187253 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -19,9 +19,9 @@
 #include <dali-toolkit/dali-toolkit.h>
 
 // INTERNAL INCLUDES
-#include "shared/utility.h"
-#include "generated/benchmark-vert.h"
 #include "generated/benchmark-frag.h"
+#include "generated/benchmark-vert.h"
+#include "shared/utility.h"
 
 using namespace Dali;
 using namespace Dali::Toolkit;
index d128218..7dc3b8a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -18,9 +18,9 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/table-view/table-view.h>
 #include <dali/dali.h>
-#include "shared/view.h"
-#include "generated/bezier-curve-vert.h"
 #include "generated/bezier-curve-frag.h"
+#include "generated/bezier-curve-vert.h"
+#include "shared/view.h"
 
 #include <sstream>
 
index cf0f140..7ba6fef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -202,7 +202,7 @@ bool FileWatcher::FileHasChanged(void)
   else
   {
     const bool result = buf.st_mtime > mLastTime;
-    mLastTime = buf.st_mtime;
+    mLastTime         = buf.st_mtime;
     return result;
   }
 
index 8963740..2a9296e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  *
  */
 #include "color-transition-controller.h"
-#include "utils.h"
-#include "dali/dali.h"
 #include "dali-toolkit/dali-toolkit.h"
-#include "generated/color-transition-controller-composite-vert.h"
+#include "dali/dali.h"
 #include "generated/color-transition-controller-composite-frag.h"
+#include "generated/color-transition-controller-composite-vert.h"
+#include "utils.h"
 
 using namespace Dali;
 using namespace Dali::Toolkit;
 
 namespace
 {
-
 const Vector4 BG_COLOR = Vector4(0.f, 0.f, 0.f, 0.f);
 
-} // nonamespace
+} // namespace
 
 ColorTransitionController::ColorTransitionController(WeakHandle<RenderTaskList> window, Actor content, RenderTaskList tasks, Vector3 initialColor)
 : mWeakRenderTasks(window)
@@ -39,8 +38,7 @@ ColorTransitionController::ColorTransitionController(WeakHandle<RenderTaskList>
   auto defaultTask = tasks.GetTask(0);
 
   // create rendertarget and rendertask
-  auto rtt = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888,
-    static_cast<uint32_t>(contentSize.x), static_cast<uint32_t>(contentSize.y));
+  auto rtt = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, static_cast<uint32_t>(contentSize.x), static_cast<uint32_t>(contentSize.y));
 
   auto fbo = FrameBuffer::New(rtt.GetWidth(), rtt.GetHeight(), FrameBuffer::Attachment::NONE);
   fbo.AttachColorTexture(rtt);
@@ -58,10 +56,10 @@ ColorTransitionController::ColorTransitionController(WeakHandle<RenderTaskList>
   CenterActor(composite);
   composite.SetProperty(Actor::Property::SIZE, contentSize);
 
-  mPropFlow = composite.RegisterProperty("uFlow", -1.f);
+  mPropFlow        = composite.RegisterProperty("uFlow", -1.f);
   mPropUvTransform = composite.RegisterProperty("uUvTransform", Vector4(0.f, 0.f, 1.f, 1.f));
-  mPropRgb[0] = composite.RegisterProperty("uRgb[0]", initialColor);
-  mPropRgb[1] = composite.RegisterProperty("uRgb[1]", Vector3::ONE);
+  mPropRgb[0]      = composite.RegisterProperty("uRgb[0]", initialColor);
+  mPropRgb[1]      = composite.RegisterProperty("uRgb[1]", Vector3::ONE);
 
   auto geomComposite = CreateQuadGeometry();
 
@@ -89,7 +87,7 @@ ColorTransitionController::ColorTransitionController(WeakHandle<RenderTaskList>
 
 ColorTransitionController::~ColorTransitionController()
 {
-  if (auto renderTasks = mWeakRenderTasks.GetHandle())
+  if(auto renderTasks = mWeakRenderTasks.GetHandle())
   {
     renderTasks.RemoveTask(mRtCompositor);
   }
@@ -103,7 +101,7 @@ Dali::Actor ColorTransitionController::GetComposite()
 void ColorTransitionController::SetFlowMap(Texture flowMap)
 {
   auto renderer = mComposite.GetRendererAt(0);
-  auto texSet = renderer.GetTextures();
+  auto texSet   = renderer.GetTextures();
   texSet.SetTexture(1, flowMap);
 }
 
@@ -123,7 +121,7 @@ void ColorTransitionController::RequestTransition(float duration, const Dali::Ve
 
 void ColorTransitionController::SetOnFinished(OnFinished onFinished, void* data)
 {
-  mOnFinished = onFinished;
+  mOnFinished     = onFinished;
   mOnFinishedData = data;
 }
 
@@ -133,7 +131,7 @@ void ColorTransitionController::OnTransitionFinished(Animation& anim)
   Vector3 color1 = mComposite.GetProperty(mPropRgb[1]).Get<Vector3>();
   mComposite.SetProperty(mPropRgb[0], color1);
 
-  if (mOnFinished)
+  if(mOnFinished)
   {
     mOnFinished(mOnFinishedData);
   }
index 962ec27..957a9f0 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef DALI_DEMO_COLOR_TRANSITION_CONTROLLER_H
 #define DALI_DEMO_COLOR_TRANSITION_CONTROLLER_H
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  * limitations under the License.
  *
  */
-#include "dali/public-api/adaptor-framework/window.h"
-#include "dali/public-api/object/weak-handle.h"
 #include "dali/public-api/actors/actor.h"
+#include "dali/public-api/adaptor-framework/window.h"
 #include "dali/public-api/animation/animation.h"
-#include "dali/public-api/rendering/texture.h"
-#include "dali/public-api/render-tasks/render-task.h"
+#include "dali/public-api/object/weak-handle.h"
 #include "dali/public-api/render-tasks/render-task-list.h"
+#include "dali/public-api/render-tasks/render-task.h"
+#include "dali/public-api/rendering/texture.h"
 
-class ColorTransitionController: public Dali::ConnectionTracker
+class ColorTransitionController : public Dali::ConnectionTracker
 {
 public:
-  using OnFinished = void(*)(void*);
+  using OnFinished = void (*)(void*);
 
   ColorTransitionController(Dali::WeakHandle<Dali::RenderTaskList> renderTasks, Dali::Actor content, Dali::RenderTaskList tasks, Dali::Vector3 initialColor);
   ~ColorTransitionController();
@@ -45,7 +45,7 @@ public:
 private:
   void OnTransitionFinished(Dali::Animation& anim);
 
-  Dali::Actor mComposite;
+  Dali::Actor           mComposite;
   Dali::Property::Index mPropFlow;
   Dali::Property::Index mPropUvTransform;
   Dali::Property::Index mPropRgb[2];
@@ -54,8 +54,8 @@ private:
 
   Dali::Animation mAnimation;
 
-  OnFinished mOnFinished = nullptr;
-  void* mOnFinishedData = nullptr;
+  OnFinished mOnFinished     = nullptr;
+  void*      mOnFinishedData = nullptr;
 
   Dali::WeakHandle<Dali::RenderTaskList> mWeakRenderTasks;
 };
index 095f3e7..3375893 100644 (file)
  * limitations under the License.
  *
  */
-#include "utils.h"
 #include "color-transition-controller.h"
-#include "dali/dali.h"
 #include "dali-toolkit/dali-toolkit.h"
+#include "dali/dali.h"
+#include "utils.h"
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -26,7 +26,7 @@ namespace
 {
 const float TRANSITION_DURATION = 1.f;
 
-const Vector3 INITIAL_COLOR{ 1.f, 1.f, .25f };
+const Vector3 INITIAL_COLOR{1.f, 1.f, .25f};
 
 const char* const FLOW_MAPS[] = {
   "circular",
@@ -38,15 +38,13 @@ const char* const FLOW_MAPS[] = {
   "radial",
   "swipe",
   "bubbles",
-  "image"
-};
+  "image"};
 
 Texture LoadTexture(const std::string& path)
 {
   PixelData pixelData = SyncImageLoader::Load(path);
 
-  Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(),
-    pixelData.GetWidth(), pixelData.GetHeight());
+  Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight());
   texture.Upload(pixelData);
   return texture;
 }
@@ -64,7 +62,7 @@ TextLabel MakeTextLabel(const char* text, const Vector4& color, float pointSize,
   return tl;
 }
 
-}
+} // namespace
 
 /**
  * Demonstrates colour transition using flow maps and uv rotation / scaling.
@@ -81,7 +79,7 @@ TextLabel MakeTextLabel(const char* text, const Vector4& color, float pointSize,
  * - Double-tap outside the middle of screen: transition using one of the
  *   effects (flow maps) mapped to the given segment of the screen;
  */
-class ColorTransition: public ConnectionTracker
+class ColorTransition : public ConnectionTracker
 {
 public:
   ColorTransition(Application& app)
@@ -100,8 +98,8 @@ private:
 
   void OnInit(Application& app)
   {
-    auto window = mApp.GetWindow();
-    auto windowSize = Vector2{ window.GetSize() };
+    auto window     = mApp.GetWindow();
+    auto windowSize = Vector2{window.GetSize()};
 
     // create content root
     Actor content = Actor::New();
@@ -132,9 +130,9 @@ private:
     window.Add(mainRoot);
     mMainRoot = mainRoot;
 
-    auto renderTasks = window.GetRenderTaskList();
+    auto renderTasks     = window.GetRenderTaskList();
     auto weakRenderTasks = WeakHandle<RenderTaskList>(renderTasks);
-    auto controller = new ColorTransitionController(weakRenderTasks, content, window.GetRenderTaskList(), INITIAL_COLOR);
+    auto controller      = new ColorTransitionController(weakRenderTasks, content, window.GetRenderTaskList(), INITIAL_COLOR);
     mController.reset(controller);
     mainRoot.Add(mController->GetComposite());
 
@@ -167,9 +165,9 @@ private:
 
   void OnKeyEvent(const KeyEvent& event)
   {
-    if (event.GetState() == KeyEvent::DOWN)
+    if(event.GetState() == KeyEvent::DOWN)
     {
-      if (IsKey(event, DALI_KEY_ESCAPE) || IsKey(event, DALI_KEY_BACK))
+      if(IsKey(event, DALI_KEY_ESCAPE) || IsKey(event, DALI_KEY_BACK))
       {
         mApp.Quit();
       }
@@ -178,17 +176,17 @@ private:
 
   void OnDoubleTap(Actor /*actor*/, const TapGesture& tap)
   {
-    auto window = mApp.GetWindow();
-    auto windowSize = Vector2{ window.GetSize() };
-    Vector2 clip = tap.GetScreenPoint() / windowSize - Vector2::ONE * .5f; // [-.5, .5]
-    if (clip.Length() < .333f * .5f)
+    auto    window     = mApp.GetWindow();
+    auto    windowSize = Vector2{window.GetSize()};
+    Vector2 clip       = tap.GetScreenPoint() / windowSize - Vector2::ONE * .5f; // [-.5, .5]
+    if(clip.Length() < .333f * .5f)
     {
       LoadFlowMap(FLOW_MAPS[rand() % std::extent<decltype(FLOW_MAPS)>::value]);
     }
     else
     {
       float theta = fmodf((atan2(clip.y, clip.x) + M_PI) / (M_PI * 2.) + .75f, 1.f);
-      int i = std::extent<decltype(FLOW_MAPS)>::value * theta;
+      int   i     = std::extent<decltype(FLOW_MAPS)>::value * theta;
 
       LoadFlowMap(FLOW_MAPS[i]);
     }
@@ -204,11 +202,11 @@ private:
   void LoadFlowMap(const char* const name)
   {
     DALI_ASSERT_DEBUG(name && "Flow map name must be given");
-    if (mLastFlowMap != name)
+    if(mLastFlowMap != name)
     {
-      std::string flowMapDir = Application::GetResourcePath() + "images/color-transition/";
+      std::string flowMapDir  = Application::GetResourcePath() + "images/color-transition/";
       std::string flowMapPath = flowMapDir + name + ".png";
-      auto flowMap = LoadTexture(flowMapPath);
+      auto        flowMap     = LoadTexture(flowMapPath);
       DALI_ASSERT_DEBUG(flowMap && "Failed to load flow map.");
       mController->SetFlowMap(flowMap);
     }
@@ -216,8 +214,7 @@ private:
 
   void RandomizeUvTransform()
   {
-    mController->SetUvTransform((rand() % 12) * M_PI / 12., 1.f,
-      (rand() % 12) * M_PI / 12., .5f);
+    mController->SetUvTransform((rand() % 12) * M_PI / 12., 1.f, (rand() % 12) * M_PI / 12., .5f);
   }
 
   void OnTransitionFinished()
@@ -241,7 +238,8 @@ int DALI_EXPORT_API main(int argc, char** argv)
 {
   auto app = Application::New(&argc, &argv
 #ifdef WIN32
-    , ".//dali-toolkit-default-theme.json"
+                              ,
+                              ".//dali-toolkit-default-theme.json"
 #endif
   );
   ColorTransition ct(app);
index c226bfe..7feb9f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -16,8 +16,8 @@
  */
 #include "utils.h"
 
-#include <cstdio>
 #include <cstdarg>
+#include <cstdio>
 
 #include <cmath>
 
@@ -32,14 +32,14 @@ Geometry CreateQuadGeometry()
   };
 
   Vertex vertexData[] = {
-    { Vector3(-.5f, .5f, .0f) },
-    { Vector3(.5f, .5f, .0f) },
-    { Vector3(-.5f, -.5f, .0f) },
-    { Vector3(.5f, -.5f, .0f) },
+    {Vector3(-.5f, .5f, .0f)},
+    {Vector3(.5f, .5f, .0f)},
+    {Vector3(-.5f, -.5f, .0f)},
+    {Vector3(.5f, -.5f, .0f)},
   };
 
   VertexBuffer vertexBuffer = VertexBuffer::New(Property::Map()
-    .Add("aPosition", Property::VECTOR3));
+                                                  .Add("aPosition", Property::VECTOR3));
   vertexBuffer.SetData(vertexData, std::extent<decltype(vertexData)>::value);
 
   Geometry geometry = Geometry::New();
@@ -52,17 +52,17 @@ Renderer CreateRenderer(TextureSet textures, Geometry geometry, Shader shader, u
 {
   Renderer renderer = Renderer::New(geometry, shader);
   renderer.SetProperty(Renderer::Property::BLEND_MODE,
-    (options & RendererOptions::BLEND) ? BlendMode::ON : BlendMode::OFF);
+                       (options & RendererOptions::BLEND) ? BlendMode::ON : BlendMode::OFF);
   renderer.SetProperty(Renderer::Property::DEPTH_TEST_MODE,
-    (options & RendererOptions::DEPTH_TEST) ? DepthTestMode::ON : DepthTestMode::OFF);
+                       (options & RendererOptions::DEPTH_TEST) ? DepthTestMode::ON : DepthTestMode::OFF);
   renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE,
-    (options & RendererOptions::DEPTH_WRITE) ? DepthWriteMode::ON : DepthWriteMode::OFF);
+                       (options & RendererOptions::DEPTH_WRITE) ? DepthWriteMode::ON : DepthWriteMode::OFF);
 
   int faceCulling = (((options & RendererOptions::CULL_BACK) != 0) << 1) |
-    ((options & RendererOptions::CULL_FRONT) != 0);
+                    ((options & RendererOptions::CULL_FRONT) != 0);
   renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, faceCulling);
 
-  if (!textures)
+  if(!textures)
   {
     textures = TextureSet::New();
   }
@@ -76,4 +76,3 @@ void CenterActor(Actor actor)
   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
 }
-
index 9a4b1bc..5795d72 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -22,7 +22,9 @@
 #include "dali/public-api/rendering/renderer.h"
 #include "dali/public-api/rendering/texture.h"
 
-#define ACTOR_DECL(x) auto x = Dali::Actor::New(); x.SetProperty(Actor::Property::NAME, #x);
+#define ACTOR_DECL(x)          \
+  auto x = Dali::Actor::New(); \
+  x.SetProperty(Actor::Property::NAME, #x);
 
 /**
  * @brief Creates a unit quad centered on the origin (i.e. vertex positions
@@ -34,12 +36,12 @@ struct RendererOptions
 {
   enum
   {
-    NONE = 0x0,
-    BLEND = 0x01,
-    DEPTH_TEST = 0x02,
+    NONE        = 0x0,
+    BLEND       = 0x01,
+    DEPTH_TEST  = 0x02,
     DEPTH_WRITE = 0x04,
-    CULL_BACK = 0x08,
-    CULL_FRONT = 0x10,
+    CULL_BACK   = 0x08,
+    CULL_FRONT  = 0x10,
   };
 };
 
@@ -49,9 +51,9 @@ struct RendererOptions
 ///@note If textures is not a valid handle, an empty texture set will be created.
 Dali::Renderer CreateRenderer(
   Dali::TextureSet textures,
-  Dali::Geometry geometry,
-  Dali::Shader shader,
-  uint32_t options = RendererOptions::NONE);
+  Dali::Geometry   geometry,
+  Dali::Shader     shader,
+  uint32_t         options = RendererOptions::NONE);
 
 ///@brief Sets @a actor's anchor point and parent origin to center.
 void CenterActor(Dali::Actor actor);
index d8e5d44..10e71e7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -27,18 +27,19 @@ namespace
 {
 const char* IMAGE_FILE(DEMO_IMAGE_DIR "gallery-medium-1.jpg");
 
-const float BLUR_RADIUS_VALUE(15.0f);
+const float   BLUR_RADIUS_VALUE(15.0f);
 const Vector2 BLUR_OFFSET_VALUE(0.05f, 0.05f);
 const Vector2 BLUR_SIZE_VALUE(1.1f, 1.1f);
 const Vector2 NO_BLUR_SIZE_VALUE(1.05f, 1.05f);
-const float ANIMATION_DURATION(2.0f);
+const float   ANIMATION_DURATION(2.0f);
 
 const Property::Value SHADOW{
   {Visual::Property::TYPE, Visual::COLOR},
   {Visual::Property::MIX_COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.5f)},
-  {Visual::Property::TRANSFORM, Property::Map{{Visual::Transform::Property::SIZE, NO_BLUR_SIZE_VALUE},
-                                              {Visual::Transform::Property::ORIGIN, Align::CENTER},
-                                              {Visual::Transform::Property::ANCHOR_POINT, Align::CENTER}}}};
+  {Visual::Property::TRANSFORM,
+   Property::Map{{Visual::Transform::Property::SIZE, NO_BLUR_SIZE_VALUE},
+                 {Visual::Transform::Property::ORIGIN, Align::CENTER},
+                 {Visual::Transform::Property::ANCHOR_POINT, Align::CENTER}}}};
 
 } // namespace
 
index 28e841b..e1cce1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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,9 +21,9 @@
 #include <dali/dali.h>
 
 // INTERNAL INCLUDES
-#include "shared/utility.h"
-#include "generated/compressed-texture-formats-example-vert.h"
 #include "generated/compressed-texture-formats-example-frag.h"
+#include "generated/compressed-texture-formats-example-vert.h"
+#include "shared/utility.h"
 
 using namespace Dali;
 using Dali::Toolkit::TextLabel;
index 539c852..64fc0e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -22,8 +22,8 @@
 #include <dali-toolkit/dali-toolkit.h>
 
 // INTERNAL INCLUDES
-#include "generated/clipped-image-vert.h"
 #include "generated/clipped-image-frag.h"
+#include "generated/clipped-image-vert.h"
 
 namespace ClippedImage
 {
index 28cf835..8a2f93b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include "dali/public-api/actors/actor.h"
 #include "dali/public-api/rendering/renderer.h"
 
-#include "generated/deferred-shading-mainpass-vert.h"
 #include "generated/deferred-shading-mainpass-frag.h"
-#include "generated/deferred-shading-prepass-vert.h"
+#include "generated/deferred-shading-mainpass-vert.h"
 #include "generated/deferred-shading-prepass-frag.h"
+#include "generated/deferred-shading-prepass-vert.h"
 
 using namespace Dali;
 
index c8a24da..d51ce9e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -19,8 +19,8 @@
 #include "game-model.h"
 #include "game-texture.h"
 
-#include "generated/game-renderer-vert.h"
 #include "generated/game-renderer-frag.h"
+#include "generated/game-renderer-vert.h"
 
 #include <dali/dali.h>
 
index 076f925..2ba4d3a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -134,12 +134,21 @@ SamplingMode::Type NextFilterMode(SamplingMode::Type oldMode)
 
 const char* StringFromScalingMode(FittingMode::Type scalingMode)
 {
-  return scalingMode == FittingMode::SCALE_TO_FILL ? "SCALE_TO_FILL" : scalingMode == FittingMode::SHRINK_TO_FIT ? "SHRINK_TO_FIT" : scalingMode == FittingMode::FIT_WIDTH ? "FIT_WIDTH" : scalingMode == FittingMode::FIT_HEIGHT ? "FIT_HEIGHT" : "UnknownScalingMode";
+  return scalingMode == FittingMode::SCALE_TO_FILL ? "SCALE_TO_FILL" : scalingMode == FittingMode::SHRINK_TO_FIT ? "SHRINK_TO_FIT"
+                                                                     : scalingMode == FittingMode::FIT_WIDTH     ? "FIT_WIDTH"
+                                                                     : scalingMode == FittingMode::FIT_HEIGHT    ? "FIT_HEIGHT"
+                                                                                                                 : "UnknownScalingMode";
 }
 
 const char* StringFromFilterMode(SamplingMode::Type filterMode)
 {
-  return filterMode == SamplingMode::BOX ? "BOX" : filterMode == SamplingMode::BOX_THEN_NEAREST ? "BOX_THEN_NEAREST" : filterMode == SamplingMode::BOX_THEN_LINEAR ? "BOX_THEN_LINEAR" : filterMode == SamplingMode::NEAREST ? "NEAREST" : filterMode == SamplingMode::LINEAR ? "LINEAR" : filterMode == SamplingMode::NO_FILTER ? "NO_FILTER" : filterMode == SamplingMode::DONT_CARE ? "DONT_CARE" : "UnknownFilterMode";
+  return filterMode == SamplingMode::BOX ? "BOX" : filterMode == SamplingMode::BOX_THEN_NEAREST ? "BOX_THEN_NEAREST"
+                                                 : filterMode == SamplingMode::BOX_THEN_LINEAR  ? "BOX_THEN_LINEAR"
+                                                 : filterMode == SamplingMode::NEAREST          ? "NEAREST"
+                                                 : filterMode == SamplingMode::LINEAR           ? "LINEAR"
+                                                 : filterMode == SamplingMode::NO_FILTER        ? "NO_FILTER"
+                                                 : filterMode == SamplingMode::DONT_CARE        ? "DONT_CARE"
+                                                                                                : "UnknownFilterMode";
 }
 
 } // namespace
index 0e5c538..7fe4b6d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -577,7 +577,9 @@ public:
 
         mFittingModes[id] = newMode;
 
-        SetTitle(std::string(newMode == FittingMode::SHRINK_TO_FIT ? "SHRINK_TO_FIT" : newMode == FittingMode::SCALE_TO_FILL ? "SCALE_TO_FILL" : newMode == FittingMode::FIT_WIDTH ? "FIT_WIDTH" : "FIT_HEIGHT"));
+        SetTitle(std::string(newMode == FittingMode::SHRINK_TO_FIT ? "SHRINK_TO_FIT" : newMode == FittingMode::SCALE_TO_FILL ? "SCALE_TO_FILL"
+                                                                                     : newMode == FittingMode::FIT_WIDTH     ? "FIT_WIDTH"
+                                                                                                                             : "FIT_HEIGHT"));
       }
     }
     return true;
index 7f2b4dd..d3f1038 100644 (file)
@@ -18,8 +18,8 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/image-loader/texture-manager.h>
 
-#include "shared/view.h"
 #include "generated/image-view-url-frag.h"
+#include "shared/view.h"
 
 using namespace Dali;
 
index 1bc3589..a71ce30 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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,9 +21,9 @@
 #include <dali/devel-api/actors/actor-devel.h>
 
 // INTERNAL INCLUDES
-#include "shared/view.h"
-#include "generated/line-mesh-vert.h"
 #include "generated/line-mesh-frag.h"
+#include "generated/line-mesh-vert.h"
+#include "shared/view.h"
 
 #include <sstream>
 
@@ -31,7 +31,6 @@ using namespace Dali;
 
 namespace
 {
-
 const unsigned short  INDEX_LINES[]   = {0, 1, 1, 2, 2, 3, 3, 4, 4, 0};
 const unsigned short  INDEX_LOOP[]    = {0, 1, 2, 3, 4};
 const unsigned short  INDEX_STRIP[]   = {0, 1, 2, 3, 4, 0};
index 852449c..0718858 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/devel-api/actors/actor-devel.h>
 
 // INTERNAL INCLUDES
-#include "shared/view.h"
-#include "generated/mesh-morph-vert.h"
 #include "generated/mesh-morph-frag.h"
+#include "generated/mesh-morph-vert.h"
+#include "shared/view.h"
 
 using namespace Dali;
 
 namespace
 {
-
 Geometry CreateGeometry()
 {
   // Create vertices
index 7a0548a..63a82b4 100644 (file)
@@ -417,8 +417,8 @@ public:
           {
             //Calculate displacement and corresponding rotation.
             const Vector2 touchPosition = touch.GetScreenPosition(0);
-            const Vector2 displacement = touchPosition - mLastTouchPosition;
-            mLastTouchPosition = touchPosition;
+            const Vector2 displacement  = touchPosition - mLastTouchPosition;
+            mLastTouchPosition          = touchPosition;
 
             const Quaternion q(Radian(displacement.y / -Y_ROTATION_DISPLACEMENT_FACTOR), Radian(displacement.x / X_ROTATION_DISPLACEMENT_FACTOR), Radian(0.f));
             const Quaternion q0 = mModels[mSelectedModelIndex].control.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>();
index ae39e8d..d9c295f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/public-api/rendering/texture.h>
 
 // INTERNAL INCLUDES
-#include "shared/utility.h" // DemoHelper::LoadTexture
-#include "generated/metaball-vert.h"
 #include "generated/metaball-frag.h"
 #include "generated/metaball-refraction-frag.h"
+#include "generated/metaball-vert.h"
+#include "shared/utility.h" // DemoHelper::LoadTexture
 
 using namespace Dali;
 
index a25e5c3..6114248 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali/public-api/rendering/texture.h>
 
 // INTERNAL INCLUDES
-#include "shared/utility.h" // DemoHelper::LoadTexture
-#include "generated/metaball-vert.h"
+#include "generated/fragment-frag.h"
 #include "generated/metaball-frag.h"
 #include "generated/metaball-refraction-frag.h"
-#include "generated/fragment-frag.h"
+#include "generated/metaball-vert.h"
+#include "shared/utility.h" // DemoHelper::LoadTexture
 
 using namespace Dali;
 
index dad40d3..c1d0f01 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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,9 +21,9 @@
 #include <cstring>
 
 // INTERNAL INCLUDES
-#include "shared/utility.h"
-#include "generated/native-image-source-texture-vert.h"
 #include "generated/native-image-source-texture-frag.h"
+#include "generated/native-image-source-texture-vert.h"
+#include "shared/utility.h"
 
 using namespace Dali;
 using namespace Toolkit;
index 7589a8e..d050e7a 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PARTICLES_FLOAT_RAND_H_
 #define PARTICLES_FLOAT_RAND_H_
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 
 struct FloatRand
 {
-  std::random_device mDevice;
-  std::mt19937 mMersenneTwister;
+  std::random_device                    mDevice;
+  std::mt19937                          mMersenneTwister;
   std::uniform_real_distribution<float> mDistribution;
 
   FloatRand()
   : mMersenneTwister(mDevice()),
     mDistribution(0., 1.)
-  {}
+  {
+  }
 
   float operator()()
   {
index eb112db..1d516b5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PARTICLES_PARTICLE_FIELD_H_
 #define PARTICLES_PARTICLE_FIELD_H_
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  * limitations under the License.
  *
  */
-#include "utils.h"
-#include "float-rand.h"
+#include <vector>
 #include "dali/public-api/math/vector2.h"
 #include "dali/public-api/math/vector3.h"
 #include "dali/public-api/math/vector4.h"
 #include "dali/public-api/rendering/geometry.h"
-#include <vector>
+#include "float-rand.h"
+#include "utils.h"
 
 struct ParticleField
 {
-  float mSize;
+  float         mSize;
   Dali::Vector3 mBoxSize;
   Dali::Vector3 mParticlesPerAxis;
-  float mSizeVariance;
-  float mNoiseAmount;    // affects color, motion (phase), twinkle (frequency, phase, size, opacity),
-  float mDisperse;
-  float mMotionScale;
-  float mMotionCycleLength;    // seconds
-  float mTwinkleFrequency;    // per motion cycle
-  float mTwinkleSizeScale;
-  float mTwinkleOpacityWeight;
+  float         mSizeVariance;
+  float         mNoiseAmount; // affects color, motion (phase), twinkle (frequency, phase, size, opacity),
+  float         mDisperse;
+  float         mMotionScale;
+  float         mMotionCycleLength; // seconds
+  float         mTwinkleFrequency;  // per motion cycle
+  float         mTwinkleSizeScale;
+  float         mTwinkleOpacityWeight;
 
   Dali::Vector3 GetParticlesPerAxisSafe() const
   {
     using namespace Dali;
     return Vector3(std::max(1.f, FastFloor(mParticlesPerAxis.x)),
-      std::max(1.f, FastFloor(mParticlesPerAxis.y)),
-      std::max(1.f, FastFloor(mParticlesPerAxis.z)));
+                   std::max(1.f, FastFloor(mParticlesPerAxis.y)),
+                   std::max(1.f, FastFloor(mParticlesPerAxis.z)));
   }
 
   Dali::Geometry MakeGeometry() const
@@ -58,14 +58,14 @@ struct ParticleField
     struct Vertex
     {
       Vector3 aPosition;
-      float aSeed;
+      float   aSeed;
       Vector4 aPath;
       Vector2 aSubPosition;
-      float aSize;
+      float   aSize;
     };
 
-    const int numPatternVertices = 6;
-    Vector2 vertexPattern[numPatternVertices] = {
+    const int numPatternVertices                = 6;
+    Vector2   vertexPattern[numPatternVertices] = {
       Vector2(-1.f, 1.f),
       Vector2(-1.f, -1.f),
       Vector2(1.f, 1.f),
@@ -75,27 +75,27 @@ struct ParticleField
     };
 
     Vector3 particlesPerAxis = GetParticlesPerAxisSafe();
-    auto numParticles = particlesPerAxis.x * particlesPerAxis.y * particlesPerAxis.z;
+    auto    numParticles     = particlesPerAxis.x * particlesPerAxis.y * particlesPerAxis.z;
 
     std::vector<Vertex> vertices;
     vertices.reserve(numParticles * numPatternVertices);
 
     Vector3 invBoxSize(1. / std::max(mBoxSize.x, 1.f),
-      1. / std::max(mBoxSize.y, 1.f),
-      1. / std::max(mBoxSize.z, 1.f));
+                       1. / std::max(mBoxSize.y, 1.f),
+                       1. / std::max(mBoxSize.z, 1.f));
     Vector3 spacing(mBoxSize.x / particlesPerAxis.x,
-      mBoxSize.y / particlesPerAxis.y,
-      mBoxSize.z / particlesPerAxis.z);
-    auto offset = (mBoxSize - spacing) * .5;
-    int nx = particlesPerAxis.x;
-    int ny = particlesPerAxis.y;
-    int nxy = nx * ny;
-    for (size_t i = 0; i < numParticles; ++i)
+                    mBoxSize.y / particlesPerAxis.y,
+                    mBoxSize.z / particlesPerAxis.z);
+    auto    offset = (mBoxSize - spacing) * .5;
+    int     nx     = particlesPerAxis.x;
+    int     ny     = particlesPerAxis.y;
+    int     nxy    = nx * ny;
+    for(size_t i = 0; i < numParticles; ++i)
     {
       Vertex v;
-      float x = float(i % nx);
-      float y = float((i / nx) % ny);
-      float z = float(i / nxy);
+      float  x    = float(i % nx);
+      float  y    = float((i / nx) % ny);
+      float  z    = float(i / nxy);
       v.aPosition = Vector3(x, y, z) * spacing - offset;
 
       Vector3 disperseDir(frandDisperse() - .5, frandDisperse() - .5, frandDisperse() - .5);
@@ -108,26 +108,25 @@ struct ParticleField
       v.aPath = Vector4(frandPath() - .5, frandPath() - .5, frandPath() - .5, frandPath() - .5) * mMotionScale;
 
       const float size = mSize * ((1.f + (frandSize() - .5) * mSizeVariance) * .5f);
-      for (int j = 0; j < numPatternVertices; ++j)
+      for(int j = 0; j < numPatternVertices; ++j)
       {
         v.aSubPosition = vertexPattern[j];
-        v.aSize = size;
+        v.aSize        = size;
         vertices.push_back(v);
       }
     }
 
-    VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
-      .Add( "aPosition", Property::VECTOR3 )
-      .Add( "aSeed", Property::FLOAT )
-      .Add( "aPath", Property::VECTOR4 )
-      .Add( "aSubPosition", Property::VECTOR2 )
-      .Add( "aSize", Property::FLOAT )
-    );
-    vertexBuffer.SetData( vertices.data(), vertices.size() );
+    VertexBuffer vertexBuffer = VertexBuffer::New(Property::Map()
+                                                    .Add("aPosition", Property::VECTOR3)
+                                                    .Add("aSeed", Property::FLOAT)
+                                                    .Add("aPath", Property::VECTOR4)
+                                                    .Add("aSubPosition", Property::VECTOR2)
+                                                    .Add("aSize", Property::FLOAT));
+    vertexBuffer.SetData(vertices.data(), vertices.size());
 
     Geometry geometry = Geometry::New();
-    geometry.AddVertexBuffer( vertexBuffer );
-    geometry.SetType( Geometry::TRIANGLES );
+    geometry.AddVertexBuffer(vertexBuffer);
+    geometry.SetType(Geometry::TRIANGLES);
     return geometry;
   }
 };
index 966a1e4..3194143 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  *
  */
 #include "particle-view.h"
-#include "utils.h"
 #include "dali/public-api/animation/constraints.h"
+#include "utils.h"
 
-#include "generated/particle-view-vert.h"
 #include "generated/particle-view-frag.h"
-#include "generated/particle-view-simple-vert.h"
 #include "generated/particle-view-simple-frag.h"
+#include "generated/particle-view-simple-vert.h"
+#include "generated/particle-view-vert.h"
 
 //#define ENABLE_DEBUG_VOLUME
 
@@ -31,7 +31,6 @@ using namespace Dali;
 
 namespace
 {
-
 const uint32_t POPULATION_GRANULARITY = 128;
 
 uint32_t GetSkipValue(uint32_t count, uint32_t prime)
@@ -40,19 +39,17 @@ uint32_t GetSkipValue(uint32_t count, uint32_t prime)
   do
   {
     skip = (rand() % prime) * count * count + (rand() % prime) * count + (rand() % prime);
-  }
-  while (skip % prime == 0);
+  } while(skip % prime == 0);
   return skip;
 }
 
-}
+} // namespace
 
-ParticleView::ParticleView(const ParticleField& field, Dali::Actor world, Dali::CameraActor camera,
-  Dali::Geometry particleGeom)
+ParticleView::ParticleView(const ParticleField& field, Dali::Actor world, Dali::CameraActor camera, Dali::Geometry particleGeom)
 : mWorld(world),
   mParticleBoxSize(field.mBoxSize)
 {
-  if (!particleGeom)
+  if(!particleGeom)
   {
     // create particles
     particleGeom = field.MakeGeometry();
@@ -61,8 +58,8 @@ ParticleView::ParticleView(const ParticleField& field, Dali::Actor world, Dali::
   // create shader
   Shader particleShader = Shader::New(SHADER_PARTICLE_VIEW_VERT, SHADER_PARTICLE_VIEW_FRAG, Shader::Hint::MODIFIES_GEOMETRY);
 
-  float zNear = camera.GetNearClippingPlane();
-  float zFar = camera.GetFarClippingPlane();
+  float         zNear = camera.GetNearClippingPlane();
+  float         zFar  = camera.GetFarClippingPlane();
   const Vector2 depthRange(zNear, 1.f / (zFar - zNear));
   particleShader.RegisterProperty("uDepthRange", depthRange);
 
@@ -70,16 +67,16 @@ ParticleView::ParticleView(const ParticleField& field, Dali::Actor world, Dali::
   particleShader.RegisterProperty("uTwinkleSizeScale", field.mTwinkleSizeScale);
   particleShader.RegisterProperty("uTwinkleOpacityWeight", field.mTwinkleOpacityWeight);
 
-  mPropPopulation = particleShader.RegisterProperty("uPopulation", 1.f);
-  mPropFocalLength = particleShader.RegisterProperty("uFocalLength", .5f);
-  mPropAperture = particleShader.RegisterProperty("uAperture", 8.f);
+  mPropPopulation        = particleShader.RegisterProperty("uPopulation", 1.f);
+  mPropFocalLength       = particleShader.RegisterProperty("uFocalLength", .5f);
+  mPropAperture          = particleShader.RegisterProperty("uAperture", 8.f);
   mPropAlphaTestRefValue = particleShader.RegisterProperty("uAlphaTestRefValue", 0.f);
-  mPropFadeRange = particleShader.RegisterProperty("uFadeRange", Vector2(0.f, 1.f));
+  mPropFadeRange         = particleShader.RegisterProperty("uFadeRange", Vector2(0.f, 1.f));
 
   // scatter variables
-  char nameBuffer[64];
+  char  nameBuffer[64];
   char* writep = nameBuffer + snprintf(nameBuffer, sizeof(nameBuffer), "uScatter[");
-  for (uint32_t i = 0; i < std::extent<decltype(mScatterProps)>::value; ++i)
+  for(uint32_t i = 0; i < std::extent<decltype(mScatterProps)>::value; ++i)
   {
     char* writep2 = writep + snprintf(writep, sizeof(nameBuffer) - std::distance(nameBuffer, writep), "%d].", i);
 
@@ -97,18 +94,18 @@ ParticleView::ParticleView(const ParticleField& field, Dali::Actor world, Dali::
   // Our particle mesh is sorted in Z; changing the population should remove
   // particles "randomly", not from one end.
   // Algorithm described in Mike McShaffry & al: Game Coding Complete.
-  const uint32_t prime = 131;  // next prime after POPULATION_GRANULARITY
-  const uint32_t skip = GetSkipValue(POPULATION_GRANULARITY, prime);
-  uint32_t next = 0;
+  const uint32_t prime = 131; // next prime after POPULATION_GRANULARITY
+  const uint32_t skip  = GetSkipValue(POPULATION_GRANULARITY, prime);
+  uint32_t       next  = 0;
 
   writep = nameBuffer + snprintf(nameBuffer, sizeof(nameBuffer), "uOrderLookUp[");
-  for (uint32_t i = 0; i < POPULATION_GRANULARITY; ++i)
+  for(uint32_t i = 0; i < POPULATION_GRANULARITY; ++i)
   {
-    do {
+    do
+    {
       next += skip;
       next %= prime;
-    }
-    while (next == 0 || next > POPULATION_GRANULARITY);
+    } while(next == 0 || next > POPULATION_GRANULARITY);
 
     snprintf(writep, sizeof(nameBuffer) - std::distance(nameBuffer, writep), "%d]", i);
     particleShader.RegisterProperty(nameBuffer, float(next - 1));
@@ -124,7 +121,7 @@ ParticleView::ParticleView(const ParticleField& field, Dali::Actor world, Dali::
 
   mParticleShader = particleShader;
 
-  auto renderer = CreateRenderer(TextureSet::New(), particleGeom, particleShader, OPTION_BLEND);
+  auto renderer        = CreateRenderer(TextureSet::New(), particleGeom, particleShader, OPTION_BLEND);
   auto masterParticles = CreateActor();
   masterParticles.SetProperty(Actor::Property::SIZE, field.mBoxSize);
   masterParticles.SetProperty(Actor::Property::VISIBLE, true);
@@ -134,7 +131,7 @@ ParticleView::ParticleView(const ParticleField& field, Dali::Actor world, Dali::
 
 #ifdef ENABLE_DEBUG_VOLUME
   Geometry cubeGeom = CreateCuboidWireframeGeometry();
-  renderer = CreateRenderer(renderer.GetTextures(), cubeGeom, Shader::New(SHADER_PARTICLE_VIEW_SIMPLE_VERT, SHADER_PARTICLE_VIEW_SIMPLE_FRAG));
+  renderer          = CreateRenderer(renderer.GetTextures(), cubeGeom, Shader::New(SHADER_PARTICLE_VIEW_SIMPLE_VERT, SHADER_PARTICLE_VIEW_SIMPLE_FRAG));
   masterParticles.AddRenderer(renderer);
 #endif
 
@@ -147,19 +144,19 @@ ParticleView::~ParticleView()
   UnparentAndReset(mMasterParticles);
   UnparentAndReset(mSlaveParticles);
 
-  for (auto anim: { mAngularAnim, mLinearAnim })
+  for(auto anim : {mAngularAnim, mLinearAnim})
   {
-    if (anim)
+    if(anim)
     {
       anim.Stop();
       anim.Reset();
     }
   }
 
-  for (auto& s: mScatterProps)
+  for(auto& s : mScatterProps)
   {
     auto& anim = s.mAnim;
-    if (anim)
+    if(anim)
     {
       anim.Stop();
       anim.Reset();
@@ -204,23 +201,26 @@ void ParticleView::SetFadeRange(float near, float far)
 
 void ParticleView::SetAngularVelocity(float v)
 {
-  if (mAngularAnim)
+  if(mAngularAnim)
   {
     mAngularAnim.Stop();
     mAngularAnim.Clear();
     mAngularAnim.Reset();
   }
 
-  if (v * v > .0f)
+  if(v * v > .0f)
   {
     float sign = Sign(v);
-    auto anim = Animation::New(std::abs(2. * M_PI / v));
+    auto  anim = Animation::New(std::abs(2. * M_PI / v));
     anim.AnimateTo(Property(mMasterParticles, Actor::Property::ORIENTATION),
-      Quaternion(Radian(Degree(120. * sign)), Vector3::ZAXIS), TimePeriod(0., anim.GetDuration() / 3.));
+                   Quaternion(Radian(Degree(120. * sign)), Vector3::ZAXIS),
+                   TimePeriod(0., anim.GetDuration() / 3.));
     anim.AnimateTo(Property(mMasterParticles, Actor::Property::ORIENTATION),
-      Quaternion(Radian(Degree(240. * sign)), Vector3::ZAXIS), TimePeriod(anim.GetDuration() / 3., anim.GetDuration() / 3.));
+                   Quaternion(Radian(Degree(240. * sign)), Vector3::ZAXIS),
+                   TimePeriod(anim.GetDuration() / 3., anim.GetDuration() / 3.));
     anim.AnimateTo(Property(mMasterParticles, Actor::Property::ORIENTATION),
-      Quaternion(Radian(Degree(360. * sign)), Vector3::ZAXIS), TimePeriod(2. * anim.GetDuration() / 3., anim.GetDuration() / 3.));
+                   Quaternion(Radian(Degree(360. * sign)), Vector3::ZAXIS),
+                   TimePeriod(2. * anim.GetDuration() / 3., anim.GetDuration() / 3.));
     anim.SetLoopCount(0);
     anim.Play();
 
@@ -230,7 +230,7 @@ void ParticleView::SetAngularVelocity(float v)
 
 void ParticleView::SetLinearVelocity(float v)
 {
-  if (mLinearAnim)
+  if(mLinearAnim)
   {
     mLinearAnim.Stop();
     mLinearAnim.Clear();
@@ -238,13 +238,13 @@ void ParticleView::SetLinearVelocity(float v)
   }
   UnparentAndReset(mSlaveParticles);
 
-  if (v * v > .0f)
+  if(v * v > .0f)
   {
-    float sign = Sign(v);
+    float sign         = Sign(v);
     float directedSize = sign * mParticleBoxSize.z;
 
-    Actor slaveParticles = CloneActor(mMasterParticles);
-    Vector3 position = mMasterParticles.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>();
+    Actor   slaveParticles = CloneActor(mMasterParticles);
+    Vector3 position       = mMasterParticles.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>();
     slaveParticles.SetProperty(Actor::Property::POSITION, position + Vector3(0., 0., directedSize));
 
     auto propSecondaryColor = slaveParticles.RegisterProperty("uSecondaryColor", Vector3::XAXIS);
@@ -252,24 +252,21 @@ void ParticleView::SetLinearVelocity(float v)
     Actor world = mWorld.GetHandle();
     world.Add(slaveParticles);
 
-    if (sign < 0.)     // fix draw order
+    if(sign < 0.) // fix draw order
     {
       world.Remove(mMasterParticles);
       world.Add(mMasterParticles);
     }
 
-    Constraint constraint = Constraint::New<Vector4>(slaveParticles, Actor::Property::COLOR,
-      EqualToConstraint());
+    Constraint constraint = Constraint::New<Vector4>(slaveParticles, Actor::Property::COLOR, EqualToConstraint());
     constraint.AddSource(Source(mMasterParticles, Actor::Property::COLOR));
     constraint.Apply();
 
-    constraint = Constraint::New<Vector3>(slaveParticles, propSecondaryColor,
-      EqualToConstraint());
+    constraint = Constraint::New<Vector3>(slaveParticles, propSecondaryColor, EqualToConstraint());
     constraint.AddSource(Source(mMasterParticles, mPropSecondaryColor));
     constraint.Apply();
 
-    constraint = Constraint::New<Quaternion>(slaveParticles, Actor::Property::ORIENTATION,
-      EqualToConstraint());
+    constraint = Constraint::New<Quaternion>(slaveParticles, Actor::Property::ORIENTATION, EqualToConstraint());
     constraint.AddSource(Source(mMasterParticles, Actor::Property::ORIENTATION));
     constraint.Apply();
 
@@ -279,7 +276,7 @@ void ParticleView::SetLinearVelocity(float v)
     anim.SetLoopCount(0);
     anim.Play();
 
-    mLinearAnim = anim;
+    mLinearAnim     = anim;
     mSlaveParticles = slaveParticles;
   }
 }
@@ -289,7 +286,7 @@ void ParticleView::Scatter(float radius, float amount, float durationOut, float
   mActiveScatter = (mActiveScatter + 1) % std::extent<decltype(mScatterProps)>::value;
 
   auto& scatter = mScatterProps[mActiveScatter];
-  if (scatter.mAnim)
+  if(scatter.mAnim)
   {
     scatter.mAnim.Stop();
   }
@@ -298,12 +295,10 @@ void ParticleView::Scatter(float radius, float amount, float durationOut, float
   radius *= radius;
   mParticleShader.SetProperty(scatter.mPropRadius, radius);
 
-  Animation anim = Animation::New(durationOut + durationIn);
-  auto scatterAmount = Property(mParticleShader, scatter.mPropAmount);
-  anim.AnimateTo(scatterAmount, amount, AlphaFunction::EASE_OUT,
-    TimePeriod(0.f, durationOut));
-  anim.AnimateTo(scatterAmount, 0.f, AlphaFunction::EASE_IN_OUT_SINE,
-    TimePeriod(durationOut, durationIn));
+  Animation anim          = Animation::New(durationOut + durationIn);
+  auto      scatterAmount = Property(mParticleShader, scatter.mPropAmount);
+  anim.AnimateTo(scatterAmount, amount, AlphaFunction::EASE_OUT, TimePeriod(0.f, durationOut));
+  anim.AnimateTo(scatterAmount, 0.f, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(durationOut, durationIn));
   anim.Play();
 
   scatter.mAnim = anim;
@@ -312,25 +307,25 @@ void ParticleView::Scatter(float radius, float amount, float durationOut, float
 void ParticleView::SetScatterRay(Dali::Vector3 rayDir)
 {
   auto& scatter = mScatterProps[mActiveScatter];
-  mParticleShader.SetProperty(scatter.mPropRay, rayDir);;
+  mParticleShader.SetProperty(scatter.mPropRay, rayDir);
+  ;
 }
 
-void ParticleView::Fade(float duration, float target, AlphaFunction alphaFn,
-  std::function<void(Dali::Animation&)> onFinished)
+void ParticleView::Fade(float duration, float target, AlphaFunction alphaFn, std::function<void(Dali::Animation&)> onFinished)
 {
-  if (mFadeAnim)
+  if(mFadeAnim)
   {
     mFadeAnim.Stop();
   }
 
   Animation anim = Animation::New(duration);
   anim.AnimateTo(Property(mMasterParticles, Actor::Property::COLOR_ALPHA), target, alphaFn);
-  if (mSlaveParticles)
+  if(mSlaveParticles)
   {
     anim.AnimateTo(Property(mSlaveParticles, Actor::Property::COLOR_ALPHA), target, alphaFn);
   }
 
-  if (onFinished)
+  if(onFinished)
   {
     anim.FinishedSignal().Connect(this, onFinished);
   }
@@ -339,11 +334,10 @@ void ParticleView::Fade(float duration, float target, AlphaFunction alphaFn,
   mFadeAnim = anim;
 }
 
-void ParticleView::Fade(float duration, float target, float from, AlphaFunction alphaFn,
-  std::function<void(Dali::Animation&)> onFinished)
+void ParticleView::Fade(float duration, float target, float from, AlphaFunction alphaFn, std::function<void(Dali::Animation&)> onFinished)
 {
   mMasterParticles.SetProperty(Actor::Property::COLOR_ALPHA, from);
-  if (mSlaveParticles)
+  if(mSlaveParticles)
   {
     mSlaveParticles.SetProperty(Actor::Property::COLOR_ALPHA, from);
   }
index 099f568..e1f5d85 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PARTICLES_PARTICLE_VIEW_H_
 #define PARTICLES_PARTICLE_VIEW_H_
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  *
  */
 
-#include "particle-field.h"
+#include <functional>
+#include <vector>
 #include "dali/public-api/actors/camera-actor.h"
 #include "dali/public-api/animation/animation.h"
 #include "dali/public-api/object/weak-handle.h"
 #include "dali/public-api/rendering/shader.h"
-#include <vector>
-#include <functional>
+#include "particle-field.h"
 
 struct ColorRange
 {
@@ -31,11 +31,10 @@ struct ColorRange
   Dali::Vector3 rgb1;
 };
 
-class ParticleView: public Dali::ConnectionTracker
+class ParticleView : public Dali::ConnectionTracker
 {
 public:
-  ParticleView(const ParticleField& field, Dali::Actor world, Dali::CameraActor camera,
-    Dali::Geometry particleGeom = Dali::Geometry());
+  ParticleView(const ParticleField& field, Dali::Actor world, Dali::CameraActor camera, Dali::Geometry particleGeom = Dali::Geometry());
   ~ParticleView();
 
   void SetColorRange(const ColorRange& range);
@@ -62,15 +61,13 @@ public:
   ///@brief Starts an animation to change the opacity of the particles to @a target.
   ///@param duration Number of seconds to complete transition in.
   ///@param target Target opacity in the 0..1.f range.
-  void Fade(float duration, float target, Dali::AlphaFunction alphaFn = Dali::AlphaFunction::DEFAULT,
-    std::function<void(Dali::Animation&)> onFinished = nullptr);
+  void Fade(float duration, float target, Dali::AlphaFunction alphaFn = Dali::AlphaFunction::DEFAULT, std::function<void(Dali::Animation&)> onFinished = nullptr);
 
   ///@brief Starts an animation to change the opacity of the particles to @a target.
   ///@param duration Number of seconds to complete transition in.
   ///@param target Target opacity in the 0..1.f range.
   ///@param from The value to set the opacity to prior to the animation.
-  void Fade(float duration, float target, float from, Dali::AlphaFunction alphaFn = Dali::AlphaFunction::DEFAULT,
-    std::function<void(Dali::Animation&)> onFinished = nullptr);
+  void Fade(float duration, float target, float from, Dali::AlphaFunction alphaFn = Dali::AlphaFunction::DEFAULT, std::function<void(Dali::Animation&)> onFinished = nullptr);
 
 private: // DATA
   struct ScatterProps
@@ -83,9 +80,9 @@ private: // DATA
   };
 
   Dali::WeakHandle<Dali::Actor> mWorld;
-  Dali::Vector3 mParticleBoxSize;
+  Dali::Vector3                 mParticleBoxSize;
 
-  Dali::Shader mParticleShader;
+  Dali::Shader          mParticleShader;
   Dali::Property::Index mPropPopulation;
   Dali::Property::Index mPropFocalLength;
   Dali::Property::Index mPropAperture;
@@ -93,9 +90,9 @@ private: // DATA
   Dali::Property::Index mPropFadeRange;
 
   ScatterProps mScatterProps[6];
-  int mActiveScatter = 0;
+  int          mActiveScatter = 0;
 
-  Dali::Actor mMasterParticles;
+  Dali::Actor           mMasterParticles;
   Dali::Property::Index mPropSecondaryColor;
 
   Dali::Actor mSlaveParticles;
index 22dd815..72ff085 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  */
 
 // INTERNAL INCLUDES
-#include "particle-view.h"
-#include "float-rand.h"
-#include "particle-field.h"
-#include "utils.h"
+#include <fstream>
+#include <iostream>
+#include <list>
+#include <memory>
+#include <numeric>
+#include <random>
 #include "dali/devel-api/adaptor-framework/tilt-sensor.h"
-#include "dali/public-api/adaptor-framework/application.h"
-#include "dali/public-api/adaptor-framework/key.h"
 #include "dali/public-api/actors/camera-actor.h"
 #include "dali/public-api/actors/layer.h"
-#include "dali/public-api/events/tap-gesture-detector.h"
+#include "dali/public-api/adaptor-framework/application.h"
+#include "dali/public-api/adaptor-framework/key.h"
 #include "dali/public-api/events/pan-gesture-detector.h"
+#include "dali/public-api/events/tap-gesture-detector.h"
 #include "dali/public-api/events/touch-event.h"
+#include "dali/public-api/object/property-index-ranges.h"
 #include "dali/public-api/render-tasks/render-task-list.h"
 #include "dali/public-api/render-tasks/render-task.h"
-#include "dali/public-api/object/property-index-ranges.h"
-#include <fstream>
-#include <iostream>
-#include <numeric>
-#include <list>
-#include <memory>
-#include <random>
+#include "float-rand.h"
+#include "particle-field.h"
+#include "particle-view.h"
+#include "utils.h"
 
 using namespace Dali;
 
 namespace
 {
-
-const float PARTICLE_ALPHA = .75;
+const float PARTICLE_ALPHA       = .75;
 const float ALPHA_TEST_REF_VALUE = .0625;
 
-const float NEAR_FADE = 0.04;  // normalized depth
-const float FAR_FADE = 0.8;    // normalized depth
+const float NEAR_FADE = 0.04; // normalized depth
+const float FAR_FADE  = 0.8;  // normalized depth
 
 const ParticleField PARTICLE_FIELD = {
   200.f,                        // particle size
@@ -63,23 +62,23 @@ const ParticleField PARTICLE_FIELD = {
   .333                          // twinkle opacity weight
 };
 
-const float WORLD_ANGULAR_VELOCITY = .08; // radians per seconds
-const float WORLD_LINEAR_VELOCITY = -500; // units along z
+const float WORLD_ANGULAR_VELOCITY = .08;  // radians per seconds
+const float WORLD_LINEAR_VELOCITY  = -500; // units along z
 
-const float SCATTER_RADIUS = 450.0f;
-const float SCATTER_AMOUNT = 180.0f;
+const float SCATTER_RADIUS       = 450.0f;
+const float SCATTER_AMOUNT       = 180.0f;
 const float SCATTER_DURATION_OUT = .8f;
-const float SCATTER_DURATION_IN = 1.5f;
+const float SCATTER_DURATION_IN  = 1.5f;
 
-const float FADE_DURATION = 1.2f;
+const float FADE_DURATION            = 1.2f;
 const float FADEOUT_SPEED_MULTIPLIER = 4.f; // speed multiplier upon fading out.
 
 const float FOCAL_LENGTH = 0.5f; // normalized depth value where particles appear sharp.
-const float APERTURE = 2.2f; // distance scale - the higher it is, the quicker the particles get blurred out moving away from the focal length.
+const float APERTURE     = 2.2f; // distance scale - the higher it is, the quicker the particles get blurred out moving away from the focal length.
 
-const ColorRange DEFAULT_COLOR_RANGE { Vector3(0., 48. / 255., 1.), Vector3(0., 216. / 255., 1.) };
+const ColorRange DEFAULT_COLOR_RANGE{Vector3(0., 48. / 255., 1.), Vector3(0., 216. / 255., 1.)};
 
-const float TILT_SCALE = 0.2;
+const float TILT_SCALE         = 0.2;
 const float TILT_RANGE_DEGREES = 30.f;
 
 FloatRand sFloatRand;
@@ -95,7 +94,7 @@ public:
   void Add(Dali::Vector2 tilt)
   {
     mTiltSamples[mIdxNextSample] = tilt;
-    mIdxNextSample = (mIdxNextSample + 1) % FILTER_SIZE;
+    mIdxNextSample               = (mIdxNextSample + 1) % FILTER_SIZE;
   }
 
   Dali::Vector2 Filter() const
@@ -104,17 +103,20 @@ public:
   }
 
 private:
-  enum { FILTER_SIZE = 8u };
+  enum
+  {
+    FILTER_SIZE = 8u
+  };
 
   Dali::Vector2 mTiltSamples[FILTER_SIZE];
-  size_t mIdxNextSample = 0;
+  size_t        mIdxNextSample = 0;
 };
 
 class ParticlesExample : public ConnectionTracker
 {
 public:
-  ParticlesExample( Application& app )
-  : mApp( app )
+  ParticlesExample(Application& app)
+  : mApp(app)
   {
     mApp.InitSignal().Connect(this, &ParticlesExample::OnInit);
     mApp.TerminateSignal().Connect(this, &ParticlesExample::OnTerminate);
@@ -127,8 +129,8 @@ private:
 
   CameraActor mCamera;
 
-  Actor mWorld;
-  Vector2 mAngularPosition;
+  Actor      mWorld;
+  Vector2    mAngularPosition;
   ColorRange mColors;
 
   std::unique_ptr<ParticleView> mParticles;
@@ -141,20 +143,20 @@ private:
 
   PanGestureDetector mPanGesture;
 
-  void OnInit( Application& application )
+  void OnInit(Application& application)
   {
-    Window window = application.GetWindow();
-    auto rootLayer = window.GetRootLayer();
+    Window window    = application.GetWindow();
+    auto   rootLayer = window.GetRootLayer();
     rootLayer.SetProperty(Layer::Property::BEHAVIOR, Layer::Behavior::LAYER_3D);
 
-    window.KeyEventSignal().Connect( this, &ParticlesExample::OnKeyEvent );
-    window.GetRootLayer().TouchedSignal().Connect( this, &ParticlesExample::OnTouched );
+    window.KeyEventSignal().Connect(this, &ParticlesExample::OnKeyEvent);
+    window.GetRootLayer().TouchedSignal().Connect(this, &ParticlesExample::OnTouched);
 
     auto tiltSensor = TiltSensor::Get();
-    if ( tiltSensor.Start() )
+    if(tiltSensor.Start())
     {
       // Get notifications when the device is tilted
-      tiltSensor.TiltedSignal().Connect( this, &ParticlesExample::OnTilted );
+      tiltSensor.TiltedSignal().Connect(this, &ParticlesExample::OnTilted);
     }
     else
     {
@@ -164,10 +166,10 @@ private:
     }
 
     // Get camera
-    RenderTaskList tasks = window.GetRenderTaskList();
-    RenderTask mainPass = tasks.GetTask(0);
-    CameraActor camera = mainPass.GetCameraActor();
-    mCamera = camera;
+    RenderTaskList tasks    = window.GetRenderTaskList();
+    RenderTask     mainPass = tasks.GetTask(0);
+    CameraActor    camera   = mainPass.GetCameraActor();
+    mCamera                 = camera;
 
     // Create world - particles and clock are added to it; this is what we apply tilt to.
     auto world = CreateActor();
@@ -205,23 +207,23 @@ private:
 
   void OnKeyEvent(const KeyEvent& event)
   {
-    if ( event.GetState() == KeyEvent::UP)     // single keystrokes
+    if(event.GetState() == KeyEvent::UP) // single keystrokes
     {
-      if( IsKey( event, DALI_KEY_ESCAPE ) || IsKey( event, DALI_KEY_BACK ) )
+      if(IsKey(event, DALI_KEY_ESCAPE) || IsKey(event, DALI_KEY_BACK))
       {
         mApp.Quit();
       }
     }
   }
 
-  bool OnTouched( Actor a, const TouchEvent& event )
+  bool OnTouched(Actor a, const TouchEvent& event)
   {
-    if (event.GetPointCount() > 0)
+    if(event.GetPointCount() > 0)
     {
       auto screenPos = event.GetScreenPosition(0);
-      switch (event.GetState(0))
+      switch(event.GetState(0))
       {
-      case PointState::STARTED:
+        case PointState::STARTED:
         {
           mParticles->Scatter(SCATTER_RADIUS, SCATTER_AMOUNT, SCATTER_DURATION_OUT, SCATTER_DURATION_IN);
 
@@ -230,8 +232,8 @@ private:
         }
         break;
 
-      default:
-        break;
+        default:
+          break;
       }
     }
 
@@ -240,7 +242,7 @@ private:
 
   void OnDoubleTap(Actor /*actor*/, const TapGesture& /*gesture*/)
   {
-    if (!mExpiringParticles)
+    if(!mExpiringParticles)
     {
       mColors.rgb0 = Vector3::ONE - mColors.rgb1;
       mColors.rgb1 = FromHueSaturationLightness(Vector3(sFloatRand() * 360.f, sFloatRand() * .5f + .5f, sFloatRand() * .25 + .75f));
@@ -251,33 +253,33 @@ private:
 
   void OnPan(Actor actor, const PanGesture& gesture)
   {
-    auto tilt = gesture.GetDisplacement() / Vector2(mApp.GetWindow().GetSize()) * TILT_SCALE;
+    auto       tilt = gesture.GetDisplacement() / Vector2(mApp.GetWindow().GetSize()) * TILT_SCALE;
     Quaternion q(Radian(-tilt.y), Radian(tilt.x), Radian(0.f));
     Quaternion q0 = mWorld.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>();
     mWorld.SetProperty(Actor::Property::ORIENTATION, q * q0);
   }
 
-  void OnTilted( const TiltSensor& sensor)
+  void OnTilted(const TiltSensor& sensor)
   {
     mTiltFilter.Add(Vector2(sensor.GetPitch(), sensor.GetRoll()));
-    Vector2 tilt = mTiltFilter.Filter() * TILT_RANGE_DEGREES;
+    Vector2    tilt = mTiltFilter.Filter() * TILT_RANGE_DEGREES;
     Quaternion q(Radian(Degree(tilt.x)), Radian(Degree(tilt.y)), Radian(0.f));
     mWorld.SetProperty(Actor::Property::ORIENTATION, q);
   }
 
   Vector3 GetViewRay(const Vector2& screenPos)
   {
-    Vector2 screenSize = mApp.GetWindow().GetSize();
+    Vector2 screenSize    = mApp.GetWindow().GetSize();
     Vector2 normScreenPos = (screenPos / screenSize) * 2.f - Vector2::ONE;
 
-    const float fov = mCamera.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get<float>();
+    const float fov    = mCamera.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get<float>();
     const float tanFov = std::tan(fov);
 
     const float zNear = mCamera.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get<float>();
     const float hProj = zNear * tanFov;
 
     const float aspectRatio = mCamera.GetProperty(CameraActor::Property::ASPECT_RATIO).Get<float>();
-    const float wProj = hProj * aspectRatio;
+    const float wProj       = hProj * aspectRatio;
 
     // Get camera orientation for view space ray casting. Assume:
     // - this to be world space, i.e. no parent transforms;
@@ -287,7 +289,7 @@ private:
     Matrix worldCamera;
     worldCamera.SetTransformComponents(Vector3::ONE, cameraOrientation, Vector3::ZERO);
 
-    float* data = worldCamera.AsFloat();
+    float*  data = worldCamera.AsFloat();
     Vector3 xWorldCamera(data[0], data[4], data[8]);
     xWorldCamera *= wProj * normScreenPos.x / xWorldCamera.Length();
 
@@ -303,7 +305,7 @@ private:
 
   void TriggerColorTransition(const ColorRange& range)
   {
-    if (mParticles)
+    if(mParticles)
     {
       mExpiringParticles = std::move(mParticles);
 
@@ -328,12 +330,12 @@ private:
   }
 };
 
-} // nonamespace
+} // namespace
 
-int DALI_EXPORT_API main( int argc, char **argv )
+int DALI_EXPORT_API main(int argc, char** argv)
 {
-  Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
-  ParticlesExample example( application);
+  Application      application = Application::New(&argc, &argv, DEMO_THEME_PATH);
+  ParticlesExample example(application);
   application.MainLoop();
   return 0;
 }
index 7f7432e..3d585ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -24,10 +24,10 @@ Vector3 ToHueSaturationLightness(Vector3 rgb)
   float max = std::max(rgb.r, std::max(rgb.g, rgb.b));
 
   Vector3 hsl(max - min, 0.f, (max + min) * .5f);
-  if (hsl.x * hsl.x > .0f)
+  if(hsl.x * hsl.x > .0f)
   {
     hsl.y = hsl.x / max;
-    if (max == rgb.r)
+    if(max == rgb.r)
     {
       hsl.x = (rgb.g - rgb.b) / hsl.x;
     }
@@ -40,7 +40,7 @@ Vector3 ToHueSaturationLightness(Vector3 rgb)
       hsl.x = 4.f + (rgb.r - rgb.g) / hsl.x;
     }
     hsl.x *= 60.f;
-    if (hsl.x < 0.f)
+    if(hsl.x < 0.f)
     {
       hsl.x += 360.f;
     }
@@ -56,7 +56,7 @@ Vector3 ToHueSaturationLightness(Vector3 rgb)
 Vector3 FromHueSaturationLightness(Vector3 hsl)
 {
   Vector3 rgb;
-  if (hsl.y * hsl.y > 0.f)
+  if(hsl.y * hsl.y > 0.f)
   {
     if(hsl.x >= 360.f)
     {
@@ -64,50 +64,50 @@ Vector3 FromHueSaturationLightness(Vector3 hsl)
     }
     hsl.x /= 60.f;
 
-    int i = FastFloor(hsl.x);
+    int   i  = FastFloor(hsl.x);
     float ff = hsl.x - i;
-    float p = hsl.z * (1.0 - hsl.y);
-    float q = hsl.z * (1.0 - (hsl.y * ff));
-    float t = hsl.z * (1.0 - (hsl.y * (1.f - ff)));
+    float p  = hsl.z * (1.0 - hsl.y);
+    float q  = hsl.z * (1.0 - (hsl.y * ff));
+    float t  = hsl.z * (1.0 - (hsl.y * (1.f - ff)));
 
-    switch (i)
+    switch(i)
     {
-    case 0:
-      rgb.r = hsl.z;
-      rgb.g = t;
-      rgb.b = p;
-      break;
-
-    case 1:
-      rgb.r = q;
-      rgb.g = hsl.z;
-      rgb.b = p;
-      break;
-
-    case 2:
-      rgb.r = p;
-      rgb.g = hsl.z;
-      rgb.b = t;
-      break;
-
-    case 3:
-      rgb.r = p;
-      rgb.g = q;
-      rgb.b = hsl.z;
-      break;
-
-    case 4:
-      rgb.r = t;
-      rgb.g = p;
-      rgb.b = hsl.z;
-      break;
-
-    case 5:
-    default:
-      rgb.r = hsl.z;
-      rgb.g = p;
-      rgb.b = q;
-      break;
+      case 0:
+        rgb.r = hsl.z;
+        rgb.g = t;
+        rgb.b = p;
+        break;
+
+      case 1:
+        rgb.r = q;
+        rgb.g = hsl.z;
+        rgb.b = p;
+        break;
+
+      case 2:
+        rgb.r = p;
+        rgb.g = hsl.z;
+        rgb.b = t;
+        break;
+
+      case 3:
+        rgb.r = p;
+        rgb.g = q;
+        rgb.b = hsl.z;
+        break;
+
+      case 4:
+        rgb.r = t;
+        rgb.g = p;
+        rgb.b = hsl.z;
+        break;
+
+      case 5:
+      default:
+        rgb.r = hsl.z;
+        rgb.g = p;
+        rgb.b = q;
+        break;
     }
   }
   else
@@ -120,38 +120,35 @@ Vector3 FromHueSaturationLightness(Vector3 hsl)
 
 Geometry CreateCuboidWireframeGeometry()
 {
-//
-// 2---3
-// |-  |-
-// | 6---7
-// | | | |
-// 0-|-1 |
-//  -|  -|
-//   4---5
-//
+  //
+  // 2---3
+  // |-  |-
+  // | 6---7
+  // | | | |
+  // 0-|-1 |
+  //  -|  -|
+  //   4---5
+  //
   Vector3 vertexData[] = {
     Vector3(-.5, -.5, -.5),
-       Vector3( .5, -.5, -.5),
-       Vector3(-.5,  .5, -.5),
-       Vector3( .5,  .5, -.5),
-       Vector3(-.5, -.5,  .5),
-       Vector3( .5, -.5,  .5),
-       Vector3(-.5,  .5,  .5),
-       Vector3( .5,  .5,  .5),
+    Vector3(.5, -.5, -.5),
+    Vector3(-.5, .5, -.5),
+    Vector3(.5, .5, -.5),
+    Vector3(-.5, -.5, .5),
+    Vector3(.5, -.5, .5),
+    Vector3(-.5, .5, .5),
+    Vector3(.5, .5, .5),
   };
 
   uint16_t indices[] = {
-    0, 1, 1, 3, 3, 2, 2, 0,
-       0, 4, 1, 5, 3, 7, 2, 6,
-       4, 5, 5, 7, 7, 6, 6, 4
-  };
-  VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
-    .Add( "aPosition", Property::VECTOR3));
-  vertexBuffer.SetData(vertexData, std::extent<decltype(vertexData)>::value );
+    0, 1, 1, 3, 3, 2, 2, 0, 0, 4, 1, 5, 3, 7, 2, 6, 4, 5, 5, 7, 7, 6, 6, 4};
+  VertexBuffer vertexBuffer = VertexBuffer::New(Property::Map()
+                                                  .Add("aPosition", Property::VECTOR3));
+  vertexBuffer.SetData(vertexData, std::extent<decltype(vertexData)>::value);
 
   Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( vertexBuffer );
-  geometry.SetIndexBuffer( indices, std::extent<decltype(indices)>::value );
+  geometry.AddVertexBuffer(vertexBuffer);
+  geometry.SetIndexBuffer(indices, std::extent<decltype(indices)>::value);
   geometry.SetType(Geometry::LINES);
   return geometry;
 }
@@ -160,14 +157,14 @@ Renderer CreateRenderer(TextureSet textures, Geometry geometry, Shader shader, u
 {
   Renderer renderer = Renderer::New(geometry, shader);
   renderer.SetProperty(Renderer::Property::BLEND_MODE,
-                 (options & OPTION_BLEND) ? BlendMode::ON : BlendMode::OFF);
+                       (options & OPTION_BLEND) ? BlendMode::ON : BlendMode::OFF);
   renderer.SetProperty(Renderer::Property::DEPTH_TEST_MODE,
-                 (options & OPTION_DEPTH_TEST) ? DepthTestMode::ON : DepthTestMode::OFF);
+                       (options & OPTION_DEPTH_TEST) ? DepthTestMode::ON : DepthTestMode::OFF);
   renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE,
-                 (options & OPTION_DEPTH_WRITE) ? DepthWriteMode::ON : DepthWriteMode::OFF);
+                       (options & OPTION_DEPTH_WRITE) ? DepthWriteMode::ON : DepthWriteMode::OFF);
   renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK);
 
-  if (!textures)
+  if(!textures)
   {
     textures = TextureSet::New();
   }
@@ -178,8 +175,8 @@ Renderer CreateRenderer(TextureSet textures, Geometry geometry, Shader shader, u
 
 void CenterActor(Actor actor)
 {
-  actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
-  actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+  actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
 }
 
 Actor CreateActor()
@@ -191,15 +188,15 @@ Actor CreateActor()
 
 Renderer CloneRenderer(Renderer original)
 {
-  Geometry geom = original.GetGeometry();
-  Shader shader = original.GetShader();
-  Renderer clone = Renderer::New(geom, shader);
+  Geometry geom   = original.GetGeometry();
+  Shader   shader = original.GetShader();
+  Renderer clone  = Renderer::New(geom, shader);
 
   // Copy properties.
   Property::IndexContainer indices;
   original.GetPropertyIndices(indices);
 
-  for (auto& i: indices)
+  for(auto& i : indices)
   {
     auto actualIndex = PropertyRanges::DEFAULT_RENDERER_PROPERTY_START_INDEX + i;
     clone.SetProperty(actualIndex, original.GetProperty(actualIndex));
@@ -223,17 +220,17 @@ Actor CloneActor(Actor original)
   // Don't copy every single one of them.
   // Definitely don't copy resize policy related things, which will internally enable
   // relayout, which in turn will result in losing the ability to set Z size.
-  for (auto i : {
-    Actor::Property::PARENT_ORIGIN,
-    Actor::Property::ANCHOR_POINT,
-    Actor::Property::SIZE,
-    Actor::Property::POSITION,
-    Actor::Property::ORIENTATION,
-    Actor::Property::SCALE,
-    Actor::Property::VISIBLE,
-    Actor::Property::COLOR,
-    Actor::Property::NAME,
-  })
+  for(auto i : {
+        Actor::Property::PARENT_ORIGIN,
+        Actor::Property::ANCHOR_POINT,
+        Actor::Property::SIZE,
+        Actor::Property::POSITION,
+        Actor::Property::ORIENTATION,
+        Actor::Property::SCALE,
+        Actor::Property::VISIBLE,
+        Actor::Property::COLOR,
+        Actor::Property::NAME,
+      })
   {
     clone.SetProperty(i, original.GetProperty(i));
   }
index 10dee0d..ca7cfa1 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PARTICLES_UTILS_H_
 #define PARTICLES_UTILS_H_
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  *
  */
 
+#include <cmath>
 #include "dali/public-api/actors/actor.h"
-#include "dali/public-api/actors/actor.h"
+#include "dali/public-api/math/vector3.h"
 #include "dali/public-api/rendering/geometry.h"
 #include "dali/public-api/rendering/renderer.h"
 #include "dali/public-api/rendering/shader.h"
 #include "dali/public-api/rendering/texture.h"
-#include "dali/public-api/math/vector3.h"
-#include <cmath>
 
 //
 // Maths
 //
-inline
-float FastFloor(float x)
+inline float FastFloor(float x)
 {
   return static_cast<int>(x) - static_cast<int>(x < 0);
 }
@@ -52,9 +50,9 @@ Dali::Geometry CreateCuboidWireframeGeometry();
 
 enum RendererOptions
 {
-  OPTION_NONE = 0x0,
-  OPTION_BLEND = 0x01,
-  OPTION_DEPTH_TEST = 0x02,
+  OPTION_NONE        = 0x0,
+  OPTION_BLEND       = 0x01,
+  OPTION_DEPTH_TEST  = 0x02,
   OPTION_DEPTH_WRITE = 0x04
 };
 
@@ -62,8 +60,7 @@ enum RendererOptions
 /// and @a options from above.
 ///@note Back face culling is on.
 ///@note If textures is not a valid handle, an empty texture set will be created.
-Dali::Renderer CreateRenderer(Dali::TextureSet textures, Dali::Geometry geometry,
-  Dali::Shader shader, uint32_t options = OPTION_NONE);
+Dali::Renderer CreateRenderer(Dali::TextureSet textures, Dali::Geometry geometry, Dali::Shader shader, uint32_t options = OPTION_NONE);
 
 ///@brief Sets @a actor's anchor point and parent origin to center.
 void CenterActor(Dali::Actor actor);
index dc6cdc8..19e2737 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -17,9 +17,9 @@
 
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
-#include "shared/utility.h"
-#include "generated/perf-scroll-vert.h"
 #include "generated/perf-scroll-frag.h"
+#include "generated/perf-scroll-vert.h"
+#include "shared/utility.h"
 
 using namespace Dali;
 using namespace Dali::Toolkit;
index 1e66ab5..ba0b435 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali-toolkit/dali-toolkit.h>
 
 // INTERNAL INCLUDES
+#include "generated/point-mesh-frag.h"
+#include "generated/point-mesh-vert.h"
 #include "shared/utility.h"
 #include "shared/view.h"
-#include "generated/point-mesh-vert.h"
-#include "generated/point-mesh-frag.h"
 
 using namespace Dali;
 
index 903300a..f19a3d4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -639,12 +639,12 @@ public:
       {
         //Rotate based off the gesture.
         Vector2 displacement = gesture.GetDisplacement();
-        Vector2 rotation {
+        Vector2 rotation{
           -displacement.y / X_ROTATION_DISPLACEMENT_FACTOR, // Y displacement rotates around X axis
-          displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR // X displacement rotates around Y axis
+          displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR   // X displacement rotates around Y axis
         };
 
-        Quaternion q = Quaternion(Radian(rotation.x), Radian(rotation.y), Radian(0.f));
+        Quaternion q  = Quaternion(Radian(rotation.x), Radian(rotation.y), Radian(0.f));
         Quaternion q0 = mModel.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>();
 
         mModel.SetProperty(Actor::Property::ORIENTATION, q * q0);
@@ -698,7 +698,7 @@ private:
   PanGestureDetector mPanGestureDetector; ///< Detects pan gestures for rotation of the model.
   Animation          mRotationAnimation;  ///< Automatically rotates the model, unless it is being panned.
 
-  Vector4 mColor;    ///< Color to set all shapes.
+  Vector4 mColor; ///< Color to set all shapes.
 };
 
 int DALI_EXPORT_API main(int argc, char** argv)
index a303e21..d752149 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -68,6 +68,7 @@ struct JsonResult
 {
   bool success;
   T    result;
+
   operator T() const
   {
     return static_cast<T>(result);
index 048111b..5639c4a 100644 (file)
@@ -2,7 +2,7 @@
 #define GLTF_SCENE_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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 <string>
 #include <dali/integration-api/debug.h>
+#include <string>
 
 // INTERNAL INCLUDES
 #include "third-party/pico-json.h"
index f7f50ae..7731818 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 
 #include <map>
 
-#include "gltf-scene.h"
-#include "generated/reflection-vert.h"
 #include "generated/reflection-frag.h"
-#include "generated/reflection-simple-frag.h"
-#include "generated/reflection-textured-frag.h"
 #include "generated/reflection-plasma-frag.h"
+#include "generated/reflection-simple-frag.h"
 #include "generated/reflection-tex-frag.h"
+#include "generated/reflection-textured-frag.h"
+#include "generated/reflection-vert.h"
+#include "gltf-scene.h"
 
 using namespace Dali;
 
 namespace
 {
-
 struct Model
 {
   Shader   shader;
@@ -467,10 +466,7 @@ private:
   void OnPan(Actor actor, const PanGesture& panGesture)
   {
     Vector2 displacement = panGesture.GetScreenDisplacement();
-    Vector2 rotation{
-      displacement.y * -0.1f,
-      displacement.x * 0.1f
-    };
+    Vector2 rotation{displacement.y * -0.1f, displacement.x * 0.1f};
 
     Quaternion q(Degree(0.f), Degree(rotation.y), Degree(rotation.x));
     Quaternion q0 = mCenterActor.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>();
index cbea48b..37e83dd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <sstream>
 
 // INTERNAL INCLUDES
-#include "shared/utility.h"
-#include "shared/view.h"
-#include "generated/refraction-effect-flat-vert.h"
 #include "generated/refraction-effect-flat-frag.h"
-#include "generated/refraction-effect-refraction-vert.h"
+#include "generated/refraction-effect-flat-vert.h"
 #include "generated/refraction-effect-refraction-frag.h"
+#include "generated/refraction-effect-refraction-vert.h"
+#include "shared/utility.h"
+#include "shared/view.h"
 
 using namespace Dali;
 
index 2290639..d48e6aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/rendering/shader.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali/public-api/rendering/shader.h>
 
 // INTERNAL INCLUDES
-#include "shared/utility.h"
-#include "shared/view.h"
-#include "generated/render-stencil-vert.h"
 #include "generated/render-stencil-frag.h"
-#include "generated/render-stencil-textured-vert.h"
 #include "generated/render-stencil-textured-frag.h"
+#include "generated/render-stencil-textured-vert.h"
+#include "generated/render-stencil-vert.h"
+#include "shared/utility.h"
+#include "shared/view.h"
 
 using namespace Dali;
 
index 85588c6..e11ce15 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -18,8 +18,8 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/dali.h>
 
-#include "generated/rendering-basic-light-vert.h"
 #include "generated/rendering-basic-light-frag.h"
+#include "generated/rendering-basic-light-vert.h"
 
 using namespace Dali;
 using namespace Toolkit;
index bdd45e9..9fc15c1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -94,7 +94,7 @@ bool ConvertPixelFormat(const uint32_t ktxPixelFormat, Dali::Pixel::Format& form
 bool LoadCubeMapFromKtxFile(const std::string& path, CubeData& cubedata)
 {
   Dali::FileStream daliFileStream(path);
-  FILE* fp(daliFileStream.GetFile());
+  FILE*            fp(daliFileStream.GetFile());
   if(!fp)
   {
     return false;
index 03597f7..a4d187e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -24,9 +24,9 @@
 #include <cstdio>
 
 // INTERNAL INCLUDES
-#include "obj-loader.h"
-#include "generated/skybox-vert.h"
 #include "generated/skybox-frag.h"
+#include "generated/skybox-vert.h"
+#include "obj-loader.h"
 
 ModelSkybox::ModelSkybox()
 {
index 08cf1c7..89bd5c9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -18,8 +18,8 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/dali.h>
 
-#include "generated/rendering-cube-vert.h"
 #include "generated/rendering-cube-frag.h"
+#include "generated/rendering-cube-vert.h"
 
 using namespace Dali;
 using namespace Toolkit;
index ad20fc9..3b10e56 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -18,8 +18,8 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/dali.h>
 
-#include "generated/rendering-line-vert.h"
 #include "generated/rendering-line-frag.h"
+#include "generated/rendering-line-vert.h"
 
 using namespace Dali;
 using namespace Toolkit;
index 9bd55cd..ed8f450 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/dali.h>
 
-#include "generated/radial-progress-basic-vert.h"
 #include "generated/radial-progress-basic-frag.h"
-#include "generated/radial-progress-textured-vert.h"
+#include "generated/radial-progress-basic-vert.h"
 #include "generated/radial-progress-textured-frag.h"
+#include "generated/radial-progress-textured-vert.h"
 
 using namespace Dali;
 
index ec4f38c..c0083b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/dali.h>
 
-#include "look-camera.h"
-#include "generated/rendering-skybox-vert.h"
-#include "generated/rendering-skybox-frag.h"
-#include "generated/rendering-skybox-cube-vert.h"
 #include "generated/rendering-skybox-cube-frag.h"
+#include "generated/rendering-skybox-cube-vert.h"
+#include "generated/rendering-skybox-frag.h"
+#include "generated/rendering-skybox-vert.h"
+#include "look-camera.h"
 
 using namespace Dali;
 using namespace Toolkit;
 
 namespace
 {
-
 const float   CAMERA_DEFAULT_FOV(60.0f);
 const float   CAMERA_DEFAULT_NEAR(0.1f);
 const float   CAMERA_DEFAULT_FAR(1000.0f);
index 646e296..32d323d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/dali.h>
 
-#include "generated/rendering-textured-cube-vert.h"
 #include "generated/rendering-textured-cube-frag.h"
+#include "generated/rendering-textured-cube-vert.h"
 
 using namespace Dali;
 using namespace Toolkit;
 
 namespace
 {
-
 const char* TEXTURE_URL = DEMO_IMAGE_DIR "wood.png";
 
 } // namespace
index cecce9a..f7bb8ca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -18,8 +18,8 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/dali.h>
 
-#include "generated/rendering-triangle-vert.h"
 #include "generated/rendering-triangle-frag.h"
+#include "generated/rendering-triangle-vert.h"
 
 using namespace Dali;
 using namespace Toolkit;
index c87244a..630aa26 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -22,7 +22,7 @@ using namespace Dali;
 \r
 int DALI_EXPORT_API main(int argc, char** argv)\r
 {\r
-  auto app = Application::New(&argc, &argv, DEMO_THEME_PATH);\r
+  auto               app = Application::New(&argc, &argv, DEMO_THEME_PATH);\r
   SceneLoaderExample sceneLoader(app);\r
   app.MainLoop();\r
   return 0;\r
index 90df3da..9a1f116 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  *\r
  */\r
 #include "scene-loader-example.h"\r
+#include <dirent.h>\r
+#include <cstring>\r
+#include <string_view>\r
+#include "dali-scene-loader/public-api/dli-loader.h"\r
 #include "dali-scene-loader/public-api/gltf2-loader.h"\r
-#include "dali-scene-loader/public-api/shader-definition-factory.h"\r
 #include "dali-scene-loader/public-api/light-parameters.h"\r
-#include "dali-scene-loader/public-api/dli-loader.h"\r
 #include "dali-scene-loader/public-api/load-result.h"\r
-#include "dali/public-api/adaptor-framework/key.h"\r
-#include "dali/public-api/events/key-event.h"\r
-#include "dali/public-api/actors/layer.h"\r
-#include "dali/public-api/render-tasks/render-task-list.h"\r
-#include "dali/public-api/object/property-array.h"\r
-#include "dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h"\r
+#include "dali-scene-loader/public-api/shader-definition-factory.h"\r
 #include "dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h"\r
+#include "dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h"\r
 #include "dali-toolkit/public-api/controls/text-controls/text-label.h"\r
 #include "dali-toolkit/public-api/visuals/gradient-visual-properties.h"\r
-#include <string_view>\r
-#include <cstring>\r
-#include <dirent.h>\r
+#include "dali/public-api/actors/layer.h"\r
+#include "dali/public-api/adaptor-framework/key.h"\r
+#include "dali/public-api/events/key-event.h"\r
+#include "dali/public-api/object/property-array.h"\r
+#include "dali/public-api/render-tasks/render-task-list.h"\r
 \r
 using namespace Dali;\r
 using namespace Dali::Toolkit;\r
@@ -39,14 +39,13 @@ using namespace Dali::SceneLoader;
 \r
 namespace\r
 {\r
-\r
 const float ROTATION_SCALE = 180.f; // the amount of rotation that a swipe whose length is the width of the screen, causes, in degrees.\r
 \r
 const float ITEM_HEIGHT = 50.f;\r
 \r
 const Vector3 CAMERA_DEFAULT_POSITION(0.0f, 0.0f, 3.5f);\r
 \r
-const std::string_view DLI_EXTENSION = ".dli";\r
+const std::string_view DLI_EXTENSION  = ".dli";\r
 const std::string_view GLTF_EXTENSION = ".gltf";\r
 \r
 const std::string RESOURCE_TYPE_DIRS[]{\r
@@ -58,18 +57,19 @@ const std::string RESOURCE_TYPE_DIRS[]{
 \r
 using StringVector = std::vector<std::string>;\r
 \r
-StringVector ListFiles(const std::string& path, bool(*predicate)(const char*) = [](const char*) { return true; })\r
+StringVector ListFiles(\r
+  const std::string& path, bool (*predicate)(const char*) = [](const char*) { return true; })\r
 {\r
   StringVector results;\r
 \r
-  if (auto dirp = opendir(path.c_str()))\r
+  if(auto dirp = opendir(path.c_str()))\r
   {\r
-    std::unique_ptr<DIR, int(*)(DIR*)> dir(dirp, closedir);\r
+    std::unique_ptr<DIR, int (*)(DIR*)> dir(dirp, closedir);\r
 \r
     struct dirent* ent;\r
-    while ((ent = readdir(dir.get())) != nullptr)\r
+    while((ent = readdir(dir.get())) != nullptr)\r
     {\r
-      if (ent->d_type == DT_REG && predicate(ent->d_name))\r
+      if(ent->d_type == DT_REG && predicate(ent->d_name))\r
       {\r
         results.push_back(ent->d_name);\r
       }\r
@@ -91,12 +91,13 @@ TextLabel MakeLabel(std::string msg)
 struct ItemFactoryImpl : Dali::Toolkit::ItemFactory\r
 {\r
   const std::vector<std::string>& mSceneNames;\r
-  TapGestureDetector mTapDetector;\r
+  TapGestureDetector              mTapDetector;\r
 \r
   ItemFactoryImpl(const std::vector<std::string>& sceneNames, TapGestureDetector tapDetector)\r
   : mSceneNames(sceneNames),\r
     mTapDetector(tapDetector)\r
-  {}\r
+  {\r
+  }\r
 \r
   unsigned int GetNumberOfItems() override\r
   {\r
@@ -122,7 +123,7 @@ Actor CreateErrorMessage(std::string msg)
 \r
 void ConfigureCamera(const CameraParameters& params, CameraActor camera)\r
 {\r
-  if (params.isPerspective)\r
+  if(params.isPerspective)\r
   {\r
     camera.SetProjectionMode(Camera::PERSPECTIVE_PROJECTION);\r
     camera.SetNearClippingPlane(params.zNear);\r
@@ -133,16 +134,16 @@ void ConfigureCamera(const CameraParameters& params, CameraActor camera)
   {\r
     camera.SetProjectionMode(Camera::ORTHOGRAPHIC_PROJECTION);\r
     camera.SetOrthographicProjection(params.orthographicSize.x,\r
-      params.orthographicSize.y,\r
-      params.orthographicSize.z,\r
-      params.orthographicSize.w,\r
-      params.zNear,\r
-      params.zFar);\r
+                                     params.orthographicSize.y,\r
+                                     params.orthographicSize.z,\r
+                                     params.orthographicSize.w,\r
+                                     params.zNear,\r
+                                     params.zFar);\r
   }\r
 \r
   // model\r
-  Vector3 camTranslation;\r
-  Vector3 camScale;\r
+  Vector3    camTranslation;\r
+  Vector3    camScale;\r
   Quaternion camOrientation;\r
   params.CalculateTransformComponents(camTranslation, camOrientation, camScale);\r
 \r
@@ -155,17 +156,16 @@ void ConfigureCamera(const CameraParameters& params, CameraActor camera)
   camOrientation.Conjugate();\r
 }\r
 \r
-void ConfigureBlendShapeShaders(ResourceBundle& resources, const SceneDefinition& scene, Actor root,\r
-  std::vector<BlendshapeShaderConfigurationRequest>&& requests)\r
+void ConfigureBlendShapeShaders(ResourceBundle& resources, const SceneDefinition& scene, Actor root, std::vector<BlendshapeShaderConfigurationRequest>&& requests)\r
 {\r
   std::vector<std::string> errors;\r
-  auto onError = [&errors](const std::string& msg) {\r
+  auto                     onError = [&errors](const std::string& msg) {\r
     errors.push_back(msg);\r
   };\r
-  if (!scene.ConfigureBlendshapeShaders(resources, root, std::move(requests), onError))\r
+  if(!scene.ConfigureBlendshapeShaders(resources, root, std::move(requests), onError))\r
   {\r
     ExceptionFlinger flinger(ASSERT_LOCATION);\r
-    for (auto& msg : errors)\r
+    for(auto& msg : errors)\r
     {\r
       flinger << msg << '\n';\r
     }\r
@@ -180,12 +180,12 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
 \r
   auto path = pathProvider(ResourceType::Mesh) + sceneName;\r
 \r
-  ResourceBundle resources;\r
-  SceneDefinition scene;\r
+  ResourceBundle                        resources;\r
+  SceneDefinition                       scene;\r
   std::vector<AnimationGroupDefinition> animGroups;\r
-  std::vector<CameraParameters> cameraParameters;\r
-  std::vector<LightParameters> lights;\r
-  std::vector<AnimationDefinition> animations;\r
+  std::vector<CameraParameters>         cameraParameters;\r
+  std::vector<LightParameters>          lights;\r
+  std::vector<AnimationDefinition>      animations;\r
 \r
   LoadResult output{\r
     resources,\r
@@ -193,12 +193,11 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
     animations,\r
     animGroups,\r
     cameraParameters,\r
-    lights\r
-  };\r
+    lights};\r
 \r
-  if (sceneName.rfind(DLI_EXTENSION) == sceneName.size() - DLI_EXTENSION.size())\r
+  if(sceneName.rfind(DLI_EXTENSION) == sceneName.size() - DLI_EXTENSION.size())\r
   {\r
-    DliLoader loader;\r
+    DliLoader              loader;\r
     DliLoader::InputParams input{\r
       pathProvider(ResourceType::Mesh),\r
       nullptr,\r
@@ -206,8 +205,8 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
       {},\r
       nullptr,\r
     };\r
-    DliLoader::LoadParams loadParams{ input, output };\r
-    if (!loader.LoadScene(path, loadParams))\r
+    DliLoader::LoadParams loadParams{input, output};\r
+    if(!loader.LoadScene(path, loadParams))\r
     {\r
       ExceptionFlinger(ASSERT_LOCATION) << "Failed to load scene from '" << path << "': " << loader.GetParseError();\r
     }\r
@@ -221,7 +220,7 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
     resources.mEnvironmentMaps.push_back({});\r
   }\r
 \r
-  if (cameraParameters.empty())\r
+  if(cameraParameters.empty())\r
   {\r
     cameraParameters.push_back(CameraParameters());\r
     cameraParameters[0].matrix.SetTranslation(CAMERA_DEFAULT_POSITION);\r
@@ -229,20 +228,18 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
   ConfigureCamera(cameraParameters[0], camera);\r
 \r
   ViewProjection viewProjection = cameraParameters[0].GetViewProjection();\r
-  Transforms xforms{\r
+  Transforms     xforms{\r
     MatrixStack{},\r
-    viewProjection\r
-  };\r
+    viewProjection};\r
   NodeDefinition::CreateParams nodeParams{\r
     resources,\r
-    xforms\r
-  };\r
+    xforms};\r
   Customization::Choices choices;\r
 \r
   Actor root = Actor::New();\r
   SetActorCentered(root);\r
 \r
-  for (auto iRoot : scene.GetRoots())\r
+  for(auto iRoot : scene.GetRoots())\r
   {\r
     auto resourceRefs = resources.CreateRefCounter();\r
     scene.CountResourceRefs(iRoot, choices, resourceRefs);\r
@@ -250,7 +247,7 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
 \r
     resources.LoadResources(resourceRefs, pathProvider);\r
 \r
-    if (auto actor = scene.CreateNodes(iRoot, choices, nodeParams))\r
+    if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))\r
     {\r
       scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);\r
       scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));\r
@@ -262,7 +259,7 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
     }\r
   }\r
 \r
-  if (!animations.empty())\r
+  if(!animations.empty())\r
   {\r
     auto getActor = [&root](const std::string& name) {\r
       return root.FindChildByName(name);\r
@@ -274,14 +271,14 @@ Actor LoadScene(std::string sceneName, CameraActor camera)
   return root;\r
 }\r
 \r
-} // nonamespace\r
+} // namespace\r
 \r
 SceneLoaderExample::SceneLoaderExample(Dali::Application& app)\r
 : mApp(app)\r
 {\r
-  if (!std::getenv("DALI_APPLICATION_PACKAGE"))\r
+  if(!std::getenv("DALI_APPLICATION_PACKAGE"))\r
   {\r
-    if (auto desktopPrefix = std::getenv("DESKTOP_PREFIX"))\r
+    if(auto desktopPrefix = std::getenv("DESKTOP_PREFIX"))\r
     {\r
       std::stringstream sstr;\r
       sstr << desktopPrefix << "/share/com.samsung.dali-demo/res/";\r
@@ -298,14 +295,14 @@ SceneLoaderExample::SceneLoaderExample(Dali::Application& app)
 void SceneLoaderExample::OnInit(Application& app)\r
 {\r
   // get scenes\r
-  auto resPath = Application::GetResourcePath();\r
-  auto scenePath = resPath + RESOURCE_TYPE_DIRS[ResourceType::Mesh];\r
+  auto resPath    = Application::GetResourcePath();\r
+  auto scenePath  = resPath + RESOURCE_TYPE_DIRS[ResourceType::Mesh];\r
   auto sceneNames = ListFiles(scenePath, [](const char* name) {\r
     auto len = strlen(name);\r
     return (len > DLI_EXTENSION.size() && DLI_EXTENSION.compare(name + (len - DLI_EXTENSION.size())) == 0) ||\r
-      (len > GLTF_EXTENSION.size() && GLTF_EXTENSION.compare(name + (len - GLTF_EXTENSION.size())) == 0);\r
+           (len > GLTF_EXTENSION.size() && GLTF_EXTENSION.compare(name + (len - GLTF_EXTENSION.size())) == 0);\r
   });\r
-  mSceneNames = sceneNames;\r
+  mSceneNames     = sceneNames;\r
 \r
   // create Dali objects\r
   auto window = app.GetWindow();\r
@@ -324,13 +321,14 @@ void SceneLoaderExample::OnInit(Application& app)
   stopColors.PushBack(Vector4(0.45f, 0.7f, 0.8f, 1.f)); // Medium bright, pastel blue\r
   const float percentageWindowHeight = window.GetSize().GetHeight() * 0.6f;\r
 \r
-  navigationView.SetProperty(Toolkit::Control::Property::BACKGROUND, Dali::Property::Map().\r
-    Add(Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT).\r
-    Add(Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets).\r
-    Add(Toolkit::GradientVisual::Property::STOP_COLOR, stopColors).\r
-    Add(Toolkit::GradientVisual::Property::START_POSITION, Vector2(0.f, -percentageWindowHeight)).\r
-    Add(Toolkit::GradientVisual::Property::END_POSITION, Vector2(0.f, percentageWindowHeight)).\r
-    Add(Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE));\r
+  navigationView.SetProperty(Toolkit::Control::Property::BACKGROUND,\r
+                             Dali::Property::Map()\r
+                               .Add(Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT)\r
+                               .Add(Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets)\r
+                               .Add(Toolkit::GradientVisual::Property::STOP_COLOR, stopColors)\r
+                               .Add(Toolkit::GradientVisual::Property::START_POSITION, Vector2(0.f, -percentageWindowHeight))\r
+                               .Add(Toolkit::GradientVisual::Property::END_POSITION, Vector2(0.f, percentageWindowHeight))\r
+                               .Add(Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE));\r
   window.Add(navigationView);\r
   mNavigationView = navigationView;\r
 \r
@@ -344,13 +342,13 @@ void SceneLoaderExample::OnInit(Application& app)
   items.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);\r
 \r
   Vector3 windowSize(window.GetSize());\r
-  auto itemLayout = DefaultItemLayout::New(DefaultItemLayout::LIST);\r
+  auto    itemLayout = DefaultItemLayout::New(DefaultItemLayout::LIST);\r
   itemLayout->SetItemSize(Vector3(windowSize.x, ITEM_HEIGHT, 1.f));\r
   items.AddLayout(*itemLayout);\r
   navigationView.Push(items);\r
 \r
   mItemLayout = itemLayout;\r
-  mItemView = items;\r
+  mItemView   = items;\r
 \r
   // camera\r
   auto camera = CameraActor::New();\r
@@ -373,7 +371,7 @@ void SceneLoaderExample::OnTerminate(Application& app)
   mTapDetector.Reset();\r
   mPanDetector.Reset();\r
 \r
-  auto window = app.GetWindow();\r
+  auto window      = app.GetWindow();\r
   auto renderTasks = window.GetRenderTaskList();\r
   renderTasks.RemoveTask(mSceneRender);\r
   mSceneRender.Reset();\r
@@ -386,11 +384,11 @@ void SceneLoaderExample::OnTerminate(Application& app)
 \r
 void SceneLoaderExample::OnKey(const KeyEvent& e)\r
 {\r
-  if (e.GetState() == KeyEvent::UP)\r
+  if(e.GetState() == KeyEvent::UP)\r
   {\r
-    if (IsKey(e, DALI_KEY_ESCAPE) || IsKey(e, DALI_KEY_BACK))\r
+    if(IsKey(e, DALI_KEY_ESCAPE) || IsKey(e, DALI_KEY_BACK))\r
     {\r
-      if (mScene)\r
+      if(mScene)\r
       {\r
         mPanDetector.Reset();\r
 \r
@@ -407,15 +405,15 @@ void SceneLoaderExample::OnKey(const KeyEvent& e)
 \r
 void SceneLoaderExample::OnPan(Actor actor, const PanGesture& pan)\r
 {\r
-  auto windowSize = mApp.GetWindow().GetSize();\r
-  Vector2 size{ float(windowSize.GetWidth()), float(windowSize.GetHeight()) };\r
-  float aspect = size.y / size.x;\r
+  auto    windowSize = mApp.GetWindow().GetSize();\r
+  Vector2 size{float(windowSize.GetWidth()), float(windowSize.GetHeight())};\r
+  float   aspect = size.y / size.x;\r
 \r
   size /= ROTATION_SCALE;\r
 \r
-  Vector2 rotation{ pan.GetDisplacement().x / size.x, pan.GetDisplacement().y / size.y * aspect };\r
+  Vector2 rotation{pan.GetDisplacement().x / size.x, pan.GetDisplacement().y / size.y * aspect};\r
 \r
-  Quaternion q = Quaternion(Radian(Degree(rotation.y)), Radian(Degree(rotation.x)), Radian(0.f));\r
+  Quaternion q  = Quaternion(Radian(Degree(rotation.y)), Radian(Degree(rotation.x)), Radian(0.f));\r
   Quaternion q0 = mScene.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>();\r
 \r
   mScene.SetProperty(Actor::Property::ORIENTATION, q * q0);\r
@@ -427,7 +425,7 @@ void SceneLoaderExample::OnTap(Dali::Actor actor, const Dali::TapGesture& tap)
 \r
   try\r
   {\r
-    auto window = mApp.GetWindow();\r
+    auto window      = mApp.GetWindow();\r
     auto renderTasks = window.GetRenderTaskList();\r
     renderTasks.RemoveTask(mSceneRender);\r
 \r
@@ -438,14 +436,14 @@ void SceneLoaderExample::OnTap(Dali::Actor actor, const Dali::TapGesture& tap)
     sceneRender.SetSourceActor(scene);\r
     sceneRender.SetExclusive(true);\r
 \r
-    mScene = scene;\r
+    mScene       = scene;\r
     mSceneRender = sceneRender;\r
 \r
     mPanDetector = PanGestureDetector::New();\r
     mPanDetector.DetectedSignal().Connect(this, &SceneLoaderExample::OnPan);\r
     mPanDetector.Attach(mNavigationView);\r
   }\r
-  catch (const DaliException& e)\r
+  catch(const DaliException& e)\r
   {\r
     mScene = CreateErrorMessage(e.condition);\r
   }\r
index e7183d8..b18c830 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SCENE_LAUNCHER_H_\r
 #define SCENE_LAUNCHER_H_\r
 /*\r
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  *\r
  */\r
 #include "dali-scene-loader/public-api/animation-definition.h"\r
-#include "dali-scene-loader/public-api/scene-definition.h"\r
-#include "dali-scene-loader/public-api/node-definition.h"\r
 #include "dali-scene-loader/public-api/camera-parameters.h"\r
+#include "dali-scene-loader/public-api/node-definition.h"\r
+#include "dali-scene-loader/public-api/scene-definition.h"\r
+#include "dali-toolkit/devel-api/controls/navigation-view/navigation-view.h"\r
+#include "dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h"\r
+#include "dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h"\r
+#include "dali-toolkit/public-api/controls/scrollable/item-view/item-view.h"\r
+#include "dali/public-api/actors/camera-actor.h"\r
+#include "dali/public-api/adaptor-framework/application.h"\r
 #include "dali/public-api/common/vector-wrapper.h"\r
 #include "dali/public-api/events/pan-gesture-detector.h"\r
-#include "dali/public-api/actors/camera-actor.h"\r
 #include "dali/public-api/render-tasks/render-task.h"\r
 #include "dali/public-api/signals/connection-tracker.h"\r
-#include "dali/public-api/adaptor-framework/application.h"\r
-#include "dali-toolkit/public-api/controls/scrollable/item-view/item-view.h"\r
-#include "dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h"\r
-#include "dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h"\r
-#include "dali-toolkit/devel-api/controls/navigation-view/navigation-view.h"\r
 \r
 class SceneLoaderExample : public Dali::ConnectionTracker\r
 {\r
@@ -37,7 +37,7 @@ public:
   SceneLoaderExample(Dali::Application& app);\r
   ~SceneLoaderExample() = default;\r
 \r
-private:  // data\r
+private: // data\r
   Dali::Application& mApp;\r
 \r
   std::vector<std::string> mSceneNames;\r
@@ -45,19 +45,19 @@ private:  // data
   Dali::Toolkit::NavigationView mNavigationView;\r
 \r
   std::unique_ptr<Dali::Toolkit::ItemFactory> mItemFactory;\r
-  Dali::Toolkit::ItemLayoutPtr mItemLayout;\r
-  Dali::Toolkit::ItemView mItemView;\r
+  Dali::Toolkit::ItemLayoutPtr                mItemLayout;\r
+  Dali::Toolkit::ItemView                     mItemView;\r
 \r
   Dali::CameraActor mSceneCamera;\r
-  Dali::RenderTask mSceneRender;\r
-  Dali::Actor mScene;\r
+  Dali::RenderTask  mSceneRender;\r
+  Dali::Actor       mScene;\r
 \r
   Dali::Quaternion mCameraOrientationInv;\r
 \r
   Dali::TapGestureDetector mTapDetector;\r
-  Dali::PanGestureDetector  mPanDetector;\r
+  Dali::PanGestureDetector mPanDetector;\r
 \r
-private:  // methods\r
+private: // methods\r
   void OnInit(Dali::Application& app);\r
   void OnTerminate(Dali::Application& app);\r
 \r
@@ -66,4 +66,4 @@ private:  // methods
   void OnTap(Dali::Actor actor, const Dali::TapGesture& tap);\r
 };\r
 \r
-#endif  //SCENE_LAUNCHER_H_\r
+#endif //SCENE_LAUNCHER_H_\r
index c62fb20..c6ab50e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -65,7 +65,7 @@ public:
     mTextField.SetProperty(TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name.");
 
     mButtonSelectionStart = PushButton::New();
-    mButtonSelectionEnd = PushButton::New();
+    mButtonSelectionEnd   = PushButton::New();
 
     mButtonSelectionStart.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
     mButtonSelectionStart.SetProperty(Actor::Property::SIZE, Vector2(140.f, 50.f));
@@ -100,7 +100,7 @@ public:
     if(button == mButtonSelectionStart)
     {
       int iStart = mTextField.GetProperty(DevelTextField::Property::SELECTED_TEXT_START).Get<int>() - 1;
-      if (iStart < 0)
+      if(iStart < 0)
       {
         iStart = 0;
       }
@@ -108,22 +108,22 @@ public:
     }
     else if(button == mButtonSelectionEnd)
     {
-      mTextField.SetProperty(DevelTextField::Property::SELECTED_TEXT_END , mTextField.GetProperty(DevelTextField::Property::SELECTED_TEXT_END).Get<int>() + 1);
+      mTextField.SetProperty(DevelTextField::Property::SELECTED_TEXT_END, mTextField.GetProperty(DevelTextField::Property::SELECTED_TEXT_END).Get<int>() + 1);
     }
-    else if (mBtnEditable == button)
+    else if(mBtnEditable == button)
     {
-      bool bEditable = !mTextField.GetProperty( DevelTextField::Property::ENABLE_EDITING).Get<int>();
-      mTextField.SetProperty( DevelTextField::Property::ENABLE_EDITING , bEditable);
-      if (bEditable)
-        {
-          mBtnEditable.SetProperty(Button::Property::LABEL, "Non-editable");
-          mBtnEditable.SetBackgroundColor(Color::RED);
-        }
+      bool bEditable = !mTextField.GetProperty(DevelTextField::Property::ENABLE_EDITING).Get<int>();
+      mTextField.SetProperty(DevelTextField::Property::ENABLE_EDITING, bEditable);
+      if(bEditable)
+      {
+        mBtnEditable.SetProperty(Button::Property::LABEL, "Non-editable");
+        mBtnEditable.SetBackgroundColor(Color::RED);
+      }
       else
-        {
-          mBtnEditable.SetProperty(Button::Property::LABEL, "editable");
-          mBtnEditable.SetBackgroundColor(Color::GREEN);
-        }
+      {
+        mBtnEditable.SetProperty(Button::Property::LABEL, "editable");
+        mBtnEditable.SetBackgroundColor(Color::GREEN);
+      }
     }
 
     return true;
@@ -145,10 +145,10 @@ public:
 
 private:
   Application& mApplication;
-  TextField mTextField;
-  PushButton mButtonSelectionStart;
-  PushButton mButtonSelectionEnd;
-  PushButton mBtnEditable;
+  TextField    mTextField;
+  PushButton   mButtonSelectionStart;
+  PushButton   mButtonSelectionEnd;
+  PushButton   mBtnEditable;
 };
 
 void RunTest(Application& application)
index c9c0017..9e6d105 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -27,8 +27,8 @@
 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
 
 // INTERNAL INCLUDES
-#include "generated/simple-text-renderer-vert.h"
 #include "generated/simple-text-renderer-frag.h"
+#include "generated/simple-text-renderer-vert.h"
 
 using namespace std;
 using namespace Dali;
index c78d09c..e7f9002 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SPARKLE_EFFECT_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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;
index cba48d1..9258327 100644 (file)
@@ -31,7 +31,6 @@ namespace Internal
 {
 namespace
 {
-
 Dali::BaseHandle Create()
 {
   return Demo::ImageChannelControl::New();
index b638a36..2423d8e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <dali-toolkit/dali-toolkit.h>
 
 // INTERNAL INCLUDES
+#include "generated/textured-mesh-frag.h"
+#include "generated/textured-mesh-vert.h"
 #include "shared/utility.h"
 #include "shared/view.h"
-#include "generated/textured-mesh-vert.h"
-#include "generated/textured-mesh-frag.h"
 
 using namespace Dali;
 
index 8446939..d756e22 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -15,8 +15,8 @@
  *
  */
 #include "utils.h"
-#include "dali-toolkit/dali-toolkit.h"
 #include <fstream>
+#include "dali-toolkit/dali-toolkit.h"
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -27,10 +27,10 @@ Vector3 ToHueSaturationLightness(Vector3 rgb)
   float max = std::max(rgb.r, std::max(rgb.g, rgb.b));
 
   Vector3 hsl(max - min, 0.f, (max + min) * .5f);
-  if (hsl.x * hsl.x > .0f)
+  if(hsl.x * hsl.x > .0f)
   {
     hsl.y = hsl.x / max;
-    if (max == rgb.r)
+    if(max == rgb.r)
     {
       hsl.x = (rgb.g - rgb.b) / hsl.x;
     }
@@ -43,7 +43,7 @@ Vector3 ToHueSaturationLightness(Vector3 rgb)
       hsl.x = 4.f + (rgb.r - rgb.g) / hsl.x;
     }
     hsl.x *= 60.f;
-    if (hsl.x < 0.f)
+    if(hsl.x < 0.f)
     {
       hsl.x += 360.f;
     }
@@ -59,7 +59,7 @@ Vector3 ToHueSaturationLightness(Vector3 rgb)
 Vector3 FromHueSaturationLightness(Vector3 hsl)
 {
   Vector3 rgb;
-  if (hsl.y * hsl.y > 0.f)
+  if(hsl.y * hsl.y > 0.f)
   {
     if(hsl.x >= 360.f)
     {
@@ -67,50 +67,50 @@ Vector3 FromHueSaturationLightness(Vector3 hsl)
     }
     hsl.x /= 60.f;
 
-    int i = FastFloor(hsl.x);
+    int   i  = FastFloor(hsl.x);
     float ff = hsl.x - i;
-    float p = hsl.z * (1.0 - hsl.y);
-    float q = hsl.z * (1.0 - (hsl.y * ff));
-    float t = hsl.z * (1.0 - (hsl.y * (1.f - ff)));
+    float p  = hsl.z * (1.0 - hsl.y);
+    float q  = hsl.z * (1.0 - (hsl.y * ff));
+    float t  = hsl.z * (1.0 - (hsl.y * (1.f - ff)));
 
-    switch (i)
+    switch(i)
     {
-    case 0:
-      rgb.r = hsl.z;
-      rgb.g = t;
-      rgb.b = p;
-      break;
-
-    case 1:
-      rgb.r = q;
-      rgb.g = hsl.z;
-      rgb.b = p;
-      break;
-
-    case 2:
-      rgb.r = p;
-      rgb.g = hsl.z;
-      rgb.b = t;
-      break;
-
-    case 3:
-      rgb.r = p;
-      rgb.g = q;
-      rgb.b = hsl.z;
-      break;
-
-    case 4:
-      rgb.r = t;
-      rgb.g = p;
-      rgb.b = hsl.z;
-      break;
-
-    case 5:
-    default:
-      rgb.r = hsl.z;
-      rgb.g = p;
-      rgb.b = q;
-      break;
+      case 0:
+        rgb.r = hsl.z;
+        rgb.g = t;
+        rgb.b = p;
+        break;
+
+      case 1:
+        rgb.r = q;
+        rgb.g = hsl.z;
+        rgb.b = p;
+        break;
+
+      case 2:
+        rgb.r = p;
+        rgb.g = hsl.z;
+        rgb.b = t;
+        break;
+
+      case 3:
+        rgb.r = p;
+        rgb.g = q;
+        rgb.b = hsl.z;
+        break;
+
+      case 4:
+        rgb.r = t;
+        rgb.g = p;
+        rgb.b = hsl.z;
+        break;
+
+      case 5:
+      default:
+        rgb.r = hsl.z;
+        rgb.g = p;
+        rgb.b = q;
+        break;
     }
   }
   else
@@ -121,8 +121,7 @@ Vector3 FromHueSaturationLightness(Vector3 hsl)
   return rgb;
 }
 
-Geometry CreateTesselatedQuad(unsigned int xVerts, unsigned int yVerts,
-  Vector2 scale, VertexFn positionFn, VertexFn texCoordFn)
+Geometry CreateTesselatedQuad(unsigned int xVerts, unsigned int yVerts, Vector2 scale, VertexFn positionFn, VertexFn texCoordFn)
 {
   DALI_ASSERT_DEBUG(xVerts > 1 && yVerts > 1);
   int numVerts = xVerts * yVerts;
@@ -132,40 +131,40 @@ Geometry CreateTesselatedQuad(unsigned int xVerts, unsigned int yVerts,
     Vector2 aTexCoord;
   };
   std::vector<Vertex> vertices;
-  vertices.reserve( numVerts);
+  vertices.reserve(numVerts);
 
   float dx = 1.f / (xVerts - 1);
   float dz = 1.f / (yVerts - 1);
 
-  Vector2 pos{ 0.f, 0.f };
-  for (unsigned int i = 0; i < yVerts; ++i)
+  Vector2 pos{0.f, 0.f};
+  for(unsigned int i = 0; i < yVerts; ++i)
   {
     pos.x = float(int((i & 1) * 2) - 1) * dx * .25f;
-    for (unsigned int j = 0; j < xVerts; ++j)
+    for(unsigned int j = 0; j < xVerts; ++j)
     {
-      auto vPos = pos + Vector2{ -.5f, -.5f };
-      vertices.push_back(Vertex{ (positionFn ? positionFn(vPos) : vPos) * scale,
-        texCoordFn ? texCoordFn(pos) : pos });
+      auto vPos = pos + Vector2{-.5f, -.5f};
+      vertices.push_back(Vertex{(positionFn ? positionFn(vPos) : vPos) * scale,
+                                texCoordFn ? texCoordFn(pos) : pos});
       pos.x += dx;
     }
 
     pos.y += dz;
   }
 
-  VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
-    .Add( "aPosition", Property::VECTOR2 )
-    .Add( "aTexCoord", Property::VECTOR2 ));
+  VertexBuffer vertexBuffer = VertexBuffer::New(Property::Map()
+                                                  .Add("aPosition", Property::VECTOR2)
+                                                  .Add("aTexCoord", Property::VECTOR2));
   vertexBuffer.SetData(vertices.data(), vertices.size());
 
-  int numInds = (xVerts - 1) * (yVerts - 1) * 6;
+  int                   numInds = (xVerts - 1) * (yVerts - 1) * 6;
   std::vector<uint16_t> indices;
   indices.reserve(numInds);
 
-  for (unsigned int i = 1; i < yVerts; ++i)
+  for(unsigned int i = 1; i < yVerts; ++i)
   {
-    if ((i & 1) == 0)
+    if((i & 1) == 0)
     {
-      for (unsigned int j = 1; j < xVerts; ++j)
+      for(unsigned int j = 1; j < xVerts; ++j)
       {
         int iBase = i * xVerts + j;
         indices.push_back(iBase);
@@ -178,7 +177,7 @@ Geometry CreateTesselatedQuad(unsigned int xVerts, unsigned int yVerts,
     }
     else
     {
-      for (unsigned int j = 1; j < xVerts; ++j)
+      for(unsigned int j = 1; j < xVerts; ++j)
       {
         int iBase = i * xVerts + j;
         indices.push_back(iBase);
@@ -201,8 +200,7 @@ Texture LoadTexture(const std::string& path)
 {
   PixelData pixelData = SyncImageLoader::Load(path);
 
-  Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(),
-    pixelData.GetWidth(), pixelData.GetHeight());
+  Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight());
   texture.Upload(pixelData);
   return texture;
 }
@@ -211,14 +209,14 @@ Renderer CreateRenderer(TextureSet textures, Geometry geometry, Shader shader, u
 {
   Renderer renderer = Renderer::New(geometry, shader);
   renderer.SetProperty(Renderer::Property::BLEND_MODE,
-    (options & OPTION_BLEND) ? BlendMode::ON : BlendMode::OFF);
+                       (options & OPTION_BLEND) ? BlendMode::ON : BlendMode::OFF);
   renderer.SetProperty(Renderer::Property::DEPTH_TEST_MODE,
-    (options & OPTION_DEPTH_TEST) ? DepthTestMode::ON : DepthTestMode::OFF);
+                       (options & OPTION_DEPTH_TEST) ? DepthTestMode::ON : DepthTestMode::OFF);
   renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE,
-    (options & OPTION_DEPTH_WRITE) ? DepthWriteMode::ON : DepthWriteMode::OFF);
+                       (options & OPTION_DEPTH_WRITE) ? DepthWriteMode::ON : DepthWriteMode::OFF);
   renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK);
 
-  if (!textures)
+  if(!textures)
   {
     textures = TextureSet::New();
   }
@@ -242,15 +240,15 @@ Actor CreateActor()
 
 Renderer CloneRenderer(Renderer original)
 {
-  Geometry geom = original.GetGeometry();
-  Shader shader = original.GetShader();
-  Renderer clone = Renderer::New(geom, shader);
+  Geometry geom   = original.GetGeometry();
+  Shader   shader = original.GetShader();
+  Renderer clone  = Renderer::New(geom, shader);
 
   // Copy properties.
   Property::IndexContainer indices;
   original.GetPropertyIndices(indices);
 
-  for (auto& i: indices)
+  for(auto& i : indices)
   {
     auto actualIndex = Dali::PropertyRanges::DEFAULT_RENDERER_PROPERTY_START_INDEX + i;
     clone.SetProperty(actualIndex, original.GetProperty(actualIndex));
@@ -274,17 +272,17 @@ Actor CloneActor(Actor original)
   // Don't copy every single one of them.
   // Definitely don't copy resize policy related things, which will internally enable
   // relayout, which in turn will result in losing the ability to set Z size.
-  for (auto i : {
-    Actor::Property::PARENT_ORIGIN,
-    Actor::Property::ANCHOR_POINT,
-    Actor::Property::SIZE,
-    Actor::Property::POSITION,
-    Actor::Property::ORIENTATION,
-    Actor::Property::SCALE,
-    Actor::Property::VISIBLE,
-    Actor::Property::COLOR,
-    Actor::Property::NAME,
-  })
+  for(auto i : {
+        Actor::Property::PARENT_ORIGIN,
+        Actor::Property::ANCHOR_POINT,
+        Actor::Property::SIZE,
+        Actor::Property::POSITION,
+        Actor::Property::ORIENTATION,
+        Actor::Property::SCALE,
+        Actor::Property::VISIBLE,
+        Actor::Property::COLOR,
+        Actor::Property::NAME,
+      })
   {
     clone.SetProperty(i, original.GetProperty(i));
   }
index ea4366e..9ec7521 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef WAVES_UTILS_H_
 #define WAVES_UTILS_H_
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
  * limitations under the License.
  *
  */
+#include <cmath>
 #include "dali/public-api/actors/actor.h"
+#include "dali/public-api/math/vector3.h"
 #include "dali/public-api/rendering/geometry.h"
 #include "dali/public-api/rendering/renderer.h"
 #include "dali/public-api/rendering/shader.h"
 #include "dali/public-api/rendering/texture.h"
-#include "dali/public-api/math/vector3.h"
-#include <cmath>
 
 //
 // Maths
 //
-inline
-float FastFloor(float x)
+inline float FastFloor(float x)
 {
   return static_cast<int>(x) - static_cast<int>(x < 0);
 }
 
-inline
-float Sign(float x)
+inline float Sign(float x)
 {
   return float(x > 0.f) - float(x < .0f);
 }
 
-template <typename T>
+template<typename T>
 inline
-typename std::decay<T>::type Lerp(
+  typename std::decay<T>::type
+  Lerp(
     const T& min, const T& max, float alpha)
 {
   return min + (max - min) * alpha;
 }
 
-template <typename T>
+template<typename T>
 T Normalized(T v)
 {
   v.Normalize();
@@ -68,22 +67,21 @@ Dali::Vector3 FromHueSaturationLightness(Dali::Vector3 hsl);
 //
 // Dali entities
 //
-using VertexFn = Dali::Vector2(*)(const Dali::Vector2&);
+using VertexFn = Dali::Vector2 (*)(const Dali::Vector2&);
 
 ///@brief Creates a tesselated quad with @a xVerts vertices horizontally and @a yVerts
 /// vertices vertically. Allows the use of an optional @a shaderFn, which can be used to
 /// modify the vertex positions - these will be in the [{ 0.f, 0.f}, { 1.f, 1.f}] range.
 /// After returning from the shader, they're transformed
-Dali::Geometry CreateTesselatedQuad(unsigned int xVerts, unsigned int yVerts,
-  Dali::Vector2 scale, VertexFn positionFn = nullptr, VertexFn texCoordFn = nullptr);
+Dali::Geometry CreateTesselatedQuad(unsigned int xVerts, unsigned int yVerts, Dali::Vector2 scale, VertexFn positionFn = nullptr, VertexFn texCoordFn = nullptr);
 
 Dali::Texture LoadTexture(const std::string& path);
 
 enum RendererOptions
 {
-  OPTION_NONE = 0x0,
-  OPTION_BLEND = 0x01,
-  OPTION_DEPTH_TEST = 0x02,
+  OPTION_NONE        = 0x0,
+  OPTION_BLEND       = 0x01,
+  OPTION_DEPTH_TEST  = 0x02,
   OPTION_DEPTH_WRITE = 0x04
 };
 
@@ -91,8 +89,7 @@ enum RendererOptions
 /// and @a options from above.
 ///@note Back face culling is on.
 ///@note If textures is not a valid handle, an empty texture set will be created.
-Dali::Renderer CreateRenderer(Dali::TextureSet textures, Dali::Geometry geometry,
-  Dali::Shader shader, uint32_t options = OPTION_NONE);
+Dali::Renderer CreateRenderer(Dali::TextureSet textures, Dali::Geometry geometry, Dali::Shader shader, uint32_t options = OPTION_NONE);
 
 ///@brief Sets @a actor's anchor point and parent origin to center.
 void CenterActor(Dali::Actor actor);
index a4d2995..d6904b8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (   "License");
  * you may not use this file except in compliance with the License.
  */
 
 // INTERNAL INCLUDES
-#include "utils.h"
+#include <fstream>
+#include <iostream>
+#include <numeric>
 #include "dali/devel-api/adaptor-framework/tilt-sensor.h"
+#include "dali/public-api/actors/camera-actor.h"
+#include "dali/public-api/actors/layer.h"
 #include "dali/public-api/adaptor-framework/application.h"
 #include "dali/public-api/adaptor-framework/key.h"
 #include "dali/public-api/animation/animation.h"
+#include "dali/public-api/events/key-event.h"
 #include "dali/public-api/events/pan-gesture-detector.h"
 #include "dali/public-api/events/tap-gesture-detector.h"
-#include "dali/public-api/events/key-event.h"
-#include "dali/public-api/actors/camera-actor.h"
-#include "dali/public-api/actors/layer.h"
-#include "dali/public-api/render-tasks/render-task.h"
 #include "dali/public-api/render-tasks/render-task-list.h"
-#include <fstream>
-#include <iostream>
-#include <numeric>
+#include "dali/public-api/render-tasks/render-task.h"
+#include "utils.h"
 
-#include "generated/waves-vert.h"
 #include "generated/waves-frag.h"
+#include "generated/waves-vert.h"
 
 using namespace Dali;
 
 namespace
 {
-
 const float TIME_STEP = 0.0952664626;
 
-const std::string UNIFORM_LIGHT_COLOR_SQR = "uLightColorSqr";
-const std::string UNIFORM_AMBIENT_COLOR = "uAmbientColor";
-const std::string UNIFORM_INV_LIGHT_DIR = "uInvLightDir";
-const std::string UNIFORM_SCROLL_SCALE = "uScrollScale";
-const std::string UNIFORM_WAVE_RATE = "uWaveRate";
-const std::string UNIFORM_WAVE_AMPLITUDE = "uWaveAmplitude";
+const std::string UNIFORM_LIGHT_COLOR_SQR   = "uLightColorSqr";
+const std::string UNIFORM_AMBIENT_COLOR     = "uAmbientColor";
+const std::string UNIFORM_INV_LIGHT_DIR     = "uInvLightDir";
+const std::string UNIFORM_SCROLL_SCALE      = "uScrollScale";
+const std::string UNIFORM_WAVE_RATE         = "uWaveRate";
+const std::string UNIFORM_WAVE_AMPLITUDE    = "uWaveAmplitude";
 const std::string UNIFORM_NORMAL_MAP_WEIGHT = "uNormalMapWeight";
-const std::string UNIFORM_SPECULARITY = "uSpecularity";
-const std::string UNIFORM_PARALLAX_AMOUNT = "uParallaxAmount";
-const std::string UNIFORM_TIME = "uTime";
+const std::string UNIFORM_SPECULARITY       = "uSpecularity";
+const std::string UNIFORM_PARALLAX_AMOUNT   = "uParallaxAmount";
+const std::string UNIFORM_TIME              = "uTime";
 
-const Vector3 WAVES_COLOR { .78f, .64f, .26f };
-const Vector3 LIGHT_COLOR { 1.0f, 0.91f, 0.6f };
-const Vector3 AMBIENT_COLOR { .002f, .001f, .001f };
+const Vector3 WAVES_COLOR{.78f, .64f, .26f};
+const Vector3 LIGHT_COLOR{1.0f, 0.91f, 0.6f};
+const Vector3 AMBIENT_COLOR{.002f, .001f, .001f};
 
-const Vector3 INV_LIGHT_DIR = Normalized(Vector3{ .125f, .8f, -.55f });
+const Vector3 INV_LIGHT_DIR = Normalized(Vector3{.125f, .8f, -.55f});
 
-const Vector2 SCROLL_SCALE{ 1.f, 3.5f };
-const float WAVE_RATE = 12.17f;
-const float WAVE_AMPLITUDE = 1.f;
-const float NORMAL_MAP_WEIGHT = 0.05f;
-const float SPECULARITY = 512.f;
-const float PARALLAX_AMOUNT = .25f;
+const Vector2 SCROLL_SCALE{1.f, 3.5f};
+const float   WAVE_RATE         = 12.17f;
+const float   WAVE_AMPLITUDE    = 1.f;
+const float   NORMAL_MAP_WEIGHT = 0.05f;
+const float   SPECULARITY       = 512.f;
+const float   PARALLAX_AMOUNT   = .25f;
 
 const float TILT_RANGE_DEGREES = 30.f;
 
-const float TRANSITION_DURATION = 1.2f;
+const float TRANSITION_DURATION   = 1.2f;
 const float TRANSITION_TIME_SCALE = 6.f;
 
 const std::string_view NORMAL_MAP_NAME = "noise512.png";
@@ -92,7 +91,7 @@ public:
   void Add(Dali::Vector2 tilt)
   {
     mTiltSamples[mIdxNextSample] = tilt;
-    mIdxNextSample = (mIdxNextSample + 1) % FILTER_SIZE;
+    mIdxNextSample               = (mIdxNextSample + 1) % FILTER_SIZE;
   }
 
   Dali::Vector2 Filter() const
@@ -101,22 +100,25 @@ public:
   }
 
 private:
-  enum { FILTER_SIZE = 8u };
+  enum
+  {
+    FILTER_SIZE = 8u
+  };
 
   Dali::Vector2 mTiltSamples[FILTER_SIZE];
-  size_t mIdxNextSample = 0;
+  size_t        mIdxNextSample = 0;
 };
 
-} // nonamespace
+} // namespace
 
 class WavesExample : public ConnectionTracker
 {
 public:
-  WavesExample( Application& app )
-  : mApp( app )
+  WavesExample(Application& app)
+  : mApp(app)
   {
-    mApp.InitSignal().Connect( this, &WavesExample::Create );
-    mApp.TerminateSignal().Connect( this, &WavesExample::Destroy );
+    mApp.InitSignal().Connect(this, &WavesExample::Create);
+    mApp.TerminateSignal().Connect(this, &WavesExample::Destroy);
   }
 
   ~WavesExample() = default;
@@ -124,9 +126,9 @@ public:
 private:
   Application& mApp;
 
-  CameraActor mCamera;  // no ownership
+  CameraActor mCamera; // no ownership
 
-  Actor mWaves;
+  Actor  mWaves;
   Shader mWaveShader;
 
   Property::Index mUInvLightDir{Property::INVALID_INDEX};
@@ -150,37 +152,35 @@ private:
   Animation mTimeAnim;
   Animation mTransitionAnim;
 
-  void Create( Application& application )
+  void Create(Application& application)
   {
-    Window window = application.GetWindow();
-    auto rootLayer = window.GetRootLayer();
+    Window window    = application.GetWindow();
+    auto   rootLayer = window.GetRootLayer();
 
     window.SetBackgroundColor(Vector4(WAVES_COLOR * .5f));
 
     // Get camera
-    RenderTaskList tasks = window.GetRenderTaskList();
-    RenderTask mainPass = tasks.GetTask(0);
-    CameraActor camera = mainPass.GetCameraActor();
-    mCamera = camera;
+    RenderTaskList tasks    = window.GetRenderTaskList();
+    RenderTask     mainPass = tasks.GetTask(0);
+    CameraActor    camera   = mainPass.GetCameraActor();
+    mCamera                 = camera;
 
     // NOTE: watchface doesn't tolerate modification of the camera well;
     /// we're better off rotating the world.
-    Quaternion baseOrientation (Radian(Degree(-150.f)), Radian(M_PI), Radian(0.f));
+    Quaternion baseOrientation(Radian(Degree(-150.f)), Radian(M_PI), Radian(0.f));
 
     auto shader = CreateShader();
 
     // Create geometry
-    Geometry geom = CreateTesselatedQuad(16, 64, Vector2{ .25f, 3.8f }, [](const Vector2& v) {
+    Geometry geom = CreateTesselatedQuad(
+      16, 64, Vector2{.25f, 3.8f}, [](const Vector2& v) {
       float y = v.y + .5f;  // 0..1
       y = std::sqrt(y) - .5f; // perspective correction - increase vertex density closer to viewer
 
       float x = v.x + v.x * (1.f - y) * 5.5f;
 
       y -= .24f;  // further translation
-      return Vector2{ x, y };
-    }, [](const Vector2& v) {
-      return Vector2{ v.x, std::sqrt(v.y) };
-    });
+      return Vector2{ x, y }; }, [](const Vector2& v) { return Vector2{v.x, std::sqrt(v.y)}; });
 
     // Create texture
     auto normalMap = LoadTexture(std::string(DEMO_IMAGE_DIR) + NORMAL_MAP_NAME.data());
@@ -197,7 +197,7 @@ private:
     Renderer renderer = CreateRenderer(textures, geom, shader, OPTION_DEPTH_TEST | OPTION_DEPTH_WRITE);
 
     auto waves = CreateActor();
-    auto size = Vector2(window.GetSize());
+    auto size  = Vector2(window.GetSize());
     waves.SetProperty(Actor::Property::SIZE, Vector3(size.x, 100.f, size.y));
     waves.SetProperty(Actor::Property::ORIENTATION, baseOrientation);
     waves.SetProperty(Actor::Property::COLOR, WAVES_COLOR);
@@ -206,7 +206,7 @@ private:
     window.Add(waves);
     mWaves = waves;
 
-    window.KeyEventSignal().Connect( this, &WavesExample::OnKeyEvent );
+    window.KeyEventSignal().Connect(this, &WavesExample::OnKeyEvent);
 
     // Setup double tap detector for color change
     mDoubleTapGesture = TapGestureDetector::New(2);
@@ -215,10 +215,10 @@ private:
 
     // Touch controls
     mTiltSensor = TiltSensor::Get();
-    if ( mTiltSensor.Start() )
+    if(mTiltSensor.Start())
     {
       // Get notifications when the device is tilted
-      mTiltSensor.TiltedSignal().Connect( this, &WavesExample::OnTilted );
+      mTiltSensor.TiltedSignal().Connect(this, &WavesExample::OnTilted);
     }
     else
     {
@@ -239,7 +239,7 @@ private:
     mTimeAnim = animTime;
   }
 
-  void Destroy( Application& app)
+  void Destroy(Application& app)
   {
     mCamera.Reset();
 
@@ -251,38 +251,38 @@ private:
 
   Shader CreateShader()
   {
-    Vector3 lightColorSqr{ LIGHT_COLOR };
-    Vector3 ambientColor = AMBIENT_COLOR;
-    Vector3 invLightDir = INV_LIGHT_DIR;
-    Vector2 scrollScale = SCROLL_SCALE;
-    float waveRate = WAVE_RATE;
-    float waveAmp = WAVE_AMPLITUDE;
-    float normalMapWeight = NORMAL_MAP_WEIGHT;
-    float specularity = SPECULARITY;
-    float parallaxAmount = PARALLAX_AMOUNT;
-    if (mWaveShader)
+    Vector3 lightColorSqr{LIGHT_COLOR};
+    Vector3 ambientColor    = AMBIENT_COLOR;
+    Vector3 invLightDir     = INV_LIGHT_DIR;
+    Vector2 scrollScale     = SCROLL_SCALE;
+    float   waveRate        = WAVE_RATE;
+    float   waveAmp         = WAVE_AMPLITUDE;
+    float   normalMapWeight = NORMAL_MAP_WEIGHT;
+    float   specularity     = SPECULARITY;
+    float   parallaxAmount  = PARALLAX_AMOUNT;
+    if(mWaveShader)
     {
-      lightColorSqr = mWaveShader.GetProperty(mULightColorSqr).Get<Vector3>();
-      ambientColor = mWaveShader.GetProperty(mUAmbientColor).Get<Vector3>();
-      invLightDir = mWaveShader.GetProperty(mUInvLightDir).Get<Vector3>();
-      scrollScale = mWaveShader.GetProperty(mUScrollScale).Get<Vector2>();
-      waveRate = mWaveShader.GetProperty(mUWaveRate).Get<float>();
-      waveAmp = mWaveShader.GetProperty(mUWaveAmplitude).Get<float>();
+      lightColorSqr   = mWaveShader.GetProperty(mULightColorSqr).Get<Vector3>();
+      ambientColor    = mWaveShader.GetProperty(mUAmbientColor).Get<Vector3>();
+      invLightDir     = mWaveShader.GetProperty(mUInvLightDir).Get<Vector3>();
+      scrollScale     = mWaveShader.GetProperty(mUScrollScale).Get<Vector2>();
+      waveRate        = mWaveShader.GetProperty(mUWaveRate).Get<float>();
+      waveAmp         = mWaveShader.GetProperty(mUWaveAmplitude).Get<float>();
       normalMapWeight = mWaveShader.GetProperty(mUNormalMapWeight).Get<float>();
-      specularity = mWaveShader.GetProperty(mUSpecularity).Get<float>();
+      specularity     = mWaveShader.GetProperty(mUSpecularity).Get<float>();
     }
 
-    Shader shader = Shader::New(SHADER_WAVES_VERT, SHADER_WAVES_FRAG, Shader::Hint::MODIFIES_GEOMETRY);
-    mULightColorSqr = shader.RegisterProperty(UNIFORM_LIGHT_COLOR_SQR, lightColorSqr);
-    mUAmbientColor = shader.RegisterProperty(UNIFORM_AMBIENT_COLOR, ambientColor);
-    mUInvLightDir = shader.RegisterProperty(UNIFORM_INV_LIGHT_DIR, invLightDir);
-    mUScrollScale = shader.RegisterProperty(UNIFORM_SCROLL_SCALE, scrollScale);
-    mUWaveRate = shader.RegisterProperty(UNIFORM_WAVE_RATE, waveRate);
-    mUWaveAmplitude = shader.RegisterProperty(UNIFORM_WAVE_AMPLITUDE, waveAmp);
+    Shader shader     = Shader::New(SHADER_WAVES_VERT, SHADER_WAVES_FRAG, Shader::Hint::MODIFIES_GEOMETRY);
+    mULightColorSqr   = shader.RegisterProperty(UNIFORM_LIGHT_COLOR_SQR, lightColorSqr);
+    mUAmbientColor    = shader.RegisterProperty(UNIFORM_AMBIENT_COLOR, ambientColor);
+    mUInvLightDir     = shader.RegisterProperty(UNIFORM_INV_LIGHT_DIR, invLightDir);
+    mUScrollScale     = shader.RegisterProperty(UNIFORM_SCROLL_SCALE, scrollScale);
+    mUWaveRate        = shader.RegisterProperty(UNIFORM_WAVE_RATE, waveRate);
+    mUWaveAmplitude   = shader.RegisterProperty(UNIFORM_WAVE_AMPLITUDE, waveAmp);
     mUNormalMapWeight = shader.RegisterProperty(UNIFORM_NORMAL_MAP_WEIGHT, normalMapWeight);
-    mUSpecularity = shader.RegisterProperty(UNIFORM_SPECULARITY, specularity);
-    mUParallaxAmount = shader.RegisterProperty(UNIFORM_PARALLAX_AMOUNT, parallaxAmount);
-    mUTime = shader.RegisterProperty(UNIFORM_TIME, 0.f);
+    mUSpecularity     = shader.RegisterProperty(UNIFORM_SPECULARITY, specularity);
+    mUParallaxAmount  = shader.RegisterProperty(UNIFORM_PARALLAX_AMOUNT, parallaxAmount);
+    mUTime            = shader.RegisterProperty(UNIFORM_TIME, 0.f);
 
     auto window = mApp.GetWindow();
     shader.RegisterProperty("uScreenHalfSize", Vector2(window.GetSize()) * .5f);
@@ -293,7 +293,7 @@ private:
 
   void TriggerColorTransition(Vector3 wavesColor, Vector3 lightColor)
   {
-    if (mTransitionAnim)
+    if(mTransitionAnim)
     {
       mTransitionAnim.Stop();
     }
@@ -336,9 +336,9 @@ private:
 
   void OnKeyEvent(const KeyEvent& event)
   {
-    if ( event.GetState() == KeyEvent::UP)  // single keystrokes
+    if(event.GetState() == KeyEvent::UP) // single keystrokes
     {
-      if( IsKey( event, DALI_KEY_ESCAPE ) || IsKey( event, DALI_KEY_BACK ) )
+      if(IsKey(event, DALI_KEY_ESCAPE) || IsKey(event, DALI_KEY_BACK))
       {
         mApp.Quit();
       }
@@ -354,24 +354,24 @@ private:
   void OnPan(Actor actor, const PanGesture& gesture)
   {
     auto tilt = gesture.GetDisplacement() / Vector2(mApp.GetWindow().GetSize());
-    switch (gesture.GetState())
+    switch(gesture.GetState())
     {
-    case GestureState::STARTED:
-      mTiltFilter.Add(tilt);
-      break;
+      case GestureState::STARTED:
+        mTiltFilter.Add(tilt);
+        break;
 
-    case GestureState::CONTINUING:
-      mTiltFilter.Add(mTiltFilter.Filter() + tilt);
-      break;
+      case GestureState::CONTINUING:
+        mTiltFilter.Add(mTiltFilter.Filter() + tilt);
+        break;
 
-    default:
-      break;
+      default:
+        break;
     }
 
     UpdateLightDirection();
   }
 
-  void OnTilted( const TiltSensor& sensor)
+  void OnTilted(const TiltSensor& sensor)
   {
     mTiltFilter.Add(Vector2(sensor.GetPitch(), sensor.GetRoll()));
 
@@ -380,17 +380,17 @@ private:
 
   void UpdateLightDirection()
   {
-    Vector2 tilt = mTiltFilter.Filter();
+    Vector2    tilt = mTiltFilter.Filter();
     Quaternion q(Radian(tilt.y), Radian(-tilt.x), Radian(0.f));
-    Vector3 lightDir = q.Rotate(INV_LIGHT_DIR);
+    Vector3    lightDir = q.Rotate(INV_LIGHT_DIR);
     mWaveShader.SetProperty(mUInvLightDir, lightDir);
   }
 };
 
-int DALI_EXPORT_API main( int argc, char **argv )
+int DALI_EXPORT_API main(int argc, char** argv)
 {
-  Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
-  WavesExample example( application);
+  Application  application = Application::New(&argc, &argv, DEMO_THEME_PATH);
+  WavesExample example(application);
   application.MainLoop();
   return 0;
 }
index 5ce8e7c..5344f02 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
 // CLASS HEADER\r
 #include "bubble-animator.h"\r
 \r
-#include <dali/public-api/animation/constraint.h>\r
-#include <dali/public-api/math/random.h>\r
-#include <dali/public-api/rendering/shader.h>\r
+#include <dali-toolkit/devel-api/shader-effects/distance-field-effect.h>\r
 #include <dali-toolkit/public-api/controls/image-view/image-view.h>\r
 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>\r
 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>\r
-#include <dali-toolkit/devel-api/shader-effects/distance-field-effect.h>\r
+#include <dali/public-api/animation/constraint.h>\r
+#include <dali/public-api/math/random.h>\r
+#include <dali/public-api/rendering/shader.h>\r
 \r
 using namespace Dali;\r
 using namespace Dali::Toolkit;\r
@@ -32,19 +32,17 @@ using namespace Dali::Toolkit;
 namespace\r
 {\r
 const char* const BUBBLE_COLOR_STYLE_NAME[] =\r
-{\r
-  "BubbleColor1",\r
-  "BubbleColor2",\r
-  "BubbleColor3",\r
-  "BubbleColor4"\r
-};\r
+  {\r
+    "BubbleColor1",\r
+    "BubbleColor2",\r
+    "BubbleColor3",\r
+    "BubbleColor4"};\r
 constexpr int NUMBER_OF_BUBBLE_COLORS(sizeof(BUBBLE_COLOR_STYLE_NAME) / sizeof(BUBBLE_COLOR_STYLE_NAME[0]));\r
 \r
 const char* const SHAPE_IMAGE_TABLE[] =\r
-{\r
-  DEMO_IMAGE_DIR "shape-circle.png",\r
-  DEMO_IMAGE_DIR "shape-bubble.png"\r
-};\r
+  {\r
+    DEMO_IMAGE_DIR "shape-circle.png",\r
+    DEMO_IMAGE_DIR "shape-bubble.png"};\r
 constexpr int NUMBER_OF_SHAPE_IMAGES(sizeof(SHAPE_IMAGE_TABLE) / sizeof(SHAPE_IMAGE_TABLE[0]));\r
 \r
 constexpr int   NUM_BACKGROUND_IMAGES   = 18;\r
@@ -157,7 +155,7 @@ void BubbleAnimator::InitializeBackgroundActors(Dali::Actor actor)
 \r
     // Define bubble horizontal parallax and vertical wrapping\r
     Actor scrollView = mScrollView.GetHandle();\r
-    if( scrollView )\r
+    if(scrollView)\r
     {\r
       Constraint animConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, AnimateBubbleConstraint(childPos, Random::Range(-0.85f, 0.25f)));\r
       animConstraint.AddSource(Source(scrollView, ScrollView::Property::SCROLL_POSITION));\r
@@ -174,7 +172,6 @@ void BubbleAnimator::InitializeBackgroundActors(Dali::Actor actor)
     animation.Play();\r
     mBackgroundAnimations.push_back(animation);\r
   }\r
-\r
 }\r
 \r
 void BubbleAnimator::AddBackgroundActors(Actor layer, int count)\r
index f8f6ce9..fed6bf1 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_DEMO_BUBBLE_ANIMATOR_H\r
 \r
 /*\r
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  */\r
 \r
 // EXTERNAL INCLUDES\r
-#include <vector>\r
 #include <dali/public-api/actors/actor.h>\r
 #include <dali/public-api/adaptor-framework/timer.h>\r
 #include <dali/public-api/animation/animation.h>\r
 #include <dali/public-api/object/weak-handle.h>\r
 #include <dali/public-api/signals/connection-tracker.h>\r
+#include <vector>\r
 \r
 /**\r
  * Creates and animates random sized bubbles\r
@@ -32,7 +32,6 @@
 class BubbleAnimator : public Dali::ConnectionTracker\r
 {\r
 public:\r
-\r
   /**\r
    * @brief Initilizes the bubble background\r
    *\r
@@ -47,7 +46,6 @@ public:
   void PlayAnimation();\r
 \r
 private:\r
-\r
   /**\r
    * @brief Used by the timer to pause the animation\r
    *\r
@@ -71,13 +69,12 @@ private:
   void AddBackgroundActors(Dali::Actor layer, int count);\r
 \r
 private:\r
-\r
   using AnimationList = std::vector<Dali::Animation>;\r
 \r
-  Dali::WeakHandle<Dali::Actor> mScrollView; ///< Weak handle to the scroll view used to apply a parallax effect when scrolling.\r
-  AnimationList mBackgroundAnimations; ///< List of background bubble animations.\r
-  Dali::Timer mAnimationTimer;   ///< Timer used to turn off animation after a specific time period.\r
-  bool mBackgroundAnimsPlaying{false}; ///< Are background animations playing.\r
+  Dali::WeakHandle<Dali::Actor> mScrollView;                    ///< Weak handle to the scroll view used to apply a parallax effect when scrolling.\r
+  AnimationList                 mBackgroundAnimations;          ///< List of background bubble animations.\r
+  Dali::Timer                   mAnimationTimer;                ///< Timer used to turn off animation after a specific time period.\r
+  bool                          mBackgroundAnimsPlaying{false}; ///< Are background animations playing.\r
 };\r
 \r
 #endif // DALI_DEMO_BUBBLE_ANIMATOR_H\r
old mode 100755 (executable)
new mode 100644 (file)
index d45e345..a8743ad
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include "dali-table-view.h"
 
 // EXTERNAL INCLUDES
-#include <dali/devel-api/actors/actor-devel.h>
-#include <dali/devel-api/images/distance-field.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h>
-#include <dali-toolkit/devel-api/shader-effects/distance-field-effect.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/accessibility-manager/accessibility-manager.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/table-view/table-view.h>
 #include <dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h>
 #include <dali-toolkit/devel-api/shader-effects/distance-field-effect.h>
@@ -65,7 +61,7 @@ const float   BUTTON_PRESS_ANIMATION_TIME = 0.35f; ///< Time to perform button s
 const int     EXAMPLES_PER_ROW            = 3;
 const int     ROWS_PER_PAGE               = 3;
 const int     EXAMPLES_PER_PAGE           = EXAMPLES_PER_ROW * ROWS_PER_PAGE;
-const Vector3 TABLE_RELATIVE_SIZE(0.95f, 0.9f, 0.8f);     ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights.
+const Vector3 TABLE_RELATIVE_SIZE(0.95f, 0.9f, 0.8f); ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights.
 
 const char* const DEMO_BUILD_DATE = __DATE__ " " __TIME__;
 
@@ -159,8 +155,7 @@ Dali::Toolkit::Popup CreateVersionPopup(Application& application, ConnectionTrac
   // Hide the popup when touched outside
   popup.OutsideTouchedSignal().Connect(
     &connectionTracker,
-    [popup]() mutable
-    {
+    [popup]() mutable {
       if(popup && (popup.GetDisplayState() == Toolkit::Popup::SHOWN))
       {
         popup.SetDisplayState(Popup::HIDDEN);
@@ -399,7 +394,7 @@ void DaliTableView::Populate()
   {
     if(mSortAlphabetically)
     {
-      sort(mExampleList.begin(), mExampleList.end(), [](auto& lhs, auto& rhs)->bool { return lhs.title < rhs.title; } );
+      sort(mExampleList.begin(), mExampleList.end(), [](auto& lhs, auto& rhs) -> bool { return lhs.title < rhs.title; });
     }
 
     unsigned int         exampleCount = 0;
@@ -501,7 +496,7 @@ Actor DaliTableView::CreateTile(const std::string& name, const std::string& titl
   focusableTile.TouchedSignal().Connect(this, &DaliTableView::OnTilePressed);
   focusableTile.HoveredSignal().Connect(this, &DaliTableView::OnTileHovered);
   focusableTile.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::PUSH_BUTTON);
-  DevelControl::AccessibilityActivateSignal(focusableTile).Connect(this, [=](){
+  DevelControl::AccessibilityActivateSignal(focusableTile).Connect(this, [=]() {
     DoTilePress(focusableTile, PointState::DOWN);
     DoTilePress(focusableTile, PointState::UP);
   });
@@ -532,7 +527,7 @@ bool DaliTableView::DoTilePress(Actor actor, PointState::Type pointState)
     // ignore Example button presses when scrolling or button animating.
     if((!mScrolling) && (!mPressedAnimation))
     {
-      std::string           name = actor.GetProperty<std::string>(Dali::Actor::Property::NAME);
+      std::string name = actor.GetProperty<std::string>(Dali::Actor::Property::NAME);
       for(Example& example : mExampleList)
       {
         if(example.name == name)
index d4fee68..c265c09 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_DEMO_TABLEVIEW_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -33,7 +33,6 @@
 class DaliTableView : public Dali::ConnectionTracker
 {
 public:
-
   /**
    * Constructor
    *
@@ -66,7 +65,7 @@ public:
    */
   void SortAlphabetically(bool sortAlphabetically);
 
-private: // Application callbacks & implementation
+private:                                                          // Application callbacks & implementation
   static constexpr unsigned int FOCUS_ANIMATION_ACTOR_NUMBER = 2; ///< The number of elements used to form the custom focus effect
 
   /**
@@ -239,14 +238,14 @@ private:
   };
   FocusEffect mFocusEffect[FOCUS_ANIMATION_ACTOR_NUMBER]; ///< The elements used to create the custom focus effect
 
-  std::vector<Dali::Actor> mPages;                ///< List of pages.
-  ExampleList              mExampleList;          ///< List of examples.
+  std::vector<Dali::Actor> mPages;       ///< List of pages.
+  ExampleList              mExampleList; ///< List of examples.
 
   float mPageWidth;  ///< The width of a page within the scroll-view, used to calculate the domain
   int   mTotalPages; ///< Total pages within scrollview.
 
-  bool mScrolling : 1;              ///< Flag indicating whether view is currently being scrolled
-  bool mSortAlphabetically : 1;     ///< Sort examples alphabetically.
+  bool mScrolling : 1;          ///< Flag indicating whether view is currently being scrolled
+  bool mSortAlphabetically : 1; ///< Sort examples alphabetically.
 };
 
 #endif // DALI_DEMO_TABLEVIEW_H
index 978e849..858167e 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_DEMO_EXAMPLE_H\r
 \r
 /*\r
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -49,7 +49,7 @@ struct Example
   std::string title; ///< title (caption) of example to appear on tile button.\r
 };\r
 \r
-using ExampleList = std::vector<Example>;\r
+using ExampleList          = std::vector<Example>;\r
 using ExampleListConstIter = ExampleList::const_iterator;\r
 \r
 #endif // DALI_DEMO_SHARED_EXAMPLE_H\r