Updated demos to use DALi clang-format
[platform/core/uifw/dali-demo.git] / examples / rendering-basic-pbr / rendering-basic-pbr-example.cpp
index 38c3ce2..6b00413 100644 (file)
 #include <sstream>
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/file-stream.h>
+#include <dali/integration-api/debug.h>
 #include "ktx-loader.h"
-#include "model-skybox.h"
 #include "model-pbr.h"
-#include <dali/integration-api/debug.h>
-#include <dali/devel-api/adaptor-framework/file-stream.h>
+#include "model-skybox.h"
 
 using namespace Dali;
 using namespace Toolkit;
@@ -42,28 +42,27 @@ using namespace Toolkit;
 
 namespace
 {
-
-const char* NORMAL_ROUGH_TEXTURE_URL = DEMO_IMAGE_DIR "Test_100_normal_roughness.png";
-const char* ALBEDO_METAL_TEXTURE_URL = DEMO_IMAGE_DIR "Test_wblue_100_albedo_metal.png";
+const char* NORMAL_ROUGH_TEXTURE_URL     = DEMO_IMAGE_DIR "Test_100_normal_roughness.png";
+const char* ALBEDO_METAL_TEXTURE_URL     = DEMO_IMAGE_DIR "Test_wblue_100_albedo_metal.png";
 const char* CUBEMAP_SPECULAR_TEXTURE_URL = DEMO_IMAGE_DIR "papermill_pmrem.ktx";
-const char* CUBEMAP_DIFFUSE_TEXTURE_URL = DEMO_IMAGE_DIR "papermill_E_diffuse-64.ktx";
+const char* CUBEMAP_DIFFUSE_TEXTURE_URL  = DEMO_IMAGE_DIR "papermill_E_diffuse-64.ktx";
 
 const char* SPHERE_URL = DEMO_MODEL_DIR "sphere.obj";
 const char* TEAPOT_URL = DEMO_MODEL_DIR "teapot.obj";
 
-const char* VERTEX_SHADER_URL = DEMO_SHADER_DIR "pbr_shader.vsh";
+const char* VERTEX_SHADER_URL   = DEMO_SHADER_DIR "pbr_shader.vsh";
 const char* FRAGMENT_SHADER_URL = DEMO_SHADER_DIR "pbr_shader.fsh";
 
-const Vector3 SKYBOX_SCALE( 1.0f, 1.0f, 1.0f );
-const Vector3 SPHERE_SCALE( 1.5f, 1.5f, 1.5f );
-const Vector3 TEAPOT_SCALE( 2.0f, 2.0f, 2.0f );
+const Vector3 SKYBOX_SCALE(1.0f, 1.0f, 1.0f);
+const Vector3 SPHERE_SCALE(1.5f, 1.5f, 1.5f);
+const Vector3 TEAPOT_SCALE(2.0f, 2.0f, 2.0f);
 
-const float CAMERA_DEFAULT_FOV(    60.0f );
-const float CAMERA_DEFAULT_NEAR(    0.1f );
-const float CAMERA_DEFAULT_FAR(  1000.0f );
-const Vector3 CAMERA_DEFAULT_POSITION( 0.0f, 0.0f, 3.5f );
+const float   CAMERA_DEFAULT_FOV(60.0f);
+const float   CAMERA_DEFAULT_NEAR(0.1f);
+const float   CAMERA_DEFAULT_FAR(1000.0f);
+const Vector3 CAMERA_DEFAULT_POSITION(0.0f, 0.0f, 3.5f);
 
-}
+} // namespace
 
 /*
  *
@@ -79,21 +78,20 @@ const Vector3 CAMERA_DEFAULT_POSITION( 0.0f, 0.0f, 3.5f );
 class BasicPbrController : public ConnectionTracker
 {
 public:
-
-  BasicPbrController( Application& application )
-  : mApplication( application ),
+  BasicPbrController(Application& application)
+  : mApplication(application),
     mLabel(),
     m3dRoot(),
     mUiRoot(),
     mDoubleTapTime(),
     mModelOrientation(),
-    mRoughness( 1.f ),
-    mMetalness( 0.f ),
+    mRoughness(1.f),
+    mMetalness(0.f),
     mDoubleTap(false),
     mTeapotView(true)
   {
     // Connect to the Application's Init signal
-    mApplication.InitSignal().Connect( this, &BasicPbrController::Create );
+    mApplication.InitSignal().Connect(this, &BasicPbrController::Create);
   }
 
   ~BasicPbrController()
@@ -102,20 +100,20 @@ public:
   }
 
   // The Init signal is received once (only) during the Application lifetime
-  void Create( Application& application )
+  void Create(Application& application)
   {
     // Get a handle to the window
     Window window = application.GetWindow();
-    window.SetBackgroundColor( Color::BLACK );
-    mAnimation = Animation::New( 1.0f );
-    mLabel = TextLabel::New( "R:1 M:0" );
-    mLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
-    mLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
-    mLabel.SetProperty( Actor::Property::SIZE, Vector2( window.GetSize().GetWidth() * 0.5f, window.GetSize().GetHeight() * 0.083f ) );
-    mLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
-    mLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
-    mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE );
-    mLabel.SetProperty( Actor::Property::COLOR_ALPHA, 0.0f );
+    window.SetBackgroundColor(Color::BLACK);
+    mAnimation = Animation::New(1.0f);
+    mLabel     = TextLabel::New("R:1 M:0");
+    mLabel.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER);
+    mLabel.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER);
+    mLabel.SetProperty(Actor::Property::SIZE, Vector2(window.GetSize().GetWidth() * 0.5f, window.GetSize().GetHeight() * 0.083f));
+    mLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
+    mLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER");
+    mLabel.SetProperty(TextLabel::Property::TEXT_COLOR, Color::WHITE);
+    mLabel.SetProperty(Actor::Property::COLOR_ALPHA, 0.0f);
     // Step 1. Create shader
     CreateModelShader();
 
@@ -126,16 +124,15 @@ public:
     InitActors();
 
     // Respond to a click anywhere on the window
-    window.GetRootLayer().TouchedSignal().Connect( this, &BasicPbrController::OnTouch );
+    window.GetRootLayer().TouchedSignal().Connect(this, &BasicPbrController::OnTouch);
 
     // Respond to key events
-    window.KeyEventSignal().Connect( this, &BasicPbrController::OnKeyEvent );
+    window.KeyEventSignal().Connect(this, &BasicPbrController::OnKeyEvent);
 
     mDoubleTapTime = Timer::New(150);
-    mDoubleTapTime.TickSignal().Connect( this, &BasicPbrController::OnDoubleTapTime );
+    mDoubleTapTime.TickSignal().Connect(this, &BasicPbrController::OnDoubleTapTime);
   }
 
-
   bool OnDoubleTapTime()
   {
     mDoubleTap = false;
@@ -145,11 +142,11 @@ public:
   /**
    * This function will change the material Roughness, Metalness or the model orientation when touched
    */
