sevan пре 8 година
родитељ
комит
837b654df0
52 измењених фајлова са 6865 додато и 109119 уклоњено
  1. 0 57
      Playground/scripts/hdr rendering pipeline.js
  2. 0 1
      Playground/scripts/scripts.txt
  3. 59 13
      Tools/Gulp/config.json
  4. 0 3
      Tools/Npm/.npmignore
  5. 0 12512
      Tools/Npm/Oimo.js
  6. 0 115
      Tools/Npm/README.md
  7. 0 20679
      Tools/Npm/babylon.canvas2d.js
  8. 0 12
      Tools/Npm/babylon.canvas2d.min.js
  9. 0 31
      Tools/Npm/babylon.core.js
  10. 0 2648
      Tools/Npm/babylon.gui.js
  11. 0 2
      Tools/Npm/babylon.gui.min.js
  12. 0 43
      Tools/Npm/babylon.js
  13. 0 64953
      Tools/Npm/babylon.max.js
  14. 0 41
      Tools/Npm/babylon.noworker.js
  15. 0 14
      Tools/Npm/getfiles.bat
  16. 2 2
      canvas2D/src/Engine/babylon.canvas2d.ts
  17. 3187 3310
      dist/preview release/babylon.d.ts
  18. 38 39
      dist/preview release/babylon.js
  19. 198 565
      dist/preview release/babylon.max.js
  20. 3187 3310
      dist/preview release/babylon.module.d.ts
  21. 40 41
      dist/preview release/babylon.worker.js
  22. 7 1
      dist/preview release/canvas2D/babylon.canvas2d.js
  23. 12 12
      dist/preview release/canvas2D/babylon.canvas2d.min.js
  24. 5 0
      dist/preview release/gui/babylon.gui.js
  25. 2 2
      dist/preview release/gui/babylon.gui.min.js
  26. 17 17
      dist/preview release/inspector/babylon.inspector.bundle.js
  27. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  28. 1 0
      dist/preview release/loaders/babylon.glTF1FileLoader.d.ts
  29. 3 0
      dist/preview release/loaders/babylon.glTF1FileLoader.js
  30. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  31. 1 0
      dist/preview release/loaders/babylon.glTF2FileLoader.d.ts
  32. 3 0
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  33. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  34. 1 0
      dist/preview release/loaders/babylon.glTFFileLoader.d.ts
  35. 3 0
      dist/preview release/loaders/babylon.glTFFileLoader.js
  36. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  37. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  38. 11 5
      dist/preview release/materialsLibrary/babylon.customMaterial.js
  39. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  40. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  41. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  42. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  43. 2 0
      dist/preview release/what's new.md
  44. 5 0
      gui/src/advancedDynamicTexture.ts
  45. 14 17
      Tools/Npm/package.json
  46. 13 0
      src/Layer/babylon.highlightlayer.ts
  47. 30 30
      src/Materials/babylon.colorCurves.ts
  48. 0 461
      src/PostProcess/babylon.hdrRenderingPipeline.ts
  49. 1 1
      src/PostProcess/babylon.imageProcessingPostProcess.ts
  50. 1 1
      src/PostProcess/babylon.postProcess.ts
  51. 0 163
      src/Shaders/hdr.fragment.fx
  52. 9 5
      src/babylon.engine.ts

+ 0 - 57
Playground/scripts/hdr rendering pipeline.js

@@ -1,57 +0,0 @@
-var createScene = function () {
-    var scene = new BABYLON.Scene(engine);
-    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, BABYLON.Vector3.Zero(), scene);
-    var material = new BABYLON.StandardMaterial("kosh", scene);
-    var sphere = BABYLON.Mesh.CreateSphere("Sphere1", 32, 3, scene);
-    var light = new BABYLON.PointLight("Omni0", new BABYLON.Vector3(-17.6, 18.8, -49.9), scene);
-
-    camera.setPosition(new BABYLON.Vector3(-15, 3, 0));
-    camera.attachControl(canvas, true);
-
-    // Sphere material
-    material.reflectionTexture = new BABYLON.CubeTexture("textures/TropicalSunnyDay", scene);
-    material.diffuseColor = new BABYLON.Color3(0, 0, 0);
-    material.emissiveColor = new BABYLON.Color3(0.5, 0.5, 0.5);
-    material.alpha = 0.2;
-    material.specularPower = 16;
-
-    // Fresnel
-    material.reflectionFresnelParameters = new BABYLON.FresnelParameters();
-    material.reflectionFresnelParameters.bias = 0.1;
-
-    material.emissiveFresnelParameters = new BABYLON.FresnelParameters();
-    material.emissiveFresnelParameters.bias = 0.6;
-    material.emissiveFresnelParameters.power = 4;
-    material.emissiveFresnelParameters.leftColor = BABYLON.Color3.White();
-    material.emissiveFresnelParameters.rightColor = BABYLON.Color3.Black();
-
-    material.opacityFresnelParameters = new BABYLON.FresnelParameters();
-    material.opacityFresnelParameters.leftColor = BABYLON.Color3.White();
-    material.opacityFresnelParameters.rightColor = BABYLON.Color3.Black();
-
-    sphere.material = material;
-
-    // Skybox
-    var skybox = BABYLON.Mesh.CreateBox("skyBox", 100.0, scene);
-    var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
-    skyboxMaterial.backFaceCulling = false;
-    skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/TropicalSunnyDay", scene);
-    skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
-    skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
-    skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
-    skyboxMaterial.disableLighting = true;
-    skybox.material = skyboxMaterial;
-
-    var hdr = new BABYLON.HDRRenderingPipeline("hdr", scene, 1.0, null, [camera]);
-    hdr.brightThreshold = 0.5;
-    hdr.gaussCoeff = 0.4;
-    hdr.gaussMean = 1.0;
-    hdr.gaussStandDev = 10.0;
-    hdr.minimumLuminance = 0.5;
-    hdr.luminanceDecreaseRate = 0.5;
-    hdr.luminanceIncreaserate = 0.5;
-    hdr.exposure = 1.0;
-    hdr.gaussMultiplier = 4;
-
-    return scene;
-}

+ 0 - 1
Playground/scripts/scripts.txt

@@ -24,7 +24,6 @@ sound on mesh
 ssao rendering pipeline
 ssao 2
 volumetric Light Scattering
-hdr Rendering Pipeline
 refraction and Reflection
 pbr
 instanced bones

+ 59 - 13
Tools/Gulp/config.json

@@ -17,6 +17,7 @@
                 "particles", "solidParticles", "additionalMeshes", "meshBuilder", "audio", "additionalTextures", "shadows",
                 "loader", "userData", "offline", "fresnel", "multiMaterial", "touchCamera", "procedural", "gamepad",
                 "additionalCameras", "postProcesses", "renderingPipeline", "additionalRenderingPipeline", "depthRenderer", "geometryBufferRenderer", "additionalPostProcesses",
+                "additionalPostProcess_blur", "additionalPostProcess_fxaa", "additionalPostProcess_imageProcessing",
                 "bones", "hdr", "polygonMesh", "csg", "lensFlares", "physics", "textureFormats", "debug", "morphTargets",
                 "colorCurves", "octrees", "simd", "vr", "virtualJoystick", "optimizations", "highlights", "assetsManager",
                 "mapTexture", "dynamicFloatArray", "serialization", "probes", "layer"
