Jelajahi Sumber

Merge remote-tracking branch 'upstream/master'

nockawa 9 tahun lalu
induk
melakukan
c47c4f0270
100 mengubah file dengan 6018 tambahan dan 4356 penghapusan
  1. 84 78
      Exporters/3ds Max/BabylonExport.Entities/BabylonExport.Entities.csproj
  2. 1 56
      Exporters/3ds Max/BabylonExport.Entities/BabylonMaterial.cs
  3. 162 0
      Exporters/3ds Max/BabylonExport.Entities/BabylonPBRMaterial.cs
  4. 24 0
      Exporters/3ds Max/BabylonExport.Entities/BabylonProducer.cs
  5. 9 0
      Exporters/3ds Max/BabylonExport.Entities/BabylonScene.cs
  6. 72 0
      Exporters/3ds Max/BabylonExport.Entities/BabylonStandardMaterial.cs
  7. TEMPAT SAMPAH
      Exporters/Unity 5/Unity3D2Babylon/BabylonExport.Entities.dll
  8. 25 23
      Exporters/Unity 5/Unity3D2Babylon/ExportationOptions.cs
  9. 165 136
      Exporters/Unity 5/Unity3D2Babylon/ExporterWindow.cs
  10. 143 143
      Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Animations.cs
  11. 48 48
      Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Cameras.cs
  12. 102 97
      Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Lights.cs
  13. 346 284
      Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Materials.cs
  14. 244 291
      Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Meshes.cs
  15. 171 229
      Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.cs
  16. 25 25
      Exporters/Unity 5/Unity3D2Babylon/SerializableVector3.cs
  17. 53 53
      Exporters/Unity 5/Unity3D2Babylon/Tools.cs
  18. 180 0
      Exporters/Unity 5/Unity3D2Babylon/WebServer.cs
  19. 2 1
      Tools/Gulp/config.json
  20. 25 24
      dist/preview release/babylon.core.js
  21. 2336 2068
      dist/preview release/babylon.d.ts
  22. 33 30
      dist/preview release/babylon.js
  23. 1572 317
      dist/preview release/babylon.max.js
  24. 33 30
      dist/preview release/babylon.noworker.js
  25. 4 0
      dist/preview release/what's new.md
  26. 0 18
      materialsLibrary/config.json
  27. 0 3
      materialsLibrary/dist/babylon.pbrMaterial.min.js
  28. 0 232
      materialsLibrary/test/add/addpbr.js
  29. 1 8
      materialsLibrary/test/index.html
  30. 1 1
      src/Actions/babylon.action.js
  31. 2 2
      src/Actions/babylon.actionManager.js
  32. 4 4
      src/Actions/babylon.condition.js
  33. 12 12
      src/Actions/babylon.directActions.js
  34. 1 1
      src/Actions/babylon.interpolateValueAction.js
  35. 1 1
      src/Animations/babylon.animatable.js
  36. 4 4
      src/Animations/babylon.animation.js
  37. 13 13
      src/Animations/babylon.easing.js
  38. 1 1
      src/Audio/babylon.analyser.js
  39. 1 1
      src/Audio/babylon.audioEngine.js
  40. 1 1
      src/Audio/babylon.sound.js
  41. 1 1
      src/Audio/babylon.soundtrack.js
  42. 1 1
      src/Bones/babylon.bone.js
  43. 1 1
      src/Bones/babylon.skeleton.js
  44. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.gamepad.js
  45. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.keyboard.js
  46. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.mousewheel.js
  47. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.js
  48. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.vrdeviceorientation.js
  49. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.js
  50. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.gamepad.js
  51. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.keyboard.js
  52. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.mouse.js
  53. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.touch.js
  54. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.virtualjoystick.js
  55. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.vrdeviceorientation.js
  56. 1 1
      src/Cameras/VR/babylon.vrCameraMetrics.js
  57. 2 2
      src/Cameras/VR/babylon.vrDeviceOrientationCamera.js
  58. 1 1
      src/Cameras/VR/babylon.webVRCamera.js
  59. 1 1
      src/Cameras/babylon.arcRotateCamera.js
  60. 1 1
      src/Cameras/babylon.arcRotateCameraInputsManager.js
  61. 1 1
      src/Cameras/babylon.camera.js
  62. 2 1
      src/Cameras/babylon.cameraInputsManager.js
  63. 1 0
      src/Cameras/babylon.cameraInputsManager.ts
  64. 1 1
      src/Cameras/babylon.deviceOrientationCamera.js
  65. 2 2
      src/Cameras/babylon.followCamera.js
  66. 1 1
      src/Cameras/babylon.freeCamera.js
  67. 1 1
      src/Cameras/babylon.freeCameraInputsManager.js
  68. 1 1
      src/Cameras/babylon.gamepadCamera.js
  69. 8 8
      src/Cameras/babylon.stereoscopicCameras.js
  70. 1 1
      src/Cameras/babylon.targetCamera.js
  71. 1 1
      src/Cameras/babylon.touchCamera.js
  72. 1 1
      src/Cameras/babylon.universalCamera.js
  73. 1 1
      src/Cameras/babylon.virtualJoysticksCamera.js
  74. 1 1
      src/Collisions/babylon.collider.js
  75. 2 2
      src/Collisions/babylon.collisionCoordinator.js
  76. 3 3
      src/Collisions/babylon.collisionWorker.js
  77. 2 2
      src/Collisions/babylon.pickingInfo.js
  78. 1 1
      src/Culling/Octrees/babylon.octree.js
  79. 1 1
      src/Culling/Octrees/babylon.octreeBlock.js
  80. 1 1
      src/Culling/babylon.boundingBox.js
  81. 1 1
      src/Culling/babylon.boundingInfo.js
  82. 1 1
      src/Culling/babylon.boundingSphere.js
  83. 1 1
      src/Culling/babylon.ray.js
  84. 4 3
      src/Debug/babylon.debugLayer.js
  85. 43 42
      src/Debug/babylon.debugLayer.ts
  86. 1 1
      src/Debug/babylon.skeletonViewer.js
  87. 1 1
      src/Layer/babylon.layer.js
  88. 1 1
      src/LensFlare/babylon.lensFlare.js
  89. 1 1
      src/LensFlare/babylon.lensFlareSystem.js
  90. 1 1
      src/Lights/Shadows/babylon.shadowGenerator.js
  91. 1 1
      src/Lights/babylon.directionalLight.js
  92. 1 1
      src/Lights/babylon.hemisphericLight.js
  93. 1 1
      src/Lights/babylon.light.js
  94. 2 2
      src/Lights/babylon.pointLight.js
  95. 1 1
      src/Lights/babylon.pointLight.ts
  96. 1 1
      src/Lights/babylon.spotLight.js
  97. 0 2
      src/Loading/Plugins/babylon.babylonFileLoader.js
  98. 0 2
      src/Loading/Plugins/babylon.babylonFileLoader.ts
  99. 1 5
      src/Loading/babylon.sceneLoader.js
  100. 0 0
      src/Loading/babylon.sceneLoader.ts

+ 84 - 78
Exporters/3ds Max/BabylonExport.Entities/BabylonExport.Entities.csproj

@@ -1,79 +1,85 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{6150965A-658C-4263-89AD-4F980EB0675D}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>BabylonExport.Entities</RootNamespace>
-    <AssemblyName>BabylonExport.Entities</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <SccProjectName>SAK</SccProjectName>
-    <SccLocalPath>SAK</SccLocalPath>
-    <SccAuxPath>SAK</SccAuxPath>
-    <SccProvider>SAK</SccProvider>
-    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Runtime.Serialization" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="BabylonActions.cs" />
-    <Compile Include="BabylonAnimation.cs" />
-    <Compile Include="BabylonAnimationKey.cs" />
-    <Compile Include="BabylonBone.cs" />
-    <Compile Include="BabylonCamera.cs" />
-    <Compile Include="BabylonFresnelParameters.cs" />
-    <Compile Include="BabylonIAnimatable.cs" />
-    <Compile Include="BabylonLensFlare.cs" />
-    <Compile Include="BabylonLensFlareSystem.cs" />
-    <Compile Include="BabylonLight.cs" />
-    <Compile Include="BabylonMaterial.cs" />
-    <Compile Include="BabylonAbstractMesh.cs" />
-    <Compile Include="BabylonMesh.cs" />
-    <Compile Include="BabylonMultiMaterial.cs" />
-    <Compile Include="BabylonParticleSystem.cs" />
-    <Compile Include="BabylonScene.cs" />
-    <Compile Include="BabylonShadowGenerator.cs" />
-    <Compile Include="BabylonSkeleton.cs" />
-    <Compile Include="BabylonSound.cs" />
-    <Compile Include="BabylonSubMesh.cs" />
-    <Compile Include="BabylonTexture.cs" />
-    <Compile Include="BabylonVector3.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{6150965A-658C-4263-89AD-4F980EB0675D}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>BabylonExport.Entities</RootNamespace>
+    <AssemblyName>BabylonExport.Entities</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SccProjectName>SAK</SccProjectName>
+    <SccLocalPath>SAK</SccLocalPath>
+    <SccAuxPath>SAK</SccAuxPath>
+    <SccProvider>SAK</SccProvider>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="BabylonActions.cs" />
+    <Compile Include="BabylonAnimation.cs" />
+    <Compile Include="BabylonAnimationKey.cs" />
+    <Compile Include="BabylonBone.cs" />
+    <Compile Include="BabylonCamera.cs" />
+    <Compile Include="BabylonFresnelParameters.cs" />
+    <Compile Include="BabylonIAnimatable.cs" />
+    <Compile Include="BabylonLensFlare.cs" />
+    <Compile Include="BabylonLensFlareSystem.cs" />
+    <Compile Include="BabylonLight.cs" />
+    <Compile Include="BabylonMaterial.cs" />
+    <Compile Include="BabylonPBRMaterial.cs" />
+    <Compile Include="BabylonStandardMaterial.cs" />
+    <Compile Include="BabylonAbstractMesh.cs" />
+    <Compile Include="BabylonMesh.cs" />
+    <Compile Include="BabylonMultiMaterial.cs" />
+    <Compile Include="BabylonParticleSystem.cs" />
+    <Compile Include="BabylonProducer.cs" />
+    <Compile Include="BabylonScene.cs" />
+    <Compile Include="BabylonShadowGenerator.cs" />
+    <Compile Include="BabylonSkeleton.cs" />
+    <Compile Include="BabylonSound.cs" />
+    <Compile Include="BabylonSubMesh.cs" />
+    <Compile Include="BabylonTexture.cs" />
+    <Compile Include="BabylonVector3.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
 </Project>

+ 1 - 56
Exporters/3ds Max/BabylonExport.Entities/BabylonMaterial.cs

@@ -17,68 +17,13 @@ namespace BabylonExport.Entities
         public bool wireframe { get; set; }
 
         [DataMember]
-        public float[] ambient { get; set; }
-
-        [DataMember]
-        public float[] diffuse { get; set; }
-
-        [DataMember]
-        public float[] specular { get; set; }
-
-        [DataMember]
-        public float[] emissive { get; set; }
-
-        [DataMember]
-        public float specularPower { get; set; }
-
-        [DataMember]
         public float alpha { get; set; }
 
-        [DataMember]
-        public BabylonTexture diffuseTexture { get; set; }
-
-        [DataMember]
-        public BabylonFresnelParameters diffuseFresnelParameters { get; set; }
-
-        [DataMember]
-        public BabylonTexture ambientTexture { get; set; }
-
-        [DataMember]
-        public BabylonTexture opacityTexture { get; set; }
-
-        [DataMember]
-        public BabylonFresnelParameters opacityFresnelParameters { get; set; }
-
-        [DataMember]
-        public BabylonTexture reflectionTexture { get; set; }
-
-        [DataMember]
-        public BabylonFresnelParameters reflectionFresnelParameters { get; set; }
-
-        [DataMember]
-        public BabylonTexture emissiveTexture { get; set; }
-        [DataMember]
-        public BabylonTexture lightmapTexture { get; set; }
-        [DataMember]
-        public bool useLightmapAsShadowmap { get; set; }
-
-        [DataMember]
-        public BabylonFresnelParameters emissiveFresnelParameters { get; set; }
-
-        [DataMember]
-        public BabylonTexture specularTexture { get; set; }
-
-        [DataMember]
-        public BabylonTexture bumpTexture { get; set; }
 
         public BabylonMaterial()
         {
             backFaceCulling = true;
-            ambient = new[] {1.0f, 1.0f, 1.0f};
-            diffuse = new[] { 1.0f, 1.0f, 1.0f };
-            specular = new[] { 1.0f, 1.0f, 1.0f };
-            emissive = new[] { 0f, 0f, 0f };
-            specularPower = 64;
+
             alpha = 1.0f;
         }
     }

+ 162 - 0
Exporters/3ds Max/BabylonExport.Entities/BabylonPBRMaterial.cs

@@ -0,0 +1,162 @@
+using System.Runtime.Serialization;
+namespace BabylonExport.Entities
+{
+    [DataContract]
+    public class BabylonPBRMaterial : BabylonMaterial
+    {
+        [DataMember]
+        public string customType { get; private set; }
+        
+        [DataMember]
+        public float directIntensity { get; set; }
+
+        [DataMember]
+        public float emissiveIntensity { get; set; }
+
+        [DataMember]
+        public float environmentIntensity { get; set; }
+
+        [DataMember]
+        public float specularIntensity { get; set; }
+
+        [DataMember]
+        public float cameraExposure { get; set; }
+
+        [DataMember]
+        public float cameraContrast { get; set; }
+
+        [DataMember]
+        public float microSurface { get; set; }
+
+        [DataMember]
+        public float overloadedShadowIntensity { get; set; }
+
+        [DataMember]
+        public float overloadedShadeIntensity { get; set; }
+
+        [DataMember]
+        public float overloadedAmbientIntensity { get; set; }
+
+        [DataMember]
+        public float overloadedAlbedoIntensity { get; set; }
+
+        [DataMember]
+        public float overloadedReflectivityIntensity { get; set; }
+
+        [DataMember]
+        public float overloadedEmissiveIntensity { get; set; }
+
+        [DataMember]
+        public float overloadedAmbient { get; set; }
+
+        [DataMember]
+        public float overloadedAlbedo { get; set; }
+
+        [DataMember]
+        public float overloadedReflectivity { get; set; }
+
+        [DataMember]
+        public float overloadedEmissive { get; set; }
+
+        [DataMember]
+        public float overloadedReflection { get; set; }
+
+        [DataMember]
+        public float overloadedMicroSurface { get; set; }
+
+        [DataMember]
+        public float overloadedMicroSurfaceIntensity { get; set; }
+
+        [DataMember]
+        public float overloadedReflectionIntensity { get; set; }
+
+        [DataMember]
+        public BabylonTexture albedoTexture { get; set; }
+
+        [DataMember]
+        public BabylonTexture ambientTexture { get; set; }
+
+        [DataMember]
+        public BabylonTexture opacityTexture { get; set; }
+
+        [DataMember]
+        public BabylonTexture reflectionTexture { get; set; }
+
+        [DataMember]
+        public BabylonTexture emissiveTexture { get; set; }
+
+        [DataMember]
+        public BabylonTexture reflectivityTexture { get; set; }
+
+        [DataMember]
+        public BabylonTexture bumpTexture { get; set; }
+
+        [DataMember]
+        public BabylonTexture lightmapTexture { get; set; }
+
+        [DataMember]
+        public bool useLightmapAsShadowmap { get; set; }
+
+        [DataMember]
+        public BabylonTexture refractionTexture { get; set; }
+
+        [DataMember]
+        public float[] ambientColor { get; set; }
+
+        [DataMember]
+        public float[] albedoColor { get; set; }
+
+        [DataMember]
+        public float[] reflectivityColor { get; set; }
+
+        [DataMember]
+        public float[] reflectionColor { get; set; }
+
+        [DataMember]
+        public float[] emissiveColor { get; set; }
+
+        [DataMember]
+        public bool useAlphaFromAlbedoTexture { get; set; }
+
+        [DataMember]
+        public bool useEmissiveAsIllumination { get; set; }
+
+        [DataMember]
+        public bool useMicroSurfaceFromReflectivityMapAlpha { get; set; }
+
+        [DataMember]
+        public bool useSpecularOverAlpha { get; set; }
+
+        [DataMember]
+        public float indexOfRefraction { get; set; }
+
+        [DataMember]
+        public bool invertRefractionY { get; set; }
+
+        [DataMember]
+        public BabylonFresnelParameters emissiveFresnelParameters { get; set; }
+
+        [DataMember]
+        public BabylonFresnelParameters opacityFresnelParameters { get; set; }
+
+        public BabylonPBRMaterial(): base()
+        {
+            customType = "BABYLON.PBRMaterial";
+
+            directIntensity = 1.0f;
+            emissiveIntensity = 1.0f;
+            environmentIntensity = 1.0f;
+            specularIntensity = 1.0f;
+            cameraExposure = 1.0f;
+            cameraContrast = 1.0f;
+
+            overloadedShadowIntensity = 1.0f;
+            overloadedShadeIntensity = 1.0f;
+
+            ambientColor = new[] { 0f, 0f, 0f };
+            reflectionColor = new[] { 0f, 0f, 0f };
+            emissiveColor = new[] { 0f, 0f, 0f };
+        }
+    }
+}
+;

+ 24 - 0
Exporters/3ds Max/BabylonExport.Entities/BabylonProducer.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace BabylonExport.Entities
+{
+    [DataContract]
+    public class BabylonProducer
+    {
+        [DataMember]
+        public string name { get; set; }
+
+        [DataMember]
+        public string version { get; set; }
+
+        [DataMember]
+        public string exporter_version { get; set; }
+
+        [DataMember]
+        public string file { get; set; }
+    }
+}

+ 9 - 0
Exporters/3ds Max/BabylonExport.Entities/BabylonScene.cs

@@ -9,6 +9,9 @@ namespace BabylonExport.Entities
     public class BabylonScene
     {
         [DataMember]
+        public BabylonProducer producer { get; set; }
+
+        [DataMember]
         public bool autoClear { get; set; }
 
         [DataMember]
@@ -34,6 +37,12 @@ namespace BabylonExport.Entities
 
         [DataMember]
         public float[] gravity { get; set; }
+        
+        [DataMember]
+        public bool physicsEnabled { get; set; }
+
+        [DataMember]
+        public float[] physicsGravity { get; set; }
 
         [DataMember]
         public BabylonCamera[] cameras { get; set; }

+ 72 - 0
Exporters/3ds Max/BabylonExport.Entities/BabylonStandardMaterial.cs

@@ -0,0 +1,72 @@
+using System.Runtime.Serialization;
+namespace BabylonExport.Entities
+{
+    [DataContract]
+    public class BabylonStandardMaterial: BabylonMaterial
+    {
+        [DataMember]
+        public float[] ambient { get; set; }
+
+        [DataMember]
+        public float[] diffuse { get; set; }
+
+        [DataMember]
+        public float[] specular { get; set; }
+
+        [DataMember]
+        public float[] emissive { get; set; }
+
+        [DataMember]
+        public float specularPower { get; set; }
+
+        [DataMember]
+        public BabylonTexture diffuseTexture { get; set; }
+
+        [DataMember]
+        public BabylonFresnelParameters diffuseFresnelParameters { get; set; }
+
+        [DataMember]
+        public BabylonTexture ambientTexture { get; set; }
+
+        [DataMember]
+        public BabylonTexture opacityTexture { get; set; }
+
+        [DataMember]
+        public BabylonFresnelParameters opacityFresnelParameters { get; set; }
+
+        [DataMember]
+        public BabylonTexture reflectionTexture { get; set; }
+
+        [DataMember]
+        public BabylonFresnelParameters reflectionFresnelParameters { get; set; }
+
+        [DataMember]
+        public BabylonTexture emissiveTexture { get; set; }
+        [DataMember]
+        public BabylonTexture lightmapTexture { get; set; }
+        [DataMember]
+        public bool useLightmapAsShadowmap { get; set; }
+
+        [DataMember]
+        public BabylonFresnelParameters emissiveFresnelParameters { get; set; }
+
+        [DataMember]
+        public BabylonTexture specularTexture { get; set; }
+
+        [DataMember]
+        public BabylonTexture bumpTexture { get; set; }
+
+        [DataMember]
+        public bool useSpecularOverAlpha { get; set; }
+
+        public BabylonStandardMaterial() : base()
+        {
+            ambient = new[] {1.0f, 1.0f, 1.0f};
+            diffuse = new[] { 1.0f, 1.0f, 1.0f };
+            specular = new[] { 1.0f, 1.0f, 1.0f };
+            emissive = new[] { 0f, 0f, 0f };
+            specularPower = 64;
+            useSpecularOverAlpha = true;
+        }
+    }
+}

TEMPAT SAMPAH
Exporters/Unity 5/Unity3D2Babylon/BabylonExport.Entities.dll


+ 25 - 23
Exporters/Unity 5/Unity3D2Babylon/ExportationOptions.cs

@@ -1,23 +1,25 @@
-using System;
-using UnityEngine;
-
-namespace Unity3D2Babylon
-{
-    public class ExportationOptions
-    {
-        public string DefaultFolder { get; set; }
-        public float ReflectionDefaultLevel { get; set; }
-        public bool ExportCollisions { get; set; }
-        public SerializableVector3 CameraEllipsoid { get; set; }
-        public SerializableVector3 Gravity { get; set; }
-
-        public ExportationOptions()
-        {
-            DefaultFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
-            ReflectionDefaultLevel = 0.3f;
-            ExportCollisions = false;
-            CameraEllipsoid = new Vector3(0.5f, 1.0f, 0.5f);
-            Gravity = new Vector3(0, -0.9f, 0);
-        }
-    }
-}
+using System;
+using UnityEngine;
+
+namespace Unity3D2Babylon
+{
+    public class ExportationOptions
+    {
+        public string DefaultFolder { get; set; }
+        public float ReflectionDefaultLevel { get; set; }
+        public bool ExportCollisions { get; set; }
+        public bool ExportPhysics { get; set; }
+        public SerializableVector3 CameraEllipsoid { get; set; }
+        public SerializableVector3 Gravity { get; set; }
+
+        public ExportationOptions()
+        {
+            DefaultFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
+            ReflectionDefaultLevel = 0.3f;
+            ExportCollisions = false;
+            ExportPhysics = false;
+            CameraEllipsoid = new Vector3(0.5f, 1.0f, 0.5f);
+            Gravity = new Vector3(0, -0.9f, 0);
+        }
+    }
+}

+ 165 - 136
Exporters/Unity 5/Unity3D2Babylon/ExporterWindow.cs

@@ -1,137 +1,166 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using JsonFx;
-using UnityEditor;
-using UnityEngine;
-using JsonFx.Json;
-
-namespace Unity3D2Babylon
-{
-    public class ExporterWindow : EditorWindow
-    {
-        private static readonly List<string> logs = new List<string>();
-        Vector2 scrollPos;
-
-        ExportationOptions exportationOptions;
-
-        public static void ReportProgress(float value, string message = "")
-        {
-            EditorUtility.DisplayProgressBar("Babylon.js", message, value);
-
-            if (!string.IsNullOrEmpty(message))
-            {
-                logs.Add(message);
-            }
-        }
-
-        public static void ShowMessage(string message, string title = "Babylon.js")
-        {
-            EditorUtility.DisplayDialog(title, message, "OK");
-        }
-
-        [MenuItem("BabylonJS/Export to .babylon")]
-        public static void Init()
-        {
-            var window = (ExporterWindow)GetWindow(typeof(ExporterWindow));
-            window.Initialize();
-        }
-
-        void Initialize()
-        {
-            titleContent.text = "Babylon.js";
-        }
-
-        void OnGUI()
-        {
-            if (exportationOptions == null)
-            {
-                exportationOptions = new ExportationOptions();
-
-                if (File.Exists("Unity3D2Babylon.ini"))
-                {
-                    var readText = File.ReadAllText("Unity3D2Babylon.ini");
-                    var jsReader = new JsonReader();
-                    exportationOptions = jsReader.Read<ExportationOptions>(readText);
-                }
-            }
-
-            GUILayout.Label("Exportation options", EditorStyles.boldLabel);
-            exportationOptions.ReflectionDefaultLevel = EditorGUILayout.Slider("Reflection default level", exportationOptions.ReflectionDefaultLevel, 0, 1.0f);
-
-            GUILayout.Label("Collisions options", EditorStyles.boldLabel);
-            exportationOptions.ExportCollisions = EditorGUILayout.Toggle("Collisions", exportationOptions.ExportCollisions);
-            exportationOptions.CameraEllipsoid = EditorGUILayout.Vector3Field("Camera's Ellipsoid:", exportationOptions.CameraEllipsoid);
-            exportationOptions.Gravity = EditorGUILayout.Vector3Field("Gravity:", exportationOptions.Gravity);
-
-            EditorGUILayout.Space();
-            EditorGUILayout.Space();
-
-            if (GUILayout.Button("Export"))
-            {
-                Export();
-            }
-
-            EditorGUILayout.Space();
-
-            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
-
-            foreach (var log in logs)
-            {
-                var bold = log.StartsWith("*");
-
-                GUILayout.Label(bold ? log.Remove(0, 1) : log, bold ? (EditorStyles.boldLabel) : EditorStyles.label);
-            }
-            EditorGUILayout.EndScrollView();
-
-            Repaint();
-        }
-
-        public void Export()
-        {
-            try
-            {
-                int pos = EditorApplication.currentScene.LastIndexOf("/", StringComparison.Ordinal);
-                string sceneName = EditorApplication.currentScene.Substring(pos + 1);
-
-                exportationOptions.DefaultFolder = EditorUtility.SaveFolderPanel("Please select a folder", exportationOptions.DefaultFolder, "");
-
-                if (string.IsNullOrEmpty(exportationOptions.DefaultFolder))
-                {
-                    return;
-                }
-
-                Stopwatch watch = new Stopwatch();
-
-                watch.Start();
-
-                var jsWriter = new JsonWriter();                
-                File.WriteAllText("Unity3D2Babylon.ini", jsWriter.Write(exportationOptions));
-                logs.Clear();
-
-                ReportProgress(0);
-
-                var sceneBuilder = new SceneBuilder(exportationOptions.DefaultFolder, sceneName, exportationOptions);
-
-                sceneBuilder.ConvertFromUnity();
-
-                ReportProgress(1, "Generating output file");
-                sceneBuilder.WriteToBabylonFile();
-
-                watch.Stop();
-                ReportProgress(1, string.Format("Exportation done in {0:0.00}s", watch.Elapsed.TotalSeconds));
-                EditorUtility.ClearProgressBar();
-
-                sceneBuilder.GenerateStatus(logs);
-
-                ShowMessage("Exportation done");
-            }
-            catch (Exception ex)
-            {
-                EditorUtility.ClearProgressBar();
-                ShowMessage("A problem occurred: " + ex.Message + ex.StackTrace, "Error");
-            }
-        }
-    }
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using JsonFx;
+using UnityEditor;
+using UnityEngine;
+using JsonFx.Json;
+using UnityEditor.SceneManagement;
+
+namespace Unity3D2Babylon
+{
+    public class ExporterWindow : EditorWindow
+    {
+        private static readonly List<string> logs = new List<string>();
+        Vector2 scrollPos;
+
+        ExportationOptions exportationOptions;
+
+        public static void ReportProgress(float value, string message = "")
+        {
+            EditorUtility.DisplayProgressBar("Babylon.js", message, value);
+
+            if (!string.IsNullOrEmpty(message))
+            {
+                logs.Add(message);
+            }
+        }
+
+        public static void ShowMessage(string message, string title = "Babylon.js")
+        {
+            EditorUtility.DisplayDialog(title, message, "OK");
+        }
+
+        [MenuItem("BabylonJS/Export to .babylon")]
+        public static void Init()
+        {
+            var window = (ExporterWindow)GetWindow(typeof(ExporterWindow));
+            window.Initialize();
+        }
+
+        void Initialize()
+        {
+            titleContent = new GUIContent("Babylon.js");
+        }
+
+        void OnGUI()
+        {
+            if (exportationOptions == null)
+            {
+                exportationOptions = new ExportationOptions();
+
+                if (File.Exists("Unity3D2Babylon.ini"))
+                {
+                    var readText = File.ReadAllText("Unity3D2Babylon.ini");
+                    var jsReader = new JsonReader();
+                    exportationOptions = jsReader.Read<ExportationOptions>(readText);
+                }
+            }
+
+            GUILayout.Label("Exportation options", EditorStyles.boldLabel);
+            exportationOptions.ReflectionDefaultLevel = EditorGUILayout.Slider("Reflection default level", exportationOptions.ReflectionDefaultLevel, 0, 1.0f);
+
+            EditorGUILayout.Space();
+            GUILayout.Label("Collisions options", EditorStyles.boldLabel);
+            exportationOptions.ExportCollisions = EditorGUILayout.Toggle("Collisions", exportationOptions.ExportCollisions);
+
+            EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
+            GUILayout.Label("Camera's Ellipsoid");
+            exportationOptions.CameraEllipsoid = EditorGUILayout.Vector3Field("", exportationOptions.CameraEllipsoid, GUILayout.ExpandWidth(false));
+            EditorGUILayout.EndHorizontal();
+            GUILayout.Space(-16);
+            EditorGUILayout.BeginHorizontal();
+            GUILayout.Label("Gravity");
+            exportationOptions.Gravity = EditorGUILayout.Vector3Field("", exportationOptions.Gravity, GUILayout.ExpandWidth(false));
+            EditorGUILayout.EndHorizontal();
+            GUILayout.Space(-16);
+            EditorGUILayout.Space();
+            GUILayout.Label("Physics options", EditorStyles.boldLabel);
+            exportationOptions.ExportPhysics = EditorGUILayout.Toggle("Physics", exportationOptions.ExportPhysics);
+
+            EditorGUILayout.Space();
+            EditorGUILayout.Space();
+
+            if (GUILayout.Button("Export"))
+            {
+                Export(false);
+            }
+
+            if (WebServer.IsSupported)
+            {
+                if (GUILayout.Button("Export & Run"))
+                {
+                    Export(true);
+                }
+            }
+
+            EditorGUILayout.Space();
+
+            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
+
+            foreach (var log in logs)
+            {
+                var bold = log.StartsWith("*");
+
+                GUILayout.Label(bold ? log.Remove(0, 1) : log, bold ? (EditorStyles.boldLabel) : EditorStyles.label);
+            }
+            EditorGUILayout.EndScrollView();
+
+            Repaint();
+        }
+
+        public void Export(bool run)
+        {
+            try
+            {
+                string sceneName = EditorSceneManager.GetActiveScene().name;
+
+                exportationOptions.DefaultFolder = EditorUtility.SaveFolderPanel("Please select a folder", exportationOptions.DefaultFolder, "");
+
+                if (string.IsNullOrEmpty(exportationOptions.DefaultFolder))
+                {
+                    return;
+                }
+
+                Stopwatch watch = new Stopwatch();
+
+                watch.Start();
+
+                var jsWriter = new JsonWriter();
+                File.WriteAllText("Unity3D2Babylon.ini", jsWriter.Write(exportationOptions));
+                logs.Clear();
+
+                ReportProgress(0);
+
+                var sceneBuilder = new SceneBuilder(exportationOptions.DefaultFolder, sceneName, exportationOptions);
+
+                sceneBuilder.ConvertFromUnity();
+
+                ReportProgress(1, "Generating output file");
+                var outputFile = sceneBuilder.WriteToBabylonFile();
+
+                watch.Stop();
+                ReportProgress(1, string.Format("Exportation done in {0:0.00}s", watch.Elapsed.TotalSeconds));
+                EditorUtility.ClearProgressBar();
+
+                sceneBuilder.GenerateStatus(logs);
+
+                ShowMessage("Exportation done");
+
+                if (run)
+                {
+                    WebServer.SceneFolder = Path.GetDirectoryName(outputFile);
+                    WebServer.SceneFilename = Path.GetFileName(outputFile);
+
+                    Process.Start("http://localhost:" + WebServer.Port);
+                }
+            }
+            catch (Exception ex)
+            {
+                EditorUtility.ClearProgressBar();
+                ShowMessage("A problem occurred: " + ex.Message + ex.StackTrace, "Error");
+            }
+        }
+    }
 }

+ 143 - 143
Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Animations.cs

@@ -1,143 +1,143 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using BabylonExport.Entities;
-using UnityEditor;
-using UnityEditor.Animations;
-using UnityEngine;
-
-namespace Unity3D2Babylon
-{
-    partial class SceneBuilder
-    {
-        private static void ExportAnimations(Transform transform, BabylonIAnimatable animatable)
-        {
-            var animator = transform.gameObject.GetComponent<Animator>();
-            if (animator != null)
-            {
-                AnimatorController ac = animator.runtimeAnimatorController as AnimatorController;
-                if (ac == null)
-                {
-                    return;
-                }
-                var layer = ac.layers[0];
-                if (layer == null)
-                {
-                    return;
-                }
-                AnimatorStateMachine sm = layer.stateMachine;
-                if (sm.states.Length > 0)
-                {
-                    var state = sm.states[0].state; // We only support the first one
-                    AnimationClip clip = state.motion as AnimationClip;
-                    if (clip != null)
-                    {
-                        ExportAnimationClip(clip, true, animatable);
-                    }
-                }
-            }
-            else
-            {
-                var animation = transform.gameObject.GetComponent<Animation>();
-                if (animation != null && animation.clip != null)
-                {
-                    ExportAnimationClip(animation.clip, animation.playAutomatically, animatable);
-                }
-            }
-        }
-
-        private static bool IsRotationQuaternionAnimated(BabylonIAnimatable animatable)
-        {
-            if (animatable.animations == null)
-            {
-                return false;
-            }
-
-            return animatable.animations.Any(animation => animation.property.Contains("rotationQuaternion"));
-        }
-
-        private static void ExportAnimationClip(AnimationClip clip, bool autoPlay, BabylonIAnimatable animatable)
-        {
-            var curveBindings = AnimationUtility.GetCurveBindings(clip);
-
-            var animations = new List<BabylonAnimation>();
-
-            var maxFrame = 0;
-
-            foreach (var binding in curveBindings)
-            {
-                var curve = AnimationUtility.GetEditorCurve(clip, binding);
-                string property;
-
-                switch (binding.propertyName)
-                {
-                    case "m_LocalPosition.x":
-                        property = "position.x";
-                        break;
-                    case "m_LocalPosition.y":
-                        property = "position.y";
-                        break;
-                    case "m_LocalPosition.z":
-                        property = "position.z";
-                        break;
-
-                    case "m_LocalRotation.x":
-                        property = "rotationQuaternion.x";
-                        break;
-                    case "m_LocalRotation.y":
-                        property = "rotationQuaternion.y";
-                        break;
-                    case "m_LocalRotation.z":
-                        property = "rotationQuaternion.z";
-                        break;
-                    case "m_LocalRotation.w":
-                        property = "rotationQuaternion.w";
-                        break;
-
-                    case "m_LocalScale.x":
-                        property = "scaling.x";
-                        break;
-                    case "m_LocalScale.y":
-                        property = "scaling.y";
-                        break;
-                    case "m_LocalScale.z":
-                        property = "scaling.z";
-                        break;
-                    default:
-                        continue;
-                }
-
-                var babylonAnimation = new BabylonAnimation
-                {
-                    dataType = (int)BabylonAnimation.DataType.Float,
-                    name = property + " animation",
-                    keys = curve.keys.Select(keyFrame => new BabylonAnimationKey
-                    {
-                        frame = (int)(keyFrame.time * clip.frameRate),
-                        values = new[] { keyFrame.value }
-                    }).ToArray(),
-                    framePerSecond = (int)clip.frameRate,
-                    loopBehavior = (int)BabylonAnimation.LoopBehavior.Cycle,
-                    property = property
-                };
-
-                maxFrame = Math.Max(babylonAnimation.keys.Last().frame, maxFrame);
-
-                animations.Add(babylonAnimation);
-            }
-
-            if (animations.Count > 0)
-            {
-                animatable.animations = animations.ToArray();
-                if (autoPlay)
-                {
-                    animatable.autoAnimate = true;
-                    animatable.autoAnimateFrom = 0;
-                    animatable.autoAnimateTo = maxFrame;
-                    animatable.autoAnimateLoop = clip.isLooping;
-                }
-            }
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using BabylonExport.Entities;
+using UnityEditor;
+using UnityEditor.Animations;
+using UnityEngine;
+
+namespace Unity3D2Babylon
+{
+    partial class SceneBuilder
+    {
+        private static void ExportAnimations(Transform transform, BabylonIAnimatable animatable)
+        {
+            var animator = transform.gameObject.GetComponent<Animator>();
+            if (animator != null)
+            {
+                AnimatorController ac = animator.runtimeAnimatorController as AnimatorController;
+                if (ac == null)
+                {
+                    return;
+                }
+                var layer = ac.layers[0];
+                if (layer == null)
+                {
+                    return;
+                }
+                AnimatorStateMachine sm = layer.stateMachine;
+                if (sm.states.Length > 0)
+                {
+                    var state = sm.states[0].state; // We only support the first one
+                    AnimationClip clip = state.motion as AnimationClip;
+                    if (clip != null)
+                    {
+                        ExportAnimationClip(clip, true, animatable);
+                    }
+                }
+            }
+            else
+            {
+                var animation = transform.gameObject.GetComponent<Animation>();
+                if (animation != null && animation.clip != null)
+                {
+                    ExportAnimationClip(animation.clip, animation.playAutomatically, animatable);
+                }
+            }
+        }
+
+        private static bool IsRotationQuaternionAnimated(BabylonIAnimatable animatable)
+        {
+            if (animatable.animations == null)
+            {
+                return false;
+            }
+
+            return animatable.animations.Any(animation => animation.property.Contains("rotationQuaternion"));
+        }
+
+        private static void ExportAnimationClip(AnimationClip clip, bool autoPlay, BabylonIAnimatable animatable)
+        {
+            var curveBindings = AnimationUtility.GetCurveBindings(clip);
+
+            var animations = new List<BabylonAnimation>();
+
+            var maxFrame = 0;
+
+            foreach (var binding in curveBindings)
+            {
+                var curve = AnimationUtility.GetEditorCurve(clip, binding);
+                string property;
+
+                switch (binding.propertyName)
+                {
+                    case "m_LocalPosition.x":
+                        property = "position.x";
+                        break;
+                    case "m_LocalPosition.y":
+                        property = "position.y";
+                        break;
+                    case "m_LocalPosition.z":
+                        property = "position.z";
+                        break;
+
+                    case "m_LocalRotation.x":
+                        property = "rotationQuaternion.x";
+                        break;
+                    case "m_LocalRotation.y":
+                        property = "rotationQuaternion.y";
+                        break;
+                    case "m_LocalRotation.z":
+                        property = "rotationQuaternion.z";
+                        break;
+                    case "m_LocalRotation.w":
+                        property = "rotationQuaternion.w";
+                        break;
+
+                    case "m_LocalScale.x":
+                        property = "scaling.x";
+                        break;
+                    case "m_LocalScale.y":
+                        property = "scaling.y";
+                        break;
+                    case "m_LocalScale.z":
+                        property = "scaling.z";
+                        break;
+                    default:
+                        continue;
+                }
+
+                var babylonAnimation = new BabylonAnimation
+                {
+                    dataType = (int)BabylonAnimation.DataType.Float,
+                    name = property + " animation",
+                    keys = curve.keys.Select(keyFrame => new BabylonAnimationKey
+                    {
+                        frame = (int)(keyFrame.time * clip.frameRate),
+                        values = new[] { keyFrame.value }
+                    }).ToArray(),
+                    framePerSecond = (int)clip.frameRate,
+                    loopBehavior = (int)BabylonAnimation.LoopBehavior.Cycle,
+                    property = property
+                };
+
+                maxFrame = Math.Max(babylonAnimation.keys.Last().frame, maxFrame);
+
+                animations.Add(babylonAnimation);
+            }
+
+            if (animations.Count > 0)
+            {
+                animatable.animations = animations.ToArray();
+                if (autoPlay)
+                {
+                    animatable.autoAnimate = true;
+                    animatable.autoAnimateFrom = 0;
+                    animatable.autoAnimateTo = maxFrame;
+                    animatable.autoAnimateLoop = clip.isLooping;
+                }
+            }
+        }
+    }
+}

+ 48 - 48
Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Cameras.cs

@@ -1,48 +1,48 @@
-using System;
-using BabylonExport.Entities;
-using UnityEngine;
-
-namespace Unity3D2Babylon
-{
-    partial class SceneBuilder
-    {
-        private void ConvertUnityCameraToBabylon(Camera camera, float progress)
-        {
-            ExporterWindow.ReportProgress(progress, "Exporting camera: " + camera.name);
-
-            BabylonCamera babylonCamera = new BabylonCamera
-            {
-                name = camera.name,
-                id = GetID(camera.gameObject),
-                fov = camera.fieldOfView*(float) Math.PI/180,
-                minZ = camera.nearClipPlane,
-                maxZ = camera.farClipPlane,
-                parentId = GetParentID(camera.transform),
-                position = camera.transform.localPosition.ToFloat()
-            };
-
-            var target = new Vector3(0, 0, 1);
-            var transformedTarget = camera.transform.TransformDirection(target);
-            babylonCamera.target = (camera.transform.position + transformedTarget).ToFloat();
-
-            babylonScene.CamerasList.Add(babylonCamera);
-
-            if (Camera.main == camera)
-            {
-                babylonScene.activeCameraID = babylonCamera.id;
-                babylonScene.clearColor = camera.backgroundColor.ToFloat();
-            }
-
-            // Animations
-            ExportAnimations(camera.transform, babylonCamera);
-
-            // Collisions
-            if (exportationOptions.ExportCollisions)
-            {
-                babylonCamera.checkCollisions = true;
-                babylonCamera.applyGravity = true;
-                babylonCamera.ellipsoid = exportationOptions.CameraEllipsoid.ToFloat();
-            }
-        }
-    }
-}
+using System;
+using BabylonExport.Entities;
+using UnityEngine;
+
+namespace Unity3D2Babylon
+{
+    partial class SceneBuilder
+    {
+        private void ConvertUnityCameraToBabylon(Camera camera, float progress)
+        {
+            ExporterWindow.ReportProgress(progress, "Exporting camera: " + camera.name);
+
+            BabylonCamera babylonCamera = new BabylonCamera
+            {
+                name = camera.name,
+                id = GetID(camera.gameObject),
+                fov = camera.fieldOfView*(float) Math.PI/180,
+                minZ = camera.nearClipPlane,
+                maxZ = camera.farClipPlane,
+                parentId = GetParentID(camera.transform),
+                position = camera.transform.localPosition.ToFloat()
+            };
+
+            var target = new Vector3(0, 0, 1);
+            var transformedTarget = camera.transform.TransformDirection(target);
+            babylonCamera.target = (camera.transform.position + transformedTarget).ToFloat();
+
+            babylonScene.CamerasList.Add(babylonCamera);
+
+            if (Camera.main == camera)
+            {
+                babylonScene.activeCameraID = babylonCamera.id;
+                babylonScene.clearColor = camera.backgroundColor.ToFloat();
+            }
+
+            // Animations
+            ExportAnimations(camera.transform, babylonCamera);
+
+            // Collisions
+            if (exportationOptions.ExportCollisions)
+            {
+                babylonCamera.checkCollisions = true;
+                babylonCamera.applyGravity = true;
+                babylonCamera.ellipsoid = exportationOptions.CameraEllipsoid.ToFloat();
+            }
+        }
+    }
+}

+ 102 - 97
Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Lights.cs

@@ -1,97 +1,102 @@
-using System;
-using System.Collections.Generic;
-using BabylonExport.Entities;
-using UnityEngine;
-using UnityEngine.Rendering;
-
-namespace Unity3D2Babylon
-{
-    partial class SceneBuilder
-    {
-        private void GenerateShadowsGenerator(Light light)
-        {
-            var generator = new BabylonShadowGenerator
-            {
-                lightId = GetID(light.gameObject),
-                usePoissonSampling = light.shadows == LightShadows.Soft,
-                mapSize = 256 + 256 * QualitySettings.GetQualityLevel(),
-                bias = light.shadowBias / 10.0f
-            };
-
-            var renderList = new List<string>();
-            foreach (var gameObject in gameObjects)
-            {
-                var meshFilter = gameObject.GetComponent<MeshFilter>();
-                var renderer = gameObject.GetComponent<Renderer>();
-                if (meshFilter != null && renderer.shadowCastingMode != ShadowCastingMode.Off)
-                {
-                    renderList.Add(GetID(gameObject));
-                    continue;
-                }
-
-                var skinnedMesh = gameObject.GetComponent<SkinnedMeshRenderer>();
-                if (skinnedMesh != null && renderer.shadowCastingMode != ShadowCastingMode.Off)
-                {
-                    renderList.Add(GetID(gameObject));
-                }
-            }
-
-            generator.renderList = renderList.ToArray();
-
-            babylonScene.ShadowGeneratorsList.Add(generator);
-        }
-
-        private void ConvertUnityLightToBabylon(Light light, float progress)
-        {
-            ExporterWindow.ReportProgress(progress, "Exporting light: " + light.name);
-
-            BabylonLight babylonLight = new BabylonLight
-            {
-                name = light.name,
-                id = GetID(light.gameObject),
-                parentId = GetParentID(light.transform)
-            };
-            
-            switch (light.type)
-            {
-                case LightType.Spot:
-                    babylonLight.type = 2;
-                    break;
-                case LightType.Directional:
-                    babylonLight.type = 1;
-                    break;
-                case LightType.Point:
-                    babylonLight.type = 0;
-                    babylonLight.range = light.range;
-                    break;
-                case LightType.Area:
-                    // TODO
-                    break;
-            }
-
-            babylonLight.position = light.transform.localPosition.ToFloat();
-
-            var direction = new Vector3(0, 0, 1);
-            var transformedDirection = light.transform.TransformDirection(direction);
-            babylonLight.direction = transformedDirection.ToFloat();
-
-            babylonLight.diffuse = light.color.ToFloat();
-
-            babylonLight.intensity = light.intensity;
-
-            babylonLight.angle = light.spotAngle * (float)Math.PI / 180;
-            babylonLight.exponent = 1.0f;
-
-            babylonScene.LightsList.Add(babylonLight);
-
-            // Animations
-            ExportAnimations(light.transform, babylonLight);
-
-            // Shadows
-            if ((light.type == LightType.Directional || light.type == LightType.Spot) && light.shadows != LightShadows.None)
-            {
-                GenerateShadowsGenerator(light);
-            }
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using BabylonExport.Entities;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+namespace Unity3D2Babylon
+{
+    partial class SceneBuilder
+    {
+        private void GenerateShadowsGenerator(Light light)
+        {
+            var generator = new BabylonShadowGenerator
+            {
+                lightId = GetID(light.gameObject),
+                usePoissonSampling = light.shadows == LightShadows.Soft,
+                mapSize = 256 + 256 * QualitySettings.GetQualityLevel(),
+                bias = light.shadowBias / 10.0f
+            };
+
+            var renderList = new List<string>();
+            foreach (var gameObject in gameObjects)
+            {
+                var meshFilter = gameObject.GetComponent<MeshFilter>();
+                var renderer = gameObject.GetComponent<Renderer>();
+                if (meshFilter != null && renderer != null && renderer.shadowCastingMode != ShadowCastingMode.Off)
+                {
+                    renderList.Add(GetID(gameObject));
+                    continue;
+                }
+
+                var skinnedMesh = gameObject.GetComponent<SkinnedMeshRenderer>();
+                if (skinnedMesh != null && renderer != null && renderer.shadowCastingMode != ShadowCastingMode.Off)
+                {
+                    renderList.Add(GetID(gameObject));
+                }
+            }
+
+            generator.renderList = renderList.ToArray();
+
+            babylonScene.ShadowGeneratorsList.Add(generator);
+        }
+
+        private void ConvertUnityLightToBabylon(Light light, float progress)
+        {
+            if (!light.isActiveAndEnabled || light.alreadyLightmapped)
+            {
+                return;
+            }
+
+            ExporterWindow.ReportProgress(progress, "Exporting light: " + light.name);
+
+            BabylonLight babylonLight = new BabylonLight
+            {
+                name = light.name,
+                id = GetID(light.gameObject),
+                parentId = GetParentID(light.transform)
+            };
+            
+            switch (light.type)
+            {
+                case LightType.Spot:
+                    babylonLight.type = 2;
+                    break;
+                case LightType.Directional:
+                    babylonLight.type = 1;
+                    break;
+                case LightType.Point:
+                    babylonLight.type = 0;
+                    babylonLight.range = light.range;
+                    break;
+                case LightType.Area:
+                    // TODO
+                    break;
+            }
+
+            babylonLight.position = light.transform.localPosition.ToFloat();
+
+            var direction = new Vector3(0, 0, 1);
+            var transformedDirection = light.transform.TransformDirection(direction);
+            babylonLight.direction = transformedDirection.ToFloat();
+
+            babylonLight.diffuse = light.color.ToFloat();
+
+            babylonLight.intensity = light.intensity;
+
+            babylonLight.angle = light.spotAngle * (float)Math.PI / 180;
+            babylonLight.exponent = 1.0f;
+
+            babylonScene.LightsList.Add(babylonLight);
+
+            // Animations
+            ExportAnimations(light.transform, babylonLight);
+
+            // Shadows
+            if ((light.type == LightType.Directional || light.type == LightType.Spot) && light.shadows != LightShadows.None)
+            {
+                GenerateShadowsGenerator(light);
+            }
+        }
+    }
+}

+ 346 - 284
Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Materials.cs

@@ -1,284 +1,346 @@
-using System;
-using System.IO;
-using BabylonExport.Entities;
-using UnityEditor;
-using UnityEngine;
-
-namespace Unity3D2Babylon
-{
-    partial class SceneBuilder
-    {
-        private void CopyTextureCube(string texturePath, Cubemap cubemap, BabylonTexture babylonTexture)
-        {
-            if (!babylonScene.AddTextureCube(texturePath))
-            {
-                return;
-            }
-
-            try
-            {
-                foreach (CubemapFace face in Enum.GetValues(typeof(CubemapFace)))
-                {
-                    var faceTexturePath = Path.Combine(babylonScene.OutputPath, Path.GetFileNameWithoutExtension(texturePath));
-
-                    switch (face)
-                    {
-                        case CubemapFace.PositiveX:
-                            faceTexturePath += "_px.jpg";
-                            break;
-                        case CubemapFace.NegativeX:
-                            faceTexturePath += "_nx.jpg";
-                            break;
-                        case CubemapFace.PositiveY:
-                            faceTexturePath += "_py.jpg";
-                            break;
-                        case CubemapFace.NegativeY:
-                            faceTexturePath += "_ny.jpg";
-                            break;
-                        case CubemapFace.PositiveZ:
-                            faceTexturePath += "_pz.jpg";
-                            break;
-                        case CubemapFace.NegativeZ:
-                            faceTexturePath += "_nz.jpg";
-                            break;
-                    }
-
-                    var tempTexture = new Texture2D(cubemap.width, cubemap.height, cubemap.format, false);
-
-                    tempTexture.SetPixels(cubemap.GetPixels(face));
-                    tempTexture.Apply();
-
-                    File.WriteAllBytes(faceTexturePath, tempTexture.EncodeToJPG());
-                }
-
-            }
-            catch (Exception ex)
-            {
-                Debug.LogException(ex);
-            }
-
-            var textureName = Path.GetFileNameWithoutExtension(texturePath);
-            babylonTexture.name = textureName;
-            babylonTexture.isCube = true;
-            babylonTexture.level = exportationOptions.ReflectionDefaultLevel;
-            babylonTexture.coordinatesMode = 3;
-        }
-
-        private void CopyTexture(string texturePath, Texture2D texture2D, BabylonTexture babylonTexture)
-        {
-            bool needToDelete = false;
-            var useJPG = !texture2D.alphaIsTransparency;
-
-            // Convert unsupported file extensions
-            if (texturePath.EndsWith(".psd") || texturePath.EndsWith(".tif") || texturePath.EndsWith(".exr"))
-            {
-                try
-                {
-                    // Change texture import settings to be able to read texture data
-                    var textureImporter = AssetImporter.GetAtPath(texturePath) as TextureImporter;
-                    var previousIsReadable = textureImporter.isReadable;
-                    var previousNormalMap = textureImporter.normalmap;
-                    var previousLightmap = textureImporter.lightmap;
-                    var previousConvertToNormalmap = textureImporter.convertToNormalmap;
-                    var previousTextureType = textureImporter.textureType;
-                    var previousGrayscaleToAlpha = textureImporter.grayscaleToAlpha;
-                    textureImporter.textureType = TextureImporterType.Advanced;
-                    textureImporter.isReadable = true;
-                    textureImporter.lightmap = false;
-                    textureImporter.normalmap = false;
-                    textureImporter.convertToNormalmap = false;
-                    textureImporter.grayscaleToAlpha = false;
-
-                    AssetDatabase.ImportAsset(texturePath);
-
-                    texturePath = Path.Combine(Path.GetTempPath(), Path.GetFileName(texturePath));
-                    var extension = useJPG ? ".jpg" : ".png";
-                    texturePath = texturePath.Replace(".psd", extension).Replace(".tif", extension).Replace(".exr", extension);
-
-                    var tempTexture = new Texture2D(texture2D.width, texture2D.height, TextureFormat.ARGB32, false);
-
-                    tempTexture.SetPixels32(texture2D.GetPixels32());
-                    tempTexture.Apply();
-
-                    File.WriteAllBytes(texturePath, useJPG ? tempTexture.EncodeToJPG() : tempTexture.EncodeToPNG());
-
-                    needToDelete = true;
-
-                    // Restore
-                    textureImporter.isReadable = previousIsReadable;
-                    textureImporter.normalmap = previousNormalMap;
-                    textureImporter.lightmap = previousLightmap;
-                    textureImporter.convertToNormalmap = previousConvertToNormalmap;
-                    textureImporter.textureType = previousTextureType;
-                    textureImporter.grayscaleToAlpha = previousGrayscaleToAlpha;
-                   
-                    AssetDatabase.ImportAsset(texturePath, ImportAssetOptions.ForceUpdate);
-                }
-                catch (Exception ex)
-                {
-                    Debug.LogException(ex);
-                }
-            }
-
-            var textureName = Path.GetFileName(texturePath);
-            babylonTexture.name = textureName;
-            babylonScene.AddTexture(texturePath);
-
-            if (needToDelete)
-            {
-                File.Delete(texturePath);
-            }
-        }
-
-        private BabylonMaterial DumpMaterial(Material material, Renderer renderer)
-        {
-            if (!materialsDictionary.ContainsKey(material.name))
-            {
-                var bMat = new BabylonMaterial
-                {
-                    name = material.name,
-                    id = Guid.NewGuid().ToString(),
-                    diffuse = new float[4],
-                    specular = new float[4]
-                };
-
-                bMat.diffuse[0] = 1.0f;
-                bMat.diffuse[1] = 1.0f;
-                bMat.diffuse[2] = 1.0f;
-                bMat.diffuse[3] = 1.0f;
-
-                if (material.HasProperty("_Color"))
-                {
-                    bMat.diffuse = material.color.ToFloat();
-                }
-
-                if (material.HasProperty("_SpecColor"))
-                {
-                    var specColor = material.GetColor("_SpecColor");
-                    bMat.specular = specColor.ToFloat();
-                }
-
-                if (material.HasProperty("_Shininess"))
-                {
-                    var specShininess = material.GetFloat("_Shininess");
-                    bMat.specularPower = specShininess * 128;
-                }
-
-                if (material.HasProperty("_Emission"))
-                {
-                    var emissiveColor = material.GetColor("_Emission");
-                    bMat.emissive = emissiveColor.ToFloat();
-                }
-
-                if (material.mainTexture)
-                {
-                    var mainTexturePath = AssetDatabase.GetAssetPath(material.mainTexture);
-                    bMat.diffuseTexture = new BabylonTexture
-                    {
-                        uScale = material.mainTextureScale.x,
-                        vScale = material.mainTextureScale.y,
-                        uOffset = material.mainTextureOffset.x,
-                        vOffset = material.mainTextureOffset.y
-                    };
-
-                    var mainTexture2D = material.mainTexture as Texture2D;
-
-                    CopyTexture(mainTexturePath, mainTexture2D, bMat.diffuseTexture);
-
-                    var alphaCuttOff = 0f;
-
-                    if (material.HasProperty("_Cutoff"))
-                    {
-                        alphaCuttOff = material.GetFloat("_Cutoff");
-                    }
-
-                    if ((mainTexture2D && mainTexture2D.alphaIsTransparency) || alphaCuttOff > 0)
-                    {
-                        bMat.diffuseTexture.hasAlpha = true;
-                        bMat.backFaceCulling = false;
-                    }
-
-                    bMat.diffuse[0] = 1.0f;
-                    bMat.diffuse[1] = 1.0f;
-                    bMat.diffuse[2] = 1.0f;
-                    bMat.diffuse[3] = 1.0f;
-                }
-
-                bMat.bumpTexture = DumpTextureFromMaterial(material, "_BumpMap");
-                bMat.emissiveTexture = DumpTextureFromMaterial(material, "_Illum");
-                bMat.ambientTexture = DumpTextureFromMaterial(material, "_LightMap");
-                bMat.reflectionTexture = DumpTextureFromMaterial(material, "_Cube");
-
-                //if (bMat.ambientTexture == null && renderer.lightmapIndex >= 0 && renderer.lightmapIndex != 255 && LightmapSettings.lightmaps.Length > renderer.lightmapIndex)
-                //{
-                //    var lightmap = LightmapSettings.lightmaps[renderer.lightmapIndex].lightmapFar;
-                //    bMat.ambientTexture = DumpTexture(lightmap);
-                //    bMat.ambientTexture.coordinatesIndex = 1;
-
-                //    bMat.ambientTexture.uScale = renderer.lightmapTilingOffset.x;
-                //    bMat.ambientTexture.vScale = renderer.lightmapTilingOffset.y;
-
-                //    bMat.ambientTexture.uOffset = renderer.lightmapTilingOffset.z;
-                //    bMat.ambientTexture.vOffset = renderer.lightmapTilingOffset.w;
-                //}
-
-                materialsDictionary.Add(bMat.name, bMat);
-                return bMat;
-            }
-
-            return materialsDictionary[material.name];
-        }
-
-        private BabylonTexture DumpTextureFromMaterial(Material material, string name)
-        {
-            if (!material.HasProperty(name))
-            {
-                return null;
-            }
-
-            var texture = material.GetTexture(name);
-            return DumpTexture(texture, material, name);
-        }
-
-        private BabylonTexture DumpTexture(Texture texture, Material material = null, string name = "")
-        {
-            if (texture == null)
-            {
-                return null;
-            }
-            var texturePath = AssetDatabase.GetAssetPath(texture);
-            var textureName = Path.GetFileName(texturePath);
-            var babylonTexture = new BabylonTexture { name = textureName };
-
-            if (material != null)
-            {
-                var textureScale = material.GetTextureScale(name);
-                babylonTexture.uScale = textureScale.x;
-                babylonTexture.vScale = textureScale.y;
-
-                var textureOffset = material.GetTextureOffset(name);
-                babylonTexture.uOffset = textureOffset.x;
-                babylonTexture.vOffset = textureOffset.y;
-            }
-
-            var texture2D = texture as Texture2D;
-
-            if (texture2D)
-            {
-                babylonTexture.hasAlpha = texture2D.alphaIsTransparency;
-
-                CopyTexture(texturePath, texture2D, babylonTexture);
-            }
-            else
-            {
-                var cubemap = texture as Cubemap;
-                if (cubemap != null)
-                {
-                    CopyTextureCube(texturePath, cubemap, babylonTexture);
-                }
-            }
-
-            return babylonTexture;
-        }
-    }
-}
+using System;
+using System.IO;
+using BabylonExport.Entities;
+using UnityEditor;
+using UnityEngine;
+
+namespace Unity3D2Babylon
+{
+    partial class SceneBuilder
+    {
+        private void CopyTextureCube(string texturePath, Cubemap cubemap, BabylonTexture babylonTexture)
+        {
+            if (!babylonScene.AddTextureCube(texturePath))
+            {
+                return;
+            }
+
+            try
+            {
+                foreach (CubemapFace face in Enum.GetValues(typeof(CubemapFace)))
+                {
+                    var faceTexturePath = Path.Combine(babylonScene.OutputPath, Path.GetFileNameWithoutExtension(texturePath));
+
+                    switch (face)
+                    {
+                        case CubemapFace.PositiveX:
+                            faceTexturePath += "_px.jpg";
+                            break;
+                        case CubemapFace.NegativeX:
+                            faceTexturePath += "_nx.jpg";
+                            break;
+                        case CubemapFace.PositiveY:
+                            faceTexturePath += "_py.jpg";
+                            break;
+                        case CubemapFace.NegativeY:
+                            faceTexturePath += "_ny.jpg";
+                            break;
+                        case CubemapFace.PositiveZ:
+                            faceTexturePath += "_pz.jpg";
+                            break;
+                        case CubemapFace.NegativeZ:
+                            faceTexturePath += "_nz.jpg";
+                            break;
+                    }
+
+                    var tempTexture = new Texture2D(cubemap.width, cubemap.height, cubemap.format, false);
+
+                    tempTexture.SetPixels(cubemap.GetPixels(face));
+                    tempTexture.Apply();
+
+                    File.WriteAllBytes(faceTexturePath, tempTexture.EncodeToJPG());
+                }
+
+            }
+            catch (Exception ex)
+            {
+                Debug.LogException(ex);
+            }
+
+            var textureName = Path.GetFileNameWithoutExtension(texturePath);
+            babylonTexture.name = textureName;
+            babylonTexture.isCube = true;
+            babylonTexture.level = exportationOptions.ReflectionDefaultLevel;
+            babylonTexture.coordinatesMode = 3;
+        }
+
+        private void CopyTexture(string texturePath, Texture2D texture2D, BabylonTexture babylonTexture, bool isLightmap = false)
+        {
+            bool needToDelete = false;
+            var useJPG = !texture2D.alphaIsTransparency;
+
+            // Convert unsupported file extensions
+            if (texturePath.EndsWith(".psd") || texturePath.EndsWith(".tif") || texturePath.EndsWith(".exr"))
+            {
+                try
+                {
+                    // Change texture import settings to be able to read texture data
+                    var textureImporter = AssetImporter.GetAtPath(texturePath) as TextureImporter;
+                    var previousIsReadable = textureImporter.isReadable;
+                    var previousNormalMap = textureImporter.normalmap;
+                    var previousLightmap = textureImporter.lightmap;
+                    var previousConvertToNormalmap = textureImporter.convertToNormalmap;
+                    var previousTextureType = textureImporter.textureType;
+                    var previousGrayscaleToAlpha = textureImporter.grayscaleToAlpha;
+
+                    textureImporter.textureType = TextureImporterType.Advanced;
+                    textureImporter.isReadable = true;
+                    textureImporter.lightmap = false;
+                    textureImporter.normalmap = false;
+                    textureImporter.convertToNormalmap = false;
+                    textureImporter.grayscaleToAlpha = false;
+
+                    AssetDatabase.ImportAsset(texturePath);
+
+                    texturePath = Path.Combine(Path.GetTempPath(), Path.GetFileName(texturePath));
+                    var extension = useJPG ? ".jpg" : ".png";
+                    texturePath = texturePath.Replace(".psd", extension).Replace(".tif", extension).Replace(".exr", extension);
+
+                    var tempTexture = new Texture2D(texture2D.width, texture2D.height, TextureFormat.ARGB32, false);
+
+                    if (isLightmap)
+                    {
+                        Color[] pixels = texture2D.GetPixels(0, 0, texture2D.width, texture2D.height);
+                        for (int index = 0; index < pixels.Length; index++)
+                        {
+                            pixels[index].r = pixels[index].r * pixels[index].a * 5;
+                            pixels[index].g = pixels[index].g * pixels[index].a * 5;
+                            pixels[index].b = pixels[index].b * pixels[index].a * 5;
+                        }
+                        tempTexture.SetPixels(pixels);
+                    }
+                    else {
+                        tempTexture.SetPixels32(texture2D.GetPixels32());
+                    }
+                    tempTexture.Apply();
+
+                    File.WriteAllBytes(texturePath, useJPG ? tempTexture.EncodeToJPG() : tempTexture.EncodeToPNG());
+
+                    needToDelete = true;
+
+                    // Restore
+                    textureImporter.isReadable = previousIsReadable;
+                    textureImporter.normalmap = previousNormalMap;
+                    textureImporter.lightmap = previousLightmap;
+                    textureImporter.convertToNormalmap = previousConvertToNormalmap;
+                    textureImporter.textureType = previousTextureType;
+                    textureImporter.grayscaleToAlpha = previousGrayscaleToAlpha;
+                   
+                    AssetDatabase.ImportAsset(texturePath, ImportAssetOptions.ForceUpdate);
+                }
+                catch (Exception ex)
+                {
+                    Debug.LogException(ex);
+                }
+            }
+
+            var textureName = Path.GetFileName(texturePath);
+            babylonTexture.name = textureName;
+            babylonScene.AddTexture(texturePath);
+
+            if (needToDelete)
+            {
+                File.Delete(texturePath);
+            }
+        }
+
+        private BabylonMaterial DumpMaterial(Material material, Renderer renderer)
+        {
+            var materialNotSupported = false; 
+
+            if (!materialsDictionary.ContainsKey(material.name))
+            {
+                var bMat = new BabylonStandardMaterial
+                {
+                    name = material.name,
+                    id = Guid.NewGuid().ToString(),
+                    diffuse = new float[4],
+                    specular = new float[4]
+                };
+
+                bMat.diffuse[0] = 1.0f;
+                bMat.diffuse[1] = 1.0f;
+                bMat.diffuse[2] = 1.0f;
+                bMat.diffuse[3] = 1.0f;
+
+                if (material.HasProperty("_Color"))
+                {
+                    bMat.diffuse = material.color.ToFloat();
+                }
+
+                if (material.HasProperty("_SpecColor"))
+                {
+                    var specColor = material.GetColor("_SpecColor");
+                    bMat.specular = specColor.ToFloat();
+                }
+
+                if (material.HasProperty("_Shininess"))
+                {
+                    var specShininess = material.GetFloat("_Shininess");
+                    bMat.specularPower = specShininess * 128;
+                }
+
+                if (material.HasProperty("_Emission"))
+                {
+                    var emissiveColor = material.GetColor("_Emission");
+                    bMat.emissive = emissiveColor.ToFloat();
+                }
+
+                if (material.mainTexture && material.mainTexture.GetType().FullName == "UnityEngine.ProceduralTexture")
+                {
+                    materialNotSupported = true;
+                    Debug.LogWarning("ProceduralTexture: " + material.mainTexture.name + " not supported by Babylon.js");
+                }
+
+                if (material.mainTexture && !(materialNotSupported))
+                {
+                    var mainTexturePath = AssetDatabase.GetAssetPath(material.mainTexture);
+                    bMat.diffuseTexture = new BabylonTexture
+                    {
+                        uScale = material.mainTextureScale.x,
+                        vScale = material.mainTextureScale.y,
+                        uOffset = material.mainTextureOffset.x,
+                        vOffset = material.mainTextureOffset.y
+                    };
+
+                    var mainTexture2D = material.mainTexture as Texture2D;
+
+                    CopyTexture(mainTexturePath, mainTexture2D, bMat.diffuseTexture);
+
+                    var alphaCuttOff = 0f;
+
+                    if (material.HasProperty("_Cutoff"))
+                    {
+                        alphaCuttOff = material.GetFloat("_Cutoff");
+                    }
+
+                    if ((mainTexture2D && mainTexture2D.alphaIsTransparency) || alphaCuttOff > 0)
+                    {
+                        bMat.diffuseTexture.hasAlpha = true;
+                        bMat.backFaceCulling = false;
+                    }
+
+                    bMat.diffuse[0] = 1.0f;
+                    bMat.diffuse[1] = 1.0f;
+                    bMat.diffuse[2] = 1.0f;
+                    bMat.diffuse[3] = 1.0f;
+                }
+
+                bMat.bumpTexture = DumpTextureFromMaterial(material, "_BumpMap");
+                bMat.emissiveTexture = DumpTextureFromMaterial(material, "_Illum");
+                bMat.ambientTexture = DumpTextureFromMaterial(material, "_LightMap");
+                bMat.reflectionTexture = DumpTextureFromMaterial(material, "_Cube");
+
+                if (bMat.ambientTexture == null && renderer.lightmapIndex >= 0 && renderer.lightmapIndex != 255 && LightmapSettings.lightmaps.Length > renderer.lightmapIndex)
+                {
+                    var lightmap = LightmapSettings.lightmaps[renderer.lightmapIndex].lightmapFar;
+                    bMat.lightmapTexture = DumpTexture(lightmap, isLightmap: true);
+                    bMat.lightmapTexture.coordinatesIndex = 1;
+                    bMat.useLightmapAsShadowmap = true;
+
+                    bMat.lightmapTexture.uScale = renderer.lightmapScaleOffset.x;
+                    bMat.lightmapTexture.vScale = renderer.lightmapScaleOffset.y;
+
+                    bMat.lightmapTexture.uOffset = renderer.lightmapScaleOffset.z;
+                    bMat.lightmapTexture.vOffset = renderer.lightmapScaleOffset.w;
+                }
+
+                materialsDictionary.Add(bMat.name, bMat);
+                return bMat;
+            }
+
+            return materialsDictionary[material.name];
+        }
+
+
+        private BabylonMaterial DumpPBRMaterial(Material material, Renderer renderer)
+        {
+            if (!materialsDictionary.ContainsKey(material.name))
+            {
+                var bMat = new BabylonPBRMaterial
+                {
+                    name = material.name,
+                    id = Guid.NewGuid().ToString(),
+                    albedoColor = new float[4]
+                };
+
+                if (material.HasProperty("_Color"))
+                {
+                    bMat.albedoColor = material.color.ToFloat();
+                }
+
+                bMat.albedoTexture = DumpTextureFromMaterial(material, "_MainTex");
+
+                if (material.HasProperty("_Glossiness"))
+                {
+                    bMat.microSurface = material.GetFloat("_Glossiness");
+                }
+
+                if (material.HasProperty("_Metallic"))
+                {
+                    var metallic = material.GetFloat("_Metallic");
+                    bMat.reflectivityColor = new float[] { metallic, metallic, metallic };
+                }
+
+                bMat.bumpTexture = DumpTextureFromMaterial(material, "_BumpMap");
+
+                materialsDictionary.Add(bMat.name, bMat);
+                return bMat;
+            }
+
+            return materialsDictionary[material.name];
+        }
+
+        private BabylonTexture DumpTextureFromMaterial(Material material, string name)
+        {
+            if (!material.HasProperty(name))
+            {
+                return null;
+            }
+
+            var texture = material.GetTexture(name);
+            return DumpTexture(texture, material, name);
+        }
+
+        private BabylonTexture DumpTexture(Texture texture, Material material = null, string name = "", bool isLightmap = false)
+        {
+            if (texture == null)
+            {
+                return null;
+            }
+            var texturePath = AssetDatabase.GetAssetPath(texture);
+            var textureName = Path.GetFileName(texturePath);
+            var babylonTexture = new BabylonTexture { name = textureName };
+
+            if (material != null)
+            {
+                var textureScale = material.GetTextureScale(name);
+                babylonTexture.uScale = textureScale.x;
+                babylonTexture.vScale = textureScale.y;
+
+                var textureOffset = material.GetTextureOffset(name);
+                babylonTexture.uOffset = textureOffset.x;
+                babylonTexture.vOffset = textureOffset.y;
+            }
+
+            var texture2D = texture as Texture2D;
+
+            if (texture2D)
+            {
+                babylonTexture.hasAlpha = texture2D.alphaIsTransparency;
+
+                CopyTexture(texturePath, texture2D, babylonTexture, isLightmap);
+            }
+            else
+            {
+                var cubemap = texture as Cubemap;
+                if (cubemap != null)
+                {
+                    CopyTextureCube(texturePath, cubemap, babylonTexture);
+                }
+            }
+
+            return babylonTexture;
+        }
+    }
+}

+ 244 - 291
Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.Meshes.cs

@@ -1,291 +1,244 @@
-using System;
-using BabylonExport.Entities;
-using UnityEngine;
-
-namespace Unity3D2Babylon
-{
-    partial class SceneBuilder
-    {
-        private BabylonAbstractMesh ConvertUnityMeshToInstance(GameObject gameObject)
-        {
-            BabylonAbstractMesh babylonMesh = new BabylonAbstractMesh();
-
-            Transform transform = gameObject.transform;
-            babylonMesh.name = gameObject.name;
-            babylonMesh.position = new float[3];
-            babylonMesh.position[0] = transform.position.x;
-            babylonMesh.position[1] = transform.position.y;
-            babylonMesh.position[2] = transform.position.z;
-
-            babylonMesh.rotation = new float[3];
-            babylonMesh.rotation[0] = transform.rotation.eulerAngles.x * (float)Math.PI / 180;
-            babylonMesh.rotation[1] = transform.rotation.eulerAngles.y * (float)Math.PI / 180;
-            babylonMesh.rotation[2] = transform.rotation.eulerAngles.z * (float)Math.PI / 180;
-
-            babylonMesh.scaling = new float[3];
-            babylonMesh.scaling[0] = transform.localScale.x;
-            babylonMesh.scaling[1] = transform.localScale.y;
-            babylonMesh.scaling[2] = transform.localScale.z;
-            return babylonMesh;
-        }
-
-        private void ConvertTransform(BabylonMesh babylonMesh, Transform transform, GameObject gameObject, BabylonAbstractMesh[] instances = null)
-        {
-            Action SetTransformFromGameobject = () =>
-            {
-                babylonMesh.position = transform.localPosition.ToFloat();
-
-                babylonMesh.rotation = new float[3];
-                babylonMesh.rotation[0] = transform.localRotation.eulerAngles.x * (float)Math.PI / 180;
-                babylonMesh.rotation[1] = transform.localRotation.eulerAngles.y * (float)Math.PI / 180;
-                babylonMesh.rotation[2] = transform.localRotation.eulerAngles.z * (float)Math.PI / 180;
-
-                babylonMesh.scaling = transform.localScale.ToFloat();
-            };
-
-            Action SetTransformFromFirstInstance = () =>
-            {
-                BabylonAbstractMesh first = instances[0];
-
-                babylonMesh.position = new float[3];
-                babylonMesh.position[0] = first.position[0];
-                babylonMesh.position[1] = first.position[1];
-                babylonMesh.position[2] = first.position[2];
-
-                babylonMesh.rotation = new float[3];
-                babylonMesh.rotation[0] = first.rotation[0];
-                babylonMesh.rotation[1] = first.rotation[1];
-                babylonMesh.rotation[2] = first.rotation[2];
-
-                babylonMesh.scaling = new float[3];
-                babylonMesh.scaling[0] = first.scaling[0];
-                babylonMesh.scaling[1] = first.scaling[1];
-                babylonMesh.scaling[2] = first.scaling[2];
-            };
-
-            //Check if this is a prefab
-            if (instances != null)
-            {
-                /*
-                    Unity3D prefabs don't have transforms (position, rotation, scale) because they are just a template and are not drawn on screen          
-                    but Babylon.js meshes must have a transform because they are drawn on the screen
-                    so what we do is take the first instance
-                    copy its transform (position, rotation, scale) into the prefab mesh
-                    then remove that first instance
-                */
-
-                babylonMesh.instances = new BabylonAbstractMesh[instances.Length - 1];
-
-                //Effectively remove first instance from list of all instances
-                for (int i = 0; i < instances.Length - 1; i++)
-                {
-                    babylonMesh.instances[i] = instances[i + 1];
-                }
-
-                //If this is the root object then copy values directly from first instance
-                if (GetParentID(transform) == null)
-                {
-                    SetTransformFromFirstInstance();
-                }
-                else
-                {
-                    GameObject parent = gameObject.transform.parent.gameObject;
-                    if ((parent.GetComponent<Light>() == null) && (parent.GetComponent<Camera>() == null))
-                    {
-                        SetTransformFromGameobject();
-                    } else
-                    {
-                        SetTransformFromFirstInstance();
-                    }
-                }
-            }
-            else
-            {
-                SetTransformFromGameobject();
-            }
-        }
-
-        private void ConvertUnityEmptyObjectToBabylon(GameObject gameObject, BabylonAbstractMesh[] instances = null)
-        {
-            BabylonMesh babylonMesh = new BabylonMesh { name = gameObject.name, id = GetID(gameObject) };
-
-            var transform = gameObject.transform;
-
-            babylonMesh.parentId = GetParentID(transform);
-            ConvertTransform(babylonMesh, transform, gameObject, instances);
-
-            babylonScene.MeshesList.Add(babylonMesh);
-
-            // Animations
-            ExportAnimations(transform, babylonMesh);
-
-            if (IsRotationQuaternionAnimated(babylonMesh))
-            {
-                babylonMesh.rotationQuaternion = transform.localRotation.ToFloat();
-            }
-        }
-
-        private void ConvertUnityMeshToBabylon(Mesh mesh, Transform transform, GameObject gameObject, float progress, BabylonAbstractMesh[] instances = null)
-        {
-            BabylonMesh babylonMesh = new BabylonMesh();
-            var renderer = gameObject.GetComponent<Renderer>();
-
-            ExporterWindow.ReportProgress(progress, "Exporting mesh: " + gameObject.name);
-
-            babylonMesh.name = gameObject.name;
-            babylonMesh.id = GetID(transform.gameObject);
-            babylonMesh.receiveShadows = renderer.receiveShadows;
-
-            babylonMesh.parentId = GetParentID(transform);
-            ConvertTransform(babylonMesh, transform, gameObject, instances);
-
-            babylonMesh.positions = new float[mesh.vertexCount * 3];
-
-            for (int i = 0; i < mesh.vertices.Length; i++)
-            {
-                babylonMesh.positions[i * 3] = mesh.vertices[i].x;
-                babylonMesh.positions[(i * 3) + 1] = mesh.vertices[i].y;
-                babylonMesh.positions[(i * 3) + 2] = mesh.vertices[i].z;
-
-                // Computing world extends
-                var worldPosition = transform.TransformPoint(mesh.vertices[i]);
-
-                if (worldPosition.x > babylonScene.MaxVector.X)
-                {
-                    babylonScene.MaxVector.X = worldPosition.x;
-                }
-                if (worldPosition.y > babylonScene.MaxVector.Y)
-                {
-                    babylonScene.MaxVector.Y = worldPosition.y;
-                }
-                if (worldPosition.z > babylonScene.MaxVector.Z)
-                {
-                    babylonScene.MaxVector.Z = worldPosition.z;
-                }
-
-                if (worldPosition.x < babylonScene.MinVector.X)
-                {
-                    babylonScene.MinVector.X = worldPosition.x;
-                }
-                if (worldPosition.y < babylonScene.MinVector.Y)
-                {
-                    babylonScene.MinVector.Y = worldPosition.y;
-                }
-                if (worldPosition.z < babylonScene.MinVector.Z)
-                {
-                    babylonScene.MinVector.Z = worldPosition.z;
-                }
-            }
-
-            babylonMesh.normals = new float[mesh.vertexCount * 3];
-
-            for (int i = 0; i < mesh.normals.Length; i++)
-            {
-                babylonMesh.normals[i * 3] = mesh.normals[i].x;
-                babylonMesh.normals[(i * 3) + 1] = mesh.normals[i].y;
-                babylonMesh.normals[(i * 3) + 2] = mesh.normals[i].z;
-            }
-
-            babylonMesh.uvs = new float[mesh.vertexCount * 2];
-
-            for (int i = 0; i < mesh.uv.Length; i++)
-            {
-                babylonMesh.uvs[i * 2] = mesh.uv[i].x;
-                babylonMesh.uvs[(i * 2) + 1] = mesh.uv[i].y;
-            }
-
-            if (mesh.uv2 != null)
-            {
-                babylonMesh.uvs2 = new float[mesh.vertexCount * 2];
-
-                for (int i = 0; i < mesh.uv2.Length; i++)
-                {
-                    babylonMesh.uvs2[i * 2] = mesh.uv2[i].x;
-                    babylonMesh.uvs2[(i * 2) + 1] = mesh.uv2[i].y;
-                }
-            }
-
-            babylonMesh.indices = new int[mesh.triangles.Length];
-
-            for (int i = 0; i < mesh.triangles.Length; i += 3)
-            {
-                babylonMesh.indices[i] = mesh.triangles[i + 2];
-                babylonMesh.indices[i + 1] = mesh.triangles[i + 1];
-                babylonMesh.indices[i + 2] = mesh.triangles[i];
-            }
-
-            if (mesh.subMeshCount > 1) // Multimaterials
-            {
-                BabylonMultiMaterial bMultiMat;
-                if (!multiMatDictionary.ContainsKey(renderer.sharedMaterial.name))
-                {
-                    bMultiMat = new BabylonMultiMaterial
-                    {
-                        materials = new string[mesh.subMeshCount],
-                        id = Guid.NewGuid().ToString(),
-                        name = renderer.sharedMaterial.name
-                    };
-
-                    for (int i = 0; i < renderer.sharedMaterials.Length; i++)
-                    {
-                        var bMat = DumpMaterial(renderer.sharedMaterials[i], renderer);
-                        bMultiMat.materials[i] = bMat.id;
-                    }
-                    if (mesh.subMeshCount > 1)
-                    {
-                        multiMatDictionary.Add(bMultiMat.name, bMultiMat);
-                    }
-                }
-                else
-                {
-                    bMultiMat = multiMatDictionary[renderer.sharedMaterial.name];
-                }
-
-                babylonMesh.materialId = bMultiMat.id;
-                babylonMesh.subMeshes = new BabylonSubMesh[mesh.subMeshCount];
-
-                var offset = 0;
-                for (int materialIndex = 0; materialIndex < mesh.subMeshCount; materialIndex++)
-                {
-                    var unityTriangles = mesh.GetTriangles(materialIndex);
-
-                    babylonMesh.subMeshes[materialIndex] = new BabylonSubMesh
-                    {
-                        verticesStart = 0,
-                        verticesCount = mesh.vertexCount,
-                        materialIndex = materialIndex,
-                        indexStart = offset,
-                        indexCount = unityTriangles.Length
-                    };
-
-                    offset += unityTriangles.Length;
-                }
-            }
-            else
-            {
-                babylonMesh.materialId = DumpMaterial(renderer.sharedMaterial, renderer).id;
-            }
-
-            babylonScene.MeshesList.Add(babylonMesh);
-
-            // Animations
-            ExportAnimations(transform, babylonMesh);
-
-            if (IsRotationQuaternionAnimated(babylonMesh))
-            {
-                babylonMesh.rotationQuaternion = transform.localRotation.ToFloat();
-            }
-
-            // Collisions
-            if (exportationOptions.ExportCollisions)
-            {
-                var collider = gameObject.GetComponent<Collider>();
-
-                if (collider != null)
-                {
-                    babylonMesh.checkCollisions = true;
-                }
-            }
-        }
-    }
-}
+using System;
+using BabylonExport.Entities;
+using UnityEngine;
+
+namespace Unity3D2Babylon
+{
+    partial class SceneBuilder
+    {
+        private void ConvertUnityEmptyObjectToBabylon(GameObject gameObject)
+        {
+            BabylonMesh babylonMesh = new BabylonMesh { name = gameObject.name, id = GetID(gameObject) };
+
+            var transform = gameObject.transform;
+
+            babylonMesh.parentId = GetParentID(transform);
+
+            babylonMesh.position = transform.localPosition.ToFloat();
+
+            babylonMesh.rotation = new float[3];
+            babylonMesh.rotation[0] = transform.localRotation.eulerAngles.x * (float)Math.PI / 180;
+            babylonMesh.rotation[1] = transform.localRotation.eulerAngles.y * (float)Math.PI / 180;
+            babylonMesh.rotation[2] = transform.localRotation.eulerAngles.z * (float)Math.PI / 180;
+
+            babylonMesh.scaling = transform.localScale.ToFloat();
+
+            babylonScene.MeshesList.Add(babylonMesh);
+
+            // Animations
+            ExportAnimations(transform, babylonMesh);
+
+            if (IsRotationQuaternionAnimated(babylonMesh))
+            {
+                babylonMesh.rotationQuaternion = transform.localRotation.ToFloat();
+            }
+        }
+
+        private void ConvertUnityMeshToBabylon(Mesh mesh, Transform transform, GameObject gameObject, float progress)
+        {
+            BabylonMesh babylonMesh = new BabylonMesh();
+            var renderer = gameObject.GetComponent<Renderer>();
+
+            ExporterWindow.ReportProgress(progress, "Exporting mesh: " + gameObject.name);
+
+            babylonMesh.name = gameObject.name;
+            babylonMesh.id = GetID(transform.gameObject);
+
+            if (renderer != null)
+            {
+                babylonMesh.receiveShadows = renderer.receiveShadows;
+            }
+
+            babylonMesh.parentId = GetParentID(transform);
+
+            babylonMesh.position = transform.localPosition.ToFloat();
+
+            babylonMesh.rotation = new float[3];
+            babylonMesh.rotation[0] = transform.localRotation.eulerAngles.x * (float)Math.PI / 180;
+            babylonMesh.rotation[1] = transform.localRotation.eulerAngles.y * (float)Math.PI / 180;
+            babylonMesh.rotation[2] = transform.localRotation.eulerAngles.z * (float)Math.PI / 180;
+
+            babylonMesh.scaling = transform.localScale.ToFloat();
+
+            if (mesh != null)
+            {
+                babylonMesh.positions = new float[mesh.vertexCount * 3];
+
+                for (int i = 0; i < mesh.vertices.Length; i++)
+                {
+                    babylonMesh.positions[i * 3] = mesh.vertices[i].x;
+                    babylonMesh.positions[(i * 3) + 1] = mesh.vertices[i].y;
+                    babylonMesh.positions[(i * 3) + 2] = mesh.vertices[i].z;
+
+                    // Computing world extends
+                    var worldPosition = transform.TransformPoint(mesh.vertices[i]);
+
+                    if (worldPosition.x > babylonScene.MaxVector.X)
+                    {
+                        babylonScene.MaxVector.X = worldPosition.x;
+                    }
+                    if (worldPosition.y > babylonScene.MaxVector.Y)
+                    {
+                        babylonScene.MaxVector.Y = worldPosition.y;
+                    }
+                    if (worldPosition.z > babylonScene.MaxVector.Z)
+                    {
+                        babylonScene.MaxVector.Z = worldPosition.z;
+                    }
+
+                    if (worldPosition.x < babylonScene.MinVector.X)
+                    {
+                        babylonScene.MinVector.X = worldPosition.x;
+                    }
+                    if (worldPosition.y < babylonScene.MinVector.Y)
+                    {
+                        babylonScene.MinVector.Y = worldPosition.y;
+                    }
+                    if (worldPosition.z < babylonScene.MinVector.Z)
+                    {
+                        babylonScene.MinVector.Z = worldPosition.z;
+                    }
+                }
+
+                babylonMesh.normals = new float[mesh.vertexCount * 3];
+
+                for (int i = 0; i < mesh.normals.Length; i++)
+                {
+                    babylonMesh.normals[i * 3] = mesh.normals[i].x;
+                    babylonMesh.normals[(i * 3) + 1] = mesh.normals[i].y;
+                    babylonMesh.normals[(i * 3) + 2] = mesh.normals[i].z;
+                }
+
+                babylonMesh.uvs = new float[mesh.vertexCount * 2];
+
+                for (int i = 0; i < mesh.uv.Length; i++)
+                {
+                    babylonMesh.uvs[i * 2] = mesh.uv[i].x;
+                    babylonMesh.uvs[(i * 2) + 1] = mesh.uv[i].y;
+                }
+
+                babylonMesh.uvs2 = new float[mesh.vertexCount * 2];
+
+                if (mesh.uv2 != null && mesh.uv2.Length > 0)
+                {
+                    for (int i = 0; i < mesh.uv2.Length; i++)
+                    {
+                        babylonMesh.uvs2[i * 2] = mesh.uv2[i].x;
+                        babylonMesh.uvs2[(i * 2) + 1] = mesh.uv2[i].y;
+                    }
+                }
+                else
+                {
+                    for (int i = 0; i < mesh.uv.Length; i++)
+                    {
+                        babylonMesh.uvs2[i * 2] = mesh.uv[i].x;
+                        babylonMesh.uvs2[(i * 2) + 1] = mesh.uv[i].y;
+                    }
+                }
+
+                babylonMesh.indices = new int[mesh.triangles.Length];
+
+                for (int i = 0; i < mesh.triangles.Length; i += 3)
+                {
+                    babylonMesh.indices[i] = mesh.triangles[i + 2];
+                    babylonMesh.indices[i + 1] = mesh.triangles[i + 1];
+                    babylonMesh.indices[i + 2] = mesh.triangles[i];
+                }
+
+                if (renderer != null && renderer.sharedMaterial != null)
+                {
+                    if (mesh.subMeshCount > 1) // Multimaterials
+                    {
+                        BabylonMultiMaterial bMultiMat;
+                        if (!multiMatDictionary.ContainsKey(renderer.sharedMaterial.name))
+                        {
+                            bMultiMat = new BabylonMultiMaterial
+                            {
+                                materials = new string[mesh.subMeshCount],
+                                id = Guid.NewGuid().ToString(),
+                                name = renderer.sharedMaterial.name
+                            };
+
+                            for (int i = 0; i < renderer.sharedMaterials.Length; i++)
+                            {
+                                var sharedMaterial = renderer.sharedMaterials[i];
+                                BabylonMaterial babylonMaterial;
+
+                                if (sharedMaterial.HasProperty("_Metallic"))
+                                {
+                                    babylonMaterial = DumpPBRMaterial(sharedMaterial, renderer);
+                                }
+                                else
+                                {
+                                    babylonMaterial = DumpMaterial(sharedMaterial, renderer);
+                                }
+
+                                bMultiMat.materials[i] = babylonMaterial.id;
+                            }
+                            if (mesh.subMeshCount > 1)
+                            {
+                                multiMatDictionary.Add(bMultiMat.name, bMultiMat);
+                            }
+                        }
+                        else
+                        {
+                            bMultiMat = multiMatDictionary[renderer.sharedMaterial.name];
+                        }
+
+                        babylonMesh.materialId = bMultiMat.id;
+                        babylonMesh.subMeshes = new BabylonSubMesh[mesh.subMeshCount];
+
+                        var offset = 0;
+                        for (int materialIndex = 0; materialIndex < mesh.subMeshCount; materialIndex++)
+                        {
+                            var unityTriangles = mesh.GetTriangles(materialIndex);
+
+                            babylonMesh.subMeshes[materialIndex] = new BabylonSubMesh
+                            {
+                                verticesStart = 0,
+                                verticesCount = mesh.vertexCount,
+                                materialIndex = materialIndex,
+                                indexStart = offset,
+                                indexCount = unityTriangles.Length
+                            };
+
+                            offset += unityTriangles.Length;
+                        }
+                    }
+                    else
+                    {
+                        if (renderer.sharedMaterial.HasProperty("_Metallic"))
+                        {
+                            babylonMesh.materialId = DumpPBRMaterial(renderer.sharedMaterial, renderer).id;
+                        }
+                        else
+                        {
+                            babylonMesh.materialId = DumpMaterial(renderer.sharedMaterial, renderer).id;
+                        }
+                    }
+                }
+
+                babylonScene.MeshesList.Add(babylonMesh);
+
+                // Animations
+                ExportAnimations(transform, babylonMesh);
+
+                if (IsRotationQuaternionAnimated(babylonMesh))
+                {
+                    babylonMesh.rotationQuaternion = transform.localRotation.ToFloat();
+                }
+
+                // Collisions
+                if (exportationOptions.ExportCollisions)
+                {
+                    var collider = gameObject.GetComponent<Collider>();
+
+                    if (collider != null)
+                    {
+                        babylonMesh.checkCollisions = true;
+                    }
+                }
+            }
+        }
+    }
+}

+ 171 - 229
Exporters/Unity 5/Unity3D2Babylon/SceneBuilder.cs

@@ -1,229 +1,171 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using BabylonExport.Entities;
-using JsonFx.Json;
-using UnityEngine;
-using Object = UnityEngine.Object;
-using JsonFx.Serialization;
-using JsonFx.Serialization.Resolvers;
-using UnityEditor;
-
-namespace Unity3D2Babylon
-{
-    public partial class SceneBuilder
-    {
-        public string OutputPath { get; private set; }
-        public string SceneName { get; private set; }
-
-        readonly Dictionary<string, BabylonMaterial> materialsDictionary;
-        readonly Dictionary<string, BabylonMultiMaterial> multiMatDictionary;
-
-        readonly Dictionary<int, string> uniqueGuids;
-
-        readonly BabylonScene babylonScene;
-        GameObject[] gameObjects;
-
-        readonly ExportationOptions exportationOptions;
-
-        public SceneBuilder(string outputPath, string sceneName, ExportationOptions exportationOptions)
-        {
-            OutputPath = outputPath;
-            SceneName = string.IsNullOrEmpty(sceneName) ? "scene" : sceneName;
-
-            materialsDictionary = new Dictionary<string, BabylonMaterial>();
-            multiMatDictionary = new Dictionary<string, BabylonMultiMaterial>();
-            uniqueGuids = new Dictionary<int, string>();
-
-            babylonScene = new BabylonScene(OutputPath);
-
-            this.exportationOptions = exportationOptions;
-        }
-
-        public void WriteToBabylonFile()
-        {
-            babylonScene.Prepare();
-
-            var outputFile = Path.Combine(OutputPath, SceneName + ".babylon");
-
-            var jsWriter = new JsonWriter(new DataWriterSettings(new DataContractResolverStrategy()));
-            string babylonJSformat = jsWriter.Write(babylonScene);
-            using (var sw = new StreamWriter(outputFile))
-            {
-                sw.Write(babylonJSformat);
-                sw.Close();
-            }
-        }
-
-        public void GenerateStatus(List<string> logs)
-        {
-            var initialLog = new List<string>
-            {
-                "*Exportation Status:",
-                babylonScene.meshes.Length + " mesh(es)",
-                babylonScene.lights.Length + " light(s)",
-                babylonScene.cameras.Length + " camera(s)",
-                babylonScene.materials.Length + " material(s)",
-                babylonScene.multiMaterials.Length + " multi-material(s)",
-                "",
-                "*Log:"
-            };
-
-            logs.InsertRange(0, initialLog);
-        }
-
-        string GetParentID(Transform transform)
-        {
-            if (transform.parent == null)
-            {
-                return null;
-            }
-
-            return GetID(transform.parent.gameObject);
-        }
-
-        string GetID(GameObject gameObject)
-        {
-            var key = gameObject.GetInstanceID();
-
-            if (!uniqueGuids.ContainsKey(key))
-            {
-                uniqueGuids[key] = Guid.NewGuid().ToString();
-            }
-
-            return uniqueGuids[key];
-        }
-
-        public void ConvertFromUnity()
-        {
-            ExporterWindow.ReportProgress(0, "Starting Babylon.js exportation process...");
-
-            gameObjects = Object.FindObjectsOfType(typeof(GameObject)) as GameObject[];
-
-            if (gameObjects.Length == 0)
-            {
-                ExporterWindow.ShowMessage("No gameobject! - Please add at least a gameobject to export");
-                return;
-            }
-
-            var itemsCount = gameObjects.Length;
-
-            var index = 0;
-
-            //Dictionary to store prefabs and their instances
-            Dictionary<GameObject, List<BabylonAbstractMesh>> dicPrefabs = new Dictionary<GameObject, List<BabylonAbstractMesh>>();
-
-            foreach (var gameObject in gameObjects)
-            {
-                var progress = ((float)index / itemsCount);
-                index++;
-
-                /* 
-                    The order of processing is important here.
-                    We will only check if this is a mesh prefab if it is not a light or camera
-                */
-
-                // Light
-                var light = gameObject.GetComponent<Light>();
-                if (light != null)
-                {
-                    ConvertUnityLightToBabylon(light, progress);
-                    continue;
-                }
-
-                // Camera
-                var camera = gameObject.GetComponent<Camera>();
-                if (camera != null)
-                {
-                    ConvertUnityCameraToBabylon(camera, progress);
-                    continue;
-                }
-
-                // Check if this is a prefab instance
-                GameObject gobjPrefab = (GameObject)PrefabUtility.GetPrefabParent(gameObject);
-                if (gobjPrefab != null)
-                {
-                    //Add prefab to dictionary if it doesn't already exist
-                    if (!dicPrefabs.ContainsKey(gobjPrefab))
-                    {
-                        dicPrefabs[gobjPrefab] = new List<BabylonAbstractMesh>();
-                    }
-
-                    List<BabylonAbstractMesh> lstInstances = dicPrefabs[gobjPrefab];
-                    BabylonAbstractMesh instance = ConvertUnityMeshToInstance(gameObject);
-                    lstInstances.Add(instance);
-                    continue;
-                }
-
-                // Static meshes
-                var meshFilter = gameObject.GetComponent<MeshFilter>();
-                if (meshFilter != null)
-                {                    
-                    ConvertUnityMeshToBabylon(meshFilter.sharedMesh, meshFilter.transform, gameObject, progress);
-                    continue;
-                }
-
-                // Skinned meshes
-                var skinnedMesh = gameObject.GetComponent<SkinnedMeshRenderer>();
-                if (skinnedMesh != null)
-                {
-                    ConvertUnityMeshToBabylon(skinnedMesh.sharedMesh, skinnedMesh.transform, gameObject, progress);
-                    continue;
-                }
-
-                // Empty
-                ConvertUnityEmptyObjectToBabylon(gameObject);
-            }
-
-            index = 0;
-            itemsCount = dicPrefabs.Count;
-
-            //Convert prefabs
-            foreach (KeyValuePair<GameObject, List<BabylonAbstractMesh>> pair in dicPrefabs)
-            {
-                var progress = ((float)index / itemsCount);
-                index++;
-
-                List<BabylonAbstractMesh> lstValue = pair.Value;
-                GameObject prefab = pair.Key;
-                BabylonAbstractMesh[] lstInstance = lstValue.ToArray();
-
-                // Static meshes
-                var meshFilter = prefab.GetComponent<MeshFilter>();
-                if (meshFilter != null)
-                {
-                    ConvertUnityMeshToBabylon(meshFilter.sharedMesh, meshFilter.transform, prefab, progress, lstInstance);
-                    continue;
-                }
-
-                // Skinned meshes
-                var skinnedMesh = prefab.GetComponent<SkinnedMeshRenderer>();
-                if (skinnedMesh != null)
-                {
-                    ConvertUnityMeshToBabylon(skinnedMesh.sharedMesh, skinnedMesh.transform, prefab, progress, lstInstance);
-                    continue;
-                }
-
-                // Empty
-                ConvertUnityEmptyObjectToBabylon(prefab, lstInstance);
-            }
-
-            // Materials
-            foreach (var mat in materialsDictionary)
-            {
-                babylonScene.MaterialsList.Add(mat.Value);
-            }
-
-            foreach (var multiMat in multiMatDictionary)
-            {
-                babylonScene.MultiMaterialsList.Add(multiMat.Value);
-            }
-
-            // Collisions
-            if (exportationOptions.ExportCollisions)
-            {
-                babylonScene.gravity = exportationOptions.Gravity.ToFloat();
-            }
-        }     
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.IO;
+using BabylonExport.Entities;
+using JsonFx.Json;
+using UnityEngine;
+using Object = UnityEngine.Object;
+using JsonFx.Serialization;
+using JsonFx.Serialization.Resolvers;
+
+namespace Unity3D2Babylon
+{
+    public partial class SceneBuilder
+    {
+        public string OutputPath { get; private set; }
+        public string SceneName { get; private set; }
+
+        readonly Dictionary<string, BabylonMaterial> materialsDictionary;
+        readonly Dictionary<string, BabylonMultiMaterial> multiMatDictionary;
+
+        readonly Dictionary<int, string> uniqueGuids;
+
+        readonly BabylonScene babylonScene;
+        GameObject[] gameObjects;
+
+        readonly ExportationOptions exportationOptions;
+
+        public SceneBuilder(string outputPath, string sceneName, ExportationOptions exportationOptions)
+        {
+            OutputPath = outputPath;
+            SceneName = string.IsNullOrEmpty(sceneName) ? "scene" : sceneName;
+
+            materialsDictionary = new Dictionary<string, BabylonMaterial>();
+            multiMatDictionary = new Dictionary<string, BabylonMultiMaterial>();
+            uniqueGuids = new Dictionary<int, string>();
+
+            babylonScene = new BabylonScene(OutputPath);
+
+            this.exportationOptions = exportationOptions;
+        }
+
+        public string WriteToBabylonFile()
+        {
+            babylonScene.Prepare();
+
+            var outputFile = Path.Combine(OutputPath, SceneName + ".babylon");
+
+            var jsWriter = new JsonWriter(new DataWriterSettings(new DataContractResolverStrategy()));
+            string babylonJSformat = jsWriter.Write(babylonScene);
+            using (var sw = new StreamWriter(outputFile))
+            {
+                sw.Write(babylonJSformat);
+                sw.Close();
+            }
+
+            return outputFile;
+        }
+
+        public void GenerateStatus(List<string> logs)
+        {
+            var initialLog = new List<string>
+            {
+                "*Exportation Status:",
+                babylonScene.meshes.Length + " mesh(es)",
+                babylonScene.lights.Length + " light(s)",
+                babylonScene.cameras.Length + " camera(s)",
+                babylonScene.materials.Length + " material(s)",
+                babylonScene.multiMaterials.Length + " multi-material(s)",
+                "",
+                "*Log:"
+            };
+
+            logs.InsertRange(0, initialLog);
+        }
+
+        string GetParentID(Transform transform)
+        {
+            if (transform.parent == null)
+            {
+                return null;
+            }
+
+            return GetID(transform.parent.gameObject);
+        }
+
+        string GetID(GameObject gameObject)
+        {
+            var key = gameObject.GetInstanceID();
+
+            if (!uniqueGuids.ContainsKey(key))
+            {
+                uniqueGuids[key] = Guid.NewGuid().ToString();
+            }
+
+            return uniqueGuids[key];
+        }
+
+        public void ConvertFromUnity()
+        {
+            ExporterWindow.ReportProgress(0, "Starting Babylon.js exportation process...");
+
+            gameObjects = Object.FindObjectsOfType(typeof(GameObject)) as GameObject[];
+
+            if (gameObjects.Length == 0)
+            {
+                ExporterWindow.ShowMessage("No gameobject! - Please add at least a gameobject to export");
+                return;
+            }
+
+            var itemsCount = gameObjects.Length;
+
+            var index = 0;
+            foreach (var gameObject in gameObjects)
+            {
+                var progress = ((float)index / itemsCount);
+                index++;
+                // Static meshes
+                var meshFilter = gameObject.GetComponent<MeshFilter>();
+                if (meshFilter != null)
+                {                    
+                    ConvertUnityMeshToBabylon(meshFilter.sharedMesh, meshFilter.transform, gameObject, progress);
+                    continue;
+                }
+
+                // Skinned meshes
+                var skinnedMesh = gameObject.GetComponent<SkinnedMeshRenderer>();
+                if (skinnedMesh != null)
+                {
+                    ConvertUnityMeshToBabylon(skinnedMesh.sharedMesh, skinnedMesh.transform, gameObject, progress);
+                    continue;
+                }
+
+                // Light
+                var light = gameObject.GetComponent<Light>();
+                if (light != null)
+                {
+                    ConvertUnityLightToBabylon(light, progress);
+                    continue;
+                }
+
+                // Camera
+                var camera = gameObject.GetComponent<Camera>();
+                if (camera != null)
+                {
+                    ConvertUnityCameraToBabylon(camera, progress);
+                    continue;
+                }
+
+                // Empty
+                ConvertUnityEmptyObjectToBabylon(gameObject);
+            }
+
+            // Materials
+            foreach (var mat in materialsDictionary)
+            {
+                babylonScene.MaterialsList.Add(mat.Value);
+            }
+
+            foreach (var multiMat in multiMatDictionary)
+            {
+                babylonScene.MultiMaterialsList.Add(multiMat.Value);
+            }
+
+            // Collisions
+            if (exportationOptions.ExportCollisions)
+            {
+                babylonScene.gravity = exportationOptions.Gravity.ToFloat();
+            }
+        }     
+    }
+}

+ 25 - 25
Exporters/Unity 5/Unity3D2Babylon/SerializableVector3.cs

@@ -1,25 +1,25 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using UnityEngine;
-
-namespace Unity3D2Babylon
-{
-    public class SerializableVector3
-    {
-        public float X { get; set; }
-        public float Y { get; set; }
-        public float Z { get; set; }
-
-        public static implicit operator Vector3(SerializableVector3 source)
-        {
-            return new Vector3(source.X, source.Y, source.Z);
-        }
-
-        public static implicit operator SerializableVector3(Vector3 source)
-        {
-            return new SerializableVector3 { X = source.x, Y = source.y, Z = source.z };
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UnityEngine;
+
+namespace Unity3D2Babylon
+{
+    public class SerializableVector3
+    {
+        public float X { get; set; }
+        public float Y { get; set; }
+        public float Z { get; set; }
+
+        public static implicit operator Vector3(SerializableVector3 source)
+        {
+            return new Vector3(source.X, source.Y, source.Z);
+        }
+
+        public static implicit operator SerializableVector3(Vector3 source)
+        {
+            return new SerializableVector3 { X = source.x, Y = source.y, Z = source.z };
+        }
+    }
+}

+ 53 - 53
Exporters/Unity 5/Unity3D2Babylon/Tools.cs

@@ -1,53 +1,53 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using UnityEngine;
-
-namespace Unity3D2Babylon
-{
-    public static class Tools
-    {
-        public static float[] ToFloat(this Color color)
-        {
-            var result = new float[4];
-            result[0] = color.r;
-            result[1] = color.g;
-            result[2] = color.b;
-            result[3] = color.a;
-
-            return result;
-        }
-
-        public static float[] ToFloat(this Vector3 vector3)
-        {
-            var result = new float[3];
-            result[0] = vector3.x;
-            result[1] = vector3.y;
-            result[2] = vector3.z;
-
-            return result;
-        }
-
-        public static float[] ToFloat(this SerializableVector3 vector3)
-        {
-            var result = new float[3];
-            result[0] = vector3.X;
-            result[1] = vector3.Y;
-            result[2] = vector3.Z;
-
-            return result;
-        }
-
-        public static float[] ToFloat(this Quaternion quaternion)
-        {
-            var result = new float[4];
-            result[0] = quaternion.x;
-            result[1] = quaternion.y;
-            result[2] = quaternion.z;
-            result[3] = quaternion.w;
-
-            return result;
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UnityEngine;
+
+namespace Unity3D2Babylon
+{
+    public static class Tools
+    {
+        public static float[] ToFloat(this Color color)
+        {
+            var result = new float[4];
+            result[0] = color.r;
+            result[1] = color.g;
+            result[2] = color.b;
+            result[3] = color.a;
+
+            return result;
+        }
+
+        public static float[] ToFloat(this Vector3 vector3)
+        {
+            var result = new float[3];
+            result[0] = vector3.x;
+            result[1] = vector3.y;
+            result[2] = vector3.z;
+
+            return result;
+        }
+
+        public static float[] ToFloat(this SerializableVector3 vector3)
+        {
+            var result = new float[3];
+            result[0] = vector3.X;
+            result[1] = vector3.Y;
+            result[2] = vector3.Z;
+
+            return result;
+        }
+
+        public static float[] ToFloat(this Quaternion quaternion)
+        {
+            var result = new float[4];
+            result[0] = quaternion.x;
+            result[1] = quaternion.y;
+            result[2] = quaternion.z;
+            result[3] = quaternion.w;
+
+            return result;
+        }
+    }
+}

+ 180 - 0
Exporters/Unity 5/Unity3D2Babylon/WebServer.cs

@@ -0,0 +1,180 @@
+using System;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Threading;
+using UnityEngine;
+
+namespace Unity3D2Babylon
+{
+    public static class WebServer
+    {
+        private static readonly HttpListener listener;
+
+        const string HtmlResponseText = @"
+<!doctype html>
+<html>
+
+<head>
+    <title>Babylon.js</title>
+    <script type='text/javascript' src='http://www.babylonjs.com/oimo.js'></script>
+    <script type='text/javascript' src='http://www.babylonjs.com/cannon.js'></script>
+    <script type='text/javascript' src='http://www.babylonjs.com/babylon.js'></script>
+    <style type='text/css'>
+        html, body, div, canvas {
+            width: 100%;
+            height: 100%;
+            padding: 0;
+            margin: 0;
+            overflow: hidden;
+        }
+
+        #debugLayerButton {
+            position: absolute;
+            border: white solid 1px;
+            background: rgba(128, 128, 128, 0.3);
+            color: white;
+            left: 50%;
+            width: 100px;
+            margin-left:-50px;
+            bottom: 10px;
+        }
+    </style>
+</head>
+
+<body>
+    <canvas id='canvas'></canvas>
+    <button id='debugLayerButton'>Debug layer</button>
+    <script type='text/javascript'>
+        var canvas = document.getElementById('canvas');
+        var engine = new BABYLON.Engine(canvas, true);
+       
+        BABYLON.SceneLoader.Load('', '###SCENE###', engine, function (newScene) {
+            newScene.activeCamera.attachControl(canvas);
+
+            engine.runRenderLoop(function() {
+                newScene.render();
+            });
+
+            window.addEventListener('resize', function () {
+                engine.resize();
+            });
+
+            document.getElementById('debugLayerButton').addEventListener('click', function () {
+                if (newScene.debugLayer.isVisible()) {
+                    newScene.debugLayer.hide();
+                } else {
+                    newScene.debugLayer.show();
+                }
+            });
+        });
+    </script>
+</body>
+</html>";
+
+        public const int Port = 45478;
+
+        public static bool IsSupported { get; private set; }
+
+        static WebServer()
+        {
+            try
+            {
+                listener = new HttpListener();
+
+                if (!HttpListener.IsSupported)
+                {
+                    IsSupported = false;
+                    return;
+                }
+
+                listener.Prefixes.Add("http://localhost:" + Port + "/");
+                listener.Start();
+
+                ThreadPool.QueueUserWorkItem(Listen);
+
+                IsSupported = true;
+            }
+            catch
+            {
+                IsSupported = false;
+            }
+        }
+
+        public static string SceneFilename { get; set; }
+        public static string SceneFolder { get; set; }
+        static System.Random r = new System.Random();
+        static void Listen(object state)
+        {
+            try
+            {
+                while (listener.IsListening)
+                {
+                    var context = listener.GetContext();
+                    var request = context.Request;
+                    var url = request.Url;
+
+                    context.Response.AddHeader("Cache-Control", "no-cache");
+                    if (string.IsNullOrEmpty(url.LocalPath) || url.LocalPath == "/")
+                    {
+
+                        var responseText = HtmlResponseText.Replace("###SCENE###", SceneFilename+"?once="+r.Next());
+                        WriteResponse(context, responseText);
+                    }
+                    else
+                    {
+                        try
+                        {
+                            var path = Path.Combine(SceneFolder, WWW.UnEscapeURL(url.PathAndQuery.Substring(1)));
+                            var questionMarkIndex = path.IndexOf("?");
+                            if (questionMarkIndex != -1)
+                            {
+                                path = path.Substring(0, questionMarkIndex);
+                            }
+                            var hashIndex = path.IndexOf("#");
+                            if (hashIndex != -1)
+                            {
+                                path = path.Substring(0, hashIndex);
+                            }
+                            var buffer = File.ReadAllBytes(path);
+                            WriteResponse(context, buffer);
+                        }
+                        catch
+                        {
+                            context.Response.StatusCode = 404;
+                            context.Response.Close();
+                        }
+                    }
+
+                }
+            }
+            catch
+            {
+            }
+        }
+
+        static void WriteResponse(HttpListenerContext context, string s)
+        {
+            WriteResponse(context.Response, s);
+        }
+
+        static void WriteResponse(HttpListenerContext context, byte[] buffer)
+        {
+            WriteResponse(context.Response, buffer);
+        }
+
+        static void WriteResponse(HttpListenerResponse response, string s)
+        {
+            byte[] buffer = Encoding.UTF8.GetBytes(s);
+            WriteResponse(response, buffer);
+        }
+
+        static void WriteResponse(HttpListenerResponse response, byte[] buffer)
+        {
+            response.ContentLength64 = buffer.Length;
+            Stream output = response.OutputStream;
+            output.Write(buffer, 0, buffer.Length);
+            output.Close();
+        }
+    }
+}

+ 2 - 1
Tools/Gulp/config.json

@@ -209,7 +209,8 @@
       "../../src/tools/hdr/babylon.tools.hdr.js",
       "../../src/tools/hdr/babylon.tools.pmremGenerator.js",
       "../../src/materials/textures/babylon.hdrcubetexture.js",
-      "../../src/debug/babylon.skeletonViewer.js"      
+      "../../src/debug/babylon.skeletonViewer.js",
+      "../../src/materials/babylon.pbrmaterial.js"      
     ]
   }
 }

File diff ditekan karena terlalu besar
+ 25 - 24
dist/preview release/babylon.core.js


File diff ditekan karena terlalu besar
+ 2336 - 2068
dist/preview release/babylon.d.ts


File diff ditekan karena terlalu besar
+ 33 - 30
dist/preview release/babylon.js


File diff ditekan karena terlalu besar
+ 1572 - 317
dist/preview release/babylon.max.js


File diff ditekan karena terlalu besar
+ 33 - 30
dist/preview release/babylon.noworker.js


+ 4 - 0
dist/preview release/what's new.md

@@ -11,6 +11,9 @@
     - Added Camera Inputs Manager to manage camera inputs (mouse, touch, keyboard, gamepad, ...) in a composable way, without relying on class inheritance [gleborgne](https://github.com/gleborgne)
     - Introduced new observable system to handle events ([nockawa](https://github.com/nockawa), [deltakosh](https://github.com/deltakosh))
     - Added a new VR camera : VRDeviceOrientationArcRotateCamera [temechon](https://github.com/Temechon)
+    - Unity3D exporter: Added support for lightmaps ([davrous](https://github.com/davrous), [deltakosh](https://github.com/deltakosh))
+    - Unity3D exporter: Added support for export and run (local webserver) ([davrous](https://github.com/davrous), [deltakosh](https://github.com/deltakosh))
+    - Moved PBR Material to core ([deltakosh](https://github.com/deltakosh))
   - **Updates**
     - Added skeleton.getBoneIndexByName(boneName: string) [dad72](https://github.com/dad72)
     - Added node._children to track children hierarchy ([deltakosh](https://github.com/deltakosh))
@@ -32,6 +35,7 @@
     - class `SolidParticleSystem` documented
     - class `MeshBuilder` documented
   - **Bug fixes**
+    - Fixed bug with billboards and parenting ([deltakosh](https://github.com/deltakosh))
     - Fixed bug with ArcRotateCamera.setTarget ([deltakosh](https://github.com/deltakosh))
   - **Breaking changes**
     - `VertexData.CreateLines()` removed as `MeshBuilder.CreateLines()` now calls `MeshBuilder.CreateLineSystem()`

+ 0 - 18
materialsLibrary/config.json

@@ -10,24 +10,6 @@
       "output": "babylon.gradientMaterial.js"
     },
     {
-      "file": "materials/pbr/babylon.pbrMaterial.ts",
-      "referenceFiles": [
-        "materials/pbr/includes/pbrFunctions.fx",
-        "materials/pbr/includes/harmonicsFunctions.fx",
-        "materials/pbr/includes/pbrLightFunctions.fx",
-        "materials/pbr/includes/pbrLightFunctionsCall.fx",
-        "materials/pbr/includes/pbrShadowFunctions.fx"  
-      ],
-      "shaderFiles": [
-        "materials/pbr/pbr.vertex.fx",
-        "materials/pbr/pbr.fragment.fx",
-        "materials/pbr/legacypbr.vertex.fx",
-        "materials/pbr/legacypbr.fragment.fx"
-      ],
-      "output": "babylon.pbrMaterial.js",
-      "declarationFilename": "babylon.pbrMaterial.d.ts"
-    },
-    {
       "file": "materials/normal/babylon.normalMaterial.ts",
       "shaderFiles": [
         "materials/normal/normal.vertex.fx",

File diff ditekan karena terlalu besar
+ 0 - 3
materialsLibrary/dist/babylon.pbrMaterial.min.js


+ 0 - 232
materialsLibrary/test/add/addpbr.js

@@ -1,232 +0,0 @@
-window.preparePBR = function() {
-	var pbr = new BABYLON.PBRMaterial("pbr", scene);
-
-	pbr.albedoTexture = new BABYLON.Texture("textures/amiga.jpg", scene);
-	pbr.albedoTexture.uScale = 5;
-	pbr.albedoTexture.vScale = 5;
-    
-    var hdrTexture = new BABYLON.HDRCubeTexture("textures/hdr/environment.hdr", scene, 512);
-    
-    // Uncomment for PMREM Generation
-    // var hdrTexture = new BABYLON.HDRCubeTexture("textures/hdr/environment.hdr", scene, 128, false, true, false, true);
-    pbr.reflectionTexture = hdrTexture;
-    pbr.refractionTexture = hdrTexture;
-    pbr.linkRefractionWithTransparency = true;
-    pbr.indexOfRefraction = 0.52;
-    
-	pbr.reflectivityColor = new BABYLON.Color3(0.3, 0.3, 0.3);
-	pbr.microSurface = 0.9;
-    
-    // Skybox
-    var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", 1000.0, scene);
-    var hdrSkyboxMaterial = new BABYLON.PBRMaterial("skyBox", scene);
-    hdrSkyboxMaterial.backFaceCulling = false;
-    hdrSkyboxMaterial.reflectionTexture = hdrTexture.clone();
-    hdrSkyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
-    hdrSkyboxMaterial.microSurface = 1;
-    hdrSkyboxMaterial.specularColor = new BABYLON.Color3(1, 1, 1);
-    hdrSkyboxMaterial.disableLighting = true;
-    hdrSkyboxMaterial.cameraExposure = 0.6;
-    hdrSkyboxMaterial.cameraContrast = 1.6;
-    hdrSkyboxMaterial.directIntensity = 0;
-    hdrSkybox.material = hdrSkyboxMaterial;
-    hdrSkybox.infiniteDistance = true;
-    hdrSkybox.setEnabled(false);
-    
-	registerButtonUI("pbr", "Default", function() {
-		setRangeValues({
-		  "directIntensity": 1,
-		  "emissiveIntensity": 1,
-		  "environmentIntensity": 1,
-		  "specularIntensity": 1,
-		  "ShadowIntensity": 1,
-		  "ShadeIntensity": 1,
-		  "cameraExposure": 1,
-		  "cameraContrast": 1,
-		  "microSurface": 0.9,
-		  "reflectivityColorR": 0.3,
-		  "reflectivityColorG": 0.3,
-		  "reflectivityColorB": 0.3,
-		  "albedoColorR": 1,
-		  "albedoColorG": 1,
-		  "albedoColorB": 1,
-		  "albedoColorLevel": 0
-		});
-	});
-    registerButtonUI("pbr", "Env Irradiance No Lighting", function() {
-		setRangeValues({
-		  "directIntensity": 0,
-		  "emissiveIntensity": 1,
-		  "environmentIntensity": 1,
-		  "specularIntensity": 1,
-		  "ShadowIntensity": 1,
-		  "ShadeIntensity": 1,
-		  "cameraExposure": 1,
-		  "cameraContrast": 1,
-		  "microSurface": 0,
-		  "reflectivityColorR": 0,
-		  "reflectivityColorG": 0,
-		  "reflectivityColorB": 0,
-		  "albedoColorR": 1,
-		  "albedoColorG": 1,
-		  "albedoColorB": 1,
-		  "albedoColorLevel": 1
-		});
-        
-        hdrSkybox.setEnabled(true);
-	});
-	registerButtonUI("pbr", "Rough Gold", function() {
-		setRangeValues({
-		  "directIntensity": 1.3439461727881254,
-		  "emissiveIntensity": 1,
-		  "environmentIntensity": 0.3685013699580344,
-		  "specularIntensity": 1,
-		  "ShadowIntensity": 1,
-		  "ShadeIntensity": 1,
-		  "cameraExposure": 0.7153261887420668,
-		  "cameraContrast": 1.6474178892241538,
-		  "microSurface": 0.42269274789303946,
-		  "reflectivityColorR": 1,
-		  "reflectivityColorG": 0.8453854957860789,
-		  "reflectivityColorB": 0.5093989525890475,
-		  "albedoColorR": 0,
-		  "albedoColorG": 0,
-		  "albedoColorB": 0,
-		  "albedoColorLevel": 1
-		});
-	});
-	registerButtonUI("pbr", "Plastic", function() {
-		setRangeValues({
-		  "directIntensity": 0.9971213540040931,
-		  "emissiveIntensity": 1,
-		  "environmentIntensity": 0.3685013699580344,
-		  "specularIntensity": 1,
-		  "ShadowIntensity": 0.975444802830091,
-		  "ShadeIntensity": 0.8020323934380749,
-		  "cameraExposure": 0.7586792910900708,
-		  "cameraContrast": 1.5823882357021477,
-		  "microSurface": 0.8562237713730799,
-		  "reflectivityColorR": 0.05,
-		  "reflectivityColorG": 0.05,
-		  "reflectivityColorB": 0.05,
-		  "albedoColorR": 0.20592723615301922,
-		  "albedoColorG": 0.942929976069088,
-		  "albedoColorB": 1,
-		  "albedoColorLevel": 1
-		});
-	});
-	
-    registerRangeUI("pbr", "indiceOfRefraction", 0, 2, function(value) {
-		pbr.indexOfRefraction = value;
-	}, function() {
-		return pbr.indexOfRefraction;
-	});
-    
-    registerRangeUI("pbr", "alpha", 0, 1, function(value) {
-		pbr.alpha = value;
-	}, function() {
-		return pbr.alpha;
-	});
-    
-    registerRangeUI("pbr", "directIntensity", 0, 2, function(value) {
-		pbr.directIntensity = value;
-	}, function() {
-		return pbr.directIntensity;
-	});
-    
-	registerRangeUI("pbr", "emissiveIntensity", 0, 2, function(value) {
-		pbr.emissiveIntensity = value;
-	}, function() {
-		return pbr.emissiveIntensity;
-	});
-	
-	registerRangeUI("pbr", "environmentIntensity", 0, 2, function(value) {
-		pbr.environmentIntensity = value;
-	}, function() {
-		return pbr.environmentIntensity;
-	});
-
-	registerRangeUI("pbr", "specularIntensity", 0, 2, function(value) {
-		pbr.specularIntensity = value;
-	}, function() {
-		return pbr.specularIntensity;
-	});
-	
-	registerRangeUI("pbr", "ShadowIntensity", 0, 2, function(value) {
-		pbr.overloadedShadowIntensity = value;
-	}, function() {
-		return pbr.overloadedShadowIntensity;
-	});
-	
-	registerRangeUI("pbr", "ShadeIntensity", 0, 2, function(value) {
-		pbr.overloadedShadeIntensity = value;
-	}, function() {
-		return pbr.overloadedShadeIntensity;
-	});
-	
-	registerRangeUI("pbr", "cameraExposure", 0, 2, function(value) {
-		pbr.cameraExposure = value;
-	}, function() {
-		return pbr.cameraExposure;
-	});
-
-	registerRangeUI("pbr", "cameraContrast", 0, 2, function(value) {
-		pbr.cameraContrast = value;
-	}, function() {
-		return pbr.cameraContrast;
-	});
-	
-	registerRangeUI("pbr", "microSurface", 0, 1, function(value) {
-		pbr.microSurface = value;
-	}, function() {
-		return pbr.microSurface;
-	});
-
-	registerRangeUI("pbr", "reflectivityColorR", 0, 1, function(value) {
-		pbr.reflectivityColor.r = value;
-	}, function() {
-		return pbr.reflectivityColor.r;
-	});
-
-	registerRangeUI("pbr", "reflectivityColorG", 0, 1, function(value) {
-		pbr.reflectivityColor.g = value;
-	}, function() {
-		return pbr.reflectivityColor.g;
-	});
-
-	registerRangeUI("pbr", "reflectivityColorB", 0, 1, function(value) {
-		pbr.reflectivityColor.b = value;
-	}, function() {
-		return pbr.reflectivityColor.b;
-	});
-
-	registerRangeUI("pbr", "albedoColorR", 0, 1, function(value) {
-		pbr.overloadedAlbedo.r = value;
-	}, function() {
-		return pbr.overloadedAlbedo.r;
-	});
-
-	registerRangeUI("pbr", "albedoColorG", 0, 1, function(value) {
-		pbr.overloadedAlbedo.g = value;
-	}, function() {
-		return pbr.overloadedAlbedo.g;
-	});
-
-	registerRangeUI("pbr", "albedoColorB", 0, 1, function(value) {
-		pbr.overloadedAlbedo.b = value;
-	}, function() {
-		return pbr.overloadedAlbedo.b;
-	});
-
-	registerRangeUI("pbr", "albedoColorLevel", 0, 1, function(value) {
-		pbr.overloadedAlbedoIntensity = value;
-	}, function() {
-		return pbr.overloadedAlbedoIntensity;
-	});
-    
-    registerButtonUI("pbr", "Toggle Skybox", function() {
-        hdrSkybox.setEnabled(!hdrSkybox.isEnabled());
-	});
-
-	return pbr;
-}

+ 1 - 8
materialsLibrary/test/index.html

@@ -10,7 +10,6 @@
 	<script src="../dist/babylon.fireMaterial.js"></script>
     <script src="../dist/babylon.lavaMaterial.js"></script>
 	<script src="../dist/babylon.terrainMaterial.js"></script>
-	<script src="../dist/babylon.pbrMaterial.js"></script>
 	<script src="../dist/babylon.furMaterial.js"></script>
 	<script src="../dist/babylon.triPlanarMaterial.js"></script>
 	<script src="../dist/babylon.gradientMaterial.js"></script>
@@ -50,7 +49,6 @@
 	<canvas id="renderCanvas"></canvas>
 
 	<script src="index.js"></script>
-    <script src="add/addpbr.js"></script>
     <script src="add/addlava.js"></script>
     <script src="add/addnormal.js"></script>
 	<script src="add/addwater.js"></script>
@@ -201,8 +199,6 @@
 				
 				var terrain = prepareTerrain();
 				
-				var pbr = preparePBR();
-				
 				var triPlanar = prepareTriPlanar();
 				
 				var sky = prepareSky();
@@ -214,7 +210,7 @@
 				sphere.material = std;				
 				sphere.receiveShadows = true;
 
-				gui.add(options, 'material', ['standard', 'simple', 'water', 'fire', 'lava', 'normal', 'terrain', 'pbr', 'fur', 'triPlanar', 'gradient', 'sky', 'grid']).onFinishChange(function () {
+				gui.add(options, 'material', ['standard', 'simple', 'water', 'fire', 'lava', 'normal', 'terrain', 'fur', 'triPlanar', 'gradient', 'sky', 'grid']).onFinishChange(function () {
 					water.enableRenderTargets(false);
 					skybox.material = skyboxMaterial;
 					currentMesh.isVisible = true;
@@ -241,9 +237,6 @@
 						case "terrain":
 							currentMaterial = terrain;
 							break;
-						case "pbr":
-							currentMaterial = pbr;
-							break;
 						case "fur":
 							currentMaterial = fur.material;
 							fur.configureFur(currentMesh);

+ 1 - 1
src/Actions/babylon.action.js

@@ -67,6 +67,6 @@ var BABYLON;
             return this._actionManager._getEffectiveTarget(target, propertyPath);
         };
         return Action;
-    })();
+    }());
     BABYLON.Action = Action;
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Actions/babylon.actionManager.js

@@ -47,7 +47,7 @@ var BABYLON;
             return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
         };
         return ActionEvent;
-    })();
+    }());
     BABYLON.ActionEvent = ActionEvent;
     /**
      * Action Manager manages all events to be triggered on a given mesh or the global scene.
@@ -468,6 +468,6 @@ var BABYLON;
         ActionManager.DragMovementThreshold = 10; // in pixels
         ActionManager.LongPressDelay = 500; // in milliseconds
         return ActionManager;
-    })();
+    }());
     BABYLON.ActionManager = ActionManager;
 })(BABYLON || (BABYLON = {}));

+ 4 - 4
src/Actions/babylon.condition.js

@@ -19,7 +19,7 @@ var BABYLON;
             return this._actionManager._getEffectiveTarget(target, propertyPath);
         };
         return Condition;
-    })();
+    }());
     BABYLON.Condition = Condition;
     var ValueCondition = (function (_super) {
         __extends(ValueCondition, _super);
@@ -86,7 +86,7 @@ var BABYLON;
         ValueCondition._IsGreater = 2;
         ValueCondition._IsLesser = 3;
         return ValueCondition;
-    })(Condition);
+    }(Condition));
     BABYLON.ValueCondition = ValueCondition;
     var PredicateCondition = (function (_super) {
         __extends(PredicateCondition, _super);
@@ -98,7 +98,7 @@ var BABYLON;
             return this.predicate();
         };
         return PredicateCondition;
-    })(Condition);
+    }(Condition));
     BABYLON.PredicateCondition = PredicateCondition;
     var StateCondition = (function (_super) {
         __extends(StateCondition, _super);
@@ -112,6 +112,6 @@ var BABYLON;
             return this._target.state === this.value;
         };
         return StateCondition;
-    })(Condition);
+    }(Condition));
     BABYLON.StateCondition = StateCondition;
 })(BABYLON || (BABYLON = {}));

+ 12 - 12
src/Actions/babylon.directActions.js

@@ -20,7 +20,7 @@ var BABYLON;
             this._target[this._property] = !this._target[this._property];
         };
         return SwitchBooleanAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.SwitchBooleanAction = SwitchBooleanAction;
     var SetStateAction = (function (_super) {
         __extends(SetStateAction, _super);
@@ -33,7 +33,7 @@ var BABYLON;
             this._target.state = this.value;
         };
         return SetStateAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.SetStateAction = SetStateAction;
     var SetValueAction = (function (_super) {
         __extends(SetValueAction, _super);
@@ -51,7 +51,7 @@ var BABYLON;
             this._target[this._property] = this.value;
         };
         return SetValueAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.SetValueAction = SetValueAction;
     var IncrementValueAction = (function (_super) {
         __extends(IncrementValueAction, _super);
@@ -72,7 +72,7 @@ var BABYLON;
             this._target[this._property] += this.value;
         };
         return IncrementValueAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.IncrementValueAction = IncrementValueAction;
     var PlayAnimationAction = (function (_super) {
         __extends(PlayAnimationAction, _super);
@@ -90,7 +90,7 @@ var BABYLON;
             scene.beginAnimation(this._target, this.from, this.to, this.loop);
         };
         return PlayAnimationAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.PlayAnimationAction = PlayAnimationAction;
     var StopAnimationAction = (function (_super) {
         __extends(StopAnimationAction, _super);
@@ -105,7 +105,7 @@ var BABYLON;
             scene.stopAnimation(this._target);
         };
         return StopAnimationAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.StopAnimationAction = StopAnimationAction;
     var DoNothingAction = (function (_super) {
         __extends(DoNothingAction, _super);
@@ -116,7 +116,7 @@ var BABYLON;
         DoNothingAction.prototype.execute = function () {
         };
         return DoNothingAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.DoNothingAction = DoNothingAction;
     var CombineAction = (function (_super) {
         __extends(CombineAction, _super);
@@ -136,7 +136,7 @@ var BABYLON;
             }
         };
         return CombineAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.CombineAction = CombineAction;
     var ExecuteCodeAction = (function (_super) {
         __extends(ExecuteCodeAction, _super);
@@ -148,7 +148,7 @@ var BABYLON;
             this.func(evt);
         };
         return ExecuteCodeAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.ExecuteCodeAction = ExecuteCodeAction;
     var SetParentAction = (function (_super) {
         __extends(SetParentAction, _super);
@@ -169,7 +169,7 @@ var BABYLON;
             this._target.parent = this._parent;
         };
         return SetParentAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.SetParentAction = SetParentAction;
     var PlaySoundAction = (function (_super) {
         __extends(PlaySoundAction, _super);
@@ -184,7 +184,7 @@ var BABYLON;
                 this._sound.play();
         };
         return PlaySoundAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.PlaySoundAction = PlaySoundAction;
     var StopSoundAction = (function (_super) {
         __extends(StopSoundAction, _super);
@@ -199,6 +199,6 @@ var BABYLON;
                 this._sound.stop();
         };
         return StopSoundAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.StopSoundAction = StopSoundAction;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Actions/babylon.interpolateValueAction.js

@@ -60,6 +60,6 @@ var BABYLON;
             scene.beginDirectAnimation(this._target, [animation], 0, 100, false, 1, this.onInterpolationDone);
         };
         return InterpolateValueAction;
-    })(BABYLON.Action);
+    }(BABYLON.Action));
     BABYLON.InterpolateValueAction = InterpolateValueAction;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Animations/babylon.animatable.js

@@ -127,6 +127,6 @@ var BABYLON;
             return running;
         };
         return Animatable;
-    })();
+    }());
     BABYLON.Animatable = Animatable;
 })(BABYLON || (BABYLON = {}));

+ 4 - 4
src/Animations/babylon.animation.js

@@ -10,7 +10,7 @@ var BABYLON;
             return new AnimationRange(this.name, this.from, this.to);
         };
         return AnimationRange;
-    })();
+    }());
     BABYLON.AnimationRange = AnimationRange;
     /**
      * Composed of a frame, and an action function
@@ -23,7 +23,7 @@ var BABYLON;
             this.isDone = false;
         }
         return AnimationEvent;
-    })();
+    }());
     BABYLON.AnimationEvent = AnimationEvent;
     var PathCursor = (function () {
         function PathCursor(path) {
@@ -80,7 +80,7 @@ var BABYLON;
             return this;
         };
         return PathCursor;
-    })();
+    }());
     BABYLON.PathCursor = PathCursor;
     var Animation = (function () {
         function Animation(name, targetProperty, framePerSecond, dataType, loopMode, enableBlending) {
@@ -697,6 +697,6 @@ var BABYLON;
         Animation._ANIMATIONLOOPMODE_CYCLE = 1;
         Animation._ANIMATIONLOOPMODE_CONSTANT = 2;
         return Animation;
-    })();
+    }());
     BABYLON.Animation = Animation;
 })(BABYLON || (BABYLON = {}));

+ 13 - 13
src/Animations/babylon.easing.js

@@ -58,7 +58,7 @@ var BABYLON;
         EasingFunction._EASINGMODE_EASEOUT = 1;
         EasingFunction._EASINGMODE_EASEINOUT = 2;
         return EasingFunction;
-    })();
+    }());
     BABYLON.EasingFunction = EasingFunction;
     var CircleEase = (function (_super) {
         __extends(CircleEase, _super);
@@ -70,7 +70,7 @@ var BABYLON;
             return (1.0 - Math.sqrt(1.0 - (gradient * gradient)));
         };
         return CircleEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.CircleEase = CircleEase;
     var BackEase = (function (_super) {
         __extends(BackEase, _super);
@@ -84,7 +84,7 @@ var BABYLON;
             return (Math.pow(gradient, 3.0) - ((gradient * num) * Math.sin(3.1415926535897931 * gradient)));
         };
         return BackEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.BackEase = BackEase;
     var BounceEase = (function (_super) {
         __extends(BounceEase, _super);
@@ -116,7 +116,7 @@ var BABYLON;
             return (((-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2)) * (num6 + num2));
         };
         return BounceEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.BounceEase = BounceEase;
     var CubicEase = (function (_super) {
         __extends(CubicEase, _super);
@@ -127,7 +127,7 @@ var BABYLON;
             return (gradient * gradient * gradient);
         };
         return CubicEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.CubicEase = CubicEase;
     var ElasticEase = (function (_super) {
         __extends(ElasticEase, _super);
@@ -151,7 +151,7 @@ var BABYLON;
             return (num2 * Math.sin(((6.2831853071795862 * num3) + 1.5707963267948966) * gradient));
         };
         return ElasticEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.ElasticEase = ElasticEase;
     var ExponentialEase = (function (_super) {
         __extends(ExponentialEase, _super);
@@ -167,7 +167,7 @@ var BABYLON;
             return ((Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0));
         };
         return ExponentialEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.ExponentialEase = ExponentialEase;
     var PowerEase = (function (_super) {
         __extends(PowerEase, _super);
@@ -181,7 +181,7 @@ var BABYLON;
             return Math.pow(gradient, y);
         };
         return PowerEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.PowerEase = PowerEase;
     var QuadraticEase = (function (_super) {
         __extends(QuadraticEase, _super);
@@ -192,7 +192,7 @@ var BABYLON;
             return (gradient * gradient);
         };
         return QuadraticEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.QuadraticEase = QuadraticEase;
     var QuarticEase = (function (_super) {
         __extends(QuarticEase, _super);
@@ -203,7 +203,7 @@ var BABYLON;
             return (gradient * gradient * gradient * gradient);
         };
         return QuarticEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.QuarticEase = QuarticEase;
     var QuinticEase = (function (_super) {
         __extends(QuinticEase, _super);
@@ -214,7 +214,7 @@ var BABYLON;
             return (gradient * gradient * gradient * gradient * gradient);
         };
         return QuinticEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.QuinticEase = QuinticEase;
     var SineEase = (function (_super) {
         __extends(SineEase, _super);
@@ -225,7 +225,7 @@ var BABYLON;
             return (1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient)));
         };
         return SineEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.SineEase = SineEase;
     var BezierCurveEase = (function (_super) {
         __extends(BezierCurveEase, _super);
@@ -244,6 +244,6 @@ var BABYLON;
             return BABYLON.BezierCurve.interpolate(gradient, this.x1, this.y1, this.x2, this.y2);
         };
         return BezierCurveEase;
-    })(EasingFunction);
+    }(EasingFunction));
     BABYLON.BezierCurveEase = BezierCurveEase;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Audio/babylon.analyser.js

@@ -106,6 +106,6 @@ var BABYLON;
             }
         };
         return Analyser;
-    })();
+    }());
     BABYLON.Analyser = Analyser;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Audio/babylon.audioEngine.js

@@ -101,6 +101,6 @@ var BABYLON;
             }
         };
         return AudioEngine;
-    })();
+    }());
     BABYLON.AudioEngine = AudioEngine;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Audio/babylon.sound.js

@@ -547,6 +547,6 @@ var BABYLON;
             return newSound;
         };
         return Sound;
-    })();
+    }());
     BABYLON.Sound = Sound;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Audio/babylon.soundtrack.js

@@ -96,6 +96,6 @@ var BABYLON;
             }
         };
         return SoundTrack;
-    })();
+    }());
     BABYLON.SoundTrack = SoundTrack;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Bones/babylon.bone.js

@@ -124,6 +124,6 @@ var BABYLON;
             return true;
         };
         return Bone;
-    })(BABYLON.Node);
+    }(BABYLON.Node));
     BABYLON.Bone = Bone;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Bones/babylon.skeleton.js

@@ -317,6 +317,6 @@ var BABYLON;
             return skeleton;
         };
         return Skeleton;
-    })();
+    }());
     BABYLON.Skeleton = Skeleton;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.gamepad.js

@@ -65,7 +65,7 @@ var BABYLON;
             BABYLON.serialize()
         ], ArcRotateCameraGamepadInput.prototype, "gamepadMoveSensibility", void 0);
         return ArcRotateCameraGamepadInput;
-    })();
+    }());
     BABYLON.ArcRotateCameraGamepadInput = ArcRotateCameraGamepadInput;
     BABYLON.CameraInputTypes["ArcRotateCameraGamepadInput"] = ArcRotateCameraGamepadInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.keyboard.js

@@ -107,7 +107,7 @@ var BABYLON;
             BABYLON.serialize()
         ], ArcRotateCameraKeyboardMoveInput.prototype, "keysRight", void 0);
         return ArcRotateCameraKeyboardMoveInput;
-    })();
+    }());
     BABYLON.ArcRotateCameraKeyboardMoveInput = ArcRotateCameraKeyboardMoveInput;
     BABYLON.CameraInputTypes["ArcRotateCameraKeyboardMoveInput"] = ArcRotateCameraKeyboardMoveInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.mousewheel.js

@@ -48,7 +48,7 @@ var BABYLON;
             BABYLON.serialize()
         ], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecision", void 0);
         return ArcRotateCameraMouseWheelInput;
-    })();
+    }());
     BABYLON.ArcRotateCameraMouseWheelInput = ArcRotateCameraMouseWheelInput;
     BABYLON.CameraInputTypes["ArcRotateCameraMouseWheelInput"] = ArcRotateCameraMouseWheelInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.js

@@ -200,7 +200,7 @@ var BABYLON;
             BABYLON.serialize()
         ], ArcRotateCameraPointersInput.prototype, "panningSensibility", void 0);
         return ArcRotateCameraPointersInput;
-    })();
+    }());
     BABYLON.ArcRotateCameraPointersInput = ArcRotateCameraPointersInput;
     BABYLON.CameraInputTypes["ArcRotateCameraPointersInput"] = ArcRotateCameraPointersInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.vrdeviceorientation.js

@@ -42,7 +42,7 @@ var BABYLON;
             return "VRDeviceOrientation";
         };
         return ArcRotateCameraVRDeviceOrientationInput;
-    })();
+    }());
     BABYLON.ArcRotateCameraVRDeviceOrientationInput = ArcRotateCameraVRDeviceOrientationInput;
     BABYLON.CameraInputTypes["ArcRotateCameraVRDeviceOrientationInput"] = ArcRotateCameraVRDeviceOrientationInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.js

@@ -70,7 +70,7 @@ var BABYLON;
             BABYLON.serialize()
         ], FreeCameraDeviceOrientationInput.prototype, "moveSensibility", void 0);
         return FreeCameraDeviceOrientationInput;
-    })();
+    }());
     BABYLON.FreeCameraDeviceOrientationInput = FreeCameraDeviceOrientationInput;
     BABYLON.CameraInputTypes["FreeCameraDeviceOrientationInput"] = FreeCameraDeviceOrientationInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.gamepad.js

@@ -60,7 +60,7 @@ var BABYLON;
             BABYLON.serialize()
         ], FreeCameraGamepadInput.prototype, "gamepadMoveSensibility", void 0);
         return FreeCameraGamepadInput;
-    })();
+    }());
     BABYLON.FreeCameraGamepadInput = FreeCameraGamepadInput;
     BABYLON.CameraInputTypes["FreeCameraGamepadInput"] = FreeCameraGamepadInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.keyboard.js

@@ -111,7 +111,7 @@ var BABYLON;
             BABYLON.serialize()
         ], FreeCameraKeyboardMoveInput.prototype, "keysRight", void 0);
         return FreeCameraKeyboardMoveInput;
-    })();
+    }());
     BABYLON.FreeCameraKeyboardMoveInput = FreeCameraKeyboardMoveInput;
     BABYLON.CameraInputTypes["FreeCameraKeyboardMoveInput"] = FreeCameraKeyboardMoveInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.mouse.js

@@ -89,7 +89,7 @@ var BABYLON;
             BABYLON.serialize()
         ], FreeCameraMouseInput.prototype, "angularSensibility", void 0);
         return FreeCameraMouseInput;
-    })();
+    }());
     BABYLON.FreeCameraMouseInput = FreeCameraMouseInput;
     BABYLON.CameraInputTypes["FreeCameraMouseInput"] = FreeCameraMouseInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.touch.js

@@ -127,7 +127,7 @@ var BABYLON;
             BABYLON.serialize()
         ], FreeCameraTouchInput.prototype, "touchMoveSensibility", void 0);
         return FreeCameraTouchInput;
-    })();
+    }());
     BABYLON.FreeCameraTouchInput = FreeCameraTouchInput;
     BABYLON.CameraInputTypes["FreeCameraTouchInput"] = FreeCameraTouchInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.virtualjoystick.js

@@ -48,7 +48,7 @@ var BABYLON;
             return "virtualJoystick";
         };
         return FreeCameraVirtualJoystickInput;
-    })();
+    }());
     BABYLON.FreeCameraVirtualJoystickInput = FreeCameraVirtualJoystickInput;
     BABYLON.CameraInputTypes["FreeCameraVirtualJoystickInput"] = FreeCameraVirtualJoystickInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.vrdeviceorientation.js

@@ -47,7 +47,7 @@ var BABYLON;
             return "VRDeviceOrientation";
         };
         return FreeCameraVRDeviceOrientationInput;
-    })();
+    }());
     BABYLON.FreeCameraVRDeviceOrientationInput = FreeCameraVRDeviceOrientationInput;
     BABYLON.CameraInputTypes["FreeCameraVRDeviceOrientationInput"] = FreeCameraVRDeviceOrientationInput;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/VR/babylon.vrCameraMetrics.js

@@ -67,6 +67,6 @@ var BABYLON;
             return result;
         };
         return VRCameraMetrics;
-    })();
+    }());
     BABYLON.VRCameraMetrics = VRCameraMetrics;
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Cameras/VR/babylon.vrDeviceOrientationCamera.js

@@ -19,7 +19,7 @@ var BABYLON;
             return "VRDeviceOrientationFreeCamera";
         };
         return VRDeviceOrientationFreeCamera;
-    })(BABYLON.FreeCamera);
+    }(BABYLON.FreeCamera));
     BABYLON.VRDeviceOrientationFreeCamera = VRDeviceOrientationFreeCamera;
     var VRDeviceOrientationArcRotateCamera = (function (_super) {
         __extends(VRDeviceOrientationArcRotateCamera, _super);
@@ -35,6 +35,6 @@ var BABYLON;
             return "VRDeviceOrientationArcRotateCamera";
         };
         return VRDeviceOrientationArcRotateCamera;
-    })(BABYLON.ArcRotateCamera);
+    }(BABYLON.ArcRotateCamera));
     BABYLON.VRDeviceOrientationArcRotateCamera = VRDeviceOrientationArcRotateCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/VR/babylon.webVRCamera.js

@@ -72,6 +72,6 @@ var BABYLON;
             return "WebVRFreeCamera";
         };
         return WebVRFreeCamera;
-    })(BABYLON.FreeCamera);
+    }(BABYLON.FreeCamera));
     BABYLON.WebVRFreeCamera = WebVRFreeCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.arcRotateCamera.js

@@ -533,6 +533,6 @@ var BABYLON;
             BABYLON.serialize()
         ], ArcRotateCamera.prototype, "allowUpsideDown", void 0);
         return ArcRotateCamera;
-    })(BABYLON.TargetCamera);
+    }(BABYLON.TargetCamera));
     BABYLON.ArcRotateCamera = ArcRotateCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.arcRotateCameraInputsManager.js

@@ -31,6 +31,6 @@ var BABYLON;
             return this;
         };
         return ArcRotateCameraInputsManager;
-    })(BABYLON.CameraInputsManager);
+    }(BABYLON.CameraInputsManager));
     BABYLON.ArcRotateCameraInputsManager = ArcRotateCameraInputsManager;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.camera.js

@@ -633,6 +633,6 @@ var BABYLON;
             BABYLON.serialize()
         ], Camera.prototype, "isStereoscopicSideBySide", void 0);
         return Camera;
-    })(BABYLON.Node);
+    }(BABYLON.Node));
     BABYLON.Camera = Camera;
 })(BABYLON || (BABYLON = {}));

+ 2 - 1
src/Cameras/babylon.cameraInputsManager.js

@@ -121,12 +121,13 @@ var BABYLON;
                     var construct = BABYLON.CameraInputTypes[this.attached[n].getTypeName()];
                     if (construct) {
                         var input = BABYLON.SerializationHelper.Parse(function () { return new construct(); }, parsedCamera, null);
+                        this.remove(this.attached[n]);
                         this.add(input);
                     }
                 }
             }
         };
         return CameraInputsManager;
-    })();
+    }());
     BABYLON.CameraInputsManager = CameraInputsManager;
 })(BABYLON || (BABYLON = {}));

+ 1 - 0
src/Cameras/babylon.cameraInputsManager.ts

@@ -162,6 +162,7 @@ module BABYLON {
                     var construct = CameraInputTypes[this.attached[n].getTypeName()];
                     if (construct) {
                         var input = SerializationHelper.Parse(() => { return new construct() }, parsedCamera, null);
+                        this.remove(this.attached[n]);
                         this.add(input as any);
                     }
                 }

+ 1 - 1
src/Cameras/babylon.deviceOrientationCamera.js

@@ -46,6 +46,6 @@ var BABYLON;
             return "DeviceOrientationCamera";
         };
         return DeviceOrientationCamera;
-    })(BABYLON.FreeCamera);
+    }(BABYLON.FreeCamera));
     BABYLON.DeviceOrientationCamera = DeviceOrientationCamera;
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Cameras/babylon.followCamera.js

@@ -84,7 +84,7 @@ var BABYLON;
             BABYLON.serializeAsMeshReference("lockedTargetId")
         ], FollowCamera.prototype, "target", void 0);
         return FollowCamera;
-    })(BABYLON.TargetCamera);
+    }(BABYLON.TargetCamera));
     BABYLON.FollowCamera = FollowCamera;
     var ArcFollowCamera = (function (_super) {
         __extends(ArcFollowCamera, _super);
@@ -112,6 +112,6 @@ var BABYLON;
             return "ArcFollowCamera";
         };
         return ArcFollowCamera;
-    })(BABYLON.TargetCamera);
+    }(BABYLON.TargetCamera));
     BABYLON.ArcFollowCamera = ArcFollowCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.freeCamera.js

@@ -180,6 +180,6 @@ var BABYLON;
             BABYLON.serialize()
         ], FreeCamera.prototype, "applyGravity", void 0);
         return FreeCamera;
-    })(BABYLON.TargetCamera);
+    }(BABYLON.TargetCamera));
     BABYLON.FreeCamera = FreeCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.freeCameraInputsManager.js

@@ -39,6 +39,6 @@ var BABYLON;
             return this;
         };
         return FreeCameraInputsManager;
-    })(BABYLON.CameraInputsManager);
+    }(BABYLON.CameraInputsManager));
     BABYLON.FreeCameraInputsManager = FreeCameraInputsManager;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.gamepadCamera.js

@@ -46,6 +46,6 @@ var BABYLON;
             return "GamepadCamera";
         };
         return GamepadCamera;
-    })(BABYLON.UniversalCamera);
+    }(BABYLON.UniversalCamera));
     BABYLON.GamepadCamera = GamepadCamera;
 })(BABYLON || (BABYLON = {}));

+ 8 - 8
src/Cameras/babylon.stereoscopicCameras.js

@@ -16,7 +16,7 @@ var BABYLON;
             return "AnaglyphFreeCamera";
         };
         return AnaglyphFreeCamera;
-    })(BABYLON.FreeCamera);
+    }(BABYLON.FreeCamera));
     BABYLON.AnaglyphFreeCamera = AnaglyphFreeCamera;
     var AnaglyphArcRotateCamera = (function (_super) {
         __extends(AnaglyphArcRotateCamera, _super);
@@ -29,7 +29,7 @@ var BABYLON;
             return "AnaglyphArcRotateCamera";
         };
         return AnaglyphArcRotateCamera;
-    })(BABYLON.ArcRotateCamera);
+    }(BABYLON.ArcRotateCamera));
     BABYLON.AnaglyphArcRotateCamera = AnaglyphArcRotateCamera;
     var AnaglyphGamepadCamera = (function (_super) {
         __extends(AnaglyphGamepadCamera, _super);
@@ -42,7 +42,7 @@ var BABYLON;
             return "AnaglyphGamepadCamera";
         };
         return AnaglyphGamepadCamera;
-    })(BABYLON.GamepadCamera);
+    }(BABYLON.GamepadCamera));
     BABYLON.AnaglyphGamepadCamera = AnaglyphGamepadCamera;
     var AnaglyphUniversalCamera = (function (_super) {
         __extends(AnaglyphUniversalCamera, _super);
@@ -55,7 +55,7 @@ var BABYLON;
             return "AnaglyphUniversalCamera";
         };
         return AnaglyphUniversalCamera;
-    })(BABYLON.UniversalCamera);
+    }(BABYLON.UniversalCamera));
     BABYLON.AnaglyphUniversalCamera = AnaglyphUniversalCamera;
     var StereoscopicFreeCamera = (function (_super) {
         __extends(StereoscopicFreeCamera, _super);
@@ -69,7 +69,7 @@ var BABYLON;
             return "StereoscopicFreeCamera";
         };
         return StereoscopicFreeCamera;
-    })(BABYLON.FreeCamera);
+    }(BABYLON.FreeCamera));
     BABYLON.StereoscopicFreeCamera = StereoscopicFreeCamera;
     var StereoscopicArcRotateCamera = (function (_super) {
         __extends(StereoscopicArcRotateCamera, _super);
@@ -83,7 +83,7 @@ var BABYLON;
             return "StereoscopicArcRotateCamera";
         };
         return StereoscopicArcRotateCamera;
-    })(BABYLON.ArcRotateCamera);
+    }(BABYLON.ArcRotateCamera));
     BABYLON.StereoscopicArcRotateCamera = StereoscopicArcRotateCamera;
     var StereoscopicGamepadCamera = (function (_super) {
         __extends(StereoscopicGamepadCamera, _super);
@@ -97,7 +97,7 @@ var BABYLON;
             return "StereoscopicGamepadCamera";
         };
         return StereoscopicGamepadCamera;
-    })(BABYLON.GamepadCamera);
+    }(BABYLON.GamepadCamera));
     BABYLON.StereoscopicGamepadCamera = StereoscopicGamepadCamera;
     var StereoscopicUniversalCamera = (function (_super) {
         __extends(StereoscopicUniversalCamera, _super);
@@ -111,6 +111,6 @@ var BABYLON;
             return "StereoscopicUniversalCamera";
         };
         return StereoscopicUniversalCamera;
-    })(BABYLON.UniversalCamera);
+    }(BABYLON.UniversalCamera));
     BABYLON.StereoscopicUniversalCamera = StereoscopicUniversalCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.targetCamera.js

@@ -259,6 +259,6 @@ var BABYLON;
             BABYLON.serializeAsMeshReference("lockedTargetId")
         ], TargetCamera.prototype, "lockedTarget", void 0);
         return TargetCamera;
-    })(BABYLON.Camera);
+    }(BABYLON.Camera));
     BABYLON.TargetCamera = TargetCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.touchCamera.js

@@ -46,6 +46,6 @@ var BABYLON;
             return "TouchCamera";
         };
         return TouchCamera;
-    })(BABYLON.FreeCamera);
+    }(BABYLON.FreeCamera));
     BABYLON.TouchCamera = TouchCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.universalCamera.js

@@ -46,6 +46,6 @@ var BABYLON;
             return "UniversalCamera";
         };
         return UniversalCamera;
-    })(BABYLON.TouchCamera);
+    }(BABYLON.TouchCamera));
     BABYLON.UniversalCamera = UniversalCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.virtualJoysticksCamera.js

@@ -13,6 +13,6 @@ var BABYLON;
             this.inputs.addVirtualJoystick();
         }
         return VirtualJoysticksCamera;
-    })(BABYLON.FreeCamera);
+    }(BABYLON.FreeCamera));
     BABYLON.VirtualJoysticksCamera = VirtualJoysticksCamera;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Collisions/babylon.collider.js

@@ -267,6 +267,6 @@ var BABYLON;
             this._destinationPoint.subtractToRef(this.intersectionPoint, vel);
         };
         return Collider;
-    })();
+    }());
     BABYLON.Collider = Collider;
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Collisions/babylon.collisionCoordinator.js

@@ -205,7 +205,7 @@ var BABYLON;
             };
         };
         return CollisionCoordinatorWorker;
-    })();
+    }());
     BABYLON.CollisionCoordinatorWorker = CollisionCoordinatorWorker;
     var CollisionCoordinatorLegacy = (function () {
         function CollisionCoordinatorLegacy() {
@@ -268,6 +268,6 @@ var BABYLON;
             this._collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh);
         };
         return CollisionCoordinatorLegacy;
-    })();
+    }());
     BABYLON.CollisionCoordinatorLegacy = CollisionCoordinatorLegacy;
 })(BABYLON || (BABYLON = {}));

+ 3 - 3
src/Collisions/babylon.collisionWorker.js

@@ -32,7 +32,7 @@ var BABYLON;
             delete this._geometries[id];
         };
         return CollisionCache;
-    })();
+    }());
     BABYLON.CollisionCache = CollisionCache;
     var CollideWorker = (function () {
         function CollideWorker(collider, _collisionCache, finalPosition) {
@@ -144,7 +144,7 @@ var BABYLON;
             return this.collider._canDoCollision(BABYLON.Vector3.FromArray(subMesh.sphereCenter), subMesh.sphereRadius, BABYLON.Vector3.FromArray(subMesh.boxMinimum), BABYLON.Vector3.FromArray(subMesh.boxMaximum));
         };
         return CollideWorker;
-    })();
+    }());
     BABYLON.CollideWorker = CollideWorker;
     var CollisionDetectorTransferable = (function () {
         function CollisionDetectorTransferable() {
@@ -206,7 +206,7 @@ var BABYLON;
             postMessage(reply, undefined);
         };
         return CollisionDetectorTransferable;
-    })();
+    }());
     BABYLON.CollisionDetectorTransferable = CollisionDetectorTransferable;
     //check if we are in a web worker, as this code should NOT run on the main UI thread
     try {

+ 2 - 2
src/Collisions/babylon.pickingInfo.js

@@ -9,7 +9,7 @@ var BABYLON;
             this.subMeshId = 0;
         }
         return IntersectionInfo;
-    })();
+    }());
     BABYLON.IntersectionInfo = IntersectionInfo;
     var PickingInfo = (function () {
         function PickingInfo() {
@@ -71,6 +71,6 @@ var BABYLON;
             return new BABYLON.Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);
         };
         return PickingInfo;
-    })();
+    }());
     BABYLON.PickingInfo = PickingInfo;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/Octrees/babylon.octree.js

@@ -83,6 +83,6 @@ var BABYLON;
             }
         };
         return Octree;
-    })();
+    }());
     BABYLON.Octree = Octree;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/Octrees/babylon.octreeBlock.js

@@ -117,6 +117,6 @@ var BABYLON;
             BABYLON.Octree._CreateBlocks(this._minPoint, this._maxPoint, this.entries, this._capacity, this._depth, this._maxDepth, this, this._creationFunc);
         };
         return OctreeBlock;
-    })();
+    }());
     BABYLON.OctreeBlock = OctreeBlock;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/babylon.boundingBox.js

@@ -138,6 +138,6 @@ var BABYLON;
             return true;
         };
         return BoundingBox;
-    })();
+    }());
     BABYLON.BoundingBox = BoundingBox;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/babylon.boundingInfo.js

@@ -114,6 +114,6 @@ var BABYLON;
             return true;
         };
         return BoundingInfo;
-    })();
+    }());
     BABYLON.BoundingInfo = BoundingInfo;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/babylon.boundingSphere.js

@@ -44,6 +44,6 @@ var BABYLON;
             return true;
         };
         return BoundingSphere;
-    })();
+    }());
     BABYLON.BoundingSphere = BoundingSphere;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/babylon.ray.js

@@ -267,6 +267,6 @@ var BABYLON;
         Ray.smallnum = 0.00000001;
         Ray.rayl = 10e8;
         return Ray;
-    })();
+    }());
     BABYLON.Ray = Ray;
 })(BABYLON || (BABYLON = {}));

+ 4 - 3
src/Debug/babylon.debugLayer.js

@@ -629,6 +629,7 @@ var BABYLON;
                 + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
                 + "<b>Count</b><br>"
                 + "Total meshes: " + scene.meshes.length + "<br>"
+                + "Total lights: " + scene.lights.length + "<br>"
                 + "Total vertices: " + scene.getTotalVertices() + "<br>"
                 + "Total materials: " + scene.materials.length + "<br>"
                 + "Total textures: " + scene.textures.length + "<br>"
@@ -636,7 +637,7 @@ var BABYLON;
                 + "Active indices: " + scene.getActiveIndices() + "<br>"
                 + "Active bones: " + scene.getActiveBones() + "<br>"
                 + "Active particles: " + scene.getActiveParticles() + "<br>"
-                + "<b>Draw calls: " + engine.drawCalls + "</b><br><br><br>"
+                + "<b>Draw calls: " + engine.drawCalls + "</b><br><br>"
                 + "<b>Duration</b><br>"
                 + "Meshes selection:</i> " + BABYLON.Tools.Format(scene.getEvaluateActiveMeshesDuration()) + " ms<br>"
                 + "Render Targets: " + BABYLON.Tools.Format(scene.getRenderTargetsDuration()) + " ms<br>"
@@ -645,7 +646,7 @@ var BABYLON;
                 + "Render: <b>" + BABYLON.Tools.Format(scene.getRenderDuration()) + " ms</b><br>"
                 + "Frame: " + BABYLON.Tools.Format(scene.getLastFrameDuration()) + " ms<br>"
                 + "Potential FPS: " + BABYLON.Tools.Format(1000.0 / scene.getLastFrameDuration(), 0) + "<br>"
-                + "Resolution: " + engine.getRenderWidth() + "x" + engine.getRenderHeight() + "<br>"
+                + "Resolution: " + engine.getRenderWidth() + "x" + engine.getRenderHeight() + "<br><br>"
                 + "</div>"
                 + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
                 + "<b>Extensions</b><br>"
@@ -673,6 +674,6 @@ var BABYLON;
             }
         };
         return DebugLayer;
-    })();
+    }());
     BABYLON.DebugLayer = DebugLayer;
 })(BABYLON || (BABYLON = {}));

+ 43 - 42
src/Debug/babylon.debugLayer.ts

@@ -781,48 +781,49 @@
             var glInfo = engine.getGlInfo();
 
             this._statsSubsetDiv.innerHTML = "Babylon.js v" + Engine.Version + " - <b>" + Tools.Format(engine.getFps(), 0) + " fps</b><br><br>"
-            + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
-            + "<b>Count</b><br>"
-            + "Total meshes: " + scene.meshes.length + "<br>"
-            + "Total vertices: " + scene.getTotalVertices() + "<br>"
-            + "Total materials: " + scene.materials.length + "<br>"
-            + "Total textures: " + scene.textures.length + "<br>"
-            + "Active meshes: " + scene.getActiveMeshes().length + "<br>"
-            + "Active indices: " + scene.getActiveIndices() + "<br>"
-            + "Active bones: " + scene.getActiveBones() + "<br>"
-            + "Active particles: " + scene.getActiveParticles() + "<br>"
-            + "<b>Draw calls: " + engine.drawCalls + "</b><br><br><br>"
-            + "<b>Duration</b><br>"
-            + "Meshes selection:</i> " + Tools.Format(scene.getEvaluateActiveMeshesDuration()) + " ms<br>"
-            + "Render Targets: " + Tools.Format(scene.getRenderTargetsDuration()) + " ms<br>"
-            + "Particles: " + Tools.Format(scene.getParticlesDuration()) + " ms<br>"
-            + "Sprites: " + Tools.Format(scene.getSpritesDuration()) + " ms<br><br>"
-            + "Render: <b>" + Tools.Format(scene.getRenderDuration()) + " ms</b><br>"
-            + "Frame: " + Tools.Format(scene.getLastFrameDuration()) + " ms<br>"
-            + "Potential FPS: " + Tools.Format(1000.0 / scene.getLastFrameDuration(), 0) + "<br>"
-            + "Resolution: " + engine.getRenderWidth() + "x" + engine.getRenderHeight() + "<br>"
-            + "</div>"
-            + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
-            + "<b>Extensions</b><br>"
-            + "Std derivatives: " + (engine.getCaps().standardDerivatives ? "Yes" : "No") + "<br>"
-            + "Compressed textures: " + (engine.getCaps().s3tc ? "Yes" : "No") + "<br>"
-            + "Hardware instances: " + (engine.getCaps().instancedArrays ? "Yes" : "No") + "<br>"
-            + "Texture float: " + (engine.getCaps().textureFloat ? "Yes" : "No") + "<br><br>"
-            + "32bits indices: " + (engine.getCaps().uintIndices ? "Yes" : "No") + "<br>"
-            + "Fragment depth: " + (engine.getCaps().fragmentDepthSupported ? "Yes" : "No") + "<br>"
-            + "High precision shaders: " + (engine.getCaps().highPrecisionShaderSupported ? "Yes" : "No") + "<br>"
-            + "Draw buffers: " + (engine.getCaps().drawBuffersExtension ? "Yes" : "No") + "<br>"
-            + "</div><br>"
-            + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
-            + "<b>Caps.</b><br>"
-            + "Max textures units: " + engine.getCaps().maxTexturesImageUnits + "<br>"
-            + "Max textures size: " + engine.getCaps().maxTextureSize + "<br>"
-            + "Max anisotropy: " + engine.getCaps().maxAnisotropy + "<br>"
-            + "<b>Info</b><br>"
-            + "WebGL feature level: " + engine.webGLVersion + "<br>"
-            + glInfo.version + "<br>"
-            + "</div><br>"
-            + glInfo.renderer + "<br>";
+                + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
+                + "<b>Count</b><br>"
+                + "Total meshes: " + scene.meshes.length + "<br>"
+                + "Total lights: " + scene.lights.length + "<br>"
+                + "Total vertices: " + scene.getTotalVertices() + "<br>"
+                + "Total materials: " + scene.materials.length + "<br>"
+                + "Total textures: " + scene.textures.length + "<br>"
+                + "Active meshes: " + scene.getActiveMeshes().length + "<br>"
+                + "Active indices: " + scene.getActiveIndices() + "<br>"
+                + "Active bones: " + scene.getActiveBones() + "<br>"
+                + "Active particles: " + scene.getActiveParticles() + "<br>"
+                + "<b>Draw calls: " + engine.drawCalls + "</b><br><br>"
+                + "<b>Duration</b><br>"
+                + "Meshes selection:</i> " + Tools.Format(scene.getEvaluateActiveMeshesDuration()) + " ms<br>"
+                + "Render Targets: " + Tools.Format(scene.getRenderTargetsDuration()) + " ms<br>"
+                + "Particles: " + Tools.Format(scene.getParticlesDuration()) + " ms<br>"
+                + "Sprites: " + Tools.Format(scene.getSpritesDuration()) + " ms<br><br>"
+                + "Render: <b>" + Tools.Format(scene.getRenderDuration()) + " ms</b><br>"
+                + "Frame: " + Tools.Format(scene.getLastFrameDuration()) + " ms<br>"
+                + "Potential FPS: " + Tools.Format(1000.0 / scene.getLastFrameDuration(), 0) + "<br>"
+                + "Resolution: " + engine.getRenderWidth() + "x" + engine.getRenderHeight() + "<br><br>"
+                + "</div>"
+                + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
+                + "<b>Extensions</b><br>"
+                + "Std derivatives: " + (engine.getCaps().standardDerivatives ? "Yes" : "No") + "<br>"
+                + "Compressed textures: " + (engine.getCaps().s3tc ? "Yes" : "No") + "<br>"
+                + "Hardware instances: " + (engine.getCaps().instancedArrays ? "Yes" : "No") + "<br>"
+                + "Texture float: " + (engine.getCaps().textureFloat ? "Yes" : "No") + "<br><br>"
+                + "32bits indices: " + (engine.getCaps().uintIndices ? "Yes" : "No") + "<br>"
+                + "Fragment depth: " + (engine.getCaps().fragmentDepthSupported ? "Yes" : "No") + "<br>"
+                + "High precision shaders: " + (engine.getCaps().highPrecisionShaderSupported ? "Yes" : "No") + "<br>"
+                + "Draw buffers: " + (engine.getCaps().drawBuffersExtension ? "Yes" : "No") + "<br>"
+                + "</div><br>"
+                + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
+                + "<b>Caps.</b><br>"
+                + "Max textures units: " + engine.getCaps().maxTexturesImageUnits + "<br>"
+                + "Max textures size: " + engine.getCaps().maxTextureSize + "<br>"
+                + "Max anisotropy: " + engine.getCaps().maxAnisotropy + "<br>"
+                + "<b>Info</b><br>"
+                + "WebGL feature level: " + engine.webGLVersion + "<br>"
+                + glInfo.version + "<br>"
+                + "</div><br>"
+                + glInfo.renderer + "<br>";
 
             if (this.customStatsFunction) {
                 this._statsSubsetDiv.innerHTML += this._statsSubsetDiv.innerHTML;

+ 1 - 1
src/Debug/babylon.skeletonViewer.js

@@ -131,7 +131,7 @@ var BABYLON;
                 }
             };
             return SkeletonViewer;
-        })();
+        }());
         Debug.SkeletonViewer = SkeletonViewer;
     })(Debug = BABYLON.Debug || (BABYLON.Debug = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Layer/babylon.layer.js

@@ -90,6 +90,6 @@ var BABYLON;
             }
         };
         return Layer;
-    })();
+    }());
     BABYLON.Layer = Layer;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/LensFlare/babylon.lensFlare.js

@@ -18,6 +18,6 @@ var BABYLON;
             system.lensFlares.push(this);
         }
         return LensFlare;
-    })();
+    }());
     BABYLON.LensFlare = LensFlare;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/LensFlare/babylon.lensFlareSystem.js

@@ -203,6 +203,6 @@ var BABYLON;
             return serializationObject;
         };
         return LensFlareSystem;
-    })();
+    }());
     BABYLON.LensFlareSystem = LensFlareSystem;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Lights/Shadows/babylon.shadowGenerator.js

@@ -400,6 +400,6 @@ var BABYLON;
         ShadowGenerator._FILTER_POISSONSAMPLING = 2;
         ShadowGenerator._FILTER_BLURVARIANCESHADOWMAP = 3;
         return ShadowGenerator;
-    })();
+    }());
     BABYLON.ShadowGenerator = ShadowGenerator;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Lights/babylon.directionalLight.js

@@ -124,6 +124,6 @@ var BABYLON;
             BABYLON.serialize()
         ], DirectionalLight.prototype, "autoUpdateExtends", void 0);
         return DirectionalLight;
-    })(BABYLON.Light);
+    }(BABYLON.Light));
     BABYLON.DirectionalLight = DirectionalLight;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Lights/babylon.hemisphericLight.js

@@ -46,6 +46,6 @@ var BABYLON;
             BABYLON.serializeAsVector3()
         ], HemisphericLight.prototype, "direction", void 0);
         return HemisphericLight;
-    })(BABYLON.Light);
+    }(BABYLON.Light));
     BABYLON.HemisphericLight = HemisphericLight;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Lights/babylon.light.js

@@ -189,6 +189,6 @@ var BABYLON;
             BABYLON.serialize()
         ], Light.prototype, "radius", void 0);
         return Light;
-    })(BABYLON.Node);
+    }(BABYLON.Node));
     BABYLON.Light = Light;
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Lights/babylon.pointLight.js

@@ -25,7 +25,7 @@ var BABYLON;
                 if (!this.transformedPosition) {
                     this.transformedPosition = BABYLON.Vector3.Zero();
                 }
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);
+                BABYLON.Vector3.TransformCoordinatesToRef(this.getAbsolutePosition(), this.parent.getWorldMatrix(), this.transformedPosition);
                 return true;
             }
             return false;
@@ -82,6 +82,6 @@ var BABYLON;
             BABYLON.serializeAsVector3()
         ], PointLight.prototype, "position", void 0);
         return PointLight;
-    })(BABYLON.Light);
+    }(BABYLON.Light));
     BABYLON.PointLight = PointLight;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Lights/babylon.pointLight.ts

@@ -22,7 +22,7 @@
                     this.transformedPosition = Vector3.Zero();
                 }
 
-                Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);
+                Vector3.TransformCoordinatesToRef(this.getAbsolutePosition(), this.parent.getWorldMatrix(), this.transformedPosition);
 
                 return true;
             }

+ 1 - 1
src/Lights/babylon.spotLight.js

@@ -93,6 +93,6 @@ var BABYLON;
             BABYLON.serialize()
         ], SpotLight.prototype, "exponent", void 0);
         return SpotLight;
-    })(BABYLON.Light);
+    }(BABYLON.Light));
     BABYLON.SpotLight = SpotLight;
 })(BABYLON || (BABYLON = {}));

+ 0 - 2
src/Loading/Plugins/babylon.babylonFileLoader.js

@@ -419,8 +419,6 @@ var BABYLON;
                                 var emptySound = new BABYLON.Sound(parsedSound.name, null, scene);
                             }
                         }
-                        log += (index === 0 ? "\n\tSounds:" : "");
-                        log += "\n\t\t" + mat.toString(fullDetails);
                     }
                     loadedSounds = [];
                     // Connect parents & children and parse actions

+ 0 - 2
src/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -441,8 +441,6 @@
                             var emptySound = new Sound(parsedSound.name, null, scene);
                         }
                     }
-                    log += (index === 0 ? "\n\tSounds:" : "");
-                    log += "\n\t\t" + mat.toString(fullDetails);
                 }
 
                 loadedSounds = [];

+ 1 - 5
src/Loading/babylon.sceneLoader.js

@@ -168,10 +168,6 @@ var BABYLON;
         * @param engine is the instance of BABYLON.Engine to use to create the scene
         */
         SceneLoader.Load = function (rootUrl, sceneFilename, engine, onsuccess, progressCallBack, onerror) {
-            if (!SceneLoader._warned) {
-                BABYLON.Tools.Warn("SceneLoader.Load deprecated since 2.4.  Use SceneLoader.Append.");
-                SceneLoader._warned = true;
-            }
             SceneLoader.Append(rootUrl, sceneFilename, new BABYLON.Scene(engine), onsuccess, progressCallBack, onerror);
         };
         /**
@@ -257,7 +253,7 @@ var BABYLON;
         // Members
         SceneLoader._registeredPlugins = new Array();
         return SceneLoader;
-    })();
+    }());
     BABYLON.SceneLoader = SceneLoader;
     ;
 })(BABYLON || (BABYLON = {}));

+ 0 - 0
src/Loading/babylon.sceneLoader.ts


Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini