David Catuhe 9 年之前
父節點
當前提交
9c5c372aec

文件差異過大導致無法顯示
+ 26 - 34
dist/preview release/babylon.core.js


文件差異過大導致無法顯示
+ 6100 - 6093
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 42 - 53
dist/preview release/babylon.js


文件差異過大導致無法顯示
+ 2453 - 2421
dist/preview release/babylon.max.js


文件差異過大導致無法顯示
+ 42 - 53
dist/preview release/babylon.noworker.js


+ 4 - 4
src/Cameras/VR/babylon.vrDeviceOrientationCamera.js

@@ -22,12 +22,12 @@ var BABYLON;
     BABYLON.VRDeviceOrientationFreeCamera = VRDeviceOrientationFreeCamera;
     var VRDeviceOrientationArcRotateCamera = (function (_super) {
         __extends(VRDeviceOrientationArcRotateCamera, _super);
-        function VRDeviceOrientationArcRotateCamera(name, alpha, beta, radius, target, scene, compensateDistortion) {
+        function VRDeviceOrientationArcRotateCamera(name, alpha, beta, radius, target, scene, compensateDistortion, vrCameraMetrics) {
             if (compensateDistortion === void 0) { compensateDistortion = true; }
+            if (vrCameraMetrics === void 0) { vrCameraMetrics = BABYLON.VRCameraMetrics.GetDefault(); }
             _super.call(this, name, alpha, beta, radius, target, scene);
-            var metrics = BABYLON.VRCameraMetrics.GetDefault();
-            metrics.compensateDistortion = compensateDistortion;
-            this.setCameraRigMode(BABYLON.Camera.RIG_MODE_VR, { vrCameraMetrics: metrics });
+            vrCameraMetrics.compensateDistortion = compensateDistortion;
+            this.setCameraRigMode(BABYLON.Camera.RIG_MODE_VR, { vrCameraMetrics: vrCameraMetrics });
             this.inputs.addVRDeviceOrientation();
         }
         VRDeviceOrientationArcRotateCamera.prototype.getTypeName = function () {

+ 8 - 2
src/Cameras/babylon.targetCamera.js

@@ -228,8 +228,14 @@ var BABYLON;
                     break;
                 case BABYLON.Camera.RIG_MODE_VR:
                 case BABYLON.Camera.RIG_MODE_WEBVR:
-                    camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);
-                    camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);
+                    if (camLeft.rotationQuaternion) {
+                        camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);
+                        camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);
+                    }
+                    else {
+                        camLeft.rotation.copyFrom(this.rotation);
+                        camRight.rotation.copyFrom(this.rotation);
+                    }
                     camLeft.position.copyFrom(this.position);
                     camRight.position.copyFrom(this.position);
                     break;

+ 2 - 0
src/Canvas2d/babylon.prim2dBase.js

@@ -2501,6 +2501,8 @@ var BABYLON;
             for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                 var child = _a[_i];
                 child._setFlags(BABYLON.SmartPropertyPrim.flagActualOpacityDirty);
+                child._updateRenderMode();
+                child.onPrimBecomesDirty();
                 child._spreadActualOpacityChanged();
             }
         };

+ 1 - 1
src/Canvas2d/babylon.renderablePrim2d.js

@@ -339,7 +339,7 @@ var BABYLON;
         });
         Object.defineProperty(RenderablePrim2D.prototype, "isTransparent", {
             get: function () {
-                return (this._opacity < 1) || this._shouldUseAlphaFromTexture() || this._isPrimTransparent();
+                return (this.actualOpacity < 1) || this._shouldUseAlphaFromTexture() || this._isPrimTransparent();
             },
             enumerable: true,
             configurable: true

+ 35 - 14
src/Mesh/babylon.groundMesh.js

@@ -14,15 +14,30 @@ var BABYLON;
         }
         Object.defineProperty(GroundMesh.prototype, "subdivisions", {
             get: function () {
-                return this._subdivisions;
+                return Math.min(this._subdivisionsX, this._subdivisionsY);
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(GroundMesh.prototype, "subdivisionsX", {
+            get: function () {
+                return this._subdivisionsX;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(GroundMesh.prototype, "subdivisionsY", {
+            get: function () {
+                return this._subdivisionsY;
             },
             enumerable: true,
             configurable: true
         });
         GroundMesh.prototype.optimize = function (chunksCount, octreeBlocksSize) {
             if (octreeBlocksSize === void 0) { octreeBlocksSize = 32; }
-            this._subdivisions = chunksCount;
-            this.subdivide(this._subdivisions);
+            this._subdivisionsX = chunksCount;
+            this._subdivisionsY = chunksCount;
+            this.subdivide(chunksCount);
             this.createOrUpdateSubmeshesOctree(octreeBlocksSize);
         };
         /**
@@ -98,9 +113,11 @@ var BABYLON;
         // Returns the element "facet" from the heightQuads array relative to (x, z) local coordinates
         GroundMesh.prototype._getFacetAt = function (x, z) {
             // retrieve col and row from x, z coordinates in the ground local system
-            var col = Math.floor((x + this._maxX) * this._subdivisions / this._width);
-            var row = Math.floor(-(z + this._maxZ) * this._subdivisions / this._height + this._subdivisions);
-            var quad = this._heightQuads[row * this._subdivisions + col];
+            var subdivisionsX = this._subdivisionsX;
+            var subdivisionsY = this._subdivisionsY;
+            var col = Math.floor((x + this._maxX) * this._subdivisionsX / this._width);
+            var row = Math.floor(-(z + this._maxZ) * this._subdivisionsY / this._height + this._subdivisionsY);
+            var quad = this._heightQuads[row * this._subdivisionsX + col];
             var facet;
             if (z < quad.slope.x * x + quad.slope.y) {
                 facet = quad.facet1;
@@ -116,11 +133,13 @@ var BABYLON;
         // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0
         // facet2 :  Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0
         GroundMesh.prototype._initHeightQuads = function () {
+            var subdivisionsX = this._subdivisionsX;
+            var subdivisionsY = this._subdivisionsY;
             this._heightQuads = new Array();
-            for (var row = 0; row < this._subdivisions; row++) {
-                for (var col = 0; col < this._subdivisions; col++) {
+            for (var row = 0; row < subdivisionsY; row++) {
+                for (var col = 0; col < subdivisionsX; col++) {
                     var quad = { slope: BABYLON.Vector2.Zero(), facet1: new BABYLON.Vector4(0, 0, 0, 0), facet2: new BABYLON.Vector4(0, 0, 0, 0) };
-                    this._heightQuads[row * this._subdivisions + col] = quad;
+                    this._heightQuads[row * subdivisionsX + col] = quad;
                 }
             }
         };
@@ -146,11 +165,13 @@ var BABYLON;
             var h = 0;
             var d1 = 0; // facet plane equation : ax + by + cz + d = 0
             var d2 = 0;
-            for (var row = 0; row < this._subdivisions; row++) {
-                for (var col = 0; col < this._subdivisions; col++) {
+            var subdivisionsX = this._subdivisionsX;
+            var subdivisionsY = this._subdivisionsY;
+            for (var row = 0; row < subdivisionsY; row++) {
+                for (var col = 0; col < subdivisionsX; col++) {
                     i = col * 3;
-                    j = row * (this._subdivisions + 1) * 3;
-                    k = (row + 1) * (this._subdivisions + 1) * 3;
+                    j = row * (subdivisionsX + 1) * 3;
+                    k = (row + 1) * (subdivisionsX + 1) * 3;
                     v1.x = positions[j + i];
                     v1.y = positions[j + i + 1];
                     v1.z = positions[j + i + 2];
@@ -180,7 +201,7 @@ var BABYLON;
                     norm2.normalize();
                     d1 = -(norm1.x * v1.x + norm1.y * v1.y + norm1.z * v1.z);
                     d2 = -(norm2.x * v2.x + norm2.y * v2.y + norm2.z * v2.z);
-                    var quad = this._heightQuads[row * this._subdivisions + col];
+                    var quad = this._heightQuads[row * subdivisionsX + col];
                     quad.slope.copyFromFloats(cd, h);
                     quad.facet1.copyFromFloats(norm1.x, norm1.y, norm1.z, d1);
                     quad.facet2.copyFromFloats(norm2.x, norm2.y, norm2.z, d2);

+ 14 - 13
src/Mesh/babylon.mesh.vertexData.js

@@ -988,24 +988,25 @@ var BABYLON;
             var row, col;
             var width = options.width || 1;
             var height = options.height || 1;
-            var subdivisions = options.subdivisions || 1;
-            for (row = 0; row <= subdivisions; row++) {
-                for (col = 0; col <= subdivisions; col++) {
-                    var position = new BABYLON.Vector3((col * width) / subdivisions - (width / 2.0), 0, ((subdivisions - row) * height) / subdivisions - (height / 2.0));
+            var subdivisionsX = options.subdivisionsX || options.subdivisions || 1;
+            var subdivisionsY = options.subdivisionsY || options.subdivisions || 1;
+            for (row = 0; row <= subdivisionsY; row++) {
+                for (col = 0; col <= subdivisionsX; col++) {
+                    var position = new BABYLON.Vector3((col * width) / subdivisionsX - (width / 2.0), 0, ((subdivisionsY - row) * height) / subdivisionsY - (height / 2.0));
                     var normal = new BABYLON.Vector3(0, 1.0, 0);
                     positions.push(position.x, position.y, position.z);
                     normals.push(normal.x, normal.y, normal.z);
-                    uvs.push(col / subdivisions, 1.0 - row / subdivisions);
+                    uvs.push(col / subdivisionsX, 1.0 - row / subdivisionsX);
                 }
             }
-            for (row = 0; row < subdivisions; row++) {
-                for (col = 0; col < subdivisions; col++) {
-                    indices.push(col + 1 + (row + 1) * (subdivisions + 1));
-                    indices.push(col + 1 + row * (subdivisions + 1));
-                    indices.push(col + row * (subdivisions + 1));
-                    indices.push(col + (row + 1) * (subdivisions + 1));
-                    indices.push(col + 1 + (row + 1) * (subdivisions + 1));
-                    indices.push(col + row * (subdivisions + 1));
+            for (row = 0; row < subdivisionsY; row++) {
+                for (col = 0; col < subdivisionsX; col++) {
+                    indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));
+                    indices.push(col + 1 + row * (subdivisionsX + 1));
+                    indices.push(col + row * (subdivisionsX + 1));
+                    indices.push(col + (row + 1) * (subdivisionsX + 1));
+                    indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));
+                    indices.push(col + row * (subdivisionsX + 1));
                 }
             }
             // Result

+ 4 - 2
src/Mesh/babylon.meshBuilder.js

@@ -542,7 +542,8 @@ var BABYLON;
         MeshBuilder.CreateGround = function (name, options, scene) {
             var ground = new BABYLON.GroundMesh(name, scene);
             ground._setReady(false);
-            ground._subdivisions = options.subdivisions || 1;
+            ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;
+            ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;
             ground._width = options.width || 1;
             ground._height = options.height || 1;
             ground._maxX = ground._width / 2;
@@ -597,7 +598,8 @@ var BABYLON;
             var updatable = options.updatable;
             var onReady = options.onReady;
             var ground = new BABYLON.GroundMesh(name, scene);
-            ground._subdivisions = subdivisions;
+            ground._subdivisionsX = subdivisions;
+            ground._subdivisionsY = subdivisions;
             ground._width = width;
             ground._height = height;
             ground._maxX = ground._width / 2.0;