@@ -25,7 +26,8 @@
         "minimalWithBuilder": ["meshBuilder", "standardMaterial", "freeCamera", "hemisphericLight"],
         "minimalViewer": [
                 "meshBuilder", "animations", "arcRotateCamera", "additionalTextures", "textureFormats", "debug",
-                "multiMaterial", "pbrMaterial", "pointLight", "directionalLight", "spotLight"
+                "multiMaterial", "pbrMaterial", "pointLight", "directionalLight", "spotLight", "additionalPostProcess_blur", "additionalPostProcess_fxaa", "additionalPostProcess_highlights", "additionalPostProcess_imageProcessing",
+                "colorCurves"
         ],
         "distributed": ["minimalViewer"]
     },
@@ -569,11 +571,65 @@
                 "postprocess.vertex",
                 "pass.fragment"
             ]
+        }, 
+        "additionalPostProcess_blur" : 
+        {
+            "files": [
+                "../../src/PostProcess/babylon.blurPostProcess.js"
+            ],
+            "dependUpon" : [
+                "postProcesses"
+            ], 
+            "shaders" : [
+                "kernelBlur.vertex",
+                "kernelBlur.fragment"
+            ],
+            "shaderIncludes": [
+                "kernelBlurFragment",
+                "kernelBlurFragment2",
+                "kernelBlurVaryingDeclaration",
+                "kernelBlurVertex"
+            ]
         },    
+        "additionalPostProcess_fxaa" : 
+        {
+            "files": [
+                "../../src/PostProcess/babylon.fxaaPostProcess.js"
+            ],
+            "dependUpon" : [
+                "postProcesses"
+            ], 
+            "shaders" : [
+                "fxaa.fragment"
+            ]
+        },                       
+        "additionalPostProcess_highlights" : 
+        {
+            "files": [
+                "../../src/PostProcess/babylon.highlightsPostProcess.js"
+            ],
+            "dependUpon" : [
+                "postProcesses"
+            ], 
+            "shaders" : [
+                "highlights.fragment"
+            ]
+        },                                       
+        "additionalPostProcess_imageProcessing" : 
+        {
+            "files": [
+                "../../src/PostProcess/babylon.imageProcessingPostProcess.js"
+            ],
+            "dependUpon" : [
+                "postProcesses"
+            ], 
+            "shaders" : [
+                "imageProcessing.fragment"
+            ]
+        },                                          
         "additionalPostProcesses" : 
         {
             "files": [
-                "../../src/PostProcess/babylon.blurPostProcess.js",
                 "../../src/PostProcess/babylon.refractionPostProcess.js",
                 "../../src/PostProcess/babylon.blackAndWhitePostProcess.js",
                 "../../src/PostProcess/babylon.convolutionPostProcess.js",
@@ -590,8 +646,6 @@
                 "postProcesses"
             ], 
             "shaders" : [
-                "kernelBlur.vertex",
-                "kernelBlur.fragment",
                 "refraction.fragment",
                 "blackAndWhite.fragment",
                 "convolution.fragment",
@@ -604,12 +658,6 @@
                 "displayPass.fragment",
                 "highlights.fragment",
                 "imageProcessing.fragment"
-            ],
-            "shaderIncludes": [
-                "kernelBlurFragment",
-                "kernelBlurFragment2",
-                "kernelBlurVaryingDeclaration",
-                "kernelBlurVertex"
             ]
         },                         
         "renderingPipeline" : 
@@ -630,7 +678,6 @@
                 "../../src/PostProcess/babylon.ssaoRenderingPipeline.js",
                 "../../src/PostProcess/babylon.ssao2RenderingPipeline.js",
                 "../../src/PostProcess/babylon.lensRenderingPipeline.js",
-                "../../src/PostProcess/babylon.hdrRenderingPipeline.js",
                 "../../src/PostProcess/babylon.standardRenderingPipeline.js"
             ],
             "dependUpon" : [
@@ -644,8 +691,7 @@
                 "chromaticAberration.fragment",
                 "lensHighlights.fragment",
                 "depthOfField.fragment",
-                "standard.fragment",
-                "hdr.fragment"
+                "standard.fragment"
             ]
         },
         "bones" : 

+ 0 - 3
Tools/Npm/.npmignore

@@ -1,3 +0,0 @@
-npm_user.txt
-getfiles.bat
-npm-debug.log

Разлика између датотеке није приказан због своје велике величине
+ 0 - 12512
Tools/Npm/Oimo.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 115
Tools/Npm/README.md


Разлика између датотеке није приказан због своје велике величине
+ 0 - 20679
Tools/Npm/babylon.canvas2d.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 12
Tools/Npm/babylon.canvas2d.min.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 31
Tools/Npm/babylon.core.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 2648
Tools/Npm/babylon.gui.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 2
Tools/Npm/babylon.gui.min.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 43
Tools/Npm/babylon.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 64953
Tools/Npm/babylon.max.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 41
Tools/Npm/babylon.noworker.js


+ 0 - 14
Tools/Npm/getfiles.bat

@@ -1,14 +0,0 @@
-xcopy /Y /F "../../dist/preview release/babylon.d.ts" .
-xcopy /Y /F "../../dist/preview release/babylon.module.d.ts" .
-xcopy /Y /F "../../dist/preview release/babylon.js" .
-xcopy /Y /F "../../dist/preview release/babylon.max.js"  .
-xcopy /Y /F "../../dist/preview release/babylon.noworker.js" . 
-xcopy /Y /F "../../dist/preview release/babylon.core.js" . 
-xcopy /Y /F "../../dist/preview release/canvas2D/babylon.canvas2d.js" . 
-xcopy /Y /F "../../dist/preview release/canvas2D/babylon.canvas2d.min.js" . 
-xcopy /Y /F "../../dist/preview release/canvas2D/babylon.canvas2d.d.ts" . 
-xcopy /Y /F "../../dist/preview release/gui/babylon.gui.js" . 
-xcopy /Y /F "../../dist/preview release/gui/babylon.gui.min.js" . 
-xcopy /Y /F "../../dist/preview release/gui/babylon.gui.d.ts" . 
-xcopy /Y /F "../../dist/preview release/oimo.js" . 
-pause

+ 2 - 2
canvas2D/src/Engine/babylon.canvas2d.ts

@@ -1574,10 +1574,10 @@
                 this._renderObservable.notifyObservers(this, Canvas2D.RENDEROBSERVABLE_PRE);
             }
 
-            this._updateCanvasState(false);
-
             this._updateTrackedNodes();
 
