Explorar o código

fxaa takes now care of alpha

David Catuhe %!s(int64=11) %!d(string=hai) anos
pai
achega
69e4b5f18e

+ 1 - 2
Babylon/Mesh/babylon.groundMesh.js

@@ -22,9 +22,8 @@ var BABYLON;
         });
         });
 
 
         GroundMesh.prototype.optimize = function (chunksCount) {
         GroundMesh.prototype.optimize = function (chunksCount) {
-            if (typeof chunksCount === "undefined") { chunksCount = 32; }
             this.subdivide(this._subdivisions);
             this.subdivide(this._subdivisions);
-            this.createOrUpdateSubmeshesOctree(chunksCount);
+            this.createOrUpdateSubmeshesOctree(32);
         };
         };
 
 
         GroundMesh.prototype.getHeightAtCoordinates = function (x, z) {
         GroundMesh.prototype.getHeightAtCoordinates = function (x, z) {

+ 2 - 2
Babylon/Mesh/babylon.groundMesh.ts

@@ -13,9 +13,9 @@
             return this._subdivisions;
             return this._subdivisions;
         }
         }
 
 
-        public optimize(chunksCount: number = 32): void {
+        public optimize(chunksCount: number): void {
             this.subdivide(this._subdivisions);
             this.subdivide(this._subdivisions);
-            this.createOrUpdateSubmeshesOctree(chunksCount);
+            this.createOrUpdateSubmeshesOctree(32);
         }
         }
 
 
         public getHeightAtCoordinates(x: number, z: number): number {
         public getHeightAtCoordinates(x: number, z: number): number {

+ 4 - 3
Babylon/Shaders/fxaa.fragment.fx

@@ -16,7 +16,8 @@ void main(){
 	vec3 rgbNE = texture2D(textureSampler, (vUV + vec2(1.0, -1.0) * localTexelSize)).xyz;
 	vec3 rgbNE = texture2D(textureSampler, (vUV + vec2(1.0, -1.0) * localTexelSize)).xyz;
 	vec3 rgbSW = texture2D(textureSampler, (vUV + vec2(-1.0, 1.0) * localTexelSize)).xyz;
 	vec3 rgbSW = texture2D(textureSampler, (vUV + vec2(-1.0, 1.0) * localTexelSize)).xyz;
 	vec3 rgbSE = texture2D(textureSampler, (vUV + vec2(1.0, 1.0) * localTexelSize)).xyz;
 	vec3 rgbSE = texture2D(textureSampler, (vUV + vec2(1.0, 1.0) * localTexelSize)).xyz;
-	vec3 rgbM = texture2D(textureSampler, vUV ).xyz;
+	vec4 rgbaM = texture2D(textureSampler, vUV);
+	vec3 rgbM = rgbaM.xyz;
 	vec3 luma = vec3(0.299, 0.587, 0.114);
 	vec3 luma = vec3(0.299, 0.587, 0.114);
 	float lumaNW = dot(rgbNW, luma);
 	float lumaNW = dot(rgbNW, luma);
 	float lumaNE = dot(rgbNE, luma);
 	float lumaNE = dot(rgbNE, luma);
@@ -46,9 +47,9 @@ void main(){
 		texture2D(textureSampler, vUV + dir * 0.5).xyz);
 		texture2D(textureSampler, vUV + dir * 0.5).xyz);
 	float lumaB = dot(rgbB, luma);
 	float lumaB = dot(rgbB, luma);
 	if ((lumaB < lumaMin) || (lumaB > lumaMax)) {
 	if ((lumaB < lumaMin) || (lumaB > lumaMax)) {
-		gl_FragColor = vec4(rgbA, 1.0);
+		gl_FragColor = vec4(rgbA, rgbaM.a);
 	}
 	}
 	else {
 	else {
-		gl_FragColor = vec4(rgbB, 1.0);
+		gl_FragColor = vec4(rgbB, rgbaM.a);
 	}
 	}
 }
 }

+ 3 - 12
Babylon/babylon.scene.js

@@ -172,22 +172,14 @@
             return this._renderId;
             return this._renderId;
         };
         };
 
 