-  bool OnTouch( Actor actor, const TouchEvent& touch )
+  bool OnTouch(Actor actor, const TouchEvent& touch)
   {
-    const PointState::Type state = touch.GetState( 0 );
+    const PointState::Type state = touch.GetState(0);
 
-    switch( state )
+    switch(state)
     {
       case PointState::DOWN:
       {
@@ -161,67 +158,69 @@ public:
         }
         mDoubleTapTime.Stop();
         mStartTouch = touch.GetScreenPosition(0);
-        mPointZ = mStartTouch;
+        mPointZ     = mStartTouch;
         mAnimation.Stop();
-        mLabel.SetProperty( Actor::Property::COLOR_ALPHA, 1.0f );
+        mLabel.SetProperty(Actor::Property::COLOR_ALPHA, 1.0f);
         break;
       }
       case PointState::MOTION:
       {
-        const Window window = mApplication.GetWindow();
-        const Size size = window.GetSize();
-        const float scaleX = size.width;
-        const float scaleY = size.height;
-        const Vector2 point = touch.GetScreenPosition(0);
-        bool process = false;
-        if( ( mStartTouch.x < ( scaleX * 0.3f ) ) && ( point.x < ( scaleX * 0.3f ) ) )
+        const Window  window  = mApplication.GetWindow();
+        const Size    size    = window.GetSize();
+        const float   scaleX  = size.width;
+        const float   scaleY  = size.height;
+        const Vector2 point   = touch.GetScreenPosition(0);
+        bool          process = false;
+        if((mStartTouch.x < (scaleX * 0.3f)) && (point.x < (scaleX * 0.3f)))
         {
-          mRoughness += ( mStartTouch.y - point.y ) / ( scaleY * 0.9f );
+          mRoughness += (mStartTouch.y - point.y) / (scaleY * 0.9f);
 
           //Clamp Roughness to 0.0 to 1.0
-          mRoughness = std::max( 0.f, std::min( 1.f, mRoughness ) );
+          mRoughness = std::max(0.f, std::min(1.f, mRoughness));
 
-          mShader.SetProperty( mShader.GetPropertyIndex( "uRoughness" ), mRoughness );
+          mShader.SetProperty(mShader.GetPropertyIndex("uRoughness"), mRoughness);
           std::ostringstream oss;
           oss.precision(2);
-          oss << " R:" << mRoughness<< "," << " M:" << mMetalness;
-          mLabel.SetProperty( TextLabel::Property::TEXT, oss.str() );
+          oss << " R:" << mRoughness << ","
+              << " M:" << mMetalness;
+          mLabel.SetProperty(TextLabel::Property::TEXT, oss.str());
           mStartTouch = point;
-          process = true;
+          process     = true;
         }
-        if( ( mStartTouch.x > ( scaleX * 0.7f ) ) && ( point.x > ( scaleX * 0.7f ) ) )
+        if((mStartTouch.x > (scaleX * 0.7f)) && (point.x > (scaleX * 0.7f)))
         {
-          mMetalness += ( mStartTouch.y - point.y ) / ( scaleY * 0.9f );
+          mMetalness += (mStartTouch.y - point.y) / (scaleY * 0.9f);
 
           //Clamp Metalness to 0.0 to 1.0
-          mMetalness = std::max( 0.f, std::min( 1.f, mMetalness ) );
+          mMetalness = std::max(0.f, std::min(1.f, mMetalness));
 
-          mShader.SetProperty( mShader.GetPropertyIndex( "uMetallic" ), mMetalness );
+          mShader.SetProperty(mShader.GetPropertyIndex("uMetallic"), mMetalness);
           std::ostringstream oss;
           oss.precision(2);
-          oss << " R:" << mRoughness<< "," << " M:" << mMetalness;
-          mLabel.SetProperty( TextLabel::Property::TEXT, oss.str() );
+          oss << " R:" << mRoughness << ","
+              << " M:" << mMetalness;
+          mLabel.SetProperty(TextLabel::Property::TEXT, oss.str());
           mStartTouch = point;
-          process = true;
+          process     = true;
         }
         //If the touch is not processed above, then change the model orientation
-        if( !process )
+        if(!process)
         {
-          process = true;
-          const float angle1 = ( ( mPointZ.y - point.y ) / scaleY );
-          const float angle2 = ( ( mPointZ.x - point.x ) / scaleX );
-          Actor actor1 = mModel[0].GetActor();
-          Actor actor2 = mModel[1].GetActor();
+          process            = true;
+          const float angle1 = ((mPointZ.y - point.y) / scaleY);
+          const float angle2 = ((mPointZ.x - point.x) / scaleX);
+          Actor       actor1 = mModel[0].GetActor();
+          Actor       actor2 = mModel[1].GetActor();
 
           Quaternion modelOrientation = mModelOrientation;
           modelOrientation.Conjugate();
-          const Quaternion pitchRot(Radian(Degree(angle1 * -200.0f)), modelOrientation.Rotate( Vector3::XAXIS ) );
-          const Quaternion yawRot(Radian(Degree(angle2 * -200.0f)), modelOrientation.Rotate( Vector3::YAXIS ) );
+          const Quaternion pitchRot(Radian(Degree(angle1 * -200.0f)), modelOrientation.Rotate(Vector3::XAXIS));
+          const Quaternion yawRot(Radian(Degree(angle2 * -200.0f)), modelOrientation.Rotate(Vector3::YAXIS));
 
-          mModelOrientation = mModelOrientation * yawRot * pitchRot ;
-          mSkybox.GetActor().SetProperty( Actor::Property::ORIENTATION, mModelOrientation );
-          actor1.SetProperty( Actor::Property::ORIENTATION, mModelOrientation );
-          actor2.SetProperty( Actor::Property::ORIENTATION, mModelOrientation );
+          mModelOrientation = mModelOrientation * yawRot * pitchRot;
+          mSkybox.GetActor().SetProperty(Actor::Property::ORIENTATION, mModelOrientation);
+          actor1.SetProperty(Actor::Property::ORIENTATION, mModelOrientation);
+          actor2.SetProperty(Actor::Property::ORIENTATION, mModelOrientation);
 
           mPointZ = point;
         }
@@ -231,7 +230,7 @@ public:
       {
         mDoubleTapTime.Start();
         mDoubleTap = true;
-        mAnimation.AnimateTo( Property( mLabel, Actor::Property::COLOR_ALPHA ), 0.0f, TimePeriod( 0.5f, 1.0f ) );
+        mAnimation.AnimateTo(Property(mLabel, Actor::Property::COLOR_ALPHA), 0.0f, TimePeriod(0.5f, 1.0f));
         mAnimation.Play();
         break;
       }
@@ -250,11 +249,11 @@ public:
    * Will use this to quit the application if Back or the Escape key is received
    * @param[in] event The key event information
    */
-  void OnKeyEvent( const KeyEvent& event )
+  void OnKeyEvent(const KeyEvent& event)
   {
-    if( event.GetState() == KeyEvent::DOWN )
+    if(event.GetState() == KeyEvent::DOWN)
     {
-      if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
+      if(IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK))
       {
         mApplication.Quit();
       }
@@ -266,58 +265,56 @@ public:
    */
   void InitActors()
   {
-    Window window = mApplication.GetWindow();
+    Window  window     = mApplication.GetWindow();
     Vector2 windowSize = window.GetSize();
 
-    mSkybox.Init( SKYBOX_SCALE );
-    mModel[0].Init( mShader, SPHERE_URL, Vector3::ZERO, SPHERE_SCALE );
-    mModel[1].Init( mShader, TEAPOT_URL, Vector3::ZERO, TEAPOT_SCALE );
+    mSkybox.Init(SKYBOX_SCALE);
+    mModel[0].Init(mShader, SPHERE_URL, Vector3::ZERO, SPHERE_SCALE);
+    mModel[1].Init(mShader, TEAPOT_URL, Vector3::ZERO, TEAPOT_SCALE);
 
     // Hide the model according with mTeapotView variable
     mModel[0].GetActor().SetProperty(Dali::Actor::Property::VISIBLE, !mTeapotView);
-    mModel[1].GetActor().SetProperty(Dali::Actor::Property::VISIBLE,  mTeapotView);
+    mModel[1].GetActor().SetProperty(Dali::Actor::Property::VISIBLE, mTeapotView);
 
     // Creating root and camera actor for rendertask for 3D Scene rendering
-    mUiRoot = Actor::New();
-    m3dRoot = Actor::New();
+    mUiRoot              = Actor::New();
+    m3dRoot              = Actor::New();
     CameraActor cameraUi = CameraActor::New(window.GetSize());
-    cameraUi.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
-    cameraUi.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
+    cameraUi.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    cameraUi.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
 
     RenderTask rendertask = window.GetRenderTaskList().CreateTask();
-    rendertask.SetCameraActor( cameraUi );
-    rendertask.SetSourceActor( mUiRoot );
+    rendertask.SetCameraActor(cameraUi);
+    rendertask.SetSourceActor(mUiRoot);
 
-    mUiRoot.SetProperty(Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
-    mUiRoot.SetProperty(Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
-    mUiRoot.SetProperty(Actor::Property::SIZE, Vector2(window.GetSize()) );
+    mUiRoot.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+    mUiRoot.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+    mUiRoot.SetProperty(Actor::Property::SIZE, Vector2(window.GetSize()));
 
-    m3dRoot.SetProperty(Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
-    m3dRoot.SetProperty(Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
+    m3dRoot.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    m3dRoot.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
 
     // Setting camera parameters for 3D Scene
-    mSkybox.GetActor().SetProperty( Actor::Property::POSITION, CAMERA_DEFAULT_POSITION );
+    mSkybox.GetActor().SetProperty(Actor::Property::POSITION, CAMERA_DEFAULT_POSITION);
     CameraActor camera3d = window.GetRenderTaskList().GetTask(0).GetCameraActor();
-    camera3d.SetInvertYAxis( true );
-    camera3d.SetProperty( Actor::Property::POSITION, CAMERA_DEFAULT_POSITION );
-    camera3d.SetNearClippingPlane( CAMERA_DEFAULT_NEAR );
-    camera3d.SetFarClippingPlane( CAMERA_DEFAULT_FAR );
-    camera3d.SetFieldOfView( Radian( Degree( CAMERA_DEFAULT_FOV ) ) );
+    camera3d.SetInvertYAxis(true);
+    camera3d.SetProperty(Actor::Property::POSITION, CAMERA_DEFAULT_POSITION);
+    camera3d.SetNearClippingPlane(CAMERA_DEFAULT_NEAR);
+    camera3d.SetFarClippingPlane(CAMERA_DEFAULT_FAR);
+    camera3d.SetFieldOfView(Radian(Degree(CAMERA_DEFAULT_FOV)));
 
-    window.Add( cameraUi );
-    window.Add( mUiRoot );
-    window.Add( m3dRoot );
+    window.Add(cameraUi);
+    window.Add(mUiRoot);
+    window.Add(m3dRoot);
 
-    m3dRoot.Add( mSkybox.GetActor() );
-    m3dRoot.Add( mModel[0].GetActor() );
-    m3dRoot.Add( mModel[1].GetActor() );
+    m3dRoot.Add(mSkybox.GetActor());
+    m3dRoot.Add(mModel[0].GetActor());
+    m3dRoot.Add(mModel[1].GetActor());
 
-
-    if( (windowSize.x > 360.0f) && (windowSize.y > 360.0f) )
+    if((windowSize.x > 360.0f) && (windowSize.y > 360.0f))
     {
-      mUiRoot.Add( mLabel );
+      mUiRoot.Add(mLabel);
     }
-
   }
 
   /**
@@ -325,16 +322,16 @@ public:
    */
   void CreateModelShader()
   {
-    const std::string mCurrentVShaderFile( VERTEX_SHADER_URL );
-    const std::string mCurrentFShaderFile( FRAGMENT_SHADER_URL );
+    const std::string mCurrentVShaderFile(VERTEX_SHADER_URL);
+    const std::string mCurrentFShaderFile(FRAGMENT_SHADER_URL);
 
-    mShader = LoadShaders( mCurrentVShaderFile, mCurrentFShaderFile );
+    mShader = LoadShaders(mCurrentVShaderFile, mCurrentFShaderFile);
 
     // Initialise shader uniforms
     // Level 8 because the environment texture has 6 levels plus 2 are missing (2x2 and 1x1)
-    mShader.RegisterProperty( "uMaxLOD", 8.0f );
-    mShader.RegisterProperty( "uRoughness", 1.0f );
-    mShader.RegisterProperty( "uMetallic" , 0.0f );
+    mShader.RegisterProperty("uMaxLOD", 8.0f);
+    mShader.RegisterProperty("uRoughness", 1.0f);
+    mShader.RegisterProperty("uMetallic", 0.0f);
   }
 
   /**
@@ -342,43 +339,43 @@ public:
    */
   void CreateTexture()
   {
-    PixelData albeldoPixelData = SyncImageLoader::Load( ALBEDO_METAL_TEXTURE_URL );
-    Texture textureAlbedoMetal = Texture::New( TextureType::TEXTURE_2D, albeldoPixelData.GetPixelFormat(), albeldoPixelData.GetWidth(), albeldoPixelData.GetHeight() );
-    textureAlbedoMetal.Upload( albeldoPixelData, 0, 0, 0, 0, albeldoPixelData.GetWidth(), albeldoPixelData.GetHeight() );
+    PixelData albeldoPixelData   = SyncImageLoader::Load(ALBEDO_METAL_TEXTURE_URL);
+    Texture   textureAlbedoMetal = Texture::New(TextureType::TEXTURE_2D, albeldoPixelData.GetPixelFormat(), albeldoPixelData.GetWidth(), albeldoPixelData.GetHeight());
+    textureAlbedoMetal.Upload(albeldoPixelData, 0, 0, 0, 0, albeldoPixelData.GetWidth(), albeldoPixelData.GetHeight());
 
-    PixelData normalPixelData = SyncImageLoader::Load( NORMAL_ROUGH_TEXTURE_URL );
-    Texture textureNormalRough = Texture::New( TextureType::TEXTURE_2D, normalPixelData.GetPixelFormat(), normalPixelData.GetWidth(), normalPixelData.GetHeight() );
-    textureNormalRough.Upload( normalPixelData, 0, 0, 0, 0, normalPixelData.GetWidth(), normalPixelData.GetHeight() );
+    PixelData normalPixelData    = SyncImageLoader::Load(NORMAL_ROUGH_TEXTURE_URL);
+    Texture   textureNormalRough = Texture::New(TextureType::TEXTURE_2D, normalPixelData.GetPixelFormat(), normalPixelData.GetWidth(), normalPixelData.GetHeight());
+    textureNormalRough.Upload(normalPixelData, 0, 0, 0, 0, normalPixelData.GetWidth(), normalPixelData.GetHeight());
 
     // This texture should have 6 faces and only one mipmap
     PbrDemo::CubeData diffuse;
-    PbrDemo::LoadCubeMapFromKtxFile( CUBEMAP_DIFFUSE_TEXTURE_URL, diffuse );
+    PbrDemo::LoadCubeMapFromKtxFile(CUBEMAP_DIFFUSE_TEXTURE_URL, diffuse);
 
-    Texture diffuseTexture = Texture::New( TextureType::TEXTURE_CUBE, diffuse.img[0][0].GetPixelFormat(), diffuse.img[0][0].GetWidth(), diffuse.img[0][0].GetHeight() );
-    for( unsigned int midmapLevel = 0; midmapLevel < diffuse.img[0].size(); ++midmapLevel )
+    Texture diffuseTexture = Texture::New(TextureType::TEXTURE_CUBE, diffuse.img[0][0].GetPixelFormat(), diffuse.img[0][0].GetWidth(), diffuse.img[0][0].GetHeight());
+    for(unsigned int midmapLevel = 0; midmapLevel < diffuse.img[0].size(); ++midmapLevel)
     {
-      for( unsigned int i = 0; i < diffuse.img.size(); ++i )
+      for(unsigned int i = 0; i < diffuse.img.size(); ++i)
       {
-        diffuseTexture.Upload( diffuse.img[i][midmapLevel], CubeMapLayer::POSITIVE_X + i, midmapLevel, 0, 0, diffuse.img[i][midmapLevel].GetWidth(), diffuse.img[i][midmapLevel].GetHeight() );
+        diffuseTexture.Upload(diffuse.img[i][midmapLevel], CubeMapLayer::POSITIVE_X + i, midmapLevel, 0, 0, diffuse.img[i][midmapLevel].GetWidth(), diffuse.img[i][midmapLevel].GetHeight());
       }
     }
 
     // This texture should have 6 faces and 6 mipmaps
     PbrDemo::CubeData specular;
-    PbrDemo::LoadCubeMapFromKtxFile( CUBEMAP_SPECULAR_TEXTURE_URL, specular);
+    PbrDemo::LoadCubeMapFromKtxFile(CUBEMAP_SPECULAR_TEXTURE_URL, specular);
 
-    Texture specularTexture = Texture::New( TextureType::TEXTURE_CUBE, specular.img[0][0].GetPixelFormat(), specular.img[0][0].GetWidth(), specular.img[0][0].GetHeight() );
-    for( unsigned int midmapLevel = 0; midmapLevel < specular.img[0].size(); ++midmapLevel )
+    Texture specularTexture = Texture::New(TextureType::TEXTURE_CUBE, specular.img[0][0].GetPixelFormat(), specular.img[0][0].GetWidth(), specular.img[0][0].GetHeight());
+    for(unsigned int midmapLevel = 0; midmapLevel < specular.img[0].size(); ++midmapLevel)
     {
-      for( unsigned int i = 0; i < specular.img.size(); ++i )
+      for(unsigned int i = 0; i < specular.img.size(); ++i)
       {
-        specularTexture.Upload( specular.img[i][midmapLevel], CubeMapLayer::POSITIVE_X + i, midmapLevel, 0, 0, specular.img[i][midmapLevel].GetWidth(), specular.img[i][midmapLevel].GetHeight() );
+        specularTexture.Upload(specular.img[i][midmapLevel], CubeMapLayer::POSITIVE_X + i, midmapLevel, 0, 0, specular.img[i][midmapLevel].GetWidth(), specular.img[i][midmapLevel].GetHeight());
       }
     }
 
-    mModel[0].InitTexture( textureAlbedoMetal, textureNormalRough, diffuseTexture, specularTexture );
-    mModel[1].InitTexture( textureAlbedoMetal, textureNormalRough, diffuseTexture, specularTexture );
-    mSkybox.InitTexture( specularTexture );
+    mModel[0].InitTexture(textureAlbedoMetal, textureNormalRough, diffuseTexture, specularTexture);
+    mModel[1].InitTexture(textureAlbedoMetal, textureNormalRough, diffuseTexture, specularTexture);
+    mSkybox.InitTexture(specularTexture);
   }
 
   /**
@@ -387,28 +384,28 @@ public:
   * @param[out] The contents of file
   * @return True if the source was read successfully
   */
-  bool LoadShaderCode( const std::string& fullpath, std::vector<char>& output )
+  bool LoadShaderCode(const std::string& fullpath, std::vector<char>& output)
   {
-    Dali::FileStream fileStream( fullpath, FileStream::READ | FileStream::BINARY );
-    FILE* file = fileStream.GetFile();
-    if( NULL == file )
+    Dali::FileStream fileStream(fullpath, FileStream::READ | FileStream::BINARY);
+    FILE*            file = fileStream.GetFile();
+    if(NULL == file)
     {
       return false;
     }
 
     bool retValue = false;
-    if( ! fseek( file, 0, SEEK_END ) )
+    if(!fseek(file, 0, SEEK_END))
     {
-      long int size = ftell( file );
+      long int size = ftell(file);
 
-      if( ( size != -1L ) &&
-        ( ! fseek( file, 0, SEEK_SET ) ) )
+      if((size != -1L) &&
+         (!fseek(file, 0, SEEK_SET)))
       {
-        output.resize( size + 1 );
-        std::fill( output.begin(), output.end(), 0 );
-        ssize_t result = fread( output.data(), size, 1, file );
+        output.resize(size + 1);
+        std::fill(output.begin(), output.end(), 0);
+        ssize_t result = fread(output.data(), size, 1, file);
 
-        retValue = ( result >= 0 );
+        retValue = (result >= 0);
       }
     }
 
@@ -421,16 +418,16 @@ public:
   * @param[in] shaderFragFileName is the filepath of Fragment shader
   * @return the Dali::Shader object
   */
-  Shader LoadShaders( const std::string& shaderVertexFileName, const std::string& shaderFragFileName )
+  Shader LoadShaders(const std::string& shaderVertexFileName, const std::string& shaderFragFileName)
   {
-    Shader shader;
+    Shader            shader;
     std::vector<char> bufV, bufF;
 
-    if( LoadShaderCode( shaderVertexFileName.c_str(), bufV ) )
+    if(LoadShaderCode(shaderVertexFileName.c_str(), bufV))
     {
-      if( LoadShaderCode( shaderFragFileName.c_str(), bufF ) )
+      if(LoadShaderCode(shaderFragFileName.c_str(), bufF))
       {
-        shader = Shader::New( bufV.data() , bufF.data() );
+        shader = Shader::New(bufV.data(), bufF.data());
       }
     }
     return shader;
@@ -438,31 +435,30 @@ public:
 
 private:
   Application& mApplication;
-  TextLabel mLabel;
-  Actor m3dRoot;
-  Actor mUiRoot;
-  Shader mShader;
-  Animation mAnimation;
-  Timer mDoubleTapTime;
+  TextLabel    mLabel;
+  Actor        m3dRoot;
+  Actor        mUiRoot;
+  Shader       mShader;
+  Animation    mAnimation;
+  Timer        mDoubleTapTime;
 
   ModelSkybox mSkybox;
-  ModelPbr mModel[2];
+  ModelPbr    mModel[2];
 
   Vector2 mPointZ;
   Vector2 mStartTouch;
 
   Quaternion mModelOrientation;
-  float mRoughness;
-  float mMetalness;
-  bool mDoubleTap;
-  bool mTeapotView;
-
+  float      mRoughness;
+  float      mMetalness;
+  bool       mDoubleTap;
+  bool       mTeapotView;
 };
 
-int DALI_EXPORT_API main( int argc, char **argv )
+int DALI_EXPORT_API main(int argc, char** argv)
 {
-  Application application = Application::New( &argc, &argv);
-  BasicPbrController test( application );
+  Application        application = Application::New(&argc, &argv);
+  BasicPbrController test(application);
   application.MainLoop();
   return 0;
 }