+            this._updateCanvasState(false);
+
             // Nothing to do is the Canvas is not visible
             if (this.isVisible === false) {
                 return;

Разлика између датотеке није приказан због своје велике величине
+ 3187 - 3310
dist/preview release/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 38 - 39
dist/preview release/babylon.js


Разлика између датотеке није приказан због своје велике величине
+ 198 - 565
dist/preview release/babylon.max.js


Разлика између датотеке није приказан због своје велике величине
+ 3187 - 3310
dist/preview release/babylon.module.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 40 - 41
dist/preview release/babylon.worker.js


+ 7 - 1
dist/preview release/canvas2D/babylon.canvas2d.js

@@ -18141,6 +18141,12 @@ var BABYLON;
             var v = bi.vectorsWorld;
             var cam = this.scene.cameraToUseForPointers || this.scene.activeCamera;
             cam.getViewMatrix().multiplyToRef(cam.getProjectionMatrix(), Canvas2D_1._m);
+            if (Canvas2D_1._m.m[15] < BABYLON.Epsilon && Canvas2D_1._m.m[15] >= 0) {
+                Canvas2D_1._m.m[15] = BABYLON.Epsilon;
+            }
+            else if (Canvas2D_1._m.m[15] > -BABYLON.Epsilon && Canvas2D_1._m.m[15] <= 0) {
+                Canvas2D_1._m.m[15] = -BABYLON.Epsilon;
+            }
             var vp = cam.viewport.toGlobal(this.engine.getRenderWidth(), this.engine.getRenderHeight());
             var projPoints = new Array(4);
             for (var i = 0; i < 4; i++) {
@@ -18239,8 +18245,8 @@ var BABYLON;
             if (this._renderObservable && this._renderObservable.hasObservers()) {
                 this._renderObservable.notifyObservers(this, Canvas2D_1.RENDEROBSERVABLE_PRE);
             }
-            this._updateCanvasState(false);
             this._updateTrackedNodes();
+            this._updateCanvasState(false);
             // Nothing to do is the Canvas is not visible
             if (this.isVisible === false) {
                 return;

Разлика између датотеке није приказан због своје велике величине
+ 12 - 12
dist/preview release/canvas2D/babylon.canvas2d.min.js


+ 5 - 0
dist/preview release/gui/babylon.gui.js

@@ -150,6 +150,11 @@ var BABYLON;
                         var mesh = control._linkedMesh;
                         var position = mesh.getBoundingInfo().boundingSphere.center;
                         var projectedPosition = BABYLON.Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);
+                        if (projectedPosition.z < 0 || projectedPosition.z > 1) {
+                            control.isVisible = false;
+                            continue;
+                        }
+                        control.isVisible = true;
                         control._moveToProjectedPosition(projectedPosition);
                     }
                 }

Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/gui/babylon.gui.min.js


Разлика између датотеке није приказан због своје велике величине
+ 17 - 17
dist/preview release/inspector/babylon.inspector.bundle.js


Разлика између датотеке није приказан због своје велике величине
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


+ 1 - 0
dist/preview release/loaders/babylon.glTF1FileLoader.d.ts

@@ -16,6 +16,7 @@ declare module BABYLON {
         extensions: ISceneLoaderPluginExtensions;
         importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onError: () => void): void;
         loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess: () => void, onError: () => void): void;
+        canDirectLoad(data: string): boolean;
         private static _parse(data);
         private _getLoader(loaderData);
         private static _parseBinary(data);

+ 3 - 0
dist/preview release/loaders/babylon.glTF1FileLoader.js

@@ -26,6 +26,9 @@ var BABYLON;
             }
             return loader.loadAsync(scene, loaderData, rootUrl, onSuccess, onError);
         };
+        GLTFFileLoader.prototype.canDirectLoad = function (data) {
+            return ((data.indexOf("scene") !== -1) && (data.indexOf("node") !== -1));
+        };
         GLTFFileLoader._parse = function (data) {
             if (data instanceof ArrayBuffer) {
                 return GLTFFileLoader._parseBinary(data);

Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


+ 1 - 0
dist/preview release/loaders/babylon.glTF2FileLoader.d.ts

@@ -16,6 +16,7 @@ declare module BABYLON {
         extensions: ISceneLoaderPluginExtensions;
         importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onError: () => void): void;
         loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess: () => void, onError: () => void): void;
+        canDirectLoad(data: string): boolean;
         private static _parse(data);
         private _getLoader(loaderData);
         private static _parseBinary(data);

+ 3 - 0
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -26,6 +26,9 @@ var BABYLON;
             }
             return loader.loadAsync(scene, loaderData, rootUrl, onSuccess, onError);
         };
+        GLTFFileLoader.prototype.canDirectLoad = function (data) {
+            return ((data.indexOf("scene") !== -1) && (data.indexOf("node") !== -1));
+        };
         GLTFFileLoader._parse = function (data) {
             if (data instanceof ArrayBuffer) {
                 return GLTFFileLoader._parseBinary(data);

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 1 - 0
dist/preview release/loaders/babylon.glTFFileLoader.d.ts

@@ -16,6 +16,7 @@ declare module BABYLON {
         extensions: ISceneLoaderPluginExtensions;
         importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onError: () => void): void;
         loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess: () => void, onError: () => void): void;
+        canDirectLoad(data: string): boolean;
         private static _parse(data);
         private _getLoader(loaderData);
         private static _parseBinary(data);

+ 3 - 0
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -26,6 +26,9 @@ var BABYLON;
             }
             return loader.loadAsync(scene, loaderData, rootUrl, onSuccess, onError);
         };
+        GLTFFileLoader.prototype.canDirectLoad = function (data) {
+            return ((data.indexOf("scene") !== -1) && (data.indexOf("node") !== -1));
+        };
         GLTFFileLoader._parse = function (data) {
             if (data instanceof ArrayBuffer) {
                 return GLTFFileLoader._parseBinary(data);

Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 11 - 5
dist/preview release/materialsLibrary/babylon.customMaterial.js

@@ -30,9 +30,7 @@ var BABYLON;
             _this.VertexStore = "";
             _this.FragmentStore = "#include<__decl__defaultFragment>\n\
 #[Fragment_Begin]\n\
-#ifdef BUMP\n\
 #extension GL_OES_standard_derivatives : enable\n\
-#endif\n\
 #ifdef LOGARITHMICDEPTH\n\
 #extension GL_EXT_frag_depth : enable\n\
 #endif\n\
@@ -43,7 +41,10 @@ uniform vec3 vAmbientColor;\n\
 \n\
 varying vec3 vPositionW;\n\
 #ifdef NORMAL\n\
-varying vec3 vNormalW;\n\
+varying vec3 vNormalW_helper;\n\
+varying vec3 localNormal;\n\
+varying vec3 localPosition;\n\
+vec3 vNormalW;\n\
 #endif\n\
 #ifdef VERTEXCOLOR\n\
 varying vec4 vColor;\n\
@@ -121,6 +122,7 @@ varying vec3 vDirectionW;\n\
 \n\
 void main(void) {\n\
 \n\
+vNormalW = vNormalW_helper;\n\
 #[Fragment_MainBegin]\n\
 \n\
 #include<clipPlaneFragment>\n\
@@ -369,9 +371,11 @@ varying vec2 vSpecularUV;\n\
 varying vec2 vBumpUV;\n\
 #endif\n\
 \n\
+varying vec3 localPosition;\n\
 varying vec3 vPositionW;\n\
 #ifdef NORMAL\n\
-varying vec3 vNormalW;\n\
+varying vec3 vNormalW_helper;\n\
+varying vec3 localNormal;\n\
 #endif\n\
 #ifdef VERTEXCOLOR\n\
 varying vec4 vColor;\n\
@@ -410,6 +414,7 @@ vPositionUVW=positionUpdated;\n\
 #include<instancesVertex>\n\
 #include<bonesVertex>\n\
 \n\
+localPosition = positionUpdated;\n\
 #[Vertex_Before_PositionUpdated]\n\
 \n\
 gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n\
@@ -419,7 +424,8 @@ vPositionW=vec3(worldPos);\n\
 \n\
 #[Vertex_Before_NormalUpdated]\n\
 \n\
-vNormalW=normalize(vec3(finalWorld*vec4(normalUpdated,0.0)));\n\
+localNormal = normalUpdated;\n\
+vNormalW_helper=normalize(vec3(finalWorld*vec4(normalUpdated,0.0)));\n\
 #endif\n\
 #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\n\
 vDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n\

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


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

@@ -109,6 +109,8 @@
   - `createCompoundImpostor` has been removed. Use PhysicsImpostor parent/child instead
 - ActionManager:
   - `LongPressDelay` and `DragMovementThreshold` are now respectively Scene.LongPressDelay and Scene.DragMovementThreshold
+- HDRRenderingPipeline:
+  - `HDRRenderingPipeline` has been removed because it is deprecated. It is now replaced by `StandardRenderingPipeline` which is more advanced. See [documentation](http://doc.babylonjs.com/tutorials/using_standard_rendering_pipeline)
  
 ## Canvas2D
 

+ 5 - 0
gui/src/advancedDynamicTexture.ts

@@ -162,6 +162,11 @@ module BABYLON.GUI {
                     var position = mesh.getBoundingInfo().boundingSphere.center;
                     var projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);
 
+                    if (projectedPosition.z < 0 || projectedPosition.z > 1) {
+                        control.isVisible = false;
+                        continue;
+                    }
+                    control.isVisible = true;
                     control._moveToProjectedPosition(projectedPosition);
                 }
             }

+ 14 - 17
Tools/Npm/package.json

@@ -3,33 +3,30 @@
     "name": "David CATUHE"
   },
   "contributors": [
-    "David ROUSSET"
+    "David ROUSSET",
+    "Sebastien VANDENBERGHE"
   ],
   "name": "babylonjs",
   "description": "Babylon.js is a JavaScript 3D engine based on webgl.",