-        Scene.prototype._updatePointerPosition = function (evt) {
-            var canvas = this._engine.getRenderingCanvas();
-            var rect = canvas.getBoundingClientRect();
-
-            this._pointerX = evt.clientX - rect.left;
-            this._pointerY = evt.clientY - rect.top;
-        };
-
         // Pointers handling
         // Pointers handling
         Scene.prototype.attachControl = function () {
         Scene.prototype.attachControl = function () {
             var _this = this;
             var _this = this;
             this._onPointerMove = function (evt) {
             this._onPointerMove = function (evt) {
                 var canvas = _this._engine.getRenderingCanvas();
                 var canvas = _this._engine.getRenderingCanvas();
 
 
-                _this._updatePointerPosition(evt);
-
+                _this._pointerX = evt.offsetX || evt.layerX;
+                _this._pointerY = evt.offsetY || evt.layerY;
                 var pickResult = _this.pick(_this._pointerX, _this._pointerY, function (mesh) {
                 var pickResult = _this.pick(_this._pointerX, _this._pointerY, function (mesh) {
                     return mesh.actionManager && mesh.isPickable && mesh.isVisible && mesh.isReady();
                     return mesh.actionManager && mesh.isPickable && mesh.isVisible && mesh.isReady();
                 });
                 });
@@ -213,8 +205,7 @@
                     };
                     };
                 }
                 }
 
 
-                _this._updatePointerPosition(evt);
-                var pickResult = _this.pick(_this._pointerX, _this._pointerY, predicate);
+                var pickResult = _this.pick(evt.offsetX || evt.layerX, evt.offsetY || evt.layerY, predicate);
 
 
                 if (pickResult.hit) {
                 if (pickResult.hit) {
                     if (pickResult.pickedMesh.actionManager) {
                     if (pickResult.pickedMesh.actionManager) {

+ 4 - 12
Babylon/babylon.scene.ts

@@ -238,21 +238,13 @@
             return this._renderId;
             return this._renderId;
         }
         }
 
 
-        private _updatePointerPosition(evt: PointerEvent): void {
-            var canvas = this._engine.getRenderingCanvas();
-            var rect = canvas.getBoundingClientRect();
-
-            this._pointerX = evt.clientX - rect.left; 
-            this._pointerY = evt.clientY - rect.top;
-        }
-
         // Pointers handling
         // Pointers handling
         public attachControl() {
         public attachControl() {
             this._onPointerMove = (evt: PointerEvent) => {
             this._onPointerMove = (evt: PointerEvent) => {
                 var canvas = this._engine.getRenderingCanvas();
                 var canvas = this._engine.getRenderingCanvas();
 
 
-                this._updatePointerPosition(evt);
-
+                this._pointerX = evt.offsetX || evt.layerX;
+                this._pointerY = evt.offsetY || evt.layerY;
                 var pickResult = this.pick(this._pointerX, this._pointerY, (mesh: AbstractMesh): boolean => mesh.actionManager && mesh.isPickable && mesh.isVisible && mesh.isReady());
                 var pickResult = this.pick(this._pointerX, this._pointerY, (mesh: AbstractMesh): boolean => mesh.actionManager && mesh.isPickable && mesh.isVisible && mesh.isReady());
 
 
                 if (pickResult.hit) {
                 if (pickResult.hit) {
@@ -268,6 +260,7 @@
             };
             };
 
 
             this._onPointerDown = (evt: PointerEvent) => {
             this._onPointerDown = (evt: PointerEvent) => {
+
                 var predicate = null;
                 var predicate = null;
 
 
                 if (!this.onPointerDown) {
                 if (!this.onPointerDown) {
@@ -276,8 +269,7 @@
                     };
                     };
                 }
                 }
 
 
-                this._updatePointerPosition(evt);
-                var pickResult = this.pick(this._pointerX, this._pointerY, predicate);
+                var pickResult = this.pick(evt.offsetX || evt.layerX, evt.offsetY || evt.layerY, predicate);
 
 
                 if (pickResult.hit) {
                 if (pickResult.hit) {
                     if (pickResult.pickedMesh.actionManager) {
                     if (pickResult.pickedMesh.actionManager) {

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2 - 2
babylon.1.13-beta-debug.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 4 - 4
babylon.1.13-beta.js