Bladeren bron

fixed ray issue
fixed spotlight issue
Fixed instance issues with incremental data

David Catuhe 8 jaren geleden
bovenliggende
commit
2aeee775a9

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


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


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


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


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


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


+ 11 - 15
dist/preview release/what's new.md

@@ -1,5 +1,7 @@
 # 2.6.0:
 # 2.6.0:
 
 
+## Core engine
+
 ### Major updates
 ### Major updates
  - WebGL2 context support.WebGL2 is initialized instead of WebGL 1 when available ([deltakosh](https://github.com/deltakosh))
  - WebGL2 context support.WebGL2 is initialized instead of WebGL 1 when available ([deltakosh](https://github.com/deltakosh))
  - Support for [Vertex Array Objects](https://www.opengl.org/registry/specs/ARB/vertex_array_object.txt) ([deltakosh](https://github.com/deltakosh))
  - Support for [Vertex Array Objects](https://www.opengl.org/registry/specs/ARB/vertex_array_object.txt) ([deltakosh](https://github.com/deltakosh))
@@ -25,30 +27,24 @@
 - Added `AbstractMesh.addRotation()` ([jerome](https://github.com/jbousquie))  
 - Added `AbstractMesh.addRotation()` ([jerome](https://github.com/jbousquie))  
 - Added the optional parameter`colorFilter` to `CreateGroundFromHeightMap()` ([jerome](https://github.com/jbousquie))  
 - Added the optional parameter`colorFilter` to `CreateGroundFromHeightMap()` ([jerome](https://github.com/jbousquie))  
  
  
-### Canvas2D
+### Bug fixes
+- Fixed a bug with spotlight direction ([deltakosh](https://github.com/deltakosh)) 
+- Fixed an issue with Mesh.attachToBone when a mesh is moving and an animation is changed ([abow](https://github.com/abow))
+- Fixed an issue withaspect ratio when using CreateScreenshot ([deltakosh](https://github.com/deltakosh))
 
 
-#### Major Updates
+## Canvas2D
+
+### Major Updates
  - Added text alignment and word wrap to Text2D ([abow](https://github.com/abow))
  - Added text alignment and word wrap to Text2D ([abow](https://github.com/abow))
  - Support of [Scale9Sprite](http://doc.babylonjs.com/overviews/Canvas2D_Sprite2D#scale9sprite-feature) feature in Sprite2D ([nockawa](https://github.com/nockawa))
  - Support of [Scale9Sprite](http://doc.babylonjs.com/overviews/Canvas2D_Sprite2D#scale9sprite-feature) feature in Sprite2D ([nockawa](https://github.com/nockawa))
  - Support of [AtlasPicture](http://doc.babylonjs.com/overviews/Canvas2D_AtlasPicture) to store many pictures into a bit one, with the possibility to create one/many Sprite2D out of it. ([nockawa](https://github.com/nockawa))
  - Support of [AtlasPicture](http://doc.babylonjs.com/overviews/Canvas2D_AtlasPicture) to store many pictures into a bit one, with the possibility to create one/many Sprite2D out of it. ([nockawa](https://github.com/nockawa))
  - Support of BMFont with the BitmaptFontTexture class, Text2D has now a bitmapFontTexture setting in the constructor to display text using a BitmapFontTexture ([nockawa](https://github.com/nockawa))
  - Support of BMFont with the BitmaptFontTexture class, Text2D has now a bitmapFontTexture setting in the constructor to display text using a BitmapFontTexture ([nockawa](https://github.com/nockawa))
 
 
-#### Minor Updates
+### Minor Updates
  - WorldSpaceCanvas: TrackNode feature, a WSC can follow a Scene Node with an optional billboarding feature (always facing the camera)[Demo](http://babylonjs-playground.com/#1KYG17#1)
  - WorldSpaceCanvas: TrackNode feature, a WSC can follow a Scene Node with an optional billboarding feature (always facing the camera)[Demo](http://babylonjs-playground.com/#1KYG17#1)
  - WorldSpaceCanvas: new setting unitScaleFactor to generated a bigger canvas than the world space mesh size. If you create a WSC with a size of 200;100 and a uSF of 3, the 3D Plane displaying the canvas will be 200;100 of scene units, the WSC will be 600;300 of pixels units.
  - WorldSpaceCanvas: new setting unitScaleFactor to generated a bigger canvas than the world space mesh size. If you create a WSC with a size of 200;100 and a uSF of 3, the 3D Plane displaying the canvas will be 200;100 of scene units, the WSC will be 600;300 of pixels units.
 
 
-#### Bug Fixing
+### Bug Fixing
  - Fix Rotation issue when the Parent's Primitive hadn't a identity scale. ([nockawa](https://github.com/nockawa))
  - Fix Rotation issue when the Parent's Primitive hadn't a identity scale. ([nockawa](https://github.com/nockawa))
  - Primitive's position computed from TrackedNode are now hidden when the node is out of the Viewing Frustum ([nockawa](https://github.com/nockawa))
  - Primitive's position computed from TrackedNode are now hidden when the node is out of the Viewing Frustum ([nockawa](https://github.com/nockawa))
  - WorldSpaceCanvas: sideOrientation is finally working, you can try Mesh.DOUBLESIDE to make you Canvas visible on both sides. ([nockawa](https://github.com/nockawa))
  - WorldSpaceCanvas: sideOrientation is finally working, you can try Mesh.DOUBLESIDE to make you Canvas visible on both sides. ([nockawa](https://github.com/nockawa))
-
-
-### Exporters
-    
-### API doc
-
-### Bug fixes
- - Fixed an issue with Mesh.attachToBone when a mesh is moving and an animation is changed ([abow](https://github.com/abow))
- - Fixed an issue withaspect ratio when using CreateScreenshot ([deltakosh](https://github.com/deltakosh))
-
-### Breaking changes

+ 1 - 2
src/Culling/babylon.ray.ts

@@ -400,8 +400,7 @@
             Vector3.TransformCoordinatesToRef(ray.origin, matrix, result.origin);
             Vector3.TransformCoordinatesToRef(ray.origin, matrix, result.origin);
             Vector3.TransformNormalToRef(ray.direction, matrix, result.direction);
             Vector3.TransformNormalToRef(ray.direction, matrix, result.direction);
 
 
-            ray.direction.normalize();
-            
+            result.direction.normalize();            
         }
         }
     }
     }
 }
 }

+ 7 - 0
src/Mesh/babylon.mesh.ts

@@ -1226,8 +1226,15 @@
                     this._delayLoadingFunction(JSON.parse(data), this);
                     this._delayLoadingFunction(JSON.parse(data), this);
                 }
                 }
 
 
+                this.instances.forEach(instance =>
+                {
+                    instance._syncSubMeshes();
+                });
+
+
                 this.delayLoadState = Engine.DELAYLOADSTATE_LOADED;
                 this.delayLoadState = Engine.DELAYLOADSTATE_LOADED;
                 scene._removePendingData(this);
                 scene._removePendingData(this);
+
             }, () => { }, scene.database, getBinaryData);
             }, () => { }, scene.database, getBinaryData);
             return this;
             return this;
         }
         }

+ 3 - 3
src/Shaders/ShadersInclude/lightsFragmentFunctions.fx

@@ -47,7 +47,7 @@ lightingInfo computeSpotLighting(vec3 viewDirectionW, vec3 vNormal, vec4 lightDa
 	float attenuation = max(0., 1.0 - length(direction) / range);
 	float attenuation = max(0., 1.0 - length(direction) / range);
 
 
 	// diffuse
 	// diffuse
-	float cosAngle = max(0., dot(-lightDirection.xyz, lightVectorW));
+	float cosAngle = max(0., dot(lightDirection.xyz, -lightVectorW));
 
 
 	if (cosAngle >= lightDirection.w)
 	if (cosAngle >= lightDirection.w)
 	{
 	{
@@ -55,12 +55,12 @@ lightingInfo computeSpotLighting(vec3 viewDirectionW, vec3 vNormal, vec4 lightDa
 		attenuation *= cosAngle;
 		attenuation *= cosAngle;
 
 
 		// Diffuse
 		// Diffuse
-		float ndl = max(0., dot(vNormal, -lightDirection.xyz));
+		float ndl = max(0., dot(vNormal, direction.xyz));
 		result.diffuse = ndl * diffuseColor * attenuation;
 		result.diffuse = ndl * diffuseColor * attenuation;
 
 
 #ifdef SPECULARTERM
 #ifdef SPECULARTERM
 		// Specular
 		// Specular
-		vec3 angleW = normalize(viewDirectionW - lightDirection.xyz);
+		vec3 angleW = normalize(direction.xyz - viewDirectionW);
 		float specComp = max(0., dot(vNormal, angleW));
 		float specComp = max(0., dot(vNormal, angleW));
 		specComp = pow(specComp, max(1., glossiness));
 		specComp = pow(specComp, max(1., glossiness));