-  "version": "3.0.1-beta",
+  "version": "3.0.2-beta",
   "repository": {
     "type": "git",
     "url": "https://github.com/BabylonJS/Babylon.js.git"
   },
   "main": "babylon.max.js",
   "files": [
-    "babylon.d.ts",
-    "babylon.module.d.ts",
-    "babylon.js",
-    "babylon.max.js",
-    "babylon.noworker.js",
-    "babylon.core.js",
-    "babylon.canvas2d.js",
-    "babylon.canvas2d.min.js",
-    "babylon.canvas2d.d.ts",
-    "babylon.gui.js",
-    "babylon.gui.min.js",
-    "babylon.gui.d.ts",
-    "Oimo.js",
+    "dist/preview release/babylon.d.ts",
+    "dist/preview release/babylon.module.d.ts",
+    "dist/preview release/babylon.js",
+    "dist/preview release/babylon.max.js",
+    "dist/preview release/babylon.worker.js",
+    "dist/preview release/gui/babylon.gui.js",
+    "dist/preview release/gui/babylon.gui.min.js",
+    "dist/preview release/gui/babylon.gui.d.ts",
+    "dist/preview release/Oimo.js",
     "package.json"
   ],
-  "typings": "babylon.module.d.ts",
+  "typings": "dist/preview release/babylon.module.d.ts",
   "keywords": [
     "3D",
     "javascript",
@@ -43,6 +40,6 @@
   },
   "readme": "Babylon.js is a 3D engine based on webgl and javascript",
   "readmeFilename": "README.md",
-  "_id": "babylonjs@2.0.2",
+  "_id": "babylonjs@3.0.2",
   "_from": "babylonjs@"
 }

+ 13 - 0
src/Layer/babylon.highlightlayer.ts

@@ -610,6 +610,9 @@ module BABYLON {
             var previousStencilBuffer = engine.getStencilBuffer();
             var previousStencilFunction = engine.getStencilFunction();
             var previousStencilMask = engine.getStencilMask();
+            var previousStencilOperationPass = engine.getStencilOperationPass();
+            var previousStencilOperationFail = engine.getStencilOperationFail();
+            var previousStencilOperationDepthFail = engine.getStencilOperationDepthFail();            
             var previousAlphaMode = engine.getAlphaMode();
 
             // Texture
@@ -618,6 +621,11 @@ module BABYLON {
             // VBOs
             engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect);
 
+            // Stencil operations
+            engine.setStencilOperationPass(Engine.REPLACE);
+            engine.setStencilOperationFail(Engine.KEEP);
+            engine.setStencilOperationDepthFail(Engine.KEEP);
+
             // Draw order
             engine.setAlphaMode(this._options.alphaBlendingMode);
             engine.setStencilMask(0x00);
@@ -640,6 +648,11 @@ module BABYLON {
             engine.setStencilMask(previousStencilMask);
             engine.setAlphaMode(previousAlphaMode);
             engine.setStencilBuffer(previousStencilBuffer);
+            engine.setStencilOperationPass(previousStencilOperationPass);
+            engine.setStencilOperationFail(previousStencilOperationFail);
+            engine.setStencilOperationDepthFail(previousStencilOperationDepthFail);            
+
+            (<any>engine)._stencilState.reset();
 
             this.onAfterComposeObservable.notifyObservers(this);
 

+ 30 - 30
src/Materials/babylon.colorCurves.ts

@@ -36,14 +36,14 @@
          * Gets the global Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          */
-        public get GlobalHue(): number {
+        public get globalHue(): number {
             return this._globalHue;
         }
         /**
          * Sets the global Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          */
-        public set GlobalHue(value: number) {
+        public set globalHue(value: number) {
             this._globalHue = value;
             this._dirty = true;
         }
@@ -52,7 +52,7 @@
          * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect. 
          * Values less than zero provide a filter of opposite hue.
          */
-        public get GlobalDensity(): number {
+        public get globalDensity(): number {
             return this._globalDensity;
         }
         /**
@@ -60,7 +60,7 @@
          * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect. 
          * Values less than zero provide a filter of opposite hue.
          */
-        public set GlobalDensity(value: number) {
+        public set globalDensity(value: number) {
             this._globalDensity = value;
             this._dirty = true;
         }
@@ -68,14 +68,14 @@
          * Gets the global Saturation value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
          */
-        public get GlobalSaturation(): number {
+        public get globalSaturation(): number {
             return this._globalSaturation;
         }
         /**
          * Sets the global Saturation value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
          */
-        public set GlobalSaturation(value: number) {
+        public set globalSaturation(value: number) {
             this._globalSaturation = value;
             this._dirty = true;
         }
@@ -96,14 +96,14 @@
          * Gets the highlights Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          */
-        public get HighlightsHue(): number {
+        public get highlightsHue(): number {
             return this._highlightsHue;
         }
         /**
          * Sets the highlights Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          */
-        public set HighlightsHue(value: number) {
+        public set highlightsHue(value: number) {
             this._highlightsHue = value;
             this._dirty = true;
         }
@@ -112,7 +112,7 @@
          * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect. 
          * Values less than zero provide a filter of opposite hue.
          */
-        public get HighlightsDensity(): number {
+        public get highlightsDensity(): number {
             return this._highlightsDensity;
         }
         /**
@@ -120,7 +120,7 @@
          * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect. 
          * Values less than zero provide a filter of opposite hue.
          */
-        public set HighlightsDensity(value: number) {
+        public set highlightsDensity(value: number) {
             this._highlightsDensity = value;
             this._dirty = true;
         }
@@ -128,14 +128,14 @@
          * Gets the highlights Saturation value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
          */
-        public get HighlightsSaturation(): number {
+        public get highlightsSaturation(): number {
             return this._highlightsSaturation;
         }
         /**
          * Sets the highlights Saturation value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
          */
-        public set HighlightsSaturation(value: number) {
+        public set highlightsSaturation(value: number) {
             this._highlightsSaturation = value;
             this._dirty = true;
         }
@@ -143,14 +143,14 @@
          * Gets the highlights Exposure value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
          */
-        public get HighlightsExposure(): number {
+        public get highlightsExposure(): number {
             return this._highlightsExposure;
         }
         /**
          * Sets the highlights Exposure value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
          */
-        public set HighlightsExposure(value: number) {
+        public set highlightsExposure(value: number) {
             this._highlightsExposure = value;
             this._dirty = true;
         }
@@ -171,14 +171,14 @@
          * Gets the midtones Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          */
-        public get MidtonesHue(): number {
+        public get midtonesHue(): number {
             return this._midtonesHue;
         }
         /**
          * Sets the midtones Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          */
-        public set MidtonesHue(value: number) {
+        public set midtonesHue(value: number) {
             this._midtonesHue = value;
             this._dirty = true;
         }
@@ -187,7 +187,7 @@
          * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect. 
          * Values less than zero provide a filter of opposite hue.
          */
-        public get MidtonesDensity(): number {
+        public get midtonesDensity(): number {
             return this._midtonesDensity;
         }
         /**
@@ -195,7 +195,7 @@
          * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect. 
          * Values less than zero provide a filter of opposite hue.
          */
-        public set MidtonesDensity(value: number) {
+        public set midtonesDensity(value: number) {
             this._midtonesDensity = value;
             this._dirty = true;
         }
@@ -203,14 +203,14 @@
          * Gets the midtones Saturation value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
          */
-        public get MidtonesSaturation(): number {
+        public get midtonesSaturation(): number {
             return this._midtonesSaturation;
         }
         /**
          * Sets the midtones Saturation value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
          */
-        public set MidtonesSaturation(value: number) {
+        public set midtonesSaturation(value: number) {
             this._midtonesSaturation = value;
             this._dirty = true;
         }
@@ -218,14 +218,14 @@
          * Gets the midtones Exposure value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
          */
-        public get MidtonesExposure(): number {
+        public get midtonesExposure(): number {
             return this._midtonesExposure;
         }
         /**
          * Sets the midtones Exposure value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
          */
-        public set MidtonesExposure(value: number) {
+        public set midtonesExposure(value: number) {
             this._midtonesExposure = value;
             this._dirty = true;
         }
@@ -239,14 +239,14 @@
          * Gets the shadows Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          */
-        public get ShadowsHue(): number {
+        public get shadowsHue(): number {
             return this._shadowsHue;
         }
         /**
          * Sets the shadows Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          */
-        public set ShadowsHue(value: number) {
+        public set shadowsHue(value: number) {
             this._shadowsHue = value;
             this._dirty = true;
         }
@@ -255,7 +255,7 @@
          * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect. 
          * Values less than zero provide a filter of opposite hue.
          */
-        public get ShadowsDensity(): number {
+        public get shadowsDensity(): number {
             return this._shadowsDensity;
         }
         /**
@@ -263,7 +263,7 @@
          * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect. 
          * Values less than zero provide a filter of opposite hue.
          */
-        public set ShadowsDensity(value: number) {
+        public set shadowsDensity(value: number) {
             this._shadowsDensity = value;
             this._dirty = true;
         }
@@ -271,14 +271,14 @@
          * Gets the shadows Saturation value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
          */
-        public get ShadowsSaturation(): number {
+        public get shadowsSaturation(): number {
             return this._shadowsSaturation;
         }
         /**
          * Sets the shadows Saturation value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
          */
-        public set ShadowsSaturation(value: number) {
+        public set shadowsSaturation(value: number) {
             this._shadowsSaturation = value;
             this._dirty = true;
         }
@@ -286,14 +286,14 @@
          * Gets the shadows Exposure value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
          */
-        public get ShadowsExposure(): number {
+        public get shadowsExposure(): number {
             return this._shadowsExposure;
         }
         /**
          * Sets the shadows Exposure value.
          * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
          */
-        public set ShadowsExposure(value: number) {
+        public set shadowsExposure(value: number) {
             this._shadowsExposure = value;
             this._dirty = true;
         }

+ 0 - 461
src/PostProcess/babylon.hdrRenderingPipeline.ts

@@ -1,461 +0,0 @@
-/// <reference path="RenderPipeline\babylon.postProcessRenderPipeline.ts" />
-
-module BABYLON {
-    export class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable {
-
-        /**
-        * Public members
-        */
-        
-        // Gaussian Blur
-        /**
-        * Gaussian blur coefficient
-        * @type {number}
-        */
-        public gaussCoeff: number = 0.3;
-        /**
-        * Gaussian blur mean
-        * @type {number}
-        */
-        public gaussMean: number = 1.0;
-        /**
-        * Gaussian blur standard deviation
-        * @type {number}
-        */
-        public gaussStandDev: number = 0.8;
-        /**
-        * Gaussian blur multiplier. Multiplies the blur effect
-        * @type {number}
-        */
-        public gaussMultiplier: number = 4.0;
-
-        // HDR
-        /**
-        * Exposure, controls the overall intensity of the pipeline
-        * @type {number}
-        */
-        public exposure: number = 1.0;
-        /**
-        * Minimum luminance that the post-process can output. Luminance is >= 0
-        * @type {number}
-        */
-        public minimumLuminance: number = 1.0;
-        /**
-        * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance
-        * @type {number}
-        */
-        public maximumLuminance: number = 1e20;
-        /**
-        * Increase rate for luminance: eye adaptation speed to dark
-        * @type {number}
-        */
-        public luminanceIncreaserate: number = 0.5;
-        /**
-        * Decrease rate for luminance: eye adaptation speed to bright
-        * @type {number}
-        */
-        public luminanceDecreaseRate: number = 0.5;
-
-        // Bright pass
-        /**
-        * Minimum luminance needed to compute HDR
-        * @type {number}
-        */
-        public brightThreshold: number = 0.8;
-
-        /**
-        * Private members
-        */
-        // Gaussian blur
-        private _guassianBlurHPostProcess: PostProcess;
-        private _guassianBlurVPostProcess: PostProcess;
-
-        // Bright pass
-        private _brightPassPostProcess: PostProcess;
-
-        // Texture adder
-        private _textureAdderPostProcess: PostProcess;
-
-        // Down Sampling
-        private _downSampleX4PostProcess: PostProcess;
-
-        // Original Post-process
-        private _originalPostProcess: PostProcess;
-
-        // HDR
-        private _hdrPostProcess: PostProcess;
-        private _hdrCurrentLuminance: number;
-        private _hdrOutputLuminance: number;
-
-        // Luminance generator
-        public static LUM_STEPS: number = 6;
-        private _downSamplePostProcesses: Array<PostProcess>;
-
-        // Global
-        private _scene: Scene;
-        private _needUpdate: boolean = true;
-
-        /**
-         * @constructor
-         * @param {string} name - The rendering pipeline name
-         * @param {BABYLON.Scene} scene - The scene linked to this pipeline
-         * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
-         * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
-         * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
-         */
-        constructor(name: string, scene: Scene, ratio: number, originalPostProcess: PostProcess = null, cameras?: Camera[]) {
-            super(scene.getEngine(), name);
-
-            this._scene = scene;
-
-            // Bright pass
-            this._createBrightPassPostProcess(scene, ratio);
-
-            // Down sample X4
-            this._createDownSampleX4PostProcess(scene, ratio);
-
-            // Create gaussian blur post-processes
-            this._createGaussianBlurPostProcess(scene, ratio);
-
-            // Texture adder
-            this._createTextureAdderPostProcess(scene, ratio);
-
-            // Luminance generator
-            this._createLuminanceGeneratorPostProcess(scene);
-
-            // HDR
-            this._createHDRPostProcess(scene, ratio);
-
-            // Pass postprocess
-            if (originalPostProcess === null) {
-                this._originalPostProcess = new PassPostProcess("hdr", ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false);
-            } else {
-                this._originalPostProcess = originalPostProcess;
-            }
-
-            // Configure pipeline
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRPassPostProcess",() => { return this._originalPostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRBrightPass",() => { return this._brightPassPostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRDownSampleX4",() => { return this._downSampleX4PostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRGaussianBlurH",() => { return this._guassianBlurHPostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRGaussianBlurV",() => { return this._guassianBlurVPostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRTextureAdder",() => { return this._textureAdderPostProcess; }, true));
-
-            var addDownSamplerPostProcess = (id: number) => {
-                this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRDownSampler" + id,() => { return this._downSamplePostProcesses[id]; }, true));
-            };
-            for (var i = HDRRenderingPipeline.LUM_STEPS - 1; i >= 0; i--) {
-                addDownSamplerPostProcess(i);
-            }
-
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDR",() => { return this._hdrPostProcess; }, true));
-
-            // Finish
-            scene.postProcessRenderPipelineManager.addPipeline(this);
-
-            if (cameras !== null) {
-                scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);
-            }
-
-            this.update();
-        }
-
-        /**
-        * Tells the pipeline to update its post-processes
-        */
-        public update(): void {
-            this._needUpdate = true;
-        }
-
-        /**
-        * Returns the current calculated luminance
-        */
-        public getCurrentLuminance(): number {
-            return this._hdrCurrentLuminance;
-        }
-
-        /**
-        * Returns the currently drawn luminance
-        */
-        public getOutputLuminance(): number {
-            return this._hdrOutputLuminance;
-        }
-
-        /**
-        * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras
-        */
-        public dispose(): void {
-            for (var i = 0; i < this._scene.cameras.length; i++) {
-                var camera = this._scene.cameras[i];
-
-                this._originalPostProcess.dispose(camera);
-                this._brightPassPostProcess.dispose(camera);
-                this._downSampleX4PostProcess.dispose(camera);
-                this._guassianBlurHPostProcess.dispose(camera);
-                this._guassianBlurVPostProcess.dispose(camera);
-                this._textureAdderPostProcess.dispose(camera);
-
-                for (var j = HDRRenderingPipeline.LUM_STEPS - 1; j >= 0; j--) {
-                    this._downSamplePostProcesses[j].dispose(camera);
-                }
-
-                this._hdrPostProcess.dispose(camera);
-            }
-
-            this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);
-
-            super.dispose();
-        }
-
-        /**
-        * Creates the HDR post-process and computes the luminance adaptation
-        */
-        private _createHDRPostProcess(scene: Scene, ratio: number): void {
-            var hdrLastLuminance = 0.0;
-            this._hdrOutputLuminance = -1.0;
-            this._hdrCurrentLuminance = 1.0;
-            this._hdrPostProcess = new PostProcess("hdr", "hdr", ["exposure", "avgLuminance"], ["otherSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define HDR");
-
-            this._hdrPostProcess.onApply = (effect: Effect) => {
-                if (this._hdrOutputLuminance < 0.0) {
-                    this._hdrOutputLuminance = this._hdrCurrentLuminance;
-                }
-                else {
-                    var dt = (hdrLastLuminance - (hdrLastLuminance + scene.getEngine().getDeltaTime())) / 1000.0;
-
-                    if (this._hdrCurrentLuminance < this._hdrOutputLuminance + this.luminanceDecreaseRate * dt) {
-                        this._hdrOutputLuminance += this.luminanceDecreaseRate * dt;
-                    }
-                    else if (this._hdrCurrentLuminance > this._hdrOutputLuminance - this.luminanceIncreaserate * dt) {
-                        this._hdrOutputLuminance -= this.luminanceIncreaserate * dt;
-                    }
-                    else {
-                        this._hdrOutputLuminance = this._hdrCurrentLuminance;
-                    }
-                }
-
-                this._hdrOutputLuminance = MathTools.Clamp(this._hdrOutputLuminance, this.minimumLuminance, this.maximumLuminance);
-                hdrLastLuminance += scene.getEngine().getDeltaTime();
-
-                effect.setTextureFromPostProcess("textureSampler", this._textureAdderPostProcess);
-                effect.setTextureFromPostProcess("otherSampler", this._originalPostProcess);
-                effect.setFloat("exposure", this.exposure);
-                effect.setFloat("avgLuminance", this._hdrOutputLuminance);
-
-                this._needUpdate = false;
-            };
-
-        }
-
-        /**
-        * Texture Adder post-process
-        */
-        private _createTextureAdderPostProcess(scene: Scene, ratio: number): void {
-            this._textureAdderPostProcess = new PostProcess("hdr", "hdr", [], ["otherSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define TEXTURE_ADDER");
-
-            this._textureAdderPostProcess.onApply = (effect: Effect) => {
-                effect.setTextureFromPostProcess("otherSampler", this._originalPostProcess);
-            };
-        }
-
-        /**
-        * Down sample X4 post-process
-        */
-        private _createDownSampleX4PostProcess(scene: Scene, ratio: number): void {
-            var downSampleX4Offsets = new Array<number>(32);
-            this._downSampleX4PostProcess = new PostProcess("hdr", "hdr", ["dsOffsets"], [], ratio / 4, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define DOWN_SAMPLE_X4");
-
-            this._downSampleX4PostProcess.onApply = (effect: Effect) => {
-                if (this._needUpdate) {
-                    var id = 0;
-                    for (var i = -2; i < 2; i++) {
-                        for (var j = -2; j < 2; j++) {
-                            downSampleX4Offsets[id] = (i + 0.5) * (1.0 / this._downSampleX4PostProcess.width);
-                            downSampleX4Offsets[id + 1] = (j + 0.5) * (1.0 / this._downSampleX4PostProcess.height);
-                            id += 2;
-                        }
-                    }
-                }
-
-                effect.setArray2("dsOffsets", downSampleX4Offsets);
-            };
-        }
-
-        /**
-        * Bright pass post-process
-        */
-        private _createBrightPassPostProcess(scene: Scene, ratio: number): void {
-            var brightOffsets = new Array<number>(8);
-
-            var brightPassCallback = (effect: Effect) => {
-                if (this._needUpdate) {
-                    var sU = (1.0 / this._brightPassPostProcess.width);
-                    var sV = (1.0 / this._brightPassPostProcess.height);
-
-                    brightOffsets[0] = -0.5 * sU;
-                    brightOffsets[1] = 0.5 * sV;
-                    brightOffsets[2] = 0.5 * sU;
-                    brightOffsets[3] = 0.5 * sV;
-                    brightOffsets[4] = -0.5 * sU;
-                    brightOffsets[5] = -0.5 * sV;
-                    brightOffsets[6] = 0.5 * sU;
-                    brightOffsets[7] = -0.5 * sV;
-                }
-
-                effect.setArray2("dsOffsets", brightOffsets);
-                effect.setFloat("brightThreshold", this.brightThreshold);
-            };
-
-            this._brightPassPostProcess = new PostProcess("hdr", "hdr", ["dsOffsets", "brightThreshold"], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define BRIGHT_PASS");
-            this._brightPassPostProcess.onApply = brightPassCallback;
-        }
-
-        /**
-        * Luminance generator. Creates the luminance post-process and down sample post-processes
-        */
-        private _createLuminanceGeneratorPostProcess(scene: Scene): void {
-            var lumSteps: number = HDRRenderingPipeline.LUM_STEPS;
-            var luminanceOffsets = new Array<number>(8);
-            var downSampleOffsets = new Array<number>(18);
-            var halfDestPixelSize: number;
-            this._downSamplePostProcesses = new Array<PostProcess>(lumSteps);
-
-            // Utils for luminance
-            var luminanceUpdateSourceOffsets = (width: number, height: number) => {
-                var sU = (1.0 / width);
-                var sV = (1.0 / height);
-
-                luminanceOffsets[0] = -0.5 * sU;
-                luminanceOffsets[1] = 0.5 * sV;
-                luminanceOffsets[2] = 0.5 * sU;
-                luminanceOffsets[3] = 0.5 * sV;
-                luminanceOffsets[4] = -0.5 * sU;
-                luminanceOffsets[5] = -0.5 * sV;
-                luminanceOffsets[6] = 0.5 * sU;
-                luminanceOffsets[7] = -0.5 * sV;
-            };
-
-            var luminanceUpdateDestOffsets = (width: number, height: number) => {
-                var id = 0;
-                for (var x = -1; x < 2; x++) {
-                    for (var y = -1; y < 2; y++) {
-                        downSampleOffsets[id] = (x) / width;
-                        downSampleOffsets[id + 1] = (y) / height;
-                        id += 2;
-                    }
-                }
-            };
-
-            // Luminance callback
-            var luminanceCallback = (effect: Effect) => {
-                if (this._needUpdate) {
-                    luminanceUpdateSourceOffsets(this._textureAdderPostProcess.width, this._textureAdderPostProcess.height);
-                }
-
-                effect.setTextureFromPostProcess("textureSampler", this._textureAdderPostProcess);
-                effect.setArray2("lumOffsets", luminanceOffsets);
-            }
-
-            // Down sample callbacks
-            var downSampleCallback = (indice: number) => {
-                var i = indice;
-                return (effect: Effect) => {
-                    luminanceUpdateSourceOffsets(this._downSamplePostProcesses[i].width, this._downSamplePostProcesses[i].height);
-                    luminanceUpdateDestOffsets(this._downSamplePostProcesses[i].width, this._downSamplePostProcesses[i].height);
-                    halfDestPixelSize = 0.5 / this._downSamplePostProcesses[i].width;
-
-                    effect.setTextureFromPostProcess("textureSampler", this._downSamplePostProcesses[i + 1]);
-                    effect.setFloat("halfDestPixelSize", halfDestPixelSize);
-                    effect.setArray2("dsOffsets", downSampleOffsets);
-                }
-            };
-
-            var downSampleAfterRenderCallback = (effect: Effect) => {
-                // Unpack result
-                var pixel = scene.getEngine().readPixels(0, 0, 1, 1);
-                var bit_shift = new Vector4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);
-                this._hdrCurrentLuminance = (pixel[0] * bit_shift.x + pixel[1] * bit_shift.y + pixel[2] * bit_shift.z + pixel[3] * bit_shift.w) / 100.0;
-            };
-
-            // Create luminance post-process
-            var ratio = { width: Math.pow(3, lumSteps - 1), height: Math.pow(3, lumSteps - 1) };
-            this._downSamplePostProcesses[lumSteps - 1] = new PostProcess("hdr", "hdr", ["lumOffsets"], [], ratio, null, Texture.NEAREST_SAMPLINGMODE, scene.getEngine(), false, "#define LUMINANCE_GENERATOR", Engine.TEXTURETYPE_FLOAT);
-            this._downSamplePostProcesses[lumSteps - 1].onApply = luminanceCallback;
-
-            // Create down sample post-processes
-            for (var i = lumSteps - 2; i >= 0; i--) {
-                var length = Math.pow(3, i);
-                ratio = { width: length, height: length };
-
-                var defines = "#define DOWN_SAMPLE\n";
-                if (i === 0) {
-                    defines += "#define FINAL_DOWN_SAMPLE\n"; // To pack the result
-                }
-
-                this._downSamplePostProcesses[i] = new PostProcess("hdr", "hdr", ["dsOffsets", "halfDestPixelSize"], [], ratio, null, Texture.NEAREST_SAMPLINGMODE, scene.getEngine(), false, defines, Engine.TEXTURETYPE_FLOAT);
-                this._downSamplePostProcesses[i].onApply = downSampleCallback(i);
-
-                if (i === 0) {
-                    this._downSamplePostProcesses[i].onAfterRender = downSampleAfterRenderCallback;
-                }
-            }
-        }
-
-        /**
-        * Gaussian blur post-processes. Horizontal and Vertical
-        */
-        private _createGaussianBlurPostProcess(scene: Scene, ratio: number): void {
-            var blurOffsetsW = new Array<number>(9);
-            var blurOffsetsH = new Array<number>(9);
-            var blurWeights = new Array<number>(9);
-            var uniforms: string[] = ["blurOffsets", "blurWeights", "multiplier"];
-
-            // Utils for gaussian blur
-            var calculateBlurOffsets = (height: boolean) => {
-                var lastOutputDimensions: any = {
-                    width: scene.getEngine().getRenderWidth(),
-                    height: scene.getEngine().getRenderHeight()
-                };
-
-                for (var i = 0; i < 9; i++) {
-                    var value = (i - 4.0) * (1.0 / (height === true ? lastOutputDimensions.height : lastOutputDimensions.width));
-                    if (height) {
-                        blurOffsetsH[i] = value;
-                    } else {
-                        blurOffsetsW[i] = value;
-                    }
-                }
-            };
-
-            var calculateWeights = () => {
-                var x: number = 0.0;
-
-                for (var i = 0; i < 9; i++) {
-                    x = (i - 4.0) / 4.0;
-                    blurWeights[i] = this.gaussCoeff * (1.0 / Math.sqrt(2.0 * Math.PI * this.gaussStandDev)) * Math.exp((-((x - this.gaussMean) * (x - this.gaussMean))) / (2.0 * this.gaussStandDev * this.gaussStandDev));
-                }
-            }
-
-            // Callback
-            var gaussianBlurCallback = (height: boolean) => {
-                return (effect: Effect) => {
-                    if (this._needUpdate) {
-                        calculateWeights();
-                        calculateBlurOffsets(height);
-                    }
-                    effect.setArray("blurOffsets", height ? blurOffsetsH : blurOffsetsW);
-                    effect.setArray("blurWeights", blurWeights);
-                    effect.setFloat("multiplier", this.gaussMultiplier);
-                };
-            };
-
-            // Create horizontal gaussian blur post-processes
-            this._guassianBlurHPostProcess = new PostProcess("hdr", "hdr", uniforms, [], ratio / 4, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define GAUSSIAN_BLUR_H");
-            this._guassianBlurHPostProcess.onApply = gaussianBlurCallback(false);
-
-            // Create vertical gaussian blur post-process
-            this._guassianBlurVPostProcess = new PostProcess("hdr", "hdr", uniforms, [], ratio / 4, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define GAUSSIAN_BLUR_V");
-            this._guassianBlurVPostProcess.onApply = gaussianBlurCallback(true);
-        }
-    }
-}

+ 1 - 1
src/PostProcess/babylon.imageProcessingPostProcess.ts

@@ -76,7 +76,7 @@
                 ColorCurves.Bind(this.colorCurves, effect);
 
                 // Vignette
-                let vignetteScaleY = this.getCamera().fov * 0.5 ;
+                let vignetteScaleY = Math.tan(this.getCamera().fov * 0.5);
                 let vignetteScaleX = vignetteScaleY * aspectRatio;
 
                 let vignetteScaleGeometricMean = Math.sqrt(vignetteScaleX * vignetteScaleY);

+ 1 - 1
src/PostProcess/babylon.postProcess.ts

@@ -195,7 +195,7 @@
                 var desiredWidth = (<PostProcessOptions>this._options).width || requiredWidth;
                 var desiredHeight = (<PostProcessOptions>this._options).height || requiredHeight;
 
-                if (this.renderTargetSamplingMode !== Texture.NEAREST_SAMPLINGMODE) {
+                if (this.renderTargetSamplingMode === Texture.TRILINEAR_SAMPLINGMODE) {
                     if (!(<PostProcessOptions>this._options).width) {
                         desiredWidth = Tools.GetExponentOfTwo(desiredWidth, maxSize);
                     }

+ 0 - 163
src/Shaders/hdr.fragment.fx

@@ -1,163 +0,0 @@
-uniform sampler2D textureSampler;
-varying vec2 vUV;
-
-#if defined(GAUSSIAN_BLUR_H) || defined(GAUSSIAN_BLUR_V)
-uniform float blurOffsets[9];
-uniform float blurWeights[9];
-uniform float multiplier;
-
-void main(void) {
-	vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
-
-	for (int i = 0; i < 9; i++) {
-		#ifdef GAUSSIAN_BLUR_H
-		color += (texture2D(textureSampler, vUV + vec2(blurOffsets[i] * multiplier, 0.0)) * blurWeights[i]);
-		#else
-		color += (texture2D(textureSampler, vUV + vec2(0.0, blurOffsets[i] * multiplier)) * blurWeights[i]);
-		#endif
-	}
-
-	color.a = 1.0;
-	gl_FragColor = color;
-}
-#endif
-
-#if defined(TEXTURE_ADDER)
-uniform sampler2D otherSampler;
-
-void main() {
-	vec4 sum = texture2D(textureSampler, vUV) + texture2D(otherSampler, vUV);
-	sum.a = clamp(sum.a, 0.0, 1.0);
-
-	gl_FragColor = sum;
-}
-#endif
-
-#if defined(LUMINANCE_GENERATOR)
-uniform vec2 lumOffsets[4];
-
-void main() {
-	float average = 0.0;
-	vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
-	float maximum = -1e20;
-
-	for (int i = 0; i < 4; i++) {
-		color = texture2D(textureSampler, vUV + lumOffsets[i]);
-
-		float GreyValue = length(color.rgb);
-
-		maximum = max(maximum, GreyValue);
-		average += (0.25 * log(1e-5 + GreyValue));
-	}
-
-	average = exp(average);
-
-	gl_FragColor = vec4(average, maximum, 0.0, 1.0);
-
-}
-#endif
-
-#if defined(DOWN_SAMPLE)
-uniform vec2 dsOffsets[9];
-uniform float halfDestPixelSize;
-
-#ifdef FINAL_DOWN_SAMPLE
-vec4 pack(float value) {
-	const vec4 bit_shift = vec4(255.0 * 255.0 * 255.0, 255.0 * 255.0, 255.0, 1.0);
-	const vec4 bit_mask = vec4(0.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);
-
-	vec4 res = fract(value * bit_shift);
-	res -= res.xxyz * bit_mask;
-
-	return res;
-}
-#endif
-
-void main() {
-	vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
-	float average = 0.0;
-
-	for (int i = 0; i < 9; i++) {
-		color = texture2D(textureSampler, vUV + vec2(halfDestPixelSize, halfDestPixelSize) + dsOffsets[i]);
-		average += color.r;
-	}
-
-	average /= 9.0;
-
-	#ifndef FINAL_DOWN_SAMPLE
-	gl_FragColor = vec4(average, average, 0.0, 1.0);
-	#else
-	gl_FragColor = pack(average);
-	#endif
-}
-#endif
-
-#if defined(BRIGHT_PASS)
-uniform vec2 dsOffsets[4];
-uniform float brightThreshold;
-
-void main() {
-	vec4 average = vec4(0.0, 0.0, 0.0, 0.0);
-
-	average = texture2D(textureSampler, vUV + vec2(dsOffsets[0].x, dsOffsets[0].y));
-	average += texture2D(textureSampler, vUV + vec2(dsOffsets[1].x, dsOffsets[1].y));
-	average += texture2D(textureSampler, vUV + vec2(dsOffsets[2].x, dsOffsets[2].y));
-	average += texture2D(textureSampler, vUV + vec2(dsOffsets[3].x, dsOffsets[3].y));
-
-	average *= 0.25;
-
-	float luminance = length(average.rgb);
-
-	if (luminance < brightThreshold) {
-		average = vec4(0.0, 0.0, 0.0, 1.0);
-	}
-
-	gl_FragColor = average;
-}
-#endif
-
-#if defined(DOWN_SAMPLE_X4)
-uniform vec2 dsOffsets[16];
-
-void main() {
-	vec4 average = vec4(0.0, 0.0, 0.0, 0.0);
-
-	average = texture2D(textureSampler, vUV + dsOffsets[0]);
-	average += texture2D(textureSampler, vUV + dsOffsets[1]);
-	average += texture2D(textureSampler, vUV + dsOffsets[2]);
-	average += texture2D(textureSampler, vUV + dsOffsets[3]);
-	average += texture2D(textureSampler, vUV + dsOffsets[4]);
-	average += texture2D(textureSampler, vUV + dsOffsets[5]);
-	average += texture2D(textureSampler, vUV + dsOffsets[6]);
-	average += texture2D(textureSampler, vUV + dsOffsets[7]);
-	average += texture2D(textureSampler, vUV + dsOffsets[8]);
-	average += texture2D(textureSampler, vUV + dsOffsets[9]);
-	average += texture2D(textureSampler, vUV + dsOffsets[10]);
-	average += texture2D(textureSampler, vUV + dsOffsets[11]);
-	average += texture2D(textureSampler, vUV + dsOffsets[12]);
-	average += texture2D(textureSampler, vUV + dsOffsets[13]);
-	average += texture2D(textureSampler, vUV + dsOffsets[14]);
-	average += texture2D(textureSampler, vUV + dsOffsets[15]);
-
-	average /= 16.0;
-
-	gl_FragColor = average;
-}
-#endif
-
-#if defined(HDR)
-uniform sampler2D otherSampler;
-
-uniform float exposure;
-uniform float avgLuminance;
-
-void main() {
-	vec4 color = texture2D(textureSampler, vUV) + texture2D(otherSampler, vUV);
-	vec4 adjustedColor = color / avgLuminance * exposure;
-
-	color = adjustedColor;
-	color.a = 1.0;
-
-	gl_FragColor = color;
-}
-#endif

+ 9 - 5
src/babylon.engine.ts

@@ -2266,17 +2266,21 @@
         }
 
         // Textures
-        public wipeCaches(): void {
+        public wipeCaches(bruteForce?: boolean): void {
             if (this.preventCacheWipeBetweenFrames) {
                 return;
             }
             this.resetTextureCache();
             this._currentEffect = null;
 
-            this._stencilState.reset();
-            this._depthCullingState.reset();
-            this.setDepthFunctionToLessOrEqual();
-            this._alphaState.reset();
+            // 6/8/2017: deltakosh: Should not be required anymore. 
+            // This message is then mostly for the future myself which will scream out loud when seeing that actually it was required :)
+            if (bruteForce) {
+                this._stencilState.reset();
+                this._depthCullingState.reset();
+                this.setDepthFunctionToLessOrEqual();
+                this._alphaState.reset();
+            }
 
             this._cachedVertexBuffers = null;
             this._cachedIndexBuffer = null;