Deltakosh 11 tahun lalu
induk
melakukan
08f7f83832
45 mengubah file dengan 621 tambahan dan 241 penghapusan
  1. 4 0
      Babylon/Materials/textures/babylon.texture.js
  2. 2 2
      Babylon/PostProcess/babylon.blackAndWhitePostProcess.js
  3. 7 2
      Babylon/PostProcess/babylon.blurPostProcess.js
  4. 16 0
      Babylon/PostProcess/babylon.convolutionPostProcess.js
  5. 10 10
      Babylon/PostProcess/babylon.fxaaPostProcess.js
  6. 2 2
      Babylon/PostProcess/babylon.passPostProcess.js
  7. 69 67
      Babylon/PostProcess/babylon.postProcess.js
  8. 3 6
      Babylon/PostProcess/babylon.postProcessManager.js
  9. 2 2
      Babylon/PostProcess/babylon.refractionPostProcess.js
  10. 17 0
      Babylon/Shaders/convolution.fragment.fx
  11. 1 1
      Babylon/Shaders/fxaa.fragment.fx
  12. 4 10
      Babylon/babylon.engine.js
  13. 1 1
      Babylon/jscompaktor.bat
  14. 18 0
      Exporters/FBX - OBJ/BabylonExport.Core/Exporters/Blender/io_export_babylon.py
  15. 3 2
      Exporters/FBX - OBJ/BabylonExport.Core/Exporters/FBX/FBXExporter.cs
  16. 10 3
      Exporters/FBX - OBJ/BabylonExport.Core/Exporters/FBX/XNA/GraphicsDeviceService.cs
  17. TEMPAT SAMPAH
      Exporters/FBX - OBJ/BabylonExport.zip
  18. 67 12
      Exporters/FBX - OBJ/BabylonExport/BabylonExport.csproj
  19. 24 1
      Exporters/FBX - OBJ/BabylonExport/Program.cs
  20. 17 35
      Exporters/FBX - OBJ/BabylonExport/Service.cs
  21. 0 12
      Exporters/FBX - OBJ/BabylonExport/generateAll.bat
  22. TEMPAT SAMPAH
      Samples/Assets/Sand.jpg
  23. TEMPAT SAMPAH
      Samples/Assets/Snow.jpg
  24. TEMPAT SAMPAH
      Samples/Assets/rock.jpg
  25. 77 0
      Samples/Scenes/Customs/postprocessBloom.js
  26. 56 0
      Samples/Scenes/Customs/postprocessRefraction.js
  27. 25 0
      Samples/Scenes/Customs/postprocesses/compose.fragment.fx
  28. 29 0
      Samples/Scenes/Customs/postprocesses/downsample.fragment.fx
  29. TEMPAT SAMPAH
      Samples/Scenes/Customs/refMap.jpg
  30. TEMPAT SAMPAH
      Samples/Scenes/Customs/skybox/snow_nx.jpg
  31. TEMPAT SAMPAH
      Samples/Scenes/Customs/skybox/snow_ny.jpg
  32. TEMPAT SAMPAH
      Samples/Scenes/Customs/skybox/snow_nz.jpg
  33. TEMPAT SAMPAH
      Samples/Scenes/Customs/skybox/snow_px.jpg
  34. TEMPAT SAMPAH
      Samples/Scenes/Customs/skybox/snow_py.jpg
  35. TEMPAT SAMPAH
      Samples/Scenes/Customs/skybox/snow_pz.jpg
  36. TEMPAT SAMPAH
      Samples/Screenshots/postprocessBloom.jpg
  37. TEMPAT SAMPAH
      Samples/Screenshots/postprocessRefraction.jpg
  38. 4 3
      Samples/babylon.js
  39. 14 7
      Samples/index.css
  40. 21 7
      Samples/index.html
  41. 100 40
      Samples/index.js
  42. 0 13
      babylon.1.5.3.js
  43. 4 3
      babylon.js
  44. 3 0
      readme.md
  45. 11 0
      what's new.md

+ 4 - 0
Babylon/Materials/textures/babylon.texture.js

@@ -27,6 +27,10 @@
     BABYLON.Texture.prototype = Object.create(BABYLON.BaseTexture.prototype);
 
     // Constants
+    BABYLON.Texture.NEAREST_SAMPLINGMODE = 1;
+    BABYLON.Texture.BILINEAR_SAMPLINGMODE = 2;
+    BABYLON.Texture.TRILINEAR_SAMPLINGMODE = 3;
+
     BABYLON.Texture.EXPLICIT_MODE = 0;
     BABYLON.Texture.SPHERICAL_MODE = 1;
     BABYLON.Texture.PLANAR_MODE = 2;

+ 2 - 2
Babylon/PostProcess/babylon.blackAndWhitePostProcess.js

@@ -1,8 +1,8 @@
 var BABYLON = BABYLON || {};
 
 (function () {
-    BABYLON.BlackAndWhitePostProcess = function (name, ratio, camera) {
-        BABYLON.PostProcess.call(this, name, "blackAndWhite", null, null, ratio, camera);
+    BABYLON.BlackAndWhitePostProcess = function (name, ratio, camera, samplingMode) {
+        BABYLON.PostProcess.call(this, name, "blackAndWhite", null, null, ratio, camera, samplingMode);
     };
     
     BABYLON.BlackAndWhitePostProcess.prototype = Object.create(BABYLON.PostProcess.prototype);

+ 7 - 2
Babylon/PostProcess/babylon.blurPostProcess.js

@@ -1,8 +1,13 @@
 var BABYLON = BABYLON || {};
 
 (function () {
-    BABYLON.BlurPostProcess = function (name, direction, blurWidth, ratio, camera) {
-        BABYLON.PostProcess.call(this, name, "blur", ["screenSize", "direction", "blurWidth"], null, ratio, camera);
+    BABYLON.BlurPostProcess = function (name, direction, blurWidth, ratio, camera, samplingMode) {
+        
+        if (samplingMode === undefined) {
+            samplingMode = BABYLON.Texture.BILINEAR_SAMPLINGMODE;
+        }
+
+        BABYLON.PostProcess.call(this, name, "blur", ["screenSize", "direction", "blurWidth"], null, ratio, camera, samplingMode);
 
         this.direction = direction;
         this.blurWidth = blurWidth;

+ 16 - 0
Babylon/PostProcess/babylon.convolutionPostProcess.js

@@ -0,0 +1,16 @@
+var BABYLON = BABYLON || {};
+
+(function () {
+    BABYLON.ConvolutionPostProcess = function (name, kernelMatrix, ratio, camera, samplingMode) {
+        BABYLON.PostProcess.call(this, name, "convolution", ["kernelMatrix"], null, ratio, camera, samplingMode);
+        
+        this.kernelMatrix = kernelMatrix;
+        var that = this;
+        this.onApply = function (effect) {
+            effect.setMatrix("kernelMatrix", that.kernelMatrix);
+        };
+    };
+    
+    BABYLON.ConvolutionPostProcess.prototype = Object.create(BABYLON.PostProcess.prototype);
+
+})();

+ 10 - 10
Babylon/PostProcess/babylon.fxaaPostProcess.js

@@ -1,16 +1,16 @@
-var BABYLON = BABYLON || {};
-
-(function () {
-    BABYLON.FxaaPostProcess = function (name, ratio, camera) {
-        BABYLON.PostProcess.call(this, name, "fxaa", ["texelSize"], null, ratio, camera);
-    };
-    
-    BABYLON.FxaaPostProcess.prototype = Object.create(BABYLON.PostProcess.prototype);
+var BABYLON = BABYLON || {};
+
+(function () {
+    BABYLON.FxaaPostProcess = function (name, ratio, camera, samplingMode) {
+        BABYLON.PostProcess.call(this, name, "fxaa", ["texelSize"], null, ratio, camera, samplingMode);
+    };
+    
+    BABYLON.FxaaPostProcess.prototype = Object.create(BABYLON.PostProcess.prototype);
     BABYLON.FxaaPostProcess.prototype.onSizeChanged = function () {
         this.texelWidth = 1.0 / this.width;
         this.texelHeight = 1.0 / this.height;
-    };
+    };
     BABYLON.FxaaPostProcess.prototype.onApply = function (effect) {
         effect.setFloat2("texelSize", this.texelWidth, this.texelHeight);
-    };
+    };
 })();

+ 2 - 2
Babylon/PostProcess/babylon.passPostProcess.js

@@ -1,8 +1,8 @@
 var BABYLON = BABYLON || {};
 
 (function () {
-    BABYLON.PassPostProcess = function (name, ratio, camera) {
-        BABYLON.PostProcess.call(this, name, "pass", null, null, ratio, camera);
+    BABYLON.PassPostProcess = function (name, ratio, camera, samplingMode) {
+        BABYLON.PostProcess.call(this, name, "pass", null, null, ratio, camera, samplingMode);
     };
     
     BABYLON.PassPostProcess.prototype = Object.create(BABYLON.PostProcess.prototype);

+ 69 - 67
Babylon/PostProcess/babylon.postProcess.js

@@ -1,33 +1,33 @@
-var BABYLON = BABYLON || {};
-
-(function () {
-    BABYLON.PostProcess = function (name, fragmentUrl, parameters, samplers, ratio, camera, samplingMode) {
-        this.name = name;
-        this._camera = camera;
-        this._scene = camera.getScene();
-        camera.postProcesses.push(this);
-        this._engine = this._scene.getEngine();
-        this._renderRatio = ratio;
-        this.width = -1;
-        this.height = -1;
-        this.renderTargetSamplingMode = samplingMode ? samplingMode : BABYLON.TextureSamplingModes.NEAREST;
-
-        samplers = samplers || [];
-        samplers.push("textureSampler");
-
-        this._effect = this._engine.createEffect({ vertex: "postprocess", fragment: fragmentUrl },
-            ["position"],
-            parameters || [],
-            samplers, "");
-    };
-    
-    // Methods
-    BABYLON.PostProcess.prototype.onApply = null;
-    BABYLON.PostProcess.prototype._onDispose = null;
-    BABYLON.PostProcess.prototype.onSizeChanged = null;
-    BABYLON.PostProcess.prototype.activate = function () {
-        var desiredWidth = this._engine._renderingCanvas.width * this._renderRatio;
-        var desiredHeight = this._engine._renderingCanvas.height * this._renderRatio;
+var BABYLON = BABYLON || {};
+
+(function () {
+    BABYLON.PostProcess = function (name, fragmentUrl, parameters, samplers, ratio, camera, samplingMode) {
+        this.name = name;
+        this._camera = camera;
+        this._scene = camera.getScene();
+        camera.postProcesses.push(this);
+        this._engine = this._scene.getEngine();
+        this._renderRatio = ratio;
+        this.width = -1;
+        this.height = -1;
+        this.renderTargetSamplingMode = samplingMode ? samplingMode : BABYLON.Texture.NEAREST_SAMPLINGMODE;
+
+        samplers = samplers || [];
+        samplers.push("textureSampler");
+
+        this._effect = this._engine.createEffect({ vertex: "postprocess", fragment: fragmentUrl },
+            ["position"],
+            parameters || [],
+            samplers, "");
+    };
+    
+    // Methods
+    BABYLON.PostProcess.prototype.onApply = null;
+    BABYLON.PostProcess.prototype._onDispose = null;
+    BABYLON.PostProcess.prototype.onSizeChanged = null;
+    BABYLON.PostProcess.prototype.activate = function () {
+        var desiredWidth = this._engine._renderingCanvas.width * this._renderRatio;
+        var desiredHeight = this._engine._renderingCanvas.height * this._renderRatio;
         if (this.width !== desiredWidth || this.height !== desiredHeight) {
             if (this._texture) {
                 this._engine._releaseTexture(this._texture);
@@ -39,45 +39,47 @@
             if (this.onSizeChanged) {
                 this.onSizeChanged();
             }
-        }
-        this._engine.bindFramebuffer(this._texture);
-    };
-
-    BABYLON.PostProcess.prototype.apply = function () {
-        // Check
-        if (!this._effect.isReady())
-            return null;
-
-        // Render
-        this._engine.enableEffect(this._effect);
-        this._engine.setState(false);
-        this._engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
-
-        // Texture
-        this._effect._bindTexture("textureSampler", this._texture);
-        
-        // Parameters
-        if (this.onApply) {
-            this.onApply(this._effect);
-        }
-
-        return this._effect;
-    };
-
-    BABYLON.PostProcess.prototype.dispose = function () {
-        if (this._onDispose) {
-            this._onDispose();
-        }
+        }
+        this._engine.bindFramebuffer(this._texture);
+    };
+
+    BABYLON.PostProcess.prototype.apply = function () {
+        // Check
+        if (!this._effect.isReady())
+            return null;
+
+        // States
+        this._engine.enableEffect(this._effect);
+        this._engine.setState(false);
+        this._engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
+        this._engine.setDepthBuffer(false);
+        this._engine.setDepthWrite(false);
+
+        // Texture
+        this._effect._bindTexture("textureSampler", this._texture);
+        
+        // Parameters
+        if (this.onApply) {
+            this.onApply(this._effect);
+        }
+
+        return this._effect;
+    };
+
+    BABYLON.PostProcess.prototype.dispose = function () {
+        if (this._onDispose) {
+            this._onDispose();
+        }
         if (this._texture) {
             this._engine._releaseTexture(this._texture);
-            this._texture = null;
-        }
-        
-        var index = this._camera.postProcesses.indexOf(this);
-        this._camera.postProcesses.splice(index, 1);
+            this._texture = null;
+        }
+        
+        var index = this._camera.postProcesses.indexOf(this);
+        this._camera.postProcesses.splice(index, 1);
         if (index == 0 && this._camera.postProcesses.length > 0) {
             this._camera.postProcesses[0].width = -1; // invalidate frameBuffer to hint the postprocess to create a depth buffer
-        }
-    };
-
+        }
+    };
+
 })();

+ 3 - 6
Babylon/PostProcess/babylon.postProcessManager.js

@@ -59,16 +59,13 @@
             if (effect) {
                 // VBOs
                 engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, effect);
-                // some effect activation have a side effect of putting depthBuffer / dephWrite on
-                // so we force it off at each post process pass
-                engine.setDepthBuffer(false);
-                engine.setDepthWrite(false);
+                
                 // Draw order
                 engine.draw(true, 0, 6);
             }
         }
-        // reenable depth buffer
-
+        
+        // Restore depth buffer
         engine.setDepthBuffer(true);
         engine.setDepthWrite(true);
     };

+ 2 - 2
Babylon/PostProcess/babylon.refractionPostProcess.js

@@ -1,8 +1,8 @@
 var BABYLON = BABYLON || {};
 
 (function () {
-    BABYLON.RefractionPostProcess = function (name, refractionTextureUrl, color, depth, colorLevel, ratio, camera) {
-        BABYLON.PostProcess.call(this, name, "refraction", ["baseColor", "depth", "colorLevel"], ["refractionSampler"], ratio, camera);
+    BABYLON.RefractionPostProcess = function (name, refractionTextureUrl, color, depth, colorLevel, ratio, camera, samplingMode) {
+        BABYLON.PostProcess.call(this, name, "refraction", ["baseColor", "depth", "colorLevel"], ["refractionSampler"], ratio, camera, samplingMode);
 
         this.color = color;
         this.depth = depth;

+ 17 - 0
Babylon/Shaders/convolution.fragment.fx

@@ -0,0 +1,17 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+// Samplers
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+
+uniform mat4 kernelMatrix;
+
+void main(void) 
+{
+	vec3 baseColor = texture2D(textureSampler, vUV).rgb;
+	vec3 updatedColor = (kernelMatrix * vec4(baseColor, 1.0)).rgb;
+
+	gl_FragColor = vec4(updatedColor, 1.0);
+}

+ 1 - 1
Babylon/Shaders/fxaa.fragment.fx

@@ -1,7 +1,7 @@
 #define FXAA_REDUCE_MIN   (1.0/128.0)
 #define FXAA_REDUCE_MUL   (1.0/8.0)
 #define FXAA_SPAN_MAX     8.0
-//#define texelSize  vec2(1.0/1600, 1.0/900)
+
 varying vec2 vUV;
 uniform sampler2D textureSampler;
 uniform vec2 texelSize;

+ 4 - 10
Babylon/babylon.engine.js

@@ -1,12 +1,6 @@
 var BABYLON = BABYLON || {};
 
 (function () {
-    BABYLON.TextureSamplingModes = {
-        NEAREST : 1,
-        BILINEAR: 2,
-        TRILINEAR: 3,
-        DEFAULT : 3
-    };
     BABYLON.Engine = function (canvas, antialias) {
         this._renderingCanvas = canvas;
 
@@ -719,7 +713,7 @@
         // in the same way, generateDepthBuffer is defaulted to true
         var generateMipMaps = false;
         var generateDepthBuffer = true;
-        var samplingMode = BABYLON.TextureSamplingModes.DEFAULT;
+        var samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE;
         if (options !== undefined) {
             generateMipMaps = options.generateMipMaps === undefined ? options : options.generateMipmaps;
             generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;
@@ -738,14 +732,14 @@
         var height = size.height || size;
         var magFilter = gl.NEAREST;
         var minFilter = gl.NEAREST;
-        if (samplingMode === BABYLON.TextureSamplingModes.BILINEAR) {
+        if (samplingMode === BABYLON.Texture.BILINEAR_SAMPLINGMODE) {
             magFilter = gl.LINEAR;
             if (generateMipMaps) {
                 minFilter = gl.LINEAR_MIPMAP_NEAREST;
             } else {
                 minFilter = gl.LINEAR;
             }
-        } else if (samplingMode === BABYLON.TextureSamplingModes.TRILINEAR) {
+        } else if (samplingMode === BABYLON.Texture.TRILINEAR_SAMPLINGMODE) {
             magFilter = gl.LINEAR;
             if (generateMipMaps) {
                 minFilter = gl.LINEAR_MIPMAP_LINEAR;
@@ -888,7 +882,7 @@
             this._gl.bindTexture(this._gl.TEXTURE_CUBE_MAP, null);
             this._activeTexturesCache[channel] = null;
         }
-        // hmm vilain leak !
+
         var index = this._loadedTexturesCache.indexOf(texture);
         if (index !== -1) {
             this._loadedTexturesCache.splice(index, 1);

File diff ditekan karena terlalu besar
+ 1 - 1
Babylon/jscompaktor.bat


+ 18 - 0
Exporters/FBX - OBJ/BabylonExport.Core/Exporters/Blender/io_export_babylon.py

@@ -135,6 +135,24 @@ class Export_babylon(bpy.types.Operator, ExportHelper):
         Export_babylon.write_bool(file_handler, "checkCollisions", object.data.checkCollisions)
         Export_babylon.write_bool(file_handler, "applyGravity", object.data.applyGravity)
         Export_babylon.write_array3(file_handler, "ellipsoid", object.data.ellipsoid)
+
+        locAnim = False
+        coma = False
+
+        if object.animation_data:
+            if object.animation_data.action:
+                file_handler.write(",\"animations\":[")
+                for fcurve in object.animation_data.action.fcurves:
+                    if fcurve.data_path == "location" and locAnim == False:
+                        Export_babylon.export_animation(object, scene, file_handler, "location", "position", coma, 1)
+                        locAnim = coma = True
+                file_handler.write("]")
+                #Set Animations
+                Export_babylon.write_bool(file_handler, "autoAnimate", True)
+                Export_babylon.write_int(file_handler, "autoAnimateFrom", 0)
+                Export_babylon.write_int(file_handler, "autoAnimateTo", bpy.context.scene.frame_end - bpy.context.scene.frame_start + 1)
+                Export_babylon.write_bool(file_handler, "autoAnimateLoop", True)
+
         file_handler.write("}")
         
     def export_light(object, scene, file_handler):      

+ 3 - 2
Exporters/FBX - OBJ/BabylonExport.Core/Exporters/FBX/FBXExporter.cs

@@ -40,8 +40,9 @@ namespace BabylonExport.Core.Exporters
             var services = new ServiceContainer();
 
             // Create a graphics device
-
-            services.AddService<IGraphicsDeviceService>(GraphicsDeviceService.singletonInstance);
+            var form = new Form();
+            
+            services.AddService<IGraphicsDeviceService>(BabylonExport.Core.Exporters.FBX.GraphicsDeviceService.AddRef(form.Handle, 1, 1));
 
             var contentBuilder = new ContentBuilder();
             var contentManager = new ContentManager(services, contentBuilder.OutputDirectory);

+ 10 - 3
Exporters/FBX - OBJ/BabylonExport.Core/Exporters/FBX/XNA/GraphicsDeviceService.cs

@@ -8,9 +8,14 @@ namespace BabylonExport.Core.Exporters.FBX
 {
     public class GraphicsDeviceService : IGraphicsDeviceService
     {
-        public static GraphicsDeviceService singletonInstance;
         static int referenceCount;
 
+        public static GraphicsDeviceService SingletonInstance
+        {
+            get;
+            private set;
+        }
+
         GraphicsDeviceService(IntPtr windowHandle, int width, int height)
         {
             parameters = new PresentationParameters();
@@ -23,6 +28,8 @@ namespace BabylonExport.Core.Exporters.FBX
             parameters.PresentationInterval = PresentInterval.Immediate;
             parameters.IsFullScreen = false;
 
+            GraphicsAdapter.UseReferenceDevice = true;
+
             graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter,
                                                 GraphicsProfile.Reach,
                                                 parameters);
@@ -32,10 +39,10 @@ namespace BabylonExport.Core.Exporters.FBX
         {
             if (Interlocked.Increment(ref referenceCount) == 1)
             {
-                singletonInstance = new GraphicsDeviceService(windowHandle, width, height);
+                SingletonInstance = new GraphicsDeviceService(windowHandle, width, height);
             }
 
-            return singletonInstance;
+            return SingletonInstance;
         }
 
         public void Release(bool disposing)

TEMPAT SAMPAH
Exporters/FBX - OBJ/BabylonExport.zip


+ 67 - 12
Exporters/FBX - OBJ/BabylonExport/BabylonExport.csproj

@@ -99,18 +99,73 @@
     <StartupObject />
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="System.Runtime.Serialization" />
-    <Reference Include="System.ServiceModel" />
-    <Reference Include="System.Windows.Forms" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline">
+      <HintPath>..\BabylonExport.Core\Refs\Microsoft.Xna.Framework.Content.Pipeline.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.AudioImporters">
+      <HintPath>..\BabylonExport.Core\Refs\Microsoft.Xna.Framework.Content.Pipeline.AudioImporters.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.EffectImporter">
+      <HintPath>..\BabylonExport.Core\Refs\Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.FBXImporter">
+      <HintPath>..\BabylonExport.Core\Refs\Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.TextureImporter">
+      <HintPath>..\BabylonExport.Core\Refs\Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.VideoImporters">
+      <HintPath>..\BabylonExport.Core\Refs\Microsoft.Xna.Framework.Content.Pipeline.VideoImporters.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter">
+      <HintPath>..\BabylonExport.Core\Refs\Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.Xna.Framework.Tools.Packaging.Tasks">
+      <HintPath>..\BabylonExport.Core\Refs\Microsoft.Xna.Framework.Tools.Packaging.Tasks.dll</HintPath>
+    </Reference>
+    <Reference Include="SkinnedModel, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\BabylonExport.Core\Refs\SkinnedModel.dll</HintPath>
+    </Reference>
+    <Reference Include="SkinnedModelPipeline">
+      <HintPath>..\BabylonExport.Core\Refs\SkinnedModelPipeline.dll</HintPath>
+    </Reference>
+    <Reference Include="System">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Core">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Drawing">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Runtime.Serialization">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.ServiceModel">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Windows.Forms">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Xml.Linq">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Data.DataSetExtensions">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.CSharp">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Data">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Xml">
+      <Private>True</Private>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Program.cs" />

+ 24 - 1
Exporters/FBX - OBJ/BabylonExport/Program.cs

@@ -14,6 +14,7 @@ namespace BabylonExport
     {
         static void Main(string[] args)
         {
+            string output = "";
             try
             {
                 if ((args.Length == 1) && (args[0] == "/service"))
@@ -40,7 +41,6 @@ namespace BabylonExport
 
                     // Parsing arguments
                     string input = "";
-                    string output = "";
                     bool skinned = false;
                     foreach (var arg in args)
                     {
@@ -109,6 +109,11 @@ namespace BabylonExport
                                 Console.WriteLine();
                                 Console.WriteLine("Generation of " + outputName + " successfull");
                                 Console.ResetColor();
+                                using (var debugFile = new StreamWriter(output + @"\debug.txt", true))
+                                {
+                                    debugFile.Write("Generation of " + outputName + " successfull");
+                                }
+                 
                             }
                             catch (Exception ex)
                             {
@@ -116,6 +121,10 @@ namespace BabylonExport
                                 Console.WriteLine();
                                 Console.WriteLine(ex.Message);
                                 Console.ResetColor();
+                                using (var debugFile = new StreamWriter(output + @"\debug.txt", true))
+                                {
+                                    debugFile.Write(ex.Message);
+                                }
                             }
                         }
                     }
@@ -127,6 +136,13 @@ namespace BabylonExport
                 Console.WriteLine("Fatal error encountered:");
                 Console.WriteLine(ex.LoaderExceptions[0].Message);
                 Console.ResetColor();
+                if (output != "")
+                {
+                    using (var debugFile = new StreamWriter(output + @"\debug.txt", true))
+                    {
+                        debugFile.Write(ex.Message);
+                    }
+                }
             }
             catch (Exception ex)
             {
@@ -134,6 +150,13 @@ namespace BabylonExport
                 Console.WriteLine("Fatal error encountered:");
                 Console.WriteLine(ex.Message);
                 Console.ResetColor();
+                if (output != "")
+                {
+                    using (var debugFile = new StreamWriter(output + @"\debug.txt", true))
+                    {
+                        debugFile.Write(ex.Message);
+                    }
+                }
             } 
         }
 

+ 17 - 35
Exporters/FBX - OBJ/BabylonExport/Service.cs

@@ -3,6 +3,7 @@ using BabylonExport.Core.Exporters;
 using BabylonExport.Interface;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -16,50 +17,31 @@ namespace BabylonExport
     {
         public bool Convert(string input, string outputName)
         {
-            var form = new Form();
-            BabylonExport.Core.Exporters.FBX.GraphicsDeviceService.AddRef(form.Handle, 1, 1);
-
-            var extension = Path.GetExtension(input).ToLower();
             try
             {
-                foreach (var type in Assembly.LoadFrom("BabylonExport.Core.dll").GetTypes())
+                Console.WriteLine("input:" + input);
+                Console.WriteLine("outputName:" + outputName);
+                System.Diagnostics.Process p = new System.Diagnostics.Process();
+                p.StartInfo.FileName = "BabylonExport.exe";
+                p.StartInfo.Arguments = "/i:" + input + " /o:" + outputName;
+                p.Start();
+                if (p.WaitForExit(1000 * 60 * 3))
                 {
-                    var interf = type.GetInterface("BabylonExport.Core.IExporter");
-                    if (interf != null)
-                    {
-                        var importer = (IExporter)Activator.CreateInstance(type);
-
-                        if (!importer.SupportedExtensions.Contains(extension))
-                        {
-                            continue;
-                        }
-
-                        Console.WriteLine("Using " + type);
-
-                        // Importation
-                        try
-                        {
-                            Console.WriteLine(input);
-                            importer.GenerateBabylonFile(input, outputName, false);
-                        }
-                        catch (Exception ex)
-                        {
-                            Console.WriteLine(ex.Message);
-                        }
-                    }
+                    p.Close();
+                    return true;
                 }
-                return true;
-            }
-            catch (ReflectionTypeLoadException ex)
-            {
-                Console.WriteLine(ex.LoaderExceptions[0].Message);
-                return false;
+                else
+                {
+                    p.Close();
+                    return false;
+                }
+                
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.Message);
                 return false;
-            } 
+            }
             
         }
 

+ 0 - 12
Exporters/FBX - OBJ/BabylonExport/generateAll.bat

@@ -1,12 +0,0 @@
-BabylonExport /i:"..\..\Test scenes\SpaceDeK\SpaceDeK.mxb" /o:"c:\Export\SpaceDeK"
-BabylonExport /i:"..\..\Test scenes\Espilit\Espilit.mxb" /o:"c:\Export\Espilit"
-BabylonExport /i:"..\..\Test scenes\WCafe\WCafe.mxb" /o:"c:\Export\WCafe"
-BabylonExport /i:"..\..\Test scenes\Flat2009\Flat2009.mxb" /o:"c:\Export\Flat2009"
-BabylonExport /i:"..\..\Test scenes\Viper\Viper.obj" /o:"c:\Export\Viper"
-BabylonExport /i:"..\..\Test scenes\Spaceship\Spaceship.fbx" /o:"c:\Export\Spaceship"
-BabylonExport /i:"..\..\Test scenes\TheCar\TheCar.mxb" /o:"c:\Export\TheCar"
-BabylonExport /i:"..\..\Test scenes\Chimie\Heart.mxb" /o:"c:\Export\Heart"
-BabylonExport /i:"..\..\Test scenes\Rabbit\Rabbit.fbx" /o:"c:\Export\Rabbit" /sk
-BabylonExport /i:"..\..\Test scenes\Dude\Dude.fbx" /o:"c:\Export\Dude" /sk
-BabylonExport /i:"..\..\Test scenes\Robot\Robot.mxb" /o:"c:\Export\Robot"
-BabylonExport /i:"..\..\Test scenes\Train\Train.mxb" /o:"c:\Export\Train"

TEMPAT SAMPAH
Samples/Assets/Sand.jpg


TEMPAT SAMPAH
Samples/Assets/Snow.jpg


TEMPAT SAMPAH
Samples/Assets/rock.jpg


+ 77 - 0
Samples/Scenes/Customs/postprocessBloom.js

@@ -0,0 +1,77 @@
+var CreatePostProcessBloomTestScene = function (engine) {
+    var scene = new BABYLON.Scene(engine);
+    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, BABYLON.Vector3.Zero(), scene);
+    var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, -1, -0.2), scene);
+    var light2 = new BABYLON.DirectionalLight("dir02", new BABYLON.Vector3(-1, -2, -1), scene);
+    light.position = new BABYLON.Vector3(0, 30, 0);
+    light2.position = new BABYLON.Vector3(10, 20, 10);
+
+    light.intensity = 0.6;
+    light2.intensity = 0.6;
+
+    camera.setPosition(new BABYLON.Vector3(-40, 40, 0));
+    camera.lowerBetaLimit = (Math.PI / 2) * 0.9;
+    
+    // Skybox
+    var skybox = BABYLON.Mesh.CreateBox("skyBox", 1000.0, scene);
+    var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
+    skyboxMaterial.backFaceCulling = false;
+    skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("Scenes/Customs/skybox/snow", scene);
+    skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
+    skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
+    skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
+    skybox.material = skyboxMaterial;
+    
+    // Spheres
+    var sphere0 = BABYLON.Mesh.CreateSphere("Sphere0", 16, 10, scene);
+    var sphere1 = BABYLON.Mesh.CreateSphere("Sphere1", 16, 10, scene);
+    var sphere2 = BABYLON.Mesh.CreateSphere("Sphere2", 16, 10, scene);
+    var cube = BABYLON.Mesh.CreateBox("Cube", 10.0, scene);
+
+    sphere0.material = new BABYLON.StandardMaterial("white", scene);
+    sphere0.material.diffuseColor = new BABYLON.Color3(0, 0, 0);
+    sphere0.material.specularColor = new BABYLON.Color3(0, 0, 0);
+    sphere0.material.emissiveColor = new BABYLON.Color3(1.0, 1.0, 1.0);
+    
+    sphere1.material = sphere0.material;
+    sphere2.material = sphere0.material;
+    
+    cube.material = new BABYLON.StandardMaterial("red", scene);
+    cube.material.diffuseColor = new BABYLON.Color3(0, 0, 0);
+    cube.material.specularColor = new BABYLON.Color3(0, 0, 0);
+    cube.material.emissiveColor = new BABYLON.Color3(1.0, 0, 0);
+       
+    // Post-process
+    var blurWidth = 1.0;
+    
+    var postProcess0 = new BABYLON.PassPostProcess("Scene copy", 1.0, camera);
+    var postProcess1 = new BABYLON.PostProcess("Down sample", "./Scenes/Customs/postprocesses/downsample", ["screenSize", "highlightThreshold"], null, 0.25, camera, BABYLON.Texture.BILINEAR_SAMPLINGMODE);
+    postProcess1.onApply = function (effect) {
+        effect.setFloat2("screenSize", postProcess1.width, postProcess1.height);
+        effect.setFloat("highlightThreshold", 0.90);
+    };
+    var postProcess2 = new BABYLON.BlurPostProcess("Horizontal blur", new BABYLON.Vector2(1.0, 0), blurWidth, 0.25, camera);
+    var postProcess3 = new BABYLON.BlurPostProcess("Vertical blur", new BABYLON.Vector2(0, 1.0), blurWidth, 0.25, camera);
+    var postProcess4 = new BABYLON.PostProcess("Final compose", "./Scenes/Customs/postprocesses/compose", ["sceneIntensity", "glowIntensity", "highlightIntensity"], ["sceneSampler"], 1, camera);
+    postProcess4.onApply = function (effect) {
+        effect.setTextureFromPostProcess("sceneSampler", postProcess0);
+        effect.setFloat("sceneIntensity", 0.5);
+        effect.setFloat("glowIntensity", 0.4);
+        effect.setFloat("highlightIntensity", 1.0);
+    };
+    
+    // Animations
+    var alpha = 0;
+    scene.registerBeforeRender(function() {
+        sphere0.position = new BABYLON.Vector3(20 * Math.sin(alpha), 0, 20 * Math.cos(alpha));
+        sphere1.position = new BABYLON.Vector3(20 * Math.sin(alpha), 0, -20 * Math.cos(alpha));
+        sphere2.position = new BABYLON.Vector3(20 * Math.cos(alpha), 0, 20 * Math.sin(alpha));
+
+        cube.rotation.y += 0.01;
+        cube.rotation.z += 0.01;
+
+        alpha += 0.01;
+    });
+    
+    return scene;
+};

+ 56 - 0
Samples/Scenes/Customs/postprocessRefraction.js

@@ -0,0 +1,56 @@
+var CreatePostProcessRefractionTestScene = function (engine) {
+    var scene = new BABYLON.Scene(engine);
+    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 100, BABYLON.Vector3.Zero(), scene);
+    var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, -1, -0.2), scene);
+    var light2 = new BABYLON.DirectionalLight("dir02", new BABYLON.Vector3(-1, -2, -1), scene);
+    light.position = new BABYLON.Vector3(0, 30, 0);
+    light2.position = new BABYLON.Vector3(10, 20, 10);
+
+    light.intensity = 0.6;
+    light2.intensity = 0.6;
+
+    camera.setPosition(new BABYLON.Vector3(-60, 60, 0));
+    camera.lowerBetaLimit = (Math.PI / 2) * 0.8;
+    
+    // Skybox
+    var skybox = BABYLON.Mesh.CreateBox("skyBox", 1000.0, scene);
+    var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
+    skyboxMaterial.backFaceCulling = false;
+    skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("Scenes/Customs/skybox/snow", scene);
+    skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
+    skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
+    skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
+    skybox.material = skyboxMaterial;
+    
+    // Spheres
+    var sphere0 = BABYLON.Mesh.CreateSphere("Sphere0", 16, 10, scene);
+    var sphere1 = BABYLON.Mesh.CreateSphere("Sphere1", 16, 10, scene);
+    var sphere2 = BABYLON.Mesh.CreateSphere("Sphere2", 16, 10, scene);
+
+    sphere0.material = new BABYLON.StandardMaterial("red", scene);
+    sphere0.material.specularColor = new BABYLON.Color3(0, 0, 0);
+    sphere0.material.diffuseColor = new BABYLON.Color3(1.0, 0, 0);
+    
+    sphere1.material = new BABYLON.StandardMaterial("green", scene);
+    sphere1.material.specularColor = new BABYLON.Color3(0, 0, 0);
+    sphere1.material.diffuseColor = new BABYLON.Color3(0, 1.0, 0);
+    
+    sphere2.material = new BABYLON.StandardMaterial("blue", scene);
+    sphere2.material.specularColor = new BABYLON.Color3(0, 0, 0);
+    sphere2.material.diffuseColor = new BABYLON.Color3(0, 0, 1.0);
+       
+    // Post-process
+    var postProcess = new BABYLON.RefractionPostProcess("Refraction", "/scenes/customs/refMap.jpg", new BABYLON.Color3(1.0, 1.0, 1.0), 0.5, 0.5, 1.0, camera);
+    
+    // Animations
+    var alpha = 0;
+    scene.registerBeforeRender(function() {
+        sphere0.position = new BABYLON.Vector3(20 * Math.sin(alpha), 0, 20 * Math.cos(alpha));
+        sphere1.position = new BABYLON.Vector3(20 * Math.sin(alpha), 0, -20 * Math.cos(alpha));
+        sphere2.position = new BABYLON.Vector3(20 * Math.cos(alpha), 0, 20 * Math.sin(alpha));
+
+        alpha += 0.01;
+    });
+    
+    return scene;
+};

+ 25 - 0
Samples/Scenes/Customs/postprocesses/compose.fragment.fx

@@ -0,0 +1,25 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+// Samplers
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform sampler2D sceneSampler;
+
+// Parameters
+uniform vec2 screenSize;
+uniform float sceneIntensity;
+uniform float glowIntensity;
+uniform float highlightIntensity;
+
+void main(void) 
+{
+	vec4 orig = texture2D(sceneSampler, vUV);
+	vec4 blur = texture2D(textureSampler, vUV);
+
+	vec4 final = sceneIntensity * orig + glowIntensity * blur + highlightIntensity * blur.a;
+	final.a = 1.0;
+
+	gl_FragColor = final;
+}

+ 29 - 0
Samples/Scenes/Customs/postprocesses/downsample.fragment.fx

@@ -0,0 +1,29 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+// Samplers
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+
+// Parameters
+uniform vec2 screenSize;
+uniform float highlightThreshold;
+
+float highlights(vec3 color)
+{
+	return smoothstep(highlightThreshold, 1.0, dot(color, vec3(0.3, 0.59, 0.11)));
+}
+
+void main(void) 
+{
+	vec2 texelSize = vec2(1.0 / screenSize.x, 1.0 / screenSize.y);
+	vec4 baseColor = texture2D(textureSampler, vUV + vec2(-1.0, -1.0) * texelSize) * 0.25;
+	baseColor += texture2D(textureSampler, vUV + vec2(1.0, -1.0) * texelSize) * 0.25;
+	baseColor += texture2D(textureSampler, vUV + vec2(1.0, 1.0) * texelSize) * 0.25;
+	baseColor += texture2D(textureSampler, vUV + vec2(-1.0, 1.0) * texelSize) * 0.25;
+	
+	baseColor.a = highlights(baseColor.rgb);
+
+	gl_FragColor = baseColor;
+}

TEMPAT SAMPAH
Samples/Scenes/Customs/refMap.jpg


TEMPAT SAMPAH
Samples/Scenes/Customs/skybox/snow_nx.jpg


TEMPAT SAMPAH
Samples/Scenes/Customs/skybox/snow_ny.jpg


TEMPAT SAMPAH
Samples/Scenes/Customs/skybox/snow_nz.jpg


TEMPAT SAMPAH
Samples/Scenes/Customs/skybox/snow_px.jpg


TEMPAT SAMPAH
Samples/Scenes/Customs/skybox/snow_py.jpg


TEMPAT SAMPAH
Samples/Scenes/Customs/skybox/snow_pz.jpg


TEMPAT SAMPAH
Samples/Screenshots/postprocessBloom.jpg


TEMPAT SAMPAH
Samples/Screenshots/postprocessRefraction.jpg


File diff ditekan karena terlalu besar
+ 4 - 3
Samples/babylon.js


+ 14 - 7
Samples/index.css

@@ -4,6 +4,7 @@
     padding: 0;
     margin: 0;
     overflow: hidden;
+    position: fixed;
     font-family: "Segoe WP", "Segoe UI", "Verdana", "Arial";
 }
 
@@ -132,12 +133,14 @@ button {
     top: 70px;
     right: 240px;
     border: 0;
+    z-index: 1;
 }
 
 #aboutLink {
     position: absolute;
     top: 70px;
     right: 360px;
+    z-index: 1;
 }
 
 #aboutText {
@@ -205,7 +208,9 @@ button {
     right: 0;
     top: 136px;
     bottom: 0px;
-    overflow: auto;
+    overflow-y: auto;
+    overflow-x: hidden;
+    width: 100%;
 }
 
 #renderZone {
@@ -270,7 +275,9 @@ button {
 
 .item-image {
     position: relative;
-    height: 100%;
+    width: 400px;
+    height: 250px;
+    /*height: 100%;*/
 }
 
 .item-text {
@@ -353,16 +360,16 @@ button {
 
 #controlPanel {
     position: absolute;
-    height: 200px;
+    height: 250px;
     bottom: 0px;
     width: 500px;
     left: 50%;
     margin-left: -250px;
     z-index: 1;
     transition: transform 0.25s ease-in-out;
-    transform: translateY(200px);
+    transform: translateY(250px);
     -webkit-transition: -webkit-transform 0.25s ease-in-out;
-    -webkit-transform: translateY(200px);
+    -webkit-transform: translateY(250px);
 }
 
 .tag {
@@ -393,7 +400,7 @@ button {
 
 #cameraPanel {
     position: absolute;
-    height: 350px;
+    height: 480px;
     right: 0px;
     width: 300px;
     top: 350px;
@@ -537,7 +544,7 @@ button {
     overflow-y: auto;
     overflow-x: hidden;
     position: absolute;
-    top: 320px;
+    top: 350px;
     left: 10px;
     right: 10px;
     bottom: 10px;

+ 21 - 7
Samples/index.html

@@ -1,7 +1,8 @@
 <!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html>
 <head>
     <title>Babylon.js</title>
+    <meta name="viewport" content="initial-scale=1">
     <script>
         (function (i, s, o, g, r, a, m) {
             i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
@@ -16,7 +17,7 @@
     </script>
     <link href="index.css" rel="stylesheet" />
     <script src="hand.minified-1.1.1.js"></script>
-    <!--<script src="Babylon/Tools/babylon.math.js"></script>
+    <script src="Babylon/Tools/babylon.math.js"></script>
     <script src="Babylon/Tools/babylon.database.js"></script>
     <script src="Babylon/Tools/babylon.tools.js"></script>
     <script src="Babylon/babylon.engine.js"></script>
@@ -68,8 +69,14 @@
     <script src="Babylon/Bones/babylon.skeleton.js"></script>
     <script src="Babylon/Bones/babylon.skeleton.js"></script>
     <script src="Babylon/PostProcess/babylon.postProcess.js"></script>
-    <script src="Babylon/PostProcess/babylon.postProcessManager.js"></script>-->
-    <script src="babylon.js"></script>
+    <script src="Babylon/PostProcess/babylon.postProcessManager.js"></script>
+    <script src="Babylon/PostProcess/babylon.passPostProcess.js"></script>
+    <script src="Babylon/PostProcess/babylon.blurPostProcess.js"></script>
+    <script src="Babylon/PostProcess/babylon.refractionPostProcess.js"></script>
+    <script src="Babylon/PostProcess/babylon.blackAndWhitePostProcess.js"></script>
+    <script src="Babylon/PostProcess/babylon.convolutionPostProcess.js"></script>
+    <script src="Babylon/PostProcess/babylon.fxaaPostProcess.js"></script>
+    <!--<script src="babylon.js"></script>-->
     <script src="Scenes/Customs/test.js"></script>
     <script src="Scenes/Customs/lights_test.js"></script>
     <script src="Scenes/Customs/bump_test.js"></script>
@@ -80,6 +87,8 @@
     <script src="Scenes/Customs/charting.js"></script>
     <script src="Scenes/Customs/octree.js"></script>
     <script src="Scenes/Customs/bones.js"></script>
+    <script src="Scenes/Customs/postprocessBloom.js"></script>
+    <script src="Scenes/Customs/postprocessRefraction.js"></script>
     <script src="index.js"></script>
 </head>
 <body>
@@ -187,6 +196,7 @@
                                     <li>Fullscreen mode</li>
                                     <li>Shadow Maps and Variance Shadow Maps</li>
                                     <li>Rendering layers</li>
+                                    <li><b>Post-processes (blur, refraction, black'n'white, fxaa, customs...) </b></li>
                                 </ul>
                             </li>
                             <li>
@@ -245,6 +255,9 @@
                             <label><input type="checkbox" id="collisions" checked="true" />Collisions</label>
                         </p>
                         <p>
+                            <label><input type="checkbox" id="postProcess" checked="true" />Post-processes</label>
+                        </p>
+                        <p>
                             <button id="fullscreen">Switch fullscreen mode</button>
                         </p>
                     </div>
@@ -272,9 +285,13 @@
                         Change control method:
                         <button class="buttonControlPanel" id="touchCamera">Switch to touch camera</button>
                         <button class="buttonControlPanel" id="deviceOrientationCamera">Switch to device orientation camera</button>
+                    </p>
+                    <p>
+                        Post-processes:
                         <button class="buttonControlPanel" id="toggleFxaa">Toggle FXAA (antialiasing)</button>
                         <button class="buttonControlPanel" id="toggleFsaa4">Toggle FSAA 4X (antialiasing)</button>
                         <button class="buttonControlPanel" id="toggleBandW">Toggle Black and white</button>
+                        <button class="buttonControlPanel" id="toggleSepia">Toggle Sepia</button>
                     </p>
                 </div>
                 <div class="cameraTag"><img src="Assets/camera.png" /></div>
@@ -286,7 +303,4 @@
         <div id="loadingText" class="loadingText"></div>
     </div>
 </body>
-<script language="javascript">
-    onload();
-</script>
 </html>

+ 100 - 40
Samples/index.js

@@ -1,4 +1,8 @@
-var onload = function () {
+document.addEventListener("DOMContentLoaded", function () {
+    onload();
+}, false);
+
+var onload = function () {
     var canvas = document.getElementById("renderCanvas");
 
     // Demos
@@ -11,9 +15,22 @@
                 }
 
                 scene.activeCamera.detachControl(canvas);
-                scene.activeCamera = scene.cameras[4];
+                scene.activeCamera = scene.cameras[6];
                 scene.activeCamera.attachControl(canvas);
                 scene.getMaterialByName("terrain_eau").bumpTexture = null;
+
+                // Postprocesses
+                var bwPostProcess = new BABYLON.BlackAndWhitePostProcess("Black and White", 1.0, scene.cameras[2]);
+                scene.cameras[2].name = "B&W";
+
+                var sepiaKernelMatrix = BABYLON.Matrix.FromValues(
+                    0.393, 0.349, 0.272, 0,
+                    0.769, 0.686, 0.534, 0,
+                    0.189, 0.168, 0.131, 0,
+                    0, 0, 0, 0
+                );
+                var sepiaPostProcess = new BABYLON.ConvolutionPostProcess("Sepia", sepiaKernelMatrix, 1.0, scene.cameras[3]);
+                scene.cameras[3].name = "SEPIA";
             }
         },
         {
@@ -27,6 +44,8 @@
             title: "ESPILIT", scene: "Espilit", screenshot: "espilit.jpg", size: "50 MB", incremental: true, onload: function () {
                 scene.autoClear = true;
                 scene.createOrUpdateSelectionOctree();
+
+                var postProcess = new BABYLON.RefractionPostProcess("Refraction", "/scenes/customs/refMap.jpg", new BABYLON.Color3(1.0, 1.0, 1.0), 0.5, 0.5, 1.0, scene.cameras[1]);
             }
         },
         { title: "WINDOWS CAFE", scene: "WCafe", screenshot: "wcafe.jpg", size: "28 MB" },
@@ -51,6 +70,8 @@
         }];
 
     var tests = [
+        { title: "POSTPROCESS - REFRACTION", id: 11, screenshot: "postprocessRefraction.jpg", size: "1.0 MB" },
+        { title: "POSTPROCESS - BLOOM", id: 10, screenshot: "postprocessBloom.jpg", size: "1.0 MB" },
         { title: "OCTREE - 8000 spheres", id: 8, screenshot: "octree.jpg", size: "0.1 MB" },
         { title: "BONES", id: 9, screenshot: "bones.jpg", size: "10 MB" },
         { title: "CHARTING", id: 7, screenshot: "charting.jpg", size: "0.1 MB" },
@@ -87,14 +108,17 @@
     var loadingText = document.getElementById("loadingText");
     var hardwareScalingLevel = document.getElementById("hardwareScalingLevel");
     var collisions = document.getElementById("collisions");
+    var postProcess = document.getElementById("postProcess");
     var status = document.getElementById("status");
     var fullscreen = document.getElementById("fullscreen");
     var touchCamera = document.getElementById("touchCamera");
     var deviceOrientationCamera = document.getElementById("deviceOrientationCamera");
     var camerasList = document.getElementById("camerasList");
-    var toggleFxaa = document.getElementById("toggleFxaa");
     var toggleFsaa4 = document.getElementById("toggleFsaa4");
+    var toggleFxaa = document.getElementById("toggleFxaa");
     var toggleBandW = document.getElementById("toggleBandW");
+    var toggleSepia = document.getElementById("toggleSepia");
+
 
     var sceneChecked;
 
@@ -122,6 +146,12 @@
         };
     };
 
+    var removeChildren = function (root) {
+        while (root.childNodes.length) {
+            root.removeChild(root.childNodes[0]);
+        }
+    };
+
     var createItem = function (item, root) {
         var span = document.createElement("span");
         var img = document.createElement("img");
@@ -160,18 +190,22 @@
     };
 
     // Demos
+
+    removeChildren(items);
     for (var index = 0; index < demos.length; index++) {
         var demo = demos[index];
         createItem(demo, items);
     }
 
     // Tests
+    removeChildren(testItems);
     for (index = 0; index < tests.length; index++) {
         var test = tests[index];
         createItem(test, testItems);
     }
 
     // 3rd party
+    removeChildren(_3rdItems);
     for (index = 0; index < thirdParties.length; index++) {
         var thirdParty = thirdParties[index];
         createItem(thirdParty, _3rdItems);
@@ -277,6 +311,11 @@
                     case 9:
                         newScene = CreateBonesTestScene(engine);
                         break;
+                    case 10:
+                        newScene = CreatePostProcessBloomTestScene(engine);
+                        break;
+                    case 11:
+                        newScene = CreatePostProcessRefractionTestScene(engine);
                 }
                 scene = newScene;
 
@@ -408,8 +447,8 @@
             controlPanel.style.transform = "translateY(0px)";
         } else {
             panelIsClosed = true;
-            controlPanel.style.webkitTransform = "translateY(200px)";
-            controlPanel.style.transform = "translateY(200px)";
+            controlPanel.style.webkitTransform = "translateY(250px)";
+            controlPanel.style.transform = "translateY(250px)";
         }
     });
 
@@ -463,8 +502,8 @@
         if (!panelIsClosed) {
             panelIsClosed = true;
             cameraPanelIsClosed = true;
-            controlPanel.style.webkitTransform = "translateY(200px)";
-            controlPanel.style.transform = "translateY(200px)";
+            controlPanel.style.webkitTransform = "translateY(250px)";
+            controlPanel.style.transform = "translateY(250px)";
             cameraPanel.style.webkitTransform = "translateX(300px)";
             cameraPanel.style.transform = "translateX(300px)";
         }
@@ -532,28 +571,39 @@
         }
     });
 
-    touchCamera.addEventListener("click", function () {
-        if (!scene) {
-            return;
+    var switchCamera = function (camera) {
+        if (scene.activeCamera.rotation) {
+            camera.rotation = scene.activeCamera.rotation.clone();
         }
-
-        var camera = new BABYLON.TouchCamera("touchCamera", scene.activeCamera.position, scene);
-        camera.rotation = scene.activeCamera.rotation.clone();
         camera.fov = scene.activeCamera.fov;
         camera.minZ = scene.activeCamera.minZ;
         camera.maxZ = scene.activeCamera.maxZ;
 
-        camera.ellipsoid = scene.activeCamera.ellipsoid.clone();
+        if (scene.activeCamera.ellipsoid) {
+            camera.ellipsoid = scene.activeCamera.ellipsoid.clone();
+        }
         camera.checkCollisions = scene.activeCamera.checkCollisions;
         camera.applyGravity = scene.activeCamera.applyGravity;
 
         camera.speed = scene.activeCamera.speed;
 
+        camera.postProcesses = scene.activeCamera.postProcesses;
+        scene.activeCamera.postProcesses = [];
         scene.activeCamera.detachControl(canvas);
 
         scene.activeCamera = camera;
 
         scene.activeCamera.attachControl(canvas);
+
+    };
+
+    touchCamera.addEventListener("click", function () {
+        if (!scene) {
+            return;
+        }
+
+        var camera = new BABYLON.TouchCamera("touchCamera", scene.activeCamera.position, scene);
+        switchCamera(camera);
     });
 
     deviceOrientationCamera.addEventListener("click", function () {
@@ -562,22 +612,7 @@
         }
 
         var camera = new BABYLON.DeviceOrientationCamera("deviceOrientationCamera", scene.activeCamera.position, scene);
-        camera.rotation = scene.activeCamera.rotation.clone();
-        camera.fov = scene.activeCamera.fov;
-        camera.minZ = scene.activeCamera.minZ;
-        camera.maxZ = scene.activeCamera.maxZ;
-
-        camera.ellipsoid = scene.activeCamera.ellipsoid.clone();
-        camera.checkCollisions = scene.activeCamera.checkCollisions;
-        camera.applyGravity = scene.activeCamera.applyGravity;
-
-        camera.speed = scene.activeCamera.speed;
-
-        scene.activeCamera.detachControl(canvas);
-
-        scene.activeCamera = camera;
-
-        scene.activeCamera.attachControl(canvas);
+        switchCamera(camera);
     });
 
     hardwareScalingLevel.addEventListener("change", function () {
@@ -592,16 +627,12 @@
         }
     });
 
-    toggleFxaa.addEventListener("click", function () {
-        if (scene && scene.activeCamera) {
-            if (scene.activeCamera.__fxaa_cookie) {
-                scene.activeCamera.__fxaa_cookie.dispose(),
-                scene.activeCamera.__fxaa_cookie = null;
-            } else {
-                scene.activeCamera.__fxaa_cookie = new BABYLON.FxaaPostProcess("fxaa", 1.0, scene.activeCamera);
-            }
+    postProcess.addEventListener("change", function () {
+        if (scene) {
+            scene.postProcessesEnabled = postProcess.checked;
         }
     });
+
     toggleBandW.addEventListener("click", function () {
         if (scene && scene.activeCamera) {
             if (scene.activeCamera.__bandw_cookie) {
@@ -612,20 +643,49 @@
             }
         }
     });
-    toggleFsaa4.addEventListener("click", function () {
+    
+    toggleFxaa.addEventListener("click", function () {
+        if (scene && scene.activeCamera) {
+            if (scene.activeCamera.__fxaa_cookie) {
+                scene.activeCamera.__fxaa_cookie.dispose(),
+                scene.activeCamera.__fxaa_cookie = null;
+            } else {
+                scene.activeCamera.__fxaa_cookie = new BABYLON.FxaaPostProcess("fxaa", 1.0, scene.activeCamera);
+            }
+        }
+    });
 
+    toggleFsaa4.addEventListener("click", function () {
         if (scene && scene.activeCamera) {
             if (scene.activeCamera.__fsaa_cookie) {
                 scene.activeCamera.__fsaa_cookie.dispose(),
                 scene.activeCamera.__fsaa_cookie = null;
             } else {
                 var fx = new BABYLON.PassPostProcess("fsaa", 2.0, scene.activeCamera);
-                fx.renderTargetSamplingMode = BABYLON.TextureSamplingModes.BILINEAR;
+                fx.renderTargetSamplingMode = BABYLON.Texture.BILINEAR_SAMPLINGMODE;
                 scene.activeCamera.__fsaa_cookie = fx;
             }
         }
     });
 
+    toggleSepia.addEventListener("click", function () {
+        if (scene && scene.activeCamera) {
+            if (scene.activeCamera.__sepia_cookie) {
+                scene.activeCamera.__sepia_cookie.dispose(),
+                scene.activeCamera.__sepia_cookie = null;
+            } else {
+                var sepiaKernelMatrix = BABYLON.Matrix.FromValues(
+                    0.393, 0.349, 0.272, 0,
+                    0.769, 0.686, 0.534, 0,
+                    0.189, 0.168, 0.131, 0,
+                    0, 0, 0, 0
+                );
+                scene.activeCamera.__sepia_cookie = new BABYLON.ConvolutionPostProcess("Sepia", sepiaKernelMatrix, 1.0, scene.activeCamera);
+            }
+        }
+    });
+
+
     // Cameras
     camerasList.addEventListener("change", function (ev) {
         scene.activeCamera.detachControl(canvas);

File diff ditekan karena terlalu besar
+ 0 - 13
babylon.1.5.3.js


File diff ditekan karena terlalu besar
+ 4 - 3
babylon.js


+ 3 - 0
readme.md

@@ -5,6 +5,8 @@ Official web site: [www.babylonjs.com](http://www.babylonjs.com/)
 
 Official [forum](http://www.html5gamedevs.com/forum/16-babylonjs/) on www.html5gamedevs.com
 
+Online [assets converter](http://www.babylonjs.com/converter.html) for .FBX, .OBJ and .MXB
+
 ## Documentation
 - [Wiki](https://github.com/babylonjs/babylon.js/wiki)
 - [Tutorials](https://github.com/BabylonJS/Babylon.js/wiki/Tutorials)
@@ -49,6 +51,7 @@ Official [forum](http://www.html5gamedevs.com/forum/16-babylonjs/) on www.html5g
  - Fullscreen mode
  - Shadow Maps and Variance Shadow Maps
  - Rendering layers
+ - Post-processes (blur, refraction, black'n'white, fxaa, customs...)
 -  Textures:
  - Render target textures
  - Dynamic textures (canvas)

+ 11 - 0
what's new.md

@@ -1,5 +1,16 @@
 Changes list
 ============
+- 1.6.0:
+ - **Major updates**
+ - Support for [postprocesses](https://github.com/BabylonJS/Babylon.js/wiki/How-to-use-postprocesses) ([deltakosh](http://www.github.com/deltakosh))
+ - New builtin postprocesses: Pass, Refraction, Blur, Black and White, Convolution ([deltakosh](http://www.github.com/deltakosh))
+ - New builtin postprocess: FXAA ([simonferquel](http://www.github.com/simonferquel))
+ - Online [assets converter](http://www.babylonjs.com/converter.html)  ([pierlag](https://github.com/pierlag))
+ - **Updates**
+ - New features demos: [POSTPROCESS - REFRACTION](http://www.babylonjs.com/index.html?POSTPROCESS - REFRACTION) and [POSTPROCESS - BLOOM](http://www.babylonjs.com/index.html?POSTPROCESS - BLOOM)
+ - Removing the unused depth buffer for postprocesses chains ([simonferquel](http://www.github.com/simonferquel))
+ - **Bugfixes**
+ - Fixing a memory leak when releasing textures ([simonferquel](http://www.github.com/simonferquel))
 - 1.5.3:
  - **Updates**
  - New ```lockedTarget``` for freeCamera in order to allow cameras to track moving targets ([deltakosh](http://www.github.com/deltakosh))