Merge changes I7b63ee17,I61bd1ed2 into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scene3d-view / gltf-loader.cpp
index 1132e95..55dfd8d 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.
 
 // CLASS HEADER
 #include <dali-toolkit/internal/controls/scene3d-view/gltf-loader.h>
-#include <dali-toolkit/internal/controls/scene3d-view/gltf-shader.h>
 
 // EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/devel-api/adaptor-framework/image-loading.h>
+#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
 #include <dali/devel-api/adaptor-framework/file-stream.h>
+#include <dali/devel-api/adaptor-framework/image-loading.h>
+#include <dali/integration-api/debug.h>
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
 namespace Internal
 {
-
 namespace Gltf
 {
-
 namespace
 {
-
 // Utility functions
-const TreeNode* Tidx( const TreeNode *node, uint32_t index )
+const TreeNode* Tidx(const TreeNode* node, uint32_t index)
 {
   uint32_t i = 0;
-  for( auto it = node->CBegin(), end = node->CEnd(); it != end; ++it, ++i )
+  for(auto it = node->CBegin(), end = node->CEnd(); it != end; ++it, ++i)
   {
-    if( i == index )
+    if(i == index)
     {
-      return &( ( *it ).second );
+      return &((*it).second);
     }
   }
   return NULL;
 }
 
-bool ReadBool( const TreeNode* node, bool& num )
+bool ReadBool(const TreeNode* node, bool& num)
 {
-  if( !node )
+  if(!node)
   {
     return false;
   }
   bool returnValue = false;
 
-  if( node->GetType() == TreeNode::BOOLEAN )
+  if(node->GetType() == TreeNode::BOOLEAN)
   {
-    num = node->GetBoolean();
+    num         = node->GetBoolean();
     returnValue = true;
   }
 
   return returnValue;
 }
 
-bool ReadInt( const TreeNode* node, int32_t& num )
+bool ReadInt(const TreeNode* node, int32_t& num)
 {
-  if( !node )
+  if(!node)
   {
     return false;
   }
   bool returnValue = false;
-  if( node->GetType() == TreeNode::INTEGER )
+  if(node->GetType() == TreeNode::INTEGER)
   {
-    num = node->GetInteger();
+    num         = node->GetInteger();
     returnValue = true;
   }
-  else  if( node->GetType() == TreeNode::FLOAT )
+  else if(node->GetType() == TreeNode::FLOAT)
   {
-    num = node->GetFloat();
+    num         = node->GetFloat();
     returnValue = true;
   }
 
   return returnValue;
 }
 
-bool ReadFloat( const TreeNode* node, float& num )
+bool ReadFloat(const TreeNode* node, float& num)
 {
-  if( !node )
+  if(!node)
   {
     return false;
   }
   bool returnValue = false;
 
-  if( node->GetType() == TreeNode::FLOAT )
+  if(node->GetType() == TreeNode::FLOAT)
   {
-    num = node->GetFloat();
+    num         = node->GetFloat();
     returnValue = true;
   }
-  else if( node->GetType() == TreeNode::INTEGER )
+  else if(node->GetType() == TreeNode::INTEGER)
   {
-    int32_t tempNum;
-    ReadInt( node, tempNum );
-    num = static_cast<float>( tempNum );
+    int32_t tempNum = 0;
+    ReadInt(node, tempNum);
+    num         = static_cast<float>(tempNum);
     returnValue = true;
   }
 
   return returnValue;
 }
 
-bool ReadVector( const TreeNode* node, float* num, uint32_t size )
+bool ReadVector(const TreeNode* node, float* num, uint32_t size)
 {
-  if( !node )
+  if(!node)
   {
     return false;
   }
   bool returnValue = false;
 
-  if( ( node->Size() >= size ) && ( node->GetType() == TreeNode::ARRAY ) )
+  if((node->Size() >= size) && (node->GetType() == TreeNode::ARRAY))
   {
     uint32_t offset = 0u;
-    for( auto it = node->CBegin(); offset < size; ++it, ++offset )
+    for(auto it = node->CBegin(); offset < size; ++it, ++offset)
     {
-      const TreeNode& coord = ( *it ).second;
-      if( !ReadFloat( &coord, *( num + offset ) ) )
+      const TreeNode& coord = (*it).second;
+      if(!ReadFloat(&coord, *(num + offset)))
       {
         return false;
       }
@@ -140,147 +135,145 @@ bool ReadVector( const TreeNode* node, float* num, uint32_t size )
   return returnValue;
 }
 
-bool ReadString( const TreeNode* node, std::string& strValue )
+bool ReadString(const TreeNode* node, std::string& strValue)
 {
-  if( !node )
+  if(!node)
   {
     return false;
   }
   bool returnValue = false;
-  if( node->GetType() == TreeNode::STRING )
+  if(node->GetType() == TreeNode::STRING)
   {
-    strValue = node->GetString();
+    strValue    = node->GetString();
     returnValue = true;
   }
   return returnValue;
 }
 
-template <typename T>
-float IntToFloat( T element, bool normalize )
+template<typename T>
+float IntToFloat(T element, bool normalize)
 {
-  if( !normalize )
+  if(!normalize)
   {
-    return static_cast<float>( element );
+    return static_cast<float>(element);
   }
 
-  if( std::is_same<T, int8_t>::value )
+  if(std::is_same<T, int8_t>::value)
   {
-    return std::max( static_cast<float>( element ) / 127.0, -1.0 );
+    return std::max(static_cast<float>(element) / 127.0, -1.0);
   }
-  if( std::is_same<T, uint8_t>::value )
+  if(std::is_same<T, uint8_t>::value)
   {
-    return static_cast<float>( element ) / 255.0;
+    return static_cast<float>(element) / 255.0;
   }
-  if( std::is_same<T, int16_t>::value )
+  if(std::is_same<T, int16_t>::value)
   {
-    return std::max( static_cast<float>( element ) / 32767.0, -1.0 );
+    return std::max(static_cast<float>(element) / 32767.0, -1.0);
   }
-  if( std::is_same<T, uint16_t>::value )
+  if(std::is_same<T, uint16_t>::value)
   {
-    return static_cast<float>( element ) / 65535.0;
+    return static_cast<float>(element) / 65535.0;
   }
   return -1.0;
 }
 
-template <typename Td, typename Ts>
-void FitBuffer( Dali::Vector<Td>& bufferDestination, Dali::Vector<Ts>& bufferSource, int32_t bufferSize, int32_t elementNumOfByteStride, bool normalize )
+template<typename Td, typename Ts>
+void FitBuffer(Dali::Vector<Td>& bufferDestination, Dali::Vector<Ts>& bufferSource, int32_t bufferSize, int32_t elementNumOfByteStride, bool normalize)
 {
-  bufferDestination.Resize( bufferSize );
+  bufferDestination.Resize(bufferSize);
   int32_t count = bufferSource.Size() / elementNumOfByteStride;
-  for( int32_t i = 0; i<count; ++i )
+  for(int32_t i = 0; i < count; ++i)
   {
-    bufferDestination[i] = static_cast<Td>( bufferSource[i * elementNumOfByteStride] );
+    bufferDestination[i] = static_cast<Td>(bufferSource[i * elementNumOfByteStride]);
   }
 }
 
-template <typename T>
-void FitBuffer( Dali::Vector<Vector2>& bufferDestination, Dali::Vector<T>& bufferSource, int32_t bufferSize, int32_t elementNumOfByteStride, bool normalize )
+template<typename T>
+void FitBuffer(Dali::Vector<Vector2>& bufferDestination, Dali::Vector<T>& bufferSource, int32_t bufferSize, int32_t elementNumOfByteStride, bool normalize)
 {
-  bufferDestination.Resize( bufferSize );
+  bufferDestination.Resize(bufferSize);
   int32_t count = bufferSource.Size() / elementNumOfByteStride;
-  for( int32_t i = 0; i<count; ++i )
+  for(int32_t i = 0; i < count; ++i)
   {
-    bufferDestination[i].x = IntToFloat( bufferSource[i * elementNumOfByteStride], normalize );
-    bufferDestination[i].y = IntToFloat( bufferSource[i * elementNumOfByteStride + 1], normalize );
+    bufferDestination[i].x = IntToFloat(bufferSource[i * elementNumOfByteStride], normalize);
+    bufferDestination[i].y = IntToFloat(bufferSource[i * elementNumOfByteStride + 1], normalize);
   }
 }
 
-template <typename T>
-void FitBuffer( Dali::Vector<Vector3>& bufferDestination, Dali::Vector<T>& bufferSource, int32_t bufferSize, int32_t elementNumOfByteStride, bool normalize )
+template<typename T>
+void FitBuffer(Dali::Vector<Vector3>& bufferDestination, Dali::Vector<T>& bufferSource, int32_t bufferSize, int32_t elementNumOfByteStride, bool normalize)
 {
-  bufferDestination.Resize( bufferSize );
+  bufferDestination.Resize(bufferSize);
   int32_t count = bufferSource.Size() / elementNumOfByteStride;
-  for( int32_t i = 0; i<count; ++i )
+  for(int32_t i = 0; i < count; ++i)
   {
-    bufferDestination[i].x = IntToFloat( bufferSource[i * elementNumOfByteStride], normalize );
-    bufferDestination[i].y = IntToFloat( bufferSource[i * elementNumOfByteStride + 1], normalize );
-    bufferDestination[i].z = IntToFloat( bufferSource[i * elementNumOfByteStride + 2], normalize );
+    bufferDestination[i].x = IntToFloat(bufferSource[i * elementNumOfByteStride], normalize);
+    bufferDestination[i].y = IntToFloat(bufferSource[i * elementNumOfByteStride + 1], normalize);
+    bufferDestination[i].z = IntToFloat(bufferSource[i * elementNumOfByteStride + 2], normalize);
   }
 }
 
-template <typename T>
-void FitBuffer( Dali::Vector<Vector4>& bufferDestination, Dali::Vector<T>& bufferSource, int32_t bufferSize, int32_t elementNumOfByteStride, bool normalize )
+template<typename T>
+void FitBuffer(Dali::Vector<Vector4>& bufferDestination, Dali::Vector<T>& bufferSource, int32_t bufferSize, int32_t elementNumOfByteStride, bool normalize)
 {
-  bufferDestination.Resize( bufferSize );
+  bufferDestination.Resize(bufferSize);
   int32_t count = bufferSource.Size() / elementNumOfByteStride;
-  for( int32_t i = 0; i<count; ++i )
+  for(int32_t i = 0; i < count; ++i)
   {
-    bufferDestination[i].x = IntToFloat( bufferSource[i * elementNumOfByteStride], normalize );
-    bufferDestination[i].y = IntToFloat( bufferSource[i * elementNumOfByteStride + 1], normalize );
-    bufferDestination[i].z = IntToFloat( bufferSource[i * elementNumOfByteStride + 2], normalize );
-    bufferDestination[i].w = IntToFloat( bufferSource[i * elementNumOfByteStride + 3], normalize );
+    bufferDestination[i].x = IntToFloat(bufferSource[i * elementNumOfByteStride], normalize);
+    bufferDestination[i].y = IntToFloat(bufferSource[i * elementNumOfByteStride + 1], normalize);
+    bufferDestination[i].z = IntToFloat(bufferSource[i * elementNumOfByteStride + 2], normalize);
+    bufferDestination[i].w = IntToFloat(bufferSource[i * elementNumOfByteStride + 3], normalize);
   }
 }
 
 // Template functions
-template <typename T>
-bool ReadBinFile( Vector<T> &dataBuffer, std::string url, int32_t offset, int32_t count )
+template<typename T>
+bool ReadBinFile(Vector<T>& dataBuffer, std::string url, int32_t offset, int32_t count)
 {
-  Dali::FileStream fileStream( url, FileStream::READ | FileStream::BINARY );
-  FILE* fp = fileStream.GetFile();
-  if( !fp )
-  {
-    return false;
-  }
-
-  dataBuffer.Resize( count );
-  ssize_t result = -1;
-  if( !fseek( fp, offset, SEEK_SET ) )
+  size_t readCount = 0;
+  Dali::FileStream fileStream(url, FileStream::READ | FileStream::BINARY);
+  FILE*            fp = fileStream.GetFile();
+  if(fp)
   {
-    result = fread( &dataBuffer[0], sizeof( T ), count, fp );
+    dataBuffer.Resize(count);
+    if(!fseek(fp, offset, SEEK_SET))
+    {
+      readCount = fread(&dataBuffer[0], sizeof(T), count, fp);
+      dataBuffer.Resize(readCount);
+    }
   }
 
-  return ( result >= 0 );
+  return (readCount > 0);
 }
 
-template <typename T>
-void LoadDataFromAccessor( int32_t accessorIdx, Dali::Vector<T>& bufferData, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray )
+template<typename T>
+void LoadDataFromAccessor(int32_t accessorIdx, Dali::Vector<T>& bufferData, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray)
 {
-  AccessorInfo accessor = accessorArray[accessorIdx];
+  AccessorInfo   accessor   = accessorArray[accessorIdx];
   BufferViewInfo bufferView = bufferViewArray[accessor.bufferView];
-  std::string load_uri = bufferArray[bufferView.buffer].uri;
+  std::string    load_uri   = bufferArray[bufferView.buffer].uri;
 
   // In the glTF 2.0 Specification, 5121 is UNSIGNED BYTE, 5123 is UNSIGNED SHORT
-  int32_t elementByteSize = ( accessor.componentType <= 5121 ) ? 1 :
-    ( ( accessor.componentType <= 5123 ) ? 2 : 4 );
-  int32_t elementNum = 1;
-  if( accessor.type == "VEC2" )
+  int32_t elementByteSize = (accessor.componentType <= 5121) ? 1 : ((accessor.componentType <= 5123) ? 2 : 4);
+  int32_t elementNum      = 1;
+  if(accessor.type == "VEC2")
   {
     elementNum = 2;
   }
-  else if( accessor.type == "VEC3" )
+  else if(accessor.type == "VEC3")
   {
     elementNum = 3;
   }
-  else if( accessor.type == "VEC4" || accessor.type == "MAT2" )
+  else if(accessor.type == "VEC4" || accessor.type == "MAT2")
   {
     elementNum = 4;
   }
-  else if( accessor.type == "MAT3" )
+  else if(accessor.type == "MAT3")
   {
     elementNum = 9;
   }
-  else if( accessor.type == "MAT4" )
+  else if(accessor.type == "MAT4")
   {
     elementNum = 16;
   }
@@ -289,7 +282,7 @@ void LoadDataFromAccessor( int32_t accessorIdx, Dali::Vector<T>& bufferData, std
     elementNum = 1;
   }
   int32_t elementNumOfByteStride = elementNum;
-  if( bufferView.byteStride > 0 )
+  if(bufferView.byteStride > 0)
   {
     elementNumOfByteStride = bufferView.byteStride / elementByteSize;
   }
@@ -304,65 +297,77 @@ void LoadDataFromAccessor( int32_t accessorIdx, Dali::Vector<T>& bufferData, std
    * 5125 : UNSIGNED_INT
    * 5126 : FLOAT
    */
-  if( accessor.componentType == 5120 )
+  if(accessor.componentType == 5120)
   {
     Dali::Vector<int8_t> inputBufferData;
-    ReadBinFile<int8_t>( inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count );
-    FitBuffer( bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized );
+    if(ReadBinFile<int8_t>(inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count))
+    {
+      FitBuffer(bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized);
+    }
   }
-  else if( accessor.componentType == 5121 )
+  else if(accessor.componentType == 5121)
   {
     Dali::Vector<uint8_t> inputBufferData;
-    ReadBinFile<uint8_t>( inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count );
-    FitBuffer( bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized );
+    if(ReadBinFile<uint8_t>(inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count))
+    {
+      FitBuffer(bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized);
+    }
   }
-  else if( accessor.componentType == 5122 )
+  else if(accessor.componentType == 5122)
   {
     Dali::Vector<int16_t> inputBufferData;
-    ReadBinFile<int16_t>( inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count );
-    FitBuffer( bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized );
+    if(ReadBinFile<int16_t>(inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count))
+    {
+      FitBuffer(bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized);
+    }
   }
-  else if( accessor.componentType == 5123 )
+  else if(accessor.componentType == 5123)
   {
     Dali::Vector<uint16_t> inputBufferData;
-    ReadBinFile<uint16_t>( inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count );
-    FitBuffer( bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized );
+    if(ReadBinFile<uint16_t>(inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count))
+    {
+      FitBuffer(bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized);
+    }
   }
-  else if( accessor.componentType == 5125 )
+  else if(accessor.componentType == 5125)
   {
     Dali::Vector<uint32_t> inputBufferData;
-    ReadBinFile<uint32_t>( inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count );
-    FitBuffer( bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized );
+    if(ReadBinFile<uint32_t>(inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count))
+    {
+      FitBuffer(bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized);
+    }
   }
-  else if( accessor.componentType == 5126 )
+  else if(accessor.componentType == 5126)
   {
     Dali::Vector<float> inputBufferData;
-    ReadBinFile<float>( inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count );
-    FitBuffer( bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized );
+    if(ReadBinFile<float>(inputBufferData, path + load_uri, bufferView.byteOffset + accessor.byteOffset, elementNumOfByteStride * accessor.count))
+    {
+      FitBuffer(bufferData, inputBufferData, accessor.count, elementNumOfByteStride, accessor.normalized);
+    }
   }
 }
 
-void SetMeshInfoAndCanonize( MeshInfo& meshInfo, Dali::Vector<Dali::Vector3> &vertexBufferData )
+void SetMeshInfoAndCanonize(MeshInfo& meshInfo, Dali::Vector<Dali::Vector3>& vertexBufferData)
 {
-  Vector3 pointMin( std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max() );
-  Vector3 pointMax( std::numeric_limits<float>::min(), std::numeric_limits<float>::min(), std::numeric_limits<float>::min() );
-  for( auto&& data : vertexBufferData )
+  Vector3 pointMin(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
+  Vector3 pointMax(std::numeric_limits<float>::min(), std::numeric_limits<float>::min(), std::numeric_limits<float>::min());
+  for(auto&& data : vertexBufferData)
   {
-    pointMin.x = std::min( data.x, pointMin.x );
-    pointMin.y = std::min( data.y, pointMin.y );
-    pointMin.z = std::min( data.z, pointMin.z );
+    pointMin.x = std::min(data.x, pointMin.x);
+    pointMin.y = std::min(data.y, pointMin.y);
+    pointMin.z = std::min(data.z, pointMin.z);
 
-    pointMax.x = std::max( data.x, pointMax.x );
-    pointMax.y = std::max( data.y, pointMax.y );
-    pointMax.z = std::max( data.z, pointMax.z );
+    pointMax.x = std::max(data.x, pointMax.x);
+    pointMax.y = std::max(data.y, pointMax.y);
+    pointMax.z = std::max(data.z, pointMax.z);
   }
-  meshInfo.size = pointMax - pointMin;
-  meshInfo.pivot.x = ( -pointMin.x ) / ( pointMax.x - pointMin.x );
-  meshInfo.pivot.y = ( -pointMin.y ) / ( pointMax.y - pointMin.y );
-  meshInfo.pivot.z = ( -pointMin.z ) / ( pointMax.z - pointMin.z );
+  meshInfo.size    = pointMax - pointMin;
+  meshInfo.pivot.x = (-pointMin.x) / (pointMax.x - pointMin.x);
+  meshInfo.pivot.y = (-pointMin.y) / (pointMax.y - pointMin.y);
+  meshInfo.pivot.z = (-pointMin.z) / (pointMax.z - pointMin.z);
 
   Vector3 center = meshInfo.size * 0.5 + pointMin;
-  for( auto&& data : vertexBufferData )
+  for(auto&& data : vertexBufferData)
   {
     data   = data - center;
     data.x = data.x / meshInfo.size.x;
@@ -371,278 +376,278 @@ void SetMeshInfoAndCanonize( MeshInfo& meshInfo, Dali::Vector<Dali::Vector3> &ve
   }
 }
 
-template <typename T>
-PropertyBuffer CreatePropertyBuffer( Vector<T> bufferData, std::string map, int32_t type )
+template<typename T>
+VertexBuffer CreateVertexBuffer(Vector<T> bufferData, std::string map, int32_t type)
 {
   Property::Map positionMap;
   positionMap[map] = type;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( positionMap );
-  propertyBuffer.SetData( bufferData.Begin(), bufferData.Count() );
-  return propertyBuffer;
+  VertexBuffer vertexBuffer = VertexBuffer::New(positionMap);
+  vertexBuffer.SetData(bufferData.Begin(), bufferData.Count());
+  return vertexBuffer;
 }
 
-void SetVertexBufferData( MeshInfo& meshInfo, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray, int32_t accessorIdx, std::string map, int32_t type )
+void SetVertexBufferData(MeshInfo& meshInfo, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray, int32_t accessorIdx, std::string map, int32_t type)
 {
-  if( accessorIdx >= 0 )
+  if(accessorIdx >= 0)
   {
     Dali::Vector<Vector3> bufferData;
-    LoadDataFromAccessor( accessorIdx, bufferData, path, accessorArray, bufferViewArray, bufferArray );
-    SetMeshInfoAndCanonize( meshInfo, bufferData );
+    LoadDataFromAccessor(accessorIdx, bufferData, path, accessorArray, bufferViewArray, bufferArray);
+    SetMeshInfoAndCanonize(meshInfo, bufferData);
 
-    PropertyBuffer propertyBuffer = CreatePropertyBuffer<Vector3>( bufferData, map, type );
-    meshInfo.geometry.AddVertexBuffer( propertyBuffer );
+    VertexBuffer vertexBuffer = CreateVertexBuffer<Vector3>(bufferData, map, type);
+    meshInfo.geometry.AddVertexBuffer(vertexBuffer);
   }
 }
 
-template <typename T>
-void SetAttributeBufferData( MeshInfo& meshInfo, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray, int32_t accessorIdx, std::string map, int32_t type )
+template<typename T>
+void SetAttributeBufferData(MeshInfo& meshInfo, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray, int32_t accessorIdx, std::string map, int32_t type)
 {
-  if( accessorIdx >= 0 )
+  if(accessorIdx >= 0)
   {
     Dali::Vector<T> bufferData;
-    LoadDataFromAccessor( accessorIdx, bufferData, path, accessorArray, bufferViewArray, bufferArray );
+    LoadDataFromAccessor(accessorIdx, bufferData, path, accessorArray, bufferViewArray, bufferArray);
 
-    PropertyBuffer propertyBuffer = CreatePropertyBuffer<T>( bufferData, map, type );
-    meshInfo.geometry.AddVertexBuffer( propertyBuffer );
+    VertexBuffer vertexBuffer = CreateVertexBuffer<T>(bufferData, map, type);
+    meshInfo.geometry.AddVertexBuffer(vertexBuffer);
   }
 }
 
-void SetIndexBuffersData( MeshInfo& meshInfo, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray, int32_t indexIdx )
+void SetIndexBuffersData(MeshInfo& meshInfo, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray, int32_t indexIdx)
 {
   Dali::Vector<uint16_t> indexBufferData;
-  LoadDataFromAccessor( indexIdx, indexBufferData, path, accessorArray, bufferViewArray, bufferArray );
-  meshInfo.geometry.SetIndexBuffer( &indexBufferData[0], indexBufferData.Size() );
+  LoadDataFromAccessor(indexIdx, indexBufferData, path, accessorArray, bufferViewArray, bufferArray);
+  meshInfo.geometry.SetIndexBuffer(&indexBufferData[0], indexBufferData.Size());
 }
 
 template<typename T>
-float LoadKeyFrames( const AnimationSamplerInfo& currentSampler, const Property::Index propIndex, KeyFrames& keyframes, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray )
+float LoadKeyFrames(const AnimationSamplerInfo& currentSampler, const Property::Index propIndex, KeyFrames& keyframes, std::string path, std::vector<AccessorInfo>& accessorArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<BufferInfo>& bufferArray)
 {
   Dali::Vector<float> inputBufferData;
-  Dali::Vector<T> outputBufferData;
+  Dali::Vector<T>     outputBufferData;
 
-  LoadDataFromAccessor<float>( currentSampler.input, inputBufferData, path, accessorArray, bufferViewArray, bufferArray );
-  LoadDataFromAccessor<T>( currentSampler.output, outputBufferData, path, accessorArray, bufferViewArray, bufferArray );
+  LoadDataFromAccessor<float>(currentSampler.input, inputBufferData, path, accessorArray, bufferViewArray, bufferArray);
+  LoadDataFromAccessor<T>(currentSampler.output, outputBufferData, path, accessorArray, bufferViewArray, bufferArray);
 
-  uint32_t keyframeNum = inputBufferData.Size();
-  float lengthAnimation = inputBufferData[inputBufferData.Size() - 1];
-  for( uint32_t i = 0; i < keyframeNum; i++ )
+  uint32_t keyframeNum     = inputBufferData.Size();
+  float    lengthAnimation = inputBufferData[inputBufferData.Size() - 1];
+  for(uint32_t i = 0; i < keyframeNum; i++)
   {
-    if( propIndex == Dali::Actor::Property::ORIENTATION )
+    if(propIndex == Dali::Actor::Property::ORIENTATION)
     {
-      Vector4 vectorOrientation( outputBufferData[i] );
-      float vW = vectorOrientation.w;
-      vW = ( vW < 0.0f ) ? std::max( vW, -1.0f ) : std::min( vW, 1.0f );
+      Vector4 vectorOrientation(outputBufferData[i]);
+      float   vW          = vectorOrientation.w;
+      vW                  = (vW < 0.0f) ? std::max(vW, -1.0f) : std::min(vW, 1.0f);
       vectorOrientation.w = vW;
-      keyframes.Add( inputBufferData[i] / lengthAnimation, Quaternion( Vector4( vectorOrientation ) ) );
+      keyframes.Add(inputBufferData[i] / lengthAnimation, Quaternion(Vector4(vectorOrientation)));
     }
-    else if( propIndex == Dali::Actor::Property::POSITION )
+    else if(propIndex == Dali::Actor::Property::POSITION)
     {
-      keyframes.Add( inputBufferData[i] / lengthAnimation, Vector3( outputBufferData[i] ) );
+      keyframes.Add(inputBufferData[i] / lengthAnimation, Vector3(outputBufferData[i]));
     }
-    else if( propIndex == Dali::Actor::Property::SCALE )
+    else if(propIndex == Dali::Actor::Property::SCALE)
     {
-      keyframes.Add( inputBufferData[i] / lengthAnimation, Vector3( outputBufferData[i] ) );
+      keyframes.Add(inputBufferData[i] / lengthAnimation, Vector3(outputBufferData[i]));
     }
   }
   return lengthAnimation;
 }
 
-bool LoadBuffer( const TreeNode& buffer, std::vector<BufferInfo>& bufferArray )
+bool LoadBuffer(const TreeNode& buffer, std::vector<BufferInfo>& bufferArray)
 {
   BufferInfo bufferInfo;
 
-  const TreeNode* uriNode = buffer.GetChild( "uri" );
-  if( uriNode )
+  const TreeNode* uriNode = buffer.GetChild("uri");
+  if(uriNode)
   {
-    ReadString( uriNode, bufferInfo.uri );
+    ReadString(uriNode, bufferInfo.uri);
   }
 
-  const TreeNode* byteLengthNode = buffer.GetChild( "byteLength" );
-  if( byteLengthNode )
+  const TreeNode* byteLengthNode = buffer.GetChild("byteLength");
+  if(byteLengthNode)
   {
-    ReadInt( byteLengthNode, bufferInfo.byteLength );
-    if( bufferInfo.byteLength < 0 )
+    ReadInt(byteLengthNode, bufferInfo.byteLength);
+    if(bufferInfo.byteLength < 0)
     {
       return false;
     }
   }
 
-  const TreeNode* nameNode = buffer.GetChild( "name" );
-  if( nameNode )
+  const TreeNode* nameNode = buffer.GetChild("name");
+  if(nameNode)
   {
-    ReadString( nameNode, bufferInfo.name );
+    ReadString(nameNode, bufferInfo.name);
   }
 
-  bufferArray.push_back( bufferInfo );
+  bufferArray.push_back(bufferInfo);
 
   return true;
 }
 
-bool LoadBufferView( const TreeNode& buffer, std::vector<BufferViewInfo>& bufferViewArray )
+bool LoadBufferView(const TreeNode& buffer, std::vector<BufferViewInfo>& bufferViewArray)
 {
   BufferViewInfo bufferViewInfo;
 
-  const TreeNode* bufferNode = buffer.GetChild( "buffer" );
-  if( bufferNode )
+  const TreeNode* bufferNode = buffer.GetChild("buffer");
+  if(bufferNode)
   {
-    ReadInt( bufferNode, bufferViewInfo.buffer );
-    if( bufferViewInfo.buffer < 0 )
+    ReadInt(bufferNode, bufferViewInfo.buffer);
+    if(bufferViewInfo.buffer < 0)
     {
       return false;
     }
   }
 
-  const TreeNode* byteOffsetNode = buffer.GetChild( "byteOffset" );
-  if( byteOffsetNode )
+  const TreeNode* byteOffsetNode = buffer.GetChild("byteOffset");
+  if(byteOffsetNode)
   {
-    ReadInt( byteOffsetNode, bufferViewInfo.byteOffset );
+    ReadInt(byteOffsetNode, bufferViewInfo.byteOffset);
   }
 
-  const TreeNode* byteLengthNode = buffer.GetChild( "byteLength" );
-  if( byteLengthNode )
+  const TreeNode* byteLengthNode = buffer.GetChild("byteLength");
+  if(byteLengthNode)
   {
-    ReadInt( byteLengthNode, bufferViewInfo.byteLength );
-    if( bufferViewInfo.byteLength < 0 )
+    ReadInt(byteLengthNode, bufferViewInfo.byteLength);
+    if(bufferViewInfo.byteLength < 0)
     {
       return false;
     }
   }
 
-  const TreeNode* byteStrideNode = buffer.GetChild( "byteStride" );
-  if( byteStrideNode )
+  const TreeNode* byteStrideNode = buffer.GetChild("byteStride");
+  if(byteStrideNode)
   {
-    ReadInt( byteStrideNode, bufferViewInfo.byteStride );
+    ReadInt(byteStrideNode, bufferViewInfo.byteStride);
   }
 
-  const TreeNode* targetNode = buffer.GetChild( "target" );
-  if( targetNode )
+  const TreeNode* targetNode = buffer.GetChild("target");
+  if(targetNode)
   {
-    ReadInt( targetNode, bufferViewInfo.target );
+    ReadInt(targetNode, bufferViewInfo.target);
   }
 
-  const TreeNode* nameNode = buffer.GetChild( "name" );
-  if( nameNode )
+  const TreeNode* nameNode = buffer.GetChild("name");
+  if(nameNode)
   {
-    ReadString( nameNode, bufferViewInfo.name );
+    ReadString(nameNode, bufferViewInfo.name);
   }
 
-  bufferViewArray.push_back( bufferViewInfo );
+  bufferViewArray.push_back(bufferViewInfo);
 
   return true;
 }
 
-bool LoadAccessor( const TreeNode& buffer, std::vector<AccessorInfo>& accessorArray )
+bool LoadAccessor(const TreeNode& buffer, std::vector<AccessorInfo>& accessorArray)
 {
   AccessorInfo accessorInfo;
 
-  const TreeNode* bufferViewNode = buffer.GetChild( "bufferView" );
-  if( bufferViewNode )
+  const TreeNode* bufferViewNode = buffer.GetChild("bufferView");
+  if(bufferViewNode)
   {
-    ReadInt( bufferViewNode, accessorInfo.bufferView );
+    ReadInt(bufferViewNode, accessorInfo.bufferView);
   }
 
-  const TreeNode* byteOffsetNode = buffer.GetChild( "byteOffset" );
-  if( byteOffsetNode )
+  const TreeNode* byteOffsetNode = buffer.GetChild("byteOffset");
+  if(byteOffsetNode)
   {
-    ReadInt( byteOffsetNode, accessorInfo.byteOffset );
+    ReadInt(byteOffsetNode, accessorInfo.byteOffset);
   }
 
-  const TreeNode* componentTypeNode = buffer.GetChild( "componentType" );
-  if( componentTypeNode )
+  const TreeNode* componentTypeNode = buffer.GetChild("componentType");
+  if(componentTypeNode)
   {
-    ReadInt( componentTypeNode, accessorInfo.componentType );
-    if( accessorInfo.componentType < 0 )
+    ReadInt(componentTypeNode, accessorInfo.componentType);
+    if(accessorInfo.componentType < 0)
     {
       return false;
     }
   }
 
-  const TreeNode* normalizedNode = buffer.GetChild( "normalized" );
-  if( normalizedNode )
+  const TreeNode* normalizedNode = buffer.GetChild("normalized");
+  if(normalizedNode)
   {
-    ReadBool( normalizedNode, accessorInfo.normalized );
+    ReadBool(normalizedNode, accessorInfo.normalized);
   }
 
-  const TreeNode* countNode = buffer.GetChild( "count" );
-  if( countNode )
+  const TreeNode* countNode = buffer.GetChild("count");
+  if(countNode)
   {
-    ReadInt( countNode, accessorInfo.count );
-    if( accessorInfo.count < 0 )
+    ReadInt(countNode, accessorInfo.count);
+    if(accessorInfo.count < 0)
     {
       return false;
     }
   }
 
-  const TreeNode* typeNode = buffer.GetChild( "type" );
-  if( typeNode )
+  const TreeNode* typeNode = buffer.GetChild("type");
+  if(typeNode)
   {
-    ReadString( typeNode, accessorInfo.type );
-    if( accessorInfo.type == "" )
+    ReadString(typeNode, accessorInfo.type);
+    if(accessorInfo.type == "")
     {
       return false;
     }
   }
 
-  const TreeNode* maxNode = buffer.GetChild( "max" );
-  if( maxNode )
+  const TreeNode* maxNode = buffer.GetChild("max");
+  if(maxNode)
   {
-    ReadInt( maxNode, accessorInfo.max );
+    ReadInt(maxNode, accessorInfo.max);
   }
 
-  const TreeNode* minNode = buffer.GetChild( "min" );
-  if( minNode )
+  const TreeNode* minNode = buffer.GetChild("min");
+  if(minNode)
   {
-    ReadInt( minNode, accessorInfo.min );
+    ReadInt(minNode, accessorInfo.min);
   }
 
-  const TreeNode* nameNode = buffer.GetChild( "name" );
-  if( nameNode )
+  const TreeNode* nameNode = buffer.GetChild("name");
+  if(nameNode)
   {
-    ReadString( nameNode, accessorInfo.name );
+    ReadString(nameNode, accessorInfo.name);
   }
 
-  accessorArray.push_back( accessorInfo );
+  accessorArray.push_back(accessorInfo);
 
   return true;
 }
 
-bool LoadBinaryData( const TreeNode& root, std::vector<BufferInfo>& bufferArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<AccessorInfo>& accessorArray )
+bool LoadBinaryData(const TreeNode& root, std::vector<BufferInfo>& bufferArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<AccessorInfo>& accessorArray)
 {
-  const TreeNode* buffersNode = root.GetChild( "buffers" );
-  if( !buffersNode )
+  const TreeNode* buffersNode = root.GetChild("buffers");
+  if(!buffersNode)
   {
     return false;
   }
-  for( auto bufferIter = buffersNode->CBegin(), end = buffersNode->CEnd(); bufferIter != end; ++bufferIter )
+  for(auto bufferIter = buffersNode->CBegin(), end = buffersNode->CEnd(); bufferIter != end; ++bufferIter)
   {
-    LoadBuffer( ( *bufferIter ).second, bufferArray );
+    LoadBuffer((*bufferIter).second, bufferArray);
   }
 
-  const TreeNode* bufferViewsNode = root.GetChild( "bufferViews" );
-  if( !bufferViewsNode )
+  const TreeNode* bufferViewsNode = root.GetChild("bufferViews");
+  if(!bufferViewsNode)
   {
     return false;
   }
-  for( auto bufferViewIter = bufferViewsNode->CBegin(), end = bufferViewsNode->CEnd(); bufferViewIter != end; ++bufferViewIter )
+  for(auto bufferViewIter = bufferViewsNode->CBegin(), end = bufferViewsNode->CEnd(); bufferViewIter != end; ++bufferViewIter)
   {
-    LoadBufferView( ( *bufferViewIter ).second, bufferViewArray );
+    LoadBufferView((*bufferViewIter).second, bufferViewArray);
   }
 
-  const TreeNode* accessorsNode = root.GetChild( "accessors" );
-  if( !accessorsNode )
+  const TreeNode* accessorsNode = root.GetChild("accessors");
+  if(!accessorsNode)
   {
     return false;
   }
-  for( auto accesorIter = accessorsNode->CBegin(), end = accessorsNode->CEnd(); accesorIter != end; ++accesorIter )
+  for(auto accesorIter = accessorsNode->CBegin(), end = accessorsNode->CEnd(); accesorIter != end; ++accesorIter)
   {
-    LoadAccessor( ( *accesorIter ).second, accessorArray );
+    LoadAccessor((*accesorIter).second, accessorArray);
   }
 
   return true;
 }
 
-FilterMode::Type GetFilterMode( uint32_t mode )
+FilterMode::Type GetFilterMode(uint32_t mode)
 {
   FilterMode::Type retValue = FilterMode::DEFAULT;
   /**
@@ -655,7 +660,7 @@ FilterMode::Type GetFilterMode( uint32_t mode )
    * 9986 : NEAREST_MIPMAP_LINEAR
    * 9987 : LINEAR_MIPMAP_LINEAR
    */
-  switch( mode )
+  switch(mode)
   {
     case 9728:
     {
@@ -692,7 +697,7 @@ FilterMode::Type GetFilterMode( uint32_t mode )
   return retValue;
 }
 
-WrapMode::Type GetWrapMode( uint32_t mode )
+WrapMode::Type GetWrapMode(uint32_t mode)
 {
   WrapMode::Type retValue = WrapMode::REPEAT;
   /**
@@ -702,7 +707,7 @@ WrapMode::Type GetWrapMode( uint32_t mode )
    * 33648 : MIRRORED_REPEAT
    * 10497 : REPEAT
    */
-  switch( mode )
+  switch(mode)
   {
     case 33071:
     {
@@ -724,17 +729,17 @@ WrapMode::Type GetWrapMode( uint32_t mode )
   return retValue;
 }
 
-Texture LoadTexture( const char* imageUrl, bool generateMipmaps )
+Texture LoadTexture(const char* imageUrl, bool generateMipmaps)
 {
-  Texture texture;
-  Devel::PixelBuffer pixelBuffer = LoadImageFromFile( imageUrl );
-  if( pixelBuffer )
+  Texture            texture;
+  Devel::PixelBuffer pixelBuffer = LoadImageFromFile(imageUrl);
+  if(pixelBuffer)
   {
-    texture = Texture::New( TextureType::TEXTURE_2D, pixelBuffer.GetPixelFormat(), pixelBuffer.GetWidth(), pixelBuffer.GetHeight() );
-    PixelData pixelData = Devel::PixelBuffer::Convert( pixelBuffer );
-    texture.Upload( pixelData );
+    texture             = Texture::New(TextureType::TEXTURE_2D, pixelBuffer.GetPixelFormat(), pixelBuffer.GetWidth(), pixelBuffer.GetHeight());
+    PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer);
+    texture.Upload(pixelData);
 
-    if( generateMipmaps )
+    if(generateMipmaps)
     {
       texture.GenerateMipmaps();
     }
@@ -743,159 +748,159 @@ Texture LoadTexture( const char* imageUrl, bool generateMipmaps )
   return texture;
 }
 
-Sampler LoadSampler( const TreeNode& samplerNode )
+Sampler LoadSampler(const TreeNode& samplerNode)
 {
   Sampler sampler = Sampler::New();
 
-  FilterMode::Type minFilter = FilterMode::DEFAULT;
-  FilterMode::Type magFilter = FilterMode::DEFAULT;
-  const TreeNode* magFilterNode = samplerNode.GetChild( "magFilter" );
-  if( magFilterNode )
+  FilterMode::Type minFilter     = FilterMode::DEFAULT;
+  FilterMode::Type magFilter     = FilterMode::DEFAULT;
+  const TreeNode*  magFilterNode = samplerNode.GetChild("magFilter");
+  if(magFilterNode)
   {
     int32_t magFilter_integer = 0;
-    ReadInt( magFilterNode, magFilter_integer );
-    magFilter = GetFilterMode( magFilter_integer );
+    ReadInt(magFilterNode, magFilter_integer);
+    magFilter = GetFilterMode(magFilter_integer);
   }
 
-  const TreeNode* minFilterNode = samplerNode.GetChild( "minFilter" );
-  if( minFilterNode )
+  const TreeNode* minFilterNode = samplerNode.GetChild("minFilter");
+  if(minFilterNode)
   {
     int32_t minFilter_integer = 0;
-    ReadInt( minFilterNode, minFilter_integer );
-    minFilter = GetFilterMode( minFilter_integer );
+    ReadInt(minFilterNode, minFilter_integer);
+    minFilter = GetFilterMode(minFilter_integer);
   }
 
-  WrapMode::Type wrapR = WrapMode::REPEAT;
-  WrapMode::Type wrapS = WrapMode::REPEAT;
-  WrapMode::Type wrapT = WrapMode::REPEAT;
-  const TreeNode* wrapNode = samplerNode.GetChild( "wrapS" );
-  if( wrapNode )
+  WrapMode::Type  wrapR    = WrapMode::REPEAT;
+  WrapMode::Type  wrapS    = WrapMode::REPEAT;
+  WrapMode::Type  wrapT    = WrapMode::REPEAT;
+  const TreeNode* wrapNode = samplerNode.GetChild("wrapS");
+  if(wrapNode)
   {
-    wrapS = GetWrapMode( wrapNode->GetInteger() );
+    wrapS = GetWrapMode(wrapNode->GetInteger());
   }
 
-  wrapNode = samplerNode.GetChild( "wrapT" );
-  if( wrapNode )
+  wrapNode = samplerNode.GetChild("wrapT");
+  if(wrapNode)
   {
-    wrapT = GetWrapMode( wrapNode->GetInteger() );
+    wrapT = GetWrapMode(wrapNode->GetInteger());
   }
 
-  sampler.SetFilterMode( minFilter, magFilter );
-  sampler.SetWrapMode( wrapR, wrapS, wrapT );
+  sampler.SetFilterMode(minFilter, magFilter);
+  sampler.SetWrapMode(wrapR, wrapS, wrapT);
 
   return sampler;
 }
 
-bool LoadTextureArray( const TreeNode& root, std::string path, std::vector<Texture>& sourceArray, std::vector<Sampler>& samplerArray, std::vector<TextureInfo>& textureArray )
+bool LoadTextureArray(const TreeNode& root, std::string path, std::vector<Texture>& sourceArray, std::vector<Sampler>& samplerArray, std::vector<TextureInfo>& textureArray)
 {
-  const TreeNode* imagesNode = root.GetChild( "images" );
-  if( imagesNode )
+  const TreeNode* imagesNode = root.GetChild("images");
+  if(imagesNode)
   {
-    for( auto imageIter = imagesNode->CBegin(), end = imagesNode->CEnd(); imageIter != end; ++imageIter )
+    for(auto imageIter = imagesNode->CBegin(), end = imagesNode->CEnd(); imageIter != end; ++imageIter)
     {
-      std::string imageUrl;
-      const TreeNode* uriNode = ( &( ( *imageIter ).second ) )->GetChild( "uri" );
-      if( uriNode )
+      std::string     imageUrl;
+      const TreeNode* uriNode = (&((*imageIter).second))->GetChild("uri");
+      if(uriNode)
       {
         std::string uri;
-        ReadString( uriNode, uri );
+        ReadString(uriNode, uri);
         imageUrl = path + uri;
       }
 
-      sourceArray.push_back( LoadTexture( imageUrl.c_str(), true ) );
+      sourceArray.push_back(LoadTexture(imageUrl.c_str(), true));
     }
   }
 
-  const TreeNode* samplersNode = root.GetChild( "samplers" );
-  if( samplersNode )
+  const TreeNode* samplersNode = root.GetChild("samplers");
+  if(samplersNode)
   {
-    for( auto samplerIter = samplersNode->CBegin(), end = samplersNode->CEnd(); samplerIter != end; ++samplerIter )
+    for(auto samplerIter = samplersNode->CBegin(), end = samplersNode->CEnd(); samplerIter != end; ++samplerIter)
     {
-      samplerArray.push_back( LoadSampler( ( ( *samplerIter ).second ) ) );
+      samplerArray.push_back(LoadSampler(((*samplerIter).second)));
     }
   }
 
-  const TreeNode* texturesNode = root.GetChild( "textures" );
-  if( texturesNode )
+  const TreeNode* texturesNode = root.GetChild("textures");
+  if(texturesNode)
   {
-    for( auto textureIter = texturesNode->CBegin(), end = texturesNode->CEnd(); textureIter != end; ++textureIter )
+    for(auto textureIter = texturesNode->CBegin(), end = texturesNode->CEnd(); textureIter != end; ++textureIter)
     {
-      const TreeNode* TextureNode = &( ( *textureIter ).second );
+      const TreeNode* TextureNode = &((*textureIter).second);
 
-      TextureInfo texture;
-      const TreeNode* sourceNode = TextureNode->GetChild( "source" );
-      if( sourceNode )
+      TextureInfo     texture;
+      const TreeNode* sourceNode = TextureNode->GetChild("source");
+      if(sourceNode)
       {
-        ReadInt( sourceNode, texture.sourceIdx );
+        ReadInt(sourceNode, texture.sourceIdx);
       }
 
-      const TreeNode* samplerNode = TextureNode->GetChild( "sampler" );
-      if( samplerNode )
+      const TreeNode* samplerNode = TextureNode->GetChild("sampler");
+      if(samplerNode)
       {
-        ReadInt( samplerNode, texture.samplerIdx );
+        ReadInt(samplerNode, texture.samplerIdx);
       }
 
-      textureArray.push_back( texture );
+      textureArray.push_back(texture);
     }
   }
   return true;
 }
 
-bool LoadPbrMetallicRoughness( const TreeNode& material, MaterialInfo& materialInfo )
+bool LoadPbrMetallicRoughness(const TreeNode& material, MaterialInfo& materialInfo)
 {
-  float floatVec[4];
-  const TreeNode* pbrMetallicRoughnessNode = material.GetChild( "pbrMetallicRoughness" );
-  if( !pbrMetallicRoughnessNode )
+  float           floatVec[4];
+  const TreeNode* pbrMetallicRoughnessNode = material.GetChild("pbrMetallicRoughness");
+  if(!pbrMetallicRoughnessNode)
   {
     return true;
   }
 
   const TreeNode* tempNode;
-  tempNode = pbrMetallicRoughnessNode->GetChild( "metallicFactor" );
-  if( tempNode )
+  tempNode = pbrMetallicRoughnessNode->GetChild("metallicFactor");
+  if(tempNode)
   {
-    ReadFloat( tempNode, materialInfo.metallicFactor );
+    ReadFloat(tempNode, materialInfo.metallicFactor);
   }
 
-  tempNode = pbrMetallicRoughnessNode->GetChild( "roughnessFactor" );
-  if( tempNode )
+  tempNode = pbrMetallicRoughnessNode->GetChild("roughnessFactor");
+  if(tempNode)
   {
-    ReadFloat( tempNode, materialInfo.roughnessFactor );
+    ReadFloat(tempNode, materialInfo.roughnessFactor);
   }
 
-  tempNode = pbrMetallicRoughnessNode->GetChild( "baseColorFactor" );
-  if( tempNode && ReadVector( tempNode, floatVec, 4 ) )
+  tempNode = pbrMetallicRoughnessNode->GetChild("baseColorFactor");
+  if(tempNode && ReadVector(tempNode, floatVec, 4))
   {
-    materialInfo.baseColorFactor = Vector4( floatVec[0], floatVec[1], floatVec[2], floatVec[3] );
+    materialInfo.baseColorFactor = Vector4(floatVec[0], floatVec[1], floatVec[2], floatVec[3]);
   }
 
-  const TreeNode* baseColorTextureNode = pbrMetallicRoughnessNode->GetChild( "baseColorTexture" );
-  if( baseColorTextureNode )
+  const TreeNode* baseColorTextureNode = pbrMetallicRoughnessNode->GetChild("baseColorTexture");
+  if(baseColorTextureNode)
   {
-    tempNode = baseColorTextureNode->GetChild( "index" );
-    if( tempNode )
+    tempNode = baseColorTextureNode->GetChild("index");
+    if(tempNode)
     {
       materialInfo.baseColorTexture.index = tempNode->GetInteger();
     }
 
-    tempNode = baseColorTextureNode->GetChild( "texCoord" );
-    if( tempNode )
+    tempNode = baseColorTextureNode->GetChild("texCoord");
+    if(tempNode)
     {
       materialInfo.baseColorTexture.texCoord = tempNode->GetInteger();
     }
   }
 
-  const TreeNode* metallicRoughnessTextureNode = pbrMetallicRoughnessNode->GetChild( "metallicRoughnessTexture" );
-  if( metallicRoughnessTextureNode )
+  const TreeNode* metallicRoughnessTextureNode = pbrMetallicRoughnessNode->GetChild("metallicRoughnessTexture");
+  if(metallicRoughnessTextureNode)
   {
-    tempNode = metallicRoughnessTextureNode->GetChild( "index" );
-    if( tempNode )
+    tempNode = metallicRoughnessTextureNode->GetChild("index");
+    if(tempNode)
     {
       materialInfo.metallicRoughnessTexture.index = tempNode->GetInteger();
     }
 
-    tempNode = metallicRoughnessTextureNode->GetChild( "texCoord" );
-    if( tempNode )
+    tempNode = metallicRoughnessTextureNode->GetChild("texCoord");
+    if(tempNode)
     {
       materialInfo.metallicRoughnessTexture.texCoord = tempNode->GetInteger();
     }
@@ -904,287 +909,286 @@ bool LoadPbrMetallicRoughness( const TreeNode& material, MaterialInfo& materialI
   return true;
 }
 
-bool LoadMaterialSetArray( const TreeNode& root, std::vector<MaterialInfo>& materialArray )
+bool LoadMaterialSetArray(const TreeNode& root, std::vector<MaterialInfo>& materialArray)
 {
-  const TreeNode* materialsNode = root.GetChild( "materials" );
-  if( !materialsNode )
+  const TreeNode* materialsNode = root.GetChild("materials");
+  if(!materialsNode)
   {
     return false;
   }
 
-  for( auto materialIter = materialsNode->CBegin(), end = materialsNode->CEnd(); materialIter != end; ++materialIter )
+  for(auto materialIter = materialsNode->CBegin(), end = materialsNode->CEnd(); materialIter != end; ++materialIter)
   {
     MaterialInfo materialInfo;
-    LoadPbrMetallicRoughness( ( ( *materialIter ).second ), materialInfo );
+    LoadPbrMetallicRoughness(((*materialIter).second), materialInfo);
 
-    const TreeNode* materialNode = &( ( *materialIter ).second );
-    const TreeNode* tempNode = materialNode->GetChild( "name" );
-    if( tempNode )
+    const TreeNode* materialNode = &((*materialIter).second);
+    const TreeNode* tempNode     = materialNode->GetChild("name");
+    if(tempNode)
     {
-      ReadString( tempNode, materialInfo.name );
+      ReadString(tempNode, materialInfo.name);
     }
 
     materialInfo.alphaMode = "OPAQUE";
-    tempNode = materialNode->GetChild( "alphaMode" );
-    if( tempNode )
+    tempNode               = materialNode->GetChild("alphaMode");
+    if(tempNode)
     {
-      ReadString( tempNode, materialInfo.alphaMode );
+      ReadString(tempNode, materialInfo.alphaMode);
     }
 
     materialInfo.alphaCutoff = 1.0;
-    tempNode = materialNode->GetChild( "alphaCutoff" );
-    if( tempNode )
+    tempNode                 = materialNode->GetChild("alphaCutoff");
+    if(tempNode)
     {
-      ReadFloat( tempNode, materialInfo.alphaCutoff );
+      ReadFloat(tempNode, materialInfo.alphaCutoff);
     }
 
     materialInfo.doubleSided = false;
-    tempNode = materialNode->GetChild( "doubleSided" );
-    if( tempNode )
+    tempNode                 = materialNode->GetChild("doubleSided");
+    if(tempNode)
     {
-      ReadBool( tempNode, materialInfo.doubleSided );
+      ReadBool(tempNode, materialInfo.doubleSided);
     }
 
     float floatVec[3];
-    tempNode = materialNode->GetChild( "emissiveFactor" );
-    if( tempNode && ReadVector( tempNode, floatVec, 3 ) )
+    tempNode = materialNode->GetChild("emissiveFactor");
+    if(tempNode && ReadVector(tempNode, floatVec, 3))
     {
-      materialInfo.emissiveFactor = Vector3( floatVec[0], floatVec[1], floatVec[2] );
+      materialInfo.emissiveFactor = Vector3(floatVec[0], floatVec[1], floatVec[2]);
     }
 
-    const TreeNode* texture = materialNode->GetChild( "normalTexture" );
-    if( texture )
+    const TreeNode* texture = materialNode->GetChild("normalTexture");
+    if(texture)
     {
-      tempNode = texture->GetChild( "index" );
-      if( tempNode )
+      tempNode = texture->GetChild("index");
+      if(tempNode)
       {
         materialInfo.normalTexture.index = tempNode->GetInteger();
       }
 
-      tempNode = texture->GetChild( "texCoord" );
-      if( tempNode )
+      tempNode = texture->GetChild("texCoord");
+      if(tempNode)
       {
         materialInfo.normalTexture.texCoord = tempNode->GetInteger();
       }
 
       materialInfo.normalTexture.value = 1.0;
-      tempNode = texture->GetChild( "scale" );
-      if( tempNode )
+      tempNode                         = texture->GetChild("scale");
+      if(tempNode)
       {
-        ReadFloat( tempNode, materialInfo.normalTexture.value );
+        ReadFloat(tempNode, materialInfo.normalTexture.value);
       }
     }
 
-    texture = materialNode->GetChild( "occlusionTexture" );
-    if( texture )
+    texture = materialNode->GetChild("occlusionTexture");
+    if(texture)
     {
-      tempNode = texture->GetChild( "index" );
-      if( tempNode )
+      tempNode = texture->GetChild("index");
+      if(tempNode)
       {
         materialInfo.occlusionTexture.index = tempNode->GetInteger();
       }
 
-      tempNode = texture->GetChild( "texCoord" );
-      if( tempNode )
+      tempNode = texture->GetChild("texCoord");
+      if(tempNode)
       {
         materialInfo.occlusionTexture.texCoord = tempNode->GetInteger();
       }
 
-
-      tempNode = texture->GetChild( "strength" );
-      if( tempNode )
+      tempNode = texture->GetChild("strength");
+      if(tempNode)
       {
-        ReadFloat( tempNode, materialInfo.occlusionTexture.value );
+        ReadFloat(tempNode, materialInfo.occlusionTexture.value);
       }
     }
 
-    texture = materialNode->GetChild( "emissiveTexture" );
-    if( texture )
+    texture = materialNode->GetChild("emissiveTexture");
+    if(texture)
     {
-      tempNode = texture->GetChild( "index" );
-      if( tempNode )
+      tempNode = texture->GetChild("index");
+      if(tempNode)
       {
         materialInfo.emissiveTexture.index = tempNode->GetInteger();
       }
 
-      tempNode = texture->GetChild( "texCoord" );
-      if( tempNode )
+      tempNode = texture->GetChild("texCoord");
+      if(tempNode)
       {
         materialInfo.emissiveTexture.texCoord = tempNode->GetInteger();
       }
     }
-    materialArray.push_back( materialInfo );
+    materialArray.push_back(materialInfo);
   }
   return true;
 }
 
-bool LoadAttribute( const TreeNode* primitive, MeshInfo& meshInfo )
+bool LoadAttribute(const TreeNode* primitive, MeshInfo& meshInfo)
 {
-  const TreeNode* attrbuteNode = primitive->GetChild( "attributes" );
-  if( !attrbuteNode )
+  const TreeNode* attrbuteNode = primitive->GetChild("attributes");
+  if(!attrbuteNode)
   {
     return false;
   }
 
   const TreeNode* tempNode;
-  tempNode = attrbuteNode->GetChild( "POSITION" );
-  if( tempNode )
+  tempNode = attrbuteNode->GetChild("POSITION");
+  if(tempNode)
   {
     meshInfo.attribute.POSITION = tempNode->GetInteger();
   }
 
-  tempNode = attrbuteNode->GetChild( "NORMAL" );
-  if( tempNode )
+  tempNode = attrbuteNode->GetChild("NORMAL");
+  if(tempNode)
   {
     meshInfo.attribute.NORMAL = tempNode->GetInteger();
   }
 
-  tempNode = attrbuteNode->GetChild( "TANGENT" );
-  if( tempNode )
+  tempNode = attrbuteNode->GetChild("TANGENT");
+  if(tempNode)
   {
     meshInfo.attribute.TANGENT = tempNode->GetInteger();
   }
 
   uint32_t index = 0;
   meshInfo.attribute.TEXCOORD.clear();
-  tempNode = attrbuteNode->GetChild( "TEXCOORD_" + std::to_string( index ) );
-  while( tempNode )
+  tempNode = attrbuteNode->GetChild("TEXCOORD_" + std::to_string(index));
+  while(tempNode)
   {
     uint32_t value = tempNode->GetInteger();
-    meshInfo.attribute.TEXCOORD.push_back( value );
-    tempNode = attrbuteNode->GetChild( "TEXCOORD_" + std::to_string( ++index ) );
+    meshInfo.attribute.TEXCOORD.push_back(value);
+    tempNode = attrbuteNode->GetChild("TEXCOORD_" + std::to_string(++index));
   }
 
   index = 0;
   meshInfo.attribute.COLOR.clear();
-  tempNode = attrbuteNode->GetChild( "COLOR_" + std::to_string( index ) );
-  while( tempNode )
+  tempNode = attrbuteNode->GetChild("COLOR_" + std::to_string(index));
+  while(tempNode)
   {
     uint32_t value = tempNode->GetInteger();
-    meshInfo.attribute.COLOR.push_back( value );
-    tempNode = attrbuteNode->GetChild( "COLOR" + std::to_string( ++index ) );
+    meshInfo.attribute.COLOR.push_back(value);
+    tempNode = attrbuteNode->GetChild("COLOR" + std::to_string(++index));
   }
 
   return true;
 }
 
-bool LoadPrimitive( const TreeNode& mesh, MeshInfo& meshInfo )
+bool LoadPrimitive(const TreeNode& mesh, MeshInfo& meshInfo)
 {
-  const TreeNode* primitivesNode = mesh.GetChild( "primitives" );
-  if( !primitivesNode )
+  const TreeNode* primitivesNode = mesh.GetChild("primitives");
+  if(!primitivesNode)
   {
     return false;
   }
 
-  for( auto primitiveIter = primitivesNode->CBegin(), end = primitivesNode->CEnd(); primitiveIter != end; ++primitiveIter )
+  for(auto primitiveIter = primitivesNode->CBegin(), end = primitivesNode->CEnd(); primitiveIter != end; ++primitiveIter)
   {
-    const TreeNode* primitiveNode = ( &( *primitiveIter ).second );
+    const TreeNode* primitiveNode = (&(*primitiveIter).second);
     const TreeNode* tempNode;
 
-    tempNode = primitiveNode->GetChild( "indices" );
-    if( tempNode )
+    tempNode = primitiveNode->GetChild("indices");
+    if(tempNode)
     {
       meshInfo.indicesIdx = tempNode->GetInteger();
     }
 
-    tempNode = primitiveNode->GetChild( "material" );
-    if( tempNode )
+    tempNode = primitiveNode->GetChild("material");
+    if(tempNode)
     {
       meshInfo.materialsIdx = tempNode->GetInteger();
     }
 
-    tempNode = primitiveNode->GetChild( "mode" );
-    if( tempNode )
+    tempNode = primitiveNode->GetChild("mode");
+    if(tempNode)
     {
       meshInfo.mode = tempNode->GetInteger();
     }
 
-    LoadAttribute( primitiveNode, meshInfo );
+    LoadAttribute(primitiveNode, meshInfo);
   }
 
   return true;
 }
 
-bool SetGeometry( MeshInfo& meshInfo, std::string path, std::vector<BufferInfo>& bufferArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<AccessorInfo>& accessorArray )
+bool SetGeometry(MeshInfo& meshInfo, std::string path, std::vector<BufferInfo>& bufferArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<AccessorInfo>& accessorArray)
 {
   int32_t indicesIdx = meshInfo.indicesIdx;
 
-  if( meshInfo.mode != 0 )
+  if(meshInfo.mode != 0)
   {
-    meshInfo.geometry.SetType( ( Dali::Geometry::Type )meshInfo.mode );
+    meshInfo.geometry.SetType((Dali::Geometry::Type)meshInfo.mode);
   }
 
-  if( indicesIdx >= 0 )
+  if(indicesIdx >= 0)
   {
-    SetIndexBuffersData( meshInfo, path, accessorArray, bufferViewArray, bufferArray, indicesIdx );
+    SetIndexBuffersData(meshInfo, path, accessorArray, bufferViewArray, bufferArray, indicesIdx);
   }
 
-  SetVertexBufferData( meshInfo, path, accessorArray, bufferViewArray, bufferArray, meshInfo.attribute.POSITION, "aPosition", Property::VECTOR3 );
-  SetAttributeBufferData<Vector3>( meshInfo, path, accessorArray, bufferViewArray, bufferArray, meshInfo.attribute.NORMAL, "aNormal", Property::VECTOR3 );
-  SetAttributeBufferData<Vector4>( meshInfo, path, accessorArray, bufferViewArray, bufferArray, meshInfo.attribute.TANGENT, "aTangent", Property::VECTOR4 );
+  SetVertexBufferData(meshInfo, path, accessorArray, bufferViewArray, bufferArray, meshInfo.attribute.POSITION, "aPosition", Property::VECTOR3);
+  SetAttributeBufferData<Vector3>(meshInfo, path, accessorArray, bufferViewArray, bufferArray, meshInfo.attribute.NORMAL, "aNormal", Property::VECTOR3);
+  SetAttributeBufferData<Vector4>(meshInfo, path, accessorArray, bufferViewArray, bufferArray, meshInfo.attribute.TANGENT, "aTangent", Property::VECTOR4);
 
-  for( uint32_t i = 0; i < meshInfo.attribute.TEXCOORD.size(); ++i )
+  for(uint32_t i = 0; i < meshInfo.attribute.TEXCOORD.size(); ++i)
   {
-    int32_t accessorIdx = meshInfo.attribute.TEXCOORD[i];
+    int32_t            accessorIdx = meshInfo.attribute.TEXCOORD[i];
     std::ostringstream texCoordString;
     texCoordString << "aTexCoord" << i;
-    SetAttributeBufferData<Vector2>( meshInfo, path, accessorArray, bufferViewArray, bufferArray, accessorIdx, texCoordString.str(), Property::VECTOR2 );
+    SetAttributeBufferData<Vector2>(meshInfo, path, accessorArray, bufferViewArray, bufferArray, accessorIdx, texCoordString.str(), Property::VECTOR2);
   }
 
-  for( auto&& accessorIdx : meshInfo.attribute.COLOR )
+  for(auto&& accessorIdx : meshInfo.attribute.COLOR)
   {
-    if( accessorIdx < 0 )
+    if(accessorIdx < 0)
     {
       break;
     }
 
-    if( accessorArray[accessorIdx].type == "VEC3" )
+    if(accessorArray[accessorIdx].type == "VEC3")
     {
       Dali::Vector<Vector3> inputBufferData;
-      LoadDataFromAccessor( accessorIdx, inputBufferData, path, accessorArray, bufferViewArray, bufferArray );
+      LoadDataFromAccessor(accessorIdx, inputBufferData, path, accessorArray, bufferViewArray, bufferArray);
 
       Dali::Vector<Vector4> bufferData;
-      bufferData.Resize( inputBufferData.Size() );
-      for( uint32_t i = 0; i<inputBufferData.Size(); ++i )
+      bufferData.Resize(inputBufferData.Size());
+      for(uint32_t i = 0; i < inputBufferData.Size(); ++i)
       {
         bufferData[i].x = inputBufferData[i].x;
         bufferData[i].y = inputBufferData[i].y;
         bufferData[i].z = inputBufferData[i].z;
         bufferData[i].w = 1.0;
       }
-      PropertyBuffer propertyBuffer = CreatePropertyBuffer<Vector4>( bufferData, "aVertexColor", Property::VECTOR4 );
-      meshInfo.geometry.AddVertexBuffer( propertyBuffer );
+      VertexBuffer vertexBuffer = CreateVertexBuffer<Vector4>(bufferData, "aVertexColor", Property::VECTOR4);
+      meshInfo.geometry.AddVertexBuffer(vertexBuffer);
     }
-    else if( accessorArray[accessorIdx].type == "VEC4" )
+    else if(accessorArray[accessorIdx].type == "VEC4")
     {
-      SetAttributeBufferData<Vector4>( meshInfo, path, accessorArray, bufferViewArray, bufferArray, accessorIdx, "aVertexColor", Property::VECTOR4 );
+      SetAttributeBufferData<Vector4>(meshInfo, path, accessorArray, bufferViewArray, bufferArray, accessorIdx, "aVertexColor", Property::VECTOR4);
     }
   }
   return true;
 }
 
-bool LoadMeshArray( const TreeNode& root, std::string path, std::vector<MeshInfo>& meshArray, std::vector<BufferInfo>& bufferArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<AccessorInfo>& accessorArray )
+bool LoadMeshArray(const TreeNode& root, std::string path, std::vector<MeshInfo>& meshArray, std::vector<BufferInfo>& bufferArray, std::vector<BufferViewInfo>& bufferViewArray, std::vector<AccessorInfo>& accessorArray)
 {
-  const TreeNode* meshesNode = root.GetChild( "meshes" );
-  if( !meshesNode )
+  const TreeNode* meshesNode = root.GetChild("meshes");
+  if(!meshesNode)
   {
     return false;
   }
 
-  for( auto meshIter = meshesNode->CBegin(), end = meshesNode->CEnd(); meshIter != end; ++meshIter )
+  for(auto meshIter = meshesNode->CBegin(), end = meshesNode->CEnd(); meshIter != end; ++meshIter)
   {
-    MeshInfo meshInfo;
-    const TreeNode* nameNode = ( &( *meshIter ).second )->GetChild( "name" );
-    if( nameNode )
+    MeshInfo        meshInfo;
+    const TreeNode* nameNode = (&(*meshIter).second)->GetChild("name");
+    if(nameNode)
     {
-      ReadString( nameNode, meshInfo.name );
+      ReadString(nameNode, meshInfo.name);
     }
     meshInfo.geometry = Geometry::New();
 
     //Need to add weights for Morph targets.
-    LoadPrimitive( ( *meshIter ).second, meshInfo );
-    SetGeometry( meshInfo, path, bufferArray, bufferViewArray, accessorArray );
-    meshArray.push_back( meshInfo );
+    LoadPrimitive((*meshIter).second, meshInfo);
+    SetGeometry(meshInfo, path, bufferArray, bufferViewArray, accessorArray);
+    meshArray.push_back(meshInfo);
   }
 
   return true;
@@ -1193,8 +1197,8 @@ bool LoadMeshArray( const TreeNode& root, std::string path, std::vector<MeshInfo
 } // namespace
 
 Loader::Loader()
-  : mNodes( NULL ),
-  mRoot( NULL )
+: mNodes(NULL),
+  mRoot(NULL)
 {
 }
 
@@ -1202,364 +1206,362 @@ Loader::~Loader()
 {
 }
 
-bool Loader::LoadScene( const std::string& filePath, Internal::Scene3dView& scene3dView )
+bool Loader::LoadScene(const std::string& filePath, Internal::Scene3dView& scene3dView)
 {
   // Extracting directory path from full path to load resources.
-  if( std::string::npos != filePath.rfind('/') )
+  if(std::string::npos != filePath.rfind('/'))
   {
-    mPath = filePath.substr( 0, filePath.rfind('/') ) + "/";
+    mPath = filePath.substr(0, filePath.rfind('/')) + "/";
   }
 
-  if( !ParseGltf( filePath ) )
+  if(!ParseGltf(filePath))
   {
-    DALI_LOG_ERROR( "Fail to parse json file\n" );
+    DALI_LOG_ERROR("Fail to parse json file\n");
     return false;
   }
 
   mRoot = mParser.GetRoot();
-  if( mRoot &&
-      LoadAssets() &&
-      CreateScene( scene3dView ) )
+  if(mRoot &&
+     LoadAssets() &&
+     CreateScene(scene3dView))
   {
     return true;
   }
   return false;
 }
 
-bool Loader::ParseGltf( const std::string& filePath )
+bool Loader::ParseGltf(const std::string& filePath)
 {
-  std::streampos bufferSize = 0;
+  std::streampos     bufferSize = 0;
   Dali::Vector<char> buffer;
-  std::string fileBuffer;
-  if( !Dali::FileLoader::ReadFile( filePath, bufferSize, buffer, FileLoader::FileType::BINARY ) )
+  std::string        fileBuffer;
+  if(!Dali::FileLoader::ReadFile(filePath, bufferSize, buffer, FileLoader::FileType::BINARY))
   {
     return false;
   }
 
-  fileBuffer.assign( &buffer[0], bufferSize );
+  fileBuffer.assign(&buffer[0], bufferSize);
   mParser = Dali::Toolkit::JsonParser::New();
-  return mParser.Parse( fileBuffer );
+  return mParser.Parse(fileBuffer);
 }
 
 bool Loader::LoadAssets()
 {
-  if( LoadBinaryData( *mRoot, mBufferArray, mBufferViewArray, mAccessorArray ) &&
-      LoadTextureArray( *mRoot, mPath, mSourceArray, mSamplerArray, mTextureArray ) &&
-      LoadMaterialSetArray( *mRoot, mMaterialArray ) &&
-      LoadMeshArray( *mRoot, mPath, mMeshArray, mBufferArray, mBufferViewArray, mAccessorArray )
-    )
+  if(LoadBinaryData(*mRoot, mBufferArray, mBufferViewArray, mAccessorArray) &&
+     LoadTextureArray(*mRoot, mPath, mSourceArray, mSamplerArray, mTextureArray) &&
+     LoadMaterialSetArray(*mRoot, mMaterialArray) &&
+     LoadMeshArray(*mRoot, mPath, mMeshArray, mBufferArray, mBufferViewArray, mAccessorArray))
   {
     return true;
   }
   return false;
 }
 
-bool Loader::CreateScene( Internal::Scene3dView& scene3dView )
+bool Loader::CreateScene(Internal::Scene3dView& scene3dView)
 {
-  scene3dView.SetDefaultCamera( Dali::Camera::LOOK_AT_TARGET, 0.01, Vector3::ZERO );
-  LoadCamera( scene3dView );
+  scene3dView.SetDefaultCamera(Dali::Camera::LOOK_AT_TARGET, 0.01, Vector3::ZERO);
+  LoadCamera(scene3dView);
 
-  if( LoadSceneNodes( scene3dView ) &&
-      LoadAnimation( scene3dView ) )
+  if(LoadSceneNodes(scene3dView) &&
+     LoadAnimation(scene3dView))
   {
     return true;
   }
   return false;
 }
 
-void Loader::LoadCamera( Scene3dView& scene3dView )
+void Loader::LoadCamera(Scene3dView& scene3dView)
 {
-  const TreeNode* camerasNode = mRoot->GetChild( "cameras" );
-  if( !camerasNode )
+  const TreeNode* camerasNode = mRoot->GetChild("cameras");
+  if(!camerasNode)
   {
     return;
   }
 
-  for( auto cameraIter = camerasNode->CBegin(), end = camerasNode->CEnd(); cameraIter != end; ++cameraIter )
+  for(auto cameraIter = camerasNode->CBegin(), end = camerasNode->CEnd(); cameraIter != end; ++cameraIter)
   {
-    const TreeNode* tempNode = ( &( *cameraIter ).second )->GetChild( "name" );
-    CameraInfo cameraInfo;
-    if( tempNode )
+    const TreeNode* tempNode = (&(*cameraIter).second)->GetChild("name");
+    CameraInfo      cameraInfo;
+    if(tempNode)
     {
-      ReadString( tempNode, cameraInfo.name );
+      ReadString(tempNode, cameraInfo.name);
     }
 
-    tempNode = ( &( *cameraIter ).second )->GetChild( "type" );
-    if( tempNode )
+    tempNode = (&(*cameraIter).second)->GetChild("type");
+    if(tempNode)
     {
-      ReadString( tempNode, cameraInfo.type );
+      ReadString(tempNode, cameraInfo.type);
     }
 
     CameraActor cameraActor = CameraActor::New();
-    cameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-    cameraActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+    cameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+    cameraActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
 
-    if( cameraInfo.type == "orthographic" )
+    if(cameraInfo.type == "orthographic")
     {
-      LoadOrthoGraphic( ( *cameraIter ).second, cameraInfo );
+      LoadOrthoGraphic((*cameraIter).second, cameraInfo);
       float xMag_2 = cameraInfo.orthographic.xmag / 2.0;
       float yMag_2 = cameraInfo.orthographic.ymag / 2.0;
-      cameraActor.SetOrthographicProjection( -xMag_2, xMag_2, yMag_2, -yMag_2,
-                                             cameraInfo.orthographic.znear, cameraInfo.orthographic.zfar );
+      cameraActor.SetOrthographicProjection(-xMag_2, xMag_2, yMag_2, -yMag_2, cameraInfo.orthographic.znear, cameraInfo.orthographic.zfar);
     }
-    else if( cameraInfo.type == "perspective" )
+    else if(cameraInfo.type == "perspective")
     {
-      if( !LoadPerspective( ( *cameraIter ).second, cameraInfo ) )
+      if(!LoadPerspective((*cameraIter).second, cameraInfo))
       {
         return;
       }
-      cameraActor.SetProjectionMode( Dali::Camera::PERSPECTIVE_PROJECTION );
-      cameraActor.SetFieldOfView( cameraInfo.perspective.yfov );
-      cameraActor.SetNearClippingPlane( cameraInfo.perspective.znear );
+      cameraActor.SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
+      cameraActor.SetFieldOfView(cameraInfo.perspective.yfov);
+      cameraActor.SetNearClippingPlane(cameraInfo.perspective.znear);
 
-      if( cameraInfo.perspective.zfar > 0.0 )
+      if(cameraInfo.perspective.zfar > 0.0)
       {
-        cameraActor.SetFarClippingPlane( cameraInfo.perspective.zfar );
+        cameraActor.SetFarClippingPlane(cameraInfo.perspective.zfar);
       }
-      if( cameraInfo.perspective.aspectRatio > 0.0 )
+      if(cameraInfo.perspective.aspectRatio > 0.0)
       {
-        cameraActor.SetAspectRatio( cameraInfo.perspective.aspectRatio );
+        cameraActor.SetAspectRatio(cameraInfo.perspective.aspectRatio);
       }
     }
 
-    scene3dView.AddCamera( cameraActor );
+    scene3dView.AddCamera(cameraActor);
   }
 }
 
-bool Loader::LoadOrthoGraphic( const TreeNode& camera, CameraInfo& cameraInfo )
+bool Loader::LoadOrthoGraphic(const TreeNode& camera, CameraInfo& cameraInfo)
 {
-  const TreeNode* orthographicNode = camera.GetChild( "orthographic" );
-  if( !orthographicNode )
+  const TreeNode* orthographicNode = camera.GetChild("orthographic");
+  if(!orthographicNode)
   {
     return false;
   }
 
   const TreeNode* tempNode;
-  tempNode = orthographicNode->GetChild( "xmag" );
-  if( tempNode )
+  tempNode = orthographicNode->GetChild("xmag");
+  if(tempNode)
   {
-    ReadFloat( tempNode, cameraInfo.orthographic.xmag );
+    ReadFloat(tempNode, cameraInfo.orthographic.xmag);
   }
 
-  tempNode = orthographicNode->GetChild( "ymag" );
-  if( tempNode )
+  tempNode = orthographicNode->GetChild("ymag");
+  if(tempNode)
   {
-    ReadFloat( tempNode, cameraInfo.orthographic.ymag );
+    ReadFloat(tempNode, cameraInfo.orthographic.ymag);
   }
 
-  tempNode = orthographicNode->GetChild( "zfar" );
-  if( tempNode )
+  tempNode = orthographicNode->GetChild("zfar");
+  if(tempNode)
   {
-    ReadFloat( tempNode, cameraInfo.orthographic.zfar );
+    ReadFloat(tempNode, cameraInfo.orthographic.zfar);
   }
 
-  tempNode = orthographicNode->GetChild( "znear" );
-  if( tempNode )
+  tempNode = orthographicNode->GetChild("znear");
+  if(tempNode)
   {
-    ReadFloat( tempNode, cameraInfo.orthographic.znear );
+    ReadFloat(tempNode, cameraInfo.orthographic.znear);
   }
 
   return true;
 }
 
-bool Loader::LoadPerspective( const TreeNode& camera, CameraInfo& cameraInfo )
+bool Loader::LoadPerspective(const TreeNode& camera, CameraInfo& cameraInfo)
 {
-  const TreeNode* perspectiveNode = camera.GetChild( "perspective" );
-  if( !perspectiveNode )
+  const TreeNode* perspectiveNode = camera.GetChild("perspective");
+  if(!perspectiveNode)
   {
     return false;
   }
 
   const TreeNode* tempNode;
-  tempNode = perspectiveNode->GetChild( "aspectRatio" );
-  if( tempNode )
+  tempNode = perspectiveNode->GetChild("aspectRatio");
+  if(tempNode)
   {
-    ReadFloat( tempNode, cameraInfo.perspective.aspectRatio );
+    ReadFloat(tempNode, cameraInfo.perspective.aspectRatio);
   }
 
-  tempNode = perspectiveNode->GetChild( "yfov" );
-  if( tempNode )
+  tempNode = perspectiveNode->GetChild("yfov");
+  if(tempNode)
   {
-    ReadFloat( tempNode, cameraInfo.perspective.yfov );
+    ReadFloat(tempNode, cameraInfo.perspective.yfov);
   }
 
-  tempNode = perspectiveNode->GetChild( "zfar" );
-  if( tempNode )
+  tempNode = perspectiveNode->GetChild("zfar");
+  if(tempNode)
   {
-    ReadFloat( tempNode, cameraInfo.perspective.zfar );
+    ReadFloat(tempNode, cameraInfo.perspective.zfar);
   }
 
-  tempNode = perspectiveNode->GetChild( "znear" );
-  if( tempNode )
+  tempNode = perspectiveNode->GetChild("znear");
+  if(tempNode)
   {
-    ReadFloat( tempNode, cameraInfo.perspective.znear );
+    ReadFloat(tempNode, cameraInfo.perspective.znear);
   }
 
   return true;
 }
 
-bool Loader::LoadSceneNodes( Scene3dView& scene3dView )
+bool Loader::LoadSceneNodes(Scene3dView& scene3dView)
 {
-  const TreeNode* sceneNode = mRoot->GetChild( "scene" );
-  uint32_t sceneNum = 0;
-  if( sceneNode )
+  const TreeNode* sceneNode = mRoot->GetChild("scene");
+  uint32_t        sceneNum  = 0;
+  if(sceneNode)
   {
     sceneNum = sceneNode->GetInteger();
   }
 
-  const TreeNode* scenesNode = mRoot->GetChild( "scenes" );
-  if( !( scenesNode && ( mNodes = mRoot->GetChild( "nodes" ) ) ) )
+  const TreeNode* scenesNode = mRoot->GetChild("scenes");
+  if(!(scenesNode && (mNodes = mRoot->GetChild("nodes"))))
   {
     return false;
   }
 
-  const TreeNode* tempNode = Tidx( scenesNode, sceneNum );
-  if( !tempNode )
+  const TreeNode* tempNode = Tidx(scenesNode, sceneNum);
+  if(!tempNode)
   {
     return false;
   }
 
-  tempNode = tempNode->GetChild( "nodes" );
-  if( !tempNode )
+  tempNode = tempNode->GetChild("nodes");
+  if(!tempNode)
   {
     return false;
   }
 
-  for( auto nodeIter = tempNode->CBegin(), end = tempNode->CEnd(); nodeIter != end; ++nodeIter )
+  for(auto nodeIter = tempNode->CBegin(), end = tempNode->CEnd(); nodeIter != end; ++nodeIter)
   {
-    Actor actor = AddNode( scene3dView, ( ( *nodeIter ).second ).GetInteger() );
-    actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-    scene3dView.GetRoot().Add( actor );
+    Actor actor = AddNode(scene3dView, ((*nodeIter).second).GetInteger());
+    actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+    scene3dView.GetRoot().Add(actor);
   }
 
   return true;
 }
 
-Actor Loader::AddNode( Scene3dView& scene3dView, uint32_t index )
+Actor Loader::AddNode(Scene3dView& scene3dView, uint32_t index)
 {
-  const TreeNode* node = Tidx( mNodes, index );
-  Actor actor = Actor::New();
-  Vector3 actorSize( Vector3::ONE );
+  const TreeNode* node  = Tidx(mNodes, index);
+  Actor           actor = Actor::New();
+  Vector3         actorSize(Vector3::ONE);
 
-  Vector3 translation = Vector3( 0.0, 0.0, 0.0 );
-  Vector3 scale = Vector3( 1.0, 1.0, 1.0 );
-  Quaternion orientation( Vector4( 0.0, 0.0, 0.0, 1.0 ) );
+  Vector3    translation = Vector3(0.0, 0.0, 0.0);
+  Vector3    scale       = Vector3(1.0, 1.0, 1.0);
+  Quaternion orientation(Vector4(0.0, 0.0, 0.0, 1.0));
 
   Vector3 anchorPoint = AnchorPoint::CENTER;
 
   const TreeNode* tempNode = NULL;
-  if( ( tempNode = node->GetChild( "translation" ) ) )
+  if((tempNode = node->GetChild("translation")))
   {
-    float floatVec[3] = { 0.0, 0.0, 0.0 };
-    if( tempNode && ReadVector( tempNode, floatVec, 3 ) )
+    float floatVec[3] = {0.0, 0.0, 0.0};
+    if(tempNode && ReadVector(tempNode, floatVec, 3))
     {
-      translation = Vector3( floatVec[0], floatVec[1], floatVec[2] );
+      translation = Vector3(floatVec[0], floatVec[1], floatVec[2]);
     }
   }
 
-  if( ( tempNode = node->GetChild( "scale" ) ) )
+  if((tempNode = node->GetChild("scale")))
   {
-    float floatVec[3] = { 1.0, 1.0, 1.0 };
-    if( tempNode && ReadVector( tempNode, floatVec, 3 ) )
+    float floatVec[3] = {1.0, 1.0, 1.0};
+    if(tempNode && ReadVector(tempNode, floatVec, 3))
     {
-      scale = Vector3( floatVec[0], floatVec[1], floatVec[2] );
+      scale = Vector3(floatVec[0], floatVec[1], floatVec[2]);
     }
   }
 
-  if( ( tempNode = node->GetChild( "rotation" ) ) )
+  if((tempNode = node->GetChild("rotation")))
   {
-    float floatVec[4] = { 0.0, 0.0, 0.0, 1.0 };
-    if( tempNode && ReadVector( tempNode, floatVec, 4 ) )
+    float floatVec[4] = {0.0, 0.0, 0.0, 1.0};
+    if(tempNode && ReadVector(tempNode, floatVec, 4))
     {
-      orientation = Quaternion( Vector4( floatVec[0], floatVec[1], floatVec[2], floatVec[3] ) );
+      orientation = Quaternion(Vector4(floatVec[0], floatVec[1], floatVec[2], floatVec[3]));
     }
   }
 
-  if( ( tempNode = node->GetChild( "matrix" ) ) )
+  if((tempNode = node->GetChild("matrix")))
   {
-    float floatVec[16] = { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 };
-    if( tempNode && ReadVector( tempNode, floatVec, 16 ) )
+    float floatVec[16] = {1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0};
+    if(tempNode && ReadVector(tempNode, floatVec, 16))
     {
-      Matrix nodeMatrix = Matrix( floatVec );
-      nodeMatrix.GetTransformComponents( translation, orientation, scale );
+      Matrix nodeMatrix = Matrix(floatVec);
+      nodeMatrix.GetTransformComponents(translation, orientation, scale);
     }
   }
 
-  if( ( tempNode = node->GetChild( "mesh" ) ) )
+  if((tempNode = node->GetChild("mesh")))
   {
-    MeshInfo meshInfo = mMeshArray[tempNode->GetInteger()];
-    bool isMaterial = ( meshInfo.materialsIdx >= 0 );
+    MeshInfo meshInfo   = mMeshArray[tempNode->GetInteger()];
+    bool     isMaterial = (meshInfo.materialsIdx >= 0);
 
     TextureSet textureSet;
     textureSet = TextureSet::New();
 
-    int32_t addIdx = 0;
-    int32_t shaderTypeIndex = 0;
-    int32_t maxMipmapLevel = 0;
-    bool isBaseColorTexture = false;
-    bool isMetallicRoughnessTexture = false;
-    bool isNormalTexture = false;
-    bool isOcclusionTexture = false;
-    bool isEmissiveTexture = false;
+    int32_t addIdx                     = 0;
+    int32_t shaderTypeIndex            = 0;
+    int32_t maxMipmapLevel             = 0;
+    bool    isBaseColorTexture         = false;
+    bool    isMetallicRoughnessTexture = false;
+    bool    isNormalTexture            = false;
+    bool    isOcclusionTexture         = false;
+    bool    isEmissiveTexture          = false;
 
     std::string VERTEX_SHADER, FRAGMENT_SHADER;
-    VERTEX_SHADER = GLES_VERSION_300;
-    VERTEX_SHADER += PHYSICALLY_BASED_VERTEX_SHADER;
-    FRAGMENT_SHADER = GLES_VERSION_300;
+    VERTEX_SHADER = SHADER_GLTF_GLES_VERSION_300_DEF.data();
+    VERTEX_SHADER += SHADER_GLTF_PHYSICALLY_BASED_SHADER_VERT.data();
+    FRAGMENT_SHADER = SHADER_GLTF_GLES_VERSION_300_DEF.data();
 
-    bool useIBL = ( scene3dView.GetLightType() >= Toolkit::Scene3dView::LightType::IMAGE_BASED_LIGHT );
-    if( isMaterial )
+    bool useIBL = scene3dView.HasImageBasedLighting();
+    if(isMaterial)
     {
       MaterialInfo materialInfo = mMaterialArray[meshInfo.materialsIdx];
-      if( SetTextureAndSampler( textureSet, materialInfo.baseColorTexture.index, FRAGMENT_SHADER, DEFINE_BASECOLOR_TEXTURE, addIdx ) )
+      if(SetTextureAndSampler(textureSet, materialInfo.baseColorTexture.index, FRAGMENT_SHADER, SHADER_GLTF_BASECOLOR_TEXTURE_DEF.data(), addIdx))
       {
-        shaderTypeIndex += static_cast<int32_t>( ShaderType::BASECOLOR_SHADER );
+        shaderTypeIndex += static_cast<int32_t>(ShaderType::BASECOLOR_SHADER);
         isBaseColorTexture = true;
       }
-      if( SetTextureAndSampler( textureSet, materialInfo.metallicRoughnessTexture.index, FRAGMENT_SHADER, DEFINE_METALLICROUGHNESS_TEXTURE, addIdx ) )
+      if(SetTextureAndSampler(textureSet, materialInfo.metallicRoughnessTexture.index, FRAGMENT_SHADER, SHADER_GLTF_METALLICROUGHNESS_TEXTURE_DEF.data(), addIdx))
       {
-        shaderTypeIndex += static_cast<int32_t>( ShaderType::METALLICROUGHNESS_SHADER );
+        shaderTypeIndex += static_cast<int32_t>(ShaderType::METALLICROUGHNESS_SHADER);
         isMetallicRoughnessTexture = true;
       }
-      if( SetTextureAndSampler( textureSet, materialInfo.normalTexture.index, FRAGMENT_SHADER, DEFINE_NORMAL_TEXTURE, addIdx ) )
+      if(SetTextureAndSampler(textureSet, materialInfo.normalTexture.index, FRAGMENT_SHADER, SHADER_GLTF_NORMAL_TEXTURE_DEF.data(), addIdx))
       {
-        shaderTypeIndex += static_cast<int32_t>( ShaderType::NORMAL_SHADER );
+        shaderTypeIndex += static_cast<int32_t>(ShaderType::NORMAL_SHADER);
         isNormalTexture = true;
       }
-      if( SetTextureAndSampler( textureSet, materialInfo.occlusionTexture.index, FRAGMENT_SHADER, DEFINE_OCCLUSION_TEXTURE, addIdx ) )
+      if(SetTextureAndSampler(textureSet, materialInfo.occlusionTexture.index, FRAGMENT_SHADER, SHADER_GLTF_OCCULUSION_TEXTURE_DEF.data(), addIdx))
       {
-        shaderTypeIndex += static_cast<int32_t>( ShaderType::OCCLUSION_SHADER );
+        shaderTypeIndex += static_cast<int32_t>(ShaderType::OCCLUSION_SHADER);
         isOcclusionTexture = true;
       }
-      if( SetTextureAndSampler( textureSet, materialInfo.emissiveTexture.index, FRAGMENT_SHADER, DEFINE_EMIT_TEXTURE, addIdx ) )
+      if(SetTextureAndSampler(textureSet, materialInfo.emissiveTexture.index, FRAGMENT_SHADER, SHADER_GLTF_EMIT_TEXTURE_DEF.data(), addIdx))
       {
-        shaderTypeIndex += static_cast<int32_t>( ShaderType::EMIT_SHADER );
+        shaderTypeIndex += static_cast<int32_t>(ShaderType::EMIT_SHADER);
         isEmissiveTexture = true;
       }
 
-      if( useIBL )
+      if(useIBL)
       {
-        shaderTypeIndex += static_cast<int32_t>( ShaderType::IBL_SHADER );
-        FRAGMENT_SHADER += DEFINE_IBL_TEXTURE;
+        shaderTypeIndex += static_cast<int32_t>(ShaderType::IBL_SHADER);
+        FRAGMENT_SHADER += SHADER_GLTF_IBL_TEXTURE_DEF.data();
 
         Sampler sampler = Sampler::New();
-        sampler.SetFilterMode( FilterMode::DEFAULT, FilterMode::DEFAULT );
-        sampler.SetWrapMode( WrapMode::REPEAT, WrapMode::REPEAT, WrapMode::REPEAT );
+        sampler.SetFilterMode(FilterMode::DEFAULT, FilterMode::DEFAULT);
+        sampler.SetWrapMode(WrapMode::REPEAT, WrapMode::REPEAT, WrapMode::REPEAT);
 
-        textureSet.SetTexture( addIdx, scene3dView.GetBRDFTexture() );
-        textureSet.SetSampler( addIdx++, sampler );
+        textureSet.SetTexture(addIdx, scene3dView.GetBRDFTexture());
+        textureSet.SetSampler(addIdx++, sampler);
         Sampler samplerIBL = Sampler::New();
-        samplerIBL.SetFilterMode( FilterMode::LINEAR_MIPMAP_LINEAR, FilterMode::LINEAR );
-        samplerIBL.SetWrapMode( WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE );
-        textureSet.SetTexture( addIdx, scene3dView.GetDiffuseTexture() );
-        textureSet.SetSampler( addIdx++, samplerIBL );
+        samplerIBL.SetFilterMode(FilterMode::LINEAR_MIPMAP_LINEAR, FilterMode::LINEAR);
+        samplerIBL.SetWrapMode(WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE);
+        textureSet.SetTexture(addIdx, scene3dView.GetDiffuseTexture());
+        textureSet.SetSampler(addIdx++, samplerIBL);
         Texture specularTexture = scene3dView.GetSpecularTexture();
-        textureSet.SetTexture( addIdx, specularTexture );
-        textureSet.SetSampler( addIdx++, samplerIBL );
+        textureSet.SetTexture(addIdx, specularTexture);
+        textureSet.SetSampler(addIdx++, samplerIBL);
 
-        int32_t textureSize = std::min( specularTexture.GetWidth(), specularTexture.GetHeight() );
-        maxMipmapLevel = 0;
-        while( textureSize >= 1 )
+        int32_t textureSize = std::min(specularTexture.GetWidth(), specularTexture.GetHeight());
+        maxMipmapLevel      = 0;
+        while(textureSize >= 1)
         {
           maxMipmapLevel++;
           textureSize /= 2;
@@ -1567,155 +1569,158 @@ Actor Loader::AddNode( Scene3dView& scene3dView, uint32_t index )
       }
     }
 
-    FRAGMENT_SHADER += PHYSICALLY_BASED_FRAGMENT_SHADER;
-    if( !mShaderCache[shaderTypeIndex] )
+    FRAGMENT_SHADER += SHADER_GLTF_PHYSICALLY_BASED_SHADER_FRAG.data();
+    if(!mShaderCache[shaderTypeIndex])
     {
-      mShaderCache[shaderTypeIndex] = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
-      scene3dView.AddShader( mShaderCache[shaderTypeIndex] );
+      mShaderCache[shaderTypeIndex] = Shader::New(VERTEX_SHADER, FRAGMENT_SHADER);
+      scene3dView.AddShader(mShaderCache[shaderTypeIndex]);
     }
     Shader shader = mShaderCache[shaderTypeIndex];
 
-    Renderer renderer = Renderer::New( meshInfo.geometry, shader );
-    renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
-    renderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::ON );
-    renderer.SetTextures( textureSet );
+    Renderer renderer = Renderer::New(meshInfo.geometry, shader);
+    renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON);
+    renderer.SetProperty(Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::ON);
+    renderer.SetTextures(textureSet);
 
     anchorPoint = meshInfo.pivot;
-    actor.SetProperty( Actor::Property::ANCHOR_POINT, anchorPoint );
+    actor.SetProperty(Actor::Property::ANCHOR_POINT, anchorPoint);
 
-    actor.SetProperty( Actor::Property::SIZE, Vector3( meshInfo.size.x, meshInfo.size.y, meshInfo.size.z ) );
-    actor.AddRenderer( renderer );
+    actor.SetProperty(Actor::Property::SIZE, Vector3(meshInfo.size.x, meshInfo.size.y, meshInfo.size.z));
+    actor.AddRenderer(renderer);
 
-    actor.SetProperty( Actor::Property::SCALE, scale );
-    actor.RotateBy( orientation );
-    actor.SetProperty( Actor::Property::POSITION, translation );
+    actor.SetProperty(Actor::Property::SCALE, scale);
+    actor.RotateBy(orientation);
+    actor.SetProperty(Actor::Property::POSITION, translation);
 
-    shader.RegisterProperty( "uLightType", ( scene3dView.GetLightType() & ~Toolkit::Scene3dView::LightType::IMAGE_BASED_LIGHT ) );
-    shader.RegisterProperty( "uLightVector", scene3dView.GetLightVector() );
-    shader.RegisterProperty( "uLightColor", scene3dView.GetLightColor() );
+    float hasLightSource = static_cast<float>(!!(scene3dView.GetLightType() & (Toolkit::Scene3dView::LightType::POINT_LIGHT | Toolkit::Scene3dView::LightType::DIRECTIONAL_LIGHT)));
+    float isPointLight = static_cast<float>(!!(scene3dView.GetLightType() & Toolkit::Scene3dView::LightType::POINT_LIGHT));
+    shader.RegisterProperty("uHasLightSource", hasLightSource);
+    shader.RegisterProperty("uIsPointLight", isPointLight);
+    shader.RegisterProperty("uLightVector", scene3dView.GetLightVector());
+    shader.RegisterProperty("uLightColor", scene3dView.GetLightColor());
 
-    actor.RegisterProperty( "uIsColor", meshInfo.attribute.COLOR.size() > 0 );
-    if( isMaterial )
+    actor.RegisterProperty("uHasVertexColor", meshInfo.attribute.COLOR.size() > 0 ? 1.0f : 0.0f);
+    if(isMaterial)
     {
       MaterialInfo materialInfo = mMaterialArray[meshInfo.materialsIdx];
-      actor.RegisterProperty( "uBaseColorFactor", materialInfo.baseColorFactor );
-      actor.RegisterProperty( "uMetallicRoughnessFactors", Vector2( materialInfo.metallicFactor, materialInfo.roughnessFactor ) );
+      actor.RegisterProperty("uBaseColorFactor", materialInfo.baseColorFactor);
+      actor.RegisterProperty("uMetallicRoughnessFactors", Vector2(materialInfo.metallicFactor, materialInfo.roughnessFactor));
 
-      if( materialInfo.alphaMode == "OPAQUE" )
+      if(materialInfo.alphaMode == "OPAQUE")
       {
-        actor.RegisterProperty( "alphaMode", 0 );
+        actor.RegisterProperty("uAlphaMode", 0.0f);
       }
-      else if( materialInfo.alphaMode == "MASK" )
+      else if(materialInfo.alphaMode == "MASK")
       {
-        actor.RegisterProperty( "alphaMode", 1 );
+        actor.RegisterProperty("uAlphaMode", 1.0f);
       }
       else
       {
-        actor.RegisterProperty( "alphaMode", 2 );
+        actor.RegisterProperty("uAlphaMode", 2.0f);
       }
-      actor.RegisterProperty( "alphaCutoff", materialInfo.alphaCutoff );
+      actor.RegisterProperty("alphaCutoff", materialInfo.alphaCutoff);
 
-      if( isBaseColorTexture )
+      if(isBaseColorTexture)
       {
-        actor.RegisterProperty( "uBaseColorTexCoordIndex", materialInfo.baseColorTexture.texCoord );
+        actor.RegisterProperty("uBaseColorTexCoordIndex", materialInfo.baseColorTexture.texCoord);
       }
-      if( isMetallicRoughnessTexture )
+      if(isMetallicRoughnessTexture)
       {
-        actor.RegisterProperty( "uMetallicRoughnessTexCoordIndex", materialInfo.metallicRoughnessTexture.texCoord );
+        actor.RegisterProperty("uMetallicRoughnessTexCoordIndex", materialInfo.metallicRoughnessTexture.texCoord);
       }
-      if( isNormalTexture )
+      if(isNormalTexture)
       {
-        actor.RegisterProperty( "uNormalScale", materialInfo.normalTexture.value );
-        actor.RegisterProperty( "uNormalTexCoordIndex", materialInfo.normalTexture.texCoord );
+        actor.RegisterProperty("uNormalScale", materialInfo.normalTexture.value);
+        actor.RegisterProperty("uNormalTexCoordIndex", materialInfo.normalTexture.texCoord);
       }
-      if( isOcclusionTexture )
+      if(isOcclusionTexture)
       {
-        actor.RegisterProperty( "uOcclusionTexCoordIndex", materialInfo.occlusionTexture.texCoord );
-        actor.RegisterProperty( "uOcclusionStrength", materialInfo.occlusionTexture.value );
+        actor.RegisterProperty("uOcclusionTexCoordIndex", materialInfo.occlusionTexture.texCoord);
+        actor.RegisterProperty("uOcclusionStrength", materialInfo.occlusionTexture.value);
       }
-      if( isEmissiveTexture )
+      if(isEmissiveTexture)
       {
-        actor.RegisterProperty( "uEmissiveTexCoordIndex", materialInfo.emissiveTexture.texCoord );
-        actor.RegisterProperty( "uEmissiveFactor", materialInfo.emissiveFactor );
+        actor.RegisterProperty("uEmissiveTexCoordIndex", materialInfo.emissiveTexture.texCoord);
+        actor.RegisterProperty("uEmissiveFactor", materialInfo.emissiveFactor);
       }
     }
 
-    if( isMaterial && useIBL )
+    if(isMaterial && useIBL)
     {
-      actor.RegisterProperty( "uScaleIBLAmbient", scene3dView.GetIBLScaleFactor() );
-      actor.RegisterProperty( "uMipmapLevel", static_cast<float>( maxMipmapLevel ) );
+      actor.RegisterProperty("uScaleIBLAmbient", scene3dView.GetIBLScaleFactor());
+      actor.RegisterProperty("uMipmapLevel", static_cast<float>(maxMipmapLevel));
     }
   }
   else
   {
-    actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
-    actor.SetProperty( Actor::Property::POSITION, translation );
-    actor.RotateBy( orientation );
-    actor.SetProperty( Actor::Property::SIZE, actorSize );
+    actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    actor.SetProperty(Actor::Property::POSITION, translation);
+    actor.RotateBy(orientation);
+    actor.SetProperty(Actor::Property::SIZE, actorSize);
   }
 
-  tempNode = node->GetChild( "camera" );
-  if( tempNode )
+  tempNode = node->GetChild("camera");
+  if(tempNode)
   {
-    int32_t cameraNum = tempNode->GetInteger();
-    CameraActor cameraActor = scene3dView.GetCamera( cameraNum );
-    if( cameraActor )
+    int32_t     cameraNum   = tempNode->GetInteger();
+    CameraActor cameraActor = scene3dView.GetCamera(cameraNum);
+    if(cameraActor)
     {
-      actor.Add( cameraActor );
+      actor.Add(cameraActor);
     }
   }
 
-  tempNode = node->GetChild( "name" );
-  if( tempNode )
+  tempNode = node->GetChild("name");
+  if(tempNode)
   {
     std::string nameString;
-    ReadString( tempNode, nameString );
-    actor.SetProperty( Dali::Actor::Property::NAME, nameString );
+    ReadString(tempNode, nameString);
+    actor.SetProperty(Dali::Actor::Property::NAME, nameString);
   }
 
-  SetActorCache( actor, index );
-  if( ( tempNode = node->GetChild( "children" ) ) )
+  SetActorCache(actor, index);
+  if((tempNode = node->GetChild("children")))
   {
-    for( auto childIter = tempNode->CBegin(), end = tempNode->CEnd(); childIter != end; ++childIter )
+    for(auto childIter = tempNode->CBegin(), end = tempNode->CEnd(); childIter != end; ++childIter)
     {
-      Actor childActor = AddNode( scene3dView, ( ( *childIter ).second ).GetInteger() );
-      childActor.SetProperty( Actor::Property::PARENT_ORIGIN, anchorPoint );
-      actor.Add( childActor );
+      Actor childActor = AddNode(scene3dView, ((*childIter).second).GetInteger());
+      childActor.SetProperty(Actor::Property::PARENT_ORIGIN, anchorPoint);
+      actor.Add(childActor);
     }
   }
 
   return actor;
 }
 
-void Loader::SetActorCache( Actor& actor, uint32_t index )
+void Loader::SetActorCache(Actor& actor, uint32_t index)
 {
-  if( mActorCache.size() < index + 1 )
+  if(mActorCache.size() < index + 1)
   {
-    mActorCache.resize( index + 1 );
+    mActorCache.resize(index + 1);
   }
   mActorCache[index] = actor;
 }
 
-bool Loader::SetTextureAndSampler( TextureSet& textureSet, int32_t textureIdx, std::string& toShader, std::string shader, int32_t& addIdx )
+bool Loader::SetTextureAndSampler(TextureSet& textureSet, int32_t textureIdx, std::string& toShader, std::string shader, int32_t& addIdx)
 {
-  if( textureIdx >= 0 )
+  if(textureIdx >= 0)
   {
     toShader += shader;
     TextureInfo textureInfo = mTextureArray[textureIdx];
-    if( textureInfo.sourceIdx >= 0 )
+    if(textureInfo.sourceIdx >= 0)
     {
-      textureSet.SetTexture( addIdx, mSourceArray[textureInfo.sourceIdx] );
+      textureSet.SetTexture(addIdx, mSourceArray[textureInfo.sourceIdx]);
     }
-    if( textureInfo.samplerIdx >= 0 )
+    if(textureInfo.samplerIdx >= 0)
     {
-      textureSet.SetSampler( addIdx, mSamplerArray[textureInfo.samplerIdx] );
+      textureSet.SetSampler(addIdx, mSamplerArray[textureInfo.samplerIdx]);
     }
     else
     {
       Sampler sampler = Sampler::New();
-      sampler.SetFilterMode( FilterMode::DEFAULT, FilterMode::DEFAULT );
-      sampler.SetWrapMode( WrapMode::REPEAT, WrapMode::REPEAT, WrapMode::REPEAT );
-      textureSet.SetSampler( addIdx, sampler );
+      sampler.SetFilterMode(FilterMode::DEFAULT, FilterMode::DEFAULT);
+      sampler.SetWrapMode(WrapMode::REPEAT, WrapMode::REPEAT, WrapMode::REPEAT);
+      textureSet.SetSampler(addIdx, sampler);
     }
     addIdx++;
     return true;
@@ -1723,101 +1728,101 @@ bool Loader::SetTextureAndSampler( TextureSet& textureSet, int32_t textureIdx, s
   return false;
 }
 
-bool Loader::LoadAnimation( Scene3dView& scene3dView )
+bool Loader::LoadAnimation(Scene3dView& scene3dView)
 {
-  const TreeNode* animationsNode = mRoot->GetChild( "animations" );
-  if( !animationsNode )
+  const TreeNode* animationsNode = mRoot->GetChild("animations");
+  if(!animationsNode)
   {
     return true;
   }
 
-  for( auto animationIter = animationsNode->CBegin(), end = animationsNode->CEnd(); animationIter != end; ++animationIter )
+  for(auto animationIter = animationsNode->CBegin(), end = animationsNode->CEnd(); animationIter != end; ++animationIter)
   {
-    const TreeNode* nameNode = ( &( *animationIter ).second )->GetChild( "name" );
-    AnimationInfo animationInfo;
-    if( nameNode )
+    const TreeNode* nameNode = (&(*animationIter).second)->GetChild("name");
+    AnimationInfo   animationInfo;
+    if(nameNode)
     {
-      ReadString( nameNode, animationInfo.name );
+      ReadString(nameNode, animationInfo.name);
     }
 
     Property::Index propIndex = Property::INVALID_INDEX;
-    LoadAnimationChannels( ( *animationIter ).second, animationInfo );
-    if( animationInfo.channelArray.size() == 0 )
+    LoadAnimationChannels((*animationIter).second, animationInfo);
+    if(animationInfo.channelArray.size() == 0)
     {
       continue;
     }
 
-    LoadAnimationSamplers( ( *animationIter ).second, animationInfo );
+    LoadAnimationSamplers((*animationIter).second, animationInfo);
 
-    for( auto&& currentChannel : animationInfo.channelArray )
+    for(auto&& currentChannel : animationInfo.channelArray)
     {
-      if( currentChannel.path == "rotation" )
+      if(currentChannel.path == "rotation")
       {
         propIndex = Dali::Actor::Property::ORIENTATION;
       }
-      else if( currentChannel.path == "translation" )
+      else if(currentChannel.path == "translation")
       {
         propIndex = Dali::Actor::Property::POSITION;
       }
-      else if( currentChannel.path == "scale" )
+      else if(currentChannel.path == "scale")
       {
         propIndex = Dali::Actor::Property::SCALE;
       }
 
-      float duration = 0.0f;
+      float     duration  = 0.0f;
       KeyFrames keyframes = KeyFrames::New();
-      if( propIndex == Dali::Actor::Property::ORIENTATION )
+      if(propIndex == Dali::Actor::Property::ORIENTATION)
       {
-        duration = LoadKeyFrames<Vector4>( animationInfo.samplerArray[currentChannel.sampler], propIndex, keyframes, mPath, mAccessorArray, mBufferViewArray, mBufferArray );
+        duration = LoadKeyFrames<Vector4>(animationInfo.samplerArray[currentChannel.sampler], propIndex, keyframes, mPath, mAccessorArray, mBufferViewArray, mBufferArray);
       }
       else
       {
-        duration = LoadKeyFrames<Vector3>( animationInfo.samplerArray[currentChannel.sampler], propIndex, keyframes, mPath, mAccessorArray, mBufferViewArray, mBufferArray );
+        duration = LoadKeyFrames<Vector3>(animationInfo.samplerArray[currentChannel.sampler], propIndex, keyframes, mPath, mAccessorArray, mBufferViewArray, mBufferArray);
       }
 
-      Animation animation = Animation::New( duration );
+      Animation                animation     = Animation::New(duration);
       Animation::Interpolation interpolation = Animation::Interpolation::LINEAR;
-      if( animationInfo.samplerArray[currentChannel.sampler].interpolation == "CUBICSPLINE" )
+      if(animationInfo.samplerArray[currentChannel.sampler].interpolation == "CUBICSPLINE")
       {
         interpolation = Animation::Interpolation::CUBIC;
       }
-      if( animationInfo.samplerArray[currentChannel.sampler].interpolation == "STEP" )
+      if(animationInfo.samplerArray[currentChannel.sampler].interpolation == "STEP")
       {
       }
 
-      animation.AnimateBetween( Property( mActorCache[currentChannel.targetNode], propIndex ), keyframes, interpolation );
+      animation.AnimateBetween(Property(mActorCache[currentChannel.targetNode], propIndex), keyframes, interpolation);
 
-      animation.SetLooping( false );
-      scene3dView.AddAnimation( animation );
+      animation.SetLooping(false);
+      scene3dView.AddAnimation(animation);
     }
   }
 
   return true;
 }
 
-bool Loader::LoadAnimationChannels( const TreeNode& animation, AnimationInfo& animationInfo )
+bool Loader::LoadAnimationChannels(const TreeNode& animation, AnimationInfo& animationInfo)
 {
-  const TreeNode* channelsNode = animation.GetChild( "channels" );
-  if( !channelsNode )
+  const TreeNode* channelsNode = animation.GetChild("channels");
+  if(!channelsNode)
   {
     return false;
   }
 
-  for( auto channelIter = channelsNode->CBegin(), end = channelsNode->CEnd(); channelIter != end; ++channelIter )
+  for(auto channelIter = channelsNode->CBegin(), end = channelsNode->CEnd(); channelIter != end; ++channelIter)
   {
     AnimationChannelInfo animationChannelInfo;
-    const TreeNode* channelNode = ( &( *channelIter ).second );
-    const TreeNode* samplerNode = channelNode->GetChild( "sampler" );
-    if( samplerNode )
+    const TreeNode*      channelNode = (&(*channelIter).second);
+    const TreeNode*      samplerNode = channelNode->GetChild("sampler");
+    if(samplerNode)
     {
       animationChannelInfo.sampler = samplerNode->GetInteger();
     }
 
-    const TreeNode* targetNode = channelNode->GetChild( "target" );
-    if( targetNode )
+    const TreeNode* targetNode = channelNode->GetChild("target");
+    if(targetNode)
     {
-      const TreeNode* tempNode = targetNode->GetChild( "node" );
-      if( tempNode )
+      const TreeNode* tempNode = targetNode->GetChild("node");
+      if(tempNode)
       {
         animationChannelInfo.targetNode = tempNode->GetInteger();
       }
@@ -1826,58 +1831,58 @@ bool Loader::LoadAnimationChannels( const TreeNode& animation, AnimationInfo& an
         continue;
       }
 
-      tempNode = targetNode->GetChild( "path" );
-      if( tempNode )
+      tempNode = targetNode->GetChild("path");
+      if(tempNode)
       {
-        ReadString( tempNode, animationChannelInfo.path );
+        ReadString(tempNode, animationChannelInfo.path);
       }
     }
 
-    animationInfo.channelArray.push_back( animationChannelInfo );
+    animationInfo.channelArray.push_back(animationChannelInfo);
   }
   return true;
 }
 
-bool Loader::LoadAnimationSamplers( const TreeNode& animation, AnimationInfo& animationInfo )
+bool Loader::LoadAnimationSamplers(const TreeNode& animation, AnimationInfo& animationInfo)
 {
-  const TreeNode* samplersNode = animation.GetChild( "samplers" );
-  if( !samplersNode )
+  const TreeNode* samplersNode = animation.GetChild("samplers");
+  if(!samplersNode)
   {
     return false;
   }
 
-  for( auto sampler = samplersNode->CBegin(), end = samplersNode->CEnd(); sampler != end; ++sampler )
+  for(auto sampler = samplersNode->CBegin(), end = samplersNode->CEnd(); sampler != end; ++sampler)
   {
     AnimationSamplerInfo animationSamplerInfo;
-    const TreeNode* samplerNode = ( &( *sampler ).second );
-    const TreeNode* tempNode = samplerNode->GetChild( "input" );
-    if( tempNode )
+    const TreeNode*      samplerNode = (&(*sampler).second);
+    const TreeNode*      tempNode    = samplerNode->GetChild("input");
+    if(tempNode)
     {
       animationSamplerInfo.input = tempNode->GetInteger();
     }
 
-    tempNode = samplerNode->GetChild( "output" );
-    if( tempNode )
+    tempNode = samplerNode->GetChild("output");
+    if(tempNode)
     {
       animationSamplerInfo.output = tempNode->GetInteger();
     }
 
-    tempNode = samplerNode->GetChild( "interpolation" );
-    if( tempNode )
+    tempNode = samplerNode->GetChild("interpolation");
+    if(tempNode)
     {
-      ReadString( tempNode, animationSamplerInfo.interpolation );
+      ReadString(tempNode, animationSamplerInfo.interpolation);
     }
 
-    animationInfo.samplerArray.push_back( animationSamplerInfo );
+    animationInfo.samplerArray.push_back(animationSamplerInfo);
   }
 
   return true;
 }
 
-}//namespace Gltf
+} //namespace Gltf
 
-}//namespace Internal
+} //namespace Internal
 
-}//namespace Toolkit
+} //namespace Toolkit
 
-}//namespace Dali
+} //namespace Dali