浏览代码

fix tiny bugs in SPS and MeshBuilder (2)

jbousquie 9 年之前
父节点
当前提交
d8405911ad
共有 3 个文件被更改,包括 13 次插入13 次删除
  1. 5 5
      src/Mesh/babylon.mesh.vertexData.ts
  2. 7 7
      src/Mesh/babylon.meshBuilder.ts
  3. 1 1
      src/Particles/babylon.solidParticleSystem.ts

+ 5 - 5
src/Mesh/babylon.mesh.vertexData.ts

@@ -1221,10 +1221,10 @@
         }
         }
 
 
         public static CreateTiledGround(options: { xmin: number, zmin: number, xmax: number, zmax: number, subdivisions?: { w: number; h: number; }, precision?: { w: number; h: number; } }): VertexData {
         public static CreateTiledGround(options: { xmin: number, zmin: number, xmax: number, zmax: number, subdivisions?: { w: number; h: number; }, precision?: { w: number; h: number; } }): VertexData {
-            var xmin = options.xmin;
-            var zmin = options.zmin;
-            var xmax = options.xmax;
-            var zmax = options.zmax;
+            var xmin = options.xmin || -1.0;
+            var zmin = options.zmin || -1.0;
+            var xmax = options.xmax || 1.0;
+            var zmax = options.zmax || 1.0;
             var subdivisions = options.subdivisions || { w: 1, h: 1 };
             var subdivisions = options.subdivisions || { w: 1, h: 1 };
             var precision = options.precision || { w: 1, h: 1 };
             var precision = options.precision || { w: 1, h: 1 };
 
 
@@ -1234,7 +1234,7 @@
             var uvs = [];
             var uvs = [];
             var row: number, col: number, tileRow: number, tileCol: number;
             var row: number, col: number, tileRow: number, tileCol: number;
 
 
-            subdivisions.h = (subdivisions.w < 1) ? 1 : subdivisions.h;
+            subdivisions.h = (subdivisions.h < 1) ? 1 : subdivisions.h;
             subdivisions.w = (subdivisions.w < 1) ? 1 : subdivisions.w;
             subdivisions.w = (subdivisions.w < 1) ? 1 : subdivisions.w;
             precision.w = (precision.w < 1) ? 1 : precision.w;
             precision.w = (precision.w < 1) ? 1 : precision.w;
             precision.h = (precision.h < 1) ? 1 : precision.h;
             precision.h = (precision.h < 1) ? 1 : precision.h;

+ 7 - 7
src/Mesh/babylon.meshBuilder.ts

@@ -613,11 +613,11 @@
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.  
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.  
          */
          */
         public static CreateGroundFromHeightMap(name: string, url: string, options: { width?: number, height?: number, subdivisions?: number, minHeight?: number, maxHeight?: number, updatable?: boolean, onReady?: (mesh: GroundMesh) => void }, scene: Scene): GroundMesh {
         public static CreateGroundFromHeightMap(name: string, url: string, options: { width?: number, height?: number, subdivisions?: number, minHeight?: number, maxHeight?: number, updatable?: boolean, onReady?: (mesh: GroundMesh) => void }, scene: Scene): GroundMesh {
-            var width = options.width || 10;
-            var height = options.height || 10;
-            var subdivisions = options.subdivisions || 1;
-            var minHeight = options.minHeight;
-            var maxHeight = options.maxHeight || 10;
+            var width = options.width || 10.0;
+            var height = options.height || 10.0;
+            var subdivisions = options.subdivisions || 1|0;
+            var minHeight = options.minHeight || 0.0;
+            var maxHeight = options.maxHeight || 10.0;
             var updatable = options.updatable;
             var updatable = options.updatable;
             var onReady = options.onReady;
             var onReady = options.onReady;
 
 
@@ -625,8 +625,8 @@
             ground._subdivisions = subdivisions;
             ground._subdivisions = subdivisions;
             ground._width = width;
             ground._width = width;
             ground._height = height;
             ground._height = height;
-            ground._maxX = ground._width / 2;
-            ground._maxZ = ground._height / 2;
+            ground._maxX = ground._width / 2.0;
+            ground._maxZ = ground._height / 2.0;
             ground._minX = -ground._maxX;
             ground._minX = -ground._maxX;
             ground._minZ = -ground._maxZ;
             ground._minZ = -ground._maxZ;
 
 

+ 1 - 1
src/Particles/babylon.solidParticleSystem.ts

@@ -328,7 +328,7 @@
 
 
                 if (this._copy.color) {
                 if (this._copy.color) {
                     this._color = this._copy.color;
                     this._color = this._copy.color;
-                } else if (meshCol && meshCol[c]) {
+                } else if (meshCol && meshCol[c] !== undefined) {
                     this._color.r = meshCol[c];
                     this._color.r = meshCol[c];
                     this._color.g = meshCol[c + 1];
                     this._color.g = meshCol[c + 1];
                     this._color.b = meshCol[c + 2];
                     this._color.b = meshCol[c + 2];