瀏覽代碼

Merge remote-tracking branch 'upstream/master' into fontCharAlignBug

nockawa 8 年之前
父節點
當前提交
5fb830dd94
共有 30 個文件被更改,包括 11992 次插入10745 次删除
  1. 1684 545
      Exporters/3ds Max/ActionsBuilder/Sources/babylon.max.js
  2. 二進制
      Exporters/3ds Max/Max2Babylon-0.7.0.zip
  3. 1 1
      Exporters/3ds Max/Max2Babylon/2017/Max2Babylon2017.csproj
  4. 1 2
      Exporters/3ds Max/Max2Babylon/Forms/CameraPropertiesForm.Designer.cs
  5. 1 2
      Exporters/3ds Max/Max2Babylon/Forms/LightPropertiesForm.Designer.cs
  6. 1 3
      Exporters/3ds Max/Max2Babylon/Forms/ObjectPropertiesForm.Designer.cs
  7. 二進制
      Playground/textures/babylonjs.mp4
  8. 二進制
      Playground/textures/babylonjs.webm
  9. 二進制
      assets/textures/babylonjs.mp4
  10. 二進制
      assets/textures/babylonjs.webm
  11. 21 21
      dist/preview release/babylon.core.js
  12. 5065 5050
      dist/preview release/babylon.d.ts
  13. 24 24
      dist/preview release/babylon.js
  14. 40 4
      dist/preview release/babylon.max.js
  15. 5065 5050
      dist/preview release/babylon.module.d.ts
  16. 31 31
      dist/preview release/babylon.noworker.js
  17. 1 0
      dist/preview release/what's new.md
  18. 9 2
      src/Lights/Shadows/babylon.shadowGenerator.ts
  19. 7 0
      src/Lights/babylon.directionalLight.ts
  20. 1 1
      src/Lights/babylon.light.ts
  21. 7 0
      src/Lights/babylon.pointLight.ts
  22. 7 0
      src/Lights/babylon.spotLight.ts
  23. 1 0
      src/Materials/Textures/babylon.texture.ts
  24. 9 1
      src/Materials/babylon.pbrMaterial.ts
  25. 4 0
      src/Materials/babylon.standardMaterial.ts
  26. 6 2
      src/Shaders/ShadersInclude/reflectionFunction.fx
  27. 1 1
      src/Shaders/default.fragment.fx
  28. 2 2
      src/Shaders/default.vertex.fx
  29. 1 1
      src/Shaders/pbr.fragment.fx
  30. 2 2
      src/Shaders/pbr.vertex.fx

File diff suppressed because it is too large
+ 1684 - 545
Exporters/3ds Max/ActionsBuilder/Sources/babylon.max.js


二進制
Exporters/3ds Max/Max2Babylon-0.7.0.zip


+ 1 - 1
Exporters/3ds Max/Max2Babylon/2017/Max2Babylon2017.csproj

@@ -23,7 +23,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>C:\Program Files\Autodesk\3ds Max 2017\bin\assemblies\</OutputPath>
+    <OutputPath>c:\Program Files\Autodesk\3ds Max 2017\bin\assemblies\</OutputPath>
     <DefineConstants>TRACE;DEBUG;MAX2017</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>

+ 1 - 2
Exporters/3ds Max/Max2Babylon/Forms/CameraPropertiesForm.Designer.cs

@@ -310,7 +310,7 @@
             // label6
             // 
             this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(16, 58);
+            this.label6.Location = new System.Drawing.Point(16, 57);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(34, 13);
             this.label6.TabIndex = 6;
@@ -319,7 +319,6 @@
             // cbCameraType
             // 
             this.cbCameraType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.cbCameraType.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.cbCameraType.FormattingEnabled = true;
             this.cbCameraType.Items.AddRange(new object[] {
             "AnaglyphArcRotateCamera",

+ 1 - 2
Exporters/3ds Max/Max2Babylon/Forms/LightPropertiesForm.Designer.cs

@@ -324,7 +324,7 @@
             // label6
             // 
             this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(18, 92);
+            this.label6.Location = new System.Drawing.Point(18, 91);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(34, 13);
             this.label6.TabIndex = 8;
@@ -342,7 +342,6 @@
             // cbCameraType
             // 
             this.cbCameraType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.cbCameraType.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.cbCameraType.FormattingEnabled = true;
             this.cbCameraType.Items.AddRange(new object[] {
             "Hard shadows",

+ 1 - 3
Exporters/3ds Max/Max2Babylon/Forms/ObjectPropertiesForm.Designer.cs

@@ -412,7 +412,7 @@
             // label6
             // 
             this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(18, 27);
+            this.label6.Location = new System.Drawing.Point(18, 26);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(50, 13);
             this.label6.TabIndex = 8;
@@ -421,7 +421,6 @@
             // cbImpostor
             // 
             this.cbImpostor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.cbImpostor.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.cbImpostor.FormattingEnabled = true;
             this.cbImpostor.Items.AddRange(new object[] {
             "None",
@@ -681,7 +680,6 @@
             // cbDistanceModel
             // 
             this.cbDistanceModel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.cbDistanceModel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.cbDistanceModel.FormattingEnabled = true;
             this.cbDistanceModel.Items.AddRange(new object[] {
             "linear",

二進制
Playground/textures/babylonjs.mp4


二進制
Playground/textures/babylonjs.webm


二進制
assets/textures/babylonjs.mp4


二進制
assets/textures/babylonjs.webm


File diff suppressed because it is too large
+ 21 - 21
dist/preview release/babylon.core.js


File diff suppressed because it is too large
+ 5065 - 5050
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 24 - 24
dist/preview release/babylon.js


File diff suppressed because it is too large
+ 40 - 4
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 5065 - 5050
dist/preview release/babylon.module.d.ts


File diff suppressed because it is too large
+ 31 - 31
dist/preview release/babylon.noworker.js


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

@@ -17,6 +17,7 @@
  - All deprecated functions and properties were removed ([deltakosh](https://github.com/deltakosh))
 
 ### Updates
+- Added `FIXED_EQUIRECTANGULAR_MIRRORED_MODE` mode for reflection texture. [Demo here](http://www.babylonjs-playground.com/#11GAIH#22) ([deltakosh](https://github.com/deltakosh))
 - Introduced `boundingBox.centerWorld` and `boundingBox.extendSizeWorld` ([deltakosh](https://github.com/deltakosh))
 - Improved FXAA post-process ([deltakosh](https://github.com/deltakosh))
 - Added `Light.customProjectionMatrixBuilder` to allow developers to define their own projection matrix for shadows ([deltakosh](https://github.com/deltakosh))

+ 9 - 2
src/Lights/Shadows/babylon.shadowGenerator.ts

@@ -34,7 +34,7 @@
         private _blurBoxOffset = 0;
         private _bias = 0.00005;
         private _lightDirection = Vector3.Zero();
-        private _depthScale = 30.0;
+        private _depthScale: number;
 
         public forceBackFacesOnly = false;
 
@@ -77,7 +77,7 @@
         }
 
         public get depthScale(): number {
-            return this._depthScale;
+            return this._depthScale !== undefined ? this._depthScale : this._light.getDepthScale();
         }
 
         public set depthScale(value: number) {
@@ -559,6 +559,13 @@
             }
             else if (parsedShadowGenerator.useBlurExponentialShadowMap) {
                 shadowGenerator.useBlurExponentialShadowMap = true;
+            }            
+            // Backward compat
+            else if (parsedShadowGenerator.useVarianceShadowMap) {
+                shadowGenerator.useExponentialShadowMap = true;
+            }
+            else if (parsedShadowGenerator.useBlurVarianceShadowMap) {
+                shadowGenerator.useBlurExponentialShadowMap = true;
             }
 
             if (parsedShadowGenerator.blurScale) {

+ 7 - 0
src/Lights/babylon.directionalLight.ts

@@ -64,6 +64,13 @@ module BABYLON {
         }
 
         /**
+         * Return the depth scale used for the shadow map.
+         */
+        public getDepthScale(): number {
+            return 30.0;
+        }
+
+        /**
          * Sets the passed matrix "matrix" as projection matrix for the shadows cast by the light according to the passed view matrix.  
          * Returns the DirectionalLight.  
          */

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

@@ -13,7 +13,7 @@
 
         customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
         setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
-        
+        getDepthScale(): number;
 
         needRefreshPerFrame(): boolean;
         needCube(): boolean;

+ 7 - 0
src/Lights/babylon.pointLight.ts

@@ -109,6 +109,13 @@
 
             return Vector3.Zero();
         }
+        
+        /**
+         * Return the depth scale used for the shadow map.
+         */
+        public getDepthScale(): number {
+            return 30.0;
+        }
 
         /**
          * Sets the passed matrix "matrix" as a left-handed perspective projection matrix with the following settings : 

+ 7 - 0
src/Lights/babylon.spotLight.ts

@@ -56,6 +56,13 @@
         }
 
         /**
+         * Return the depth scale used for the shadow map.
+         */
+        public getDepthScale(): number {
+            return 30.0;
+        }
+        
+        /**
          * Sets the passed matrix "matrix" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.  
          * Returns the SpotLight.  
          */

+ 1 - 0
src/Materials/Textures/babylon.texture.ts

@@ -14,6 +14,7 @@
         public static INVCUBIC_MODE = 6;
         public static EQUIRECTANGULAR_MODE = 7;
         public static FIXED_EQUIRECTANGULAR_MODE = 8;
+        public static FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;
 
         public static CLAMP_ADDRESSMODE = 0;
         public static WRAP_ADDRESSMODE = 1;

+ 9 - 1
src/Materials/babylon.pbrMaterial.ts

@@ -42,7 +42,9 @@
         public REFLECTIONMAP_PROJECTION = false;
         public REFLECTIONMAP_SKYBOX = false;
         public REFLECTIONMAP_EXPLICIT = false;
-        public REFLECTIONMAP_EQUIRECTANGULAR = false;
+        public REFLECTIONMAP_EQUIRECTANGULAR = false;        
+        public REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;
+        public REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;
         public INVERTCUBICMAP = false;
         public LOGARITHMICDEPTH = false;
         public CAMERATONEMAP = false;
@@ -739,6 +741,12 @@
                             case Texture.EQUIRECTANGULAR_MODE:
                                 this._defines.REFLECTIONMAP_EQUIRECTANGULAR = true;
                                 break;
+                            case Texture.FIXED_EQUIRECTANGULAR_MODE:
+                                this._defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;
+                                break;
+                            case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:
+                                this._defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;
+                                break;                                
                         }
 
                         if (this.reflectionTexture instanceof HDRCubeTexture && (<HDRCubeTexture>this.reflectionTexture)) {

+ 4 - 0
src/Materials/babylon.standardMaterial.ts

@@ -47,6 +47,7 @@ module BABYLON {
         public REFLECTIONMAP_EXPLICIT = false;
         public REFLECTIONMAP_EQUIRECTANGULAR = false;
         public REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;
+        public REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;
         public INVERTCUBICMAP = false;
         public LOGARITHMICDEPTH = false;
         public REFRACTION = false;
@@ -388,6 +389,9 @@ module BABYLON {
                             case Texture.FIXED_EQUIRECTANGULAR_MODE:
                                 this._defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;
                                 break;
+                            case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:
+                                this._defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;
+                                break;
                         }
                     }
                 }

+ 6 - 2
src/Shaders/ShadersInclude/reflectionFunction.fx

@@ -1,12 +1,16 @@
 vec3 computeReflectionCoords(vec4 worldPos, vec3 worldNormal)
 {
-#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
 	vec3 direction = normalize(vDirectionW);
 
 	float t = clamp(direction.y * -0.5 + 0.5, 0., 1.0);
 	float s = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;
 
-	return vec3(s, t, 0);
+ 	#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED
+		return vec3(1.0 - s, t, 0);
+	#else
+		return vec3(s, t, 0);
+	#endif
 #endif
 
 #ifdef REFLECTIONMAP_EQUIRECTANGULAR

+ 1 - 1
src/Shaders/default.fragment.fx

@@ -124,7 +124,7 @@ uniform sampler2D reflection2DSampler;
 #ifdef REFLECTIONMAP_SKYBOX
 varying vec3 vPositionUVW;
 #else
-#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
 varying vec3 vDirectionW;
 #endif
 

+ 2 - 2
src/Shaders/default.vertex.fx

@@ -89,7 +89,7 @@ varying vec4 vColor;
 varying vec3 vPositionUVW;
 #endif
 
-#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
 varying vec3 vDirectionW;
 #endif
 
@@ -112,7 +112,7 @@ void main(void) {
 	vNormalW = normalize(vec3(finalWorld * vec4(normal, 0.0)));
 #endif
 
-#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
 	vDirectionW = normalize(vec3(finalWorld * vec4(position, 0.0)));
 #endif
 

+ 1 - 1
src/Shaders/pbr.fragment.fx

@@ -135,7 +135,7 @@ uniform sampler2D reflection2DSampler;
 #ifdef REFLECTIONMAP_SKYBOX
 varying vec3 vPositionUVW;
 #else
-#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
 varying vec3 vDirectionW;
 #endif
 

+ 2 - 2
src/Shaders/pbr.vertex.fx

@@ -92,7 +92,7 @@ varying vec4 vColor;
 varying vec3 vPositionUVW;
 #endif
 
-#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
 varying vec3 vDirectionW;
 #endif
 
@@ -115,7 +115,7 @@ void main(void) {
     vNormalW = normalize(vec3(finalWorld * vec4(normal, 0.0)));
 #endif
 
-#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED
+#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
     vDirectionW = normalize(vec3(finalWorld * vec4(position, 0.0)));
 #endif