浏览代码

Update documentation
Update to BABYLON.Epislon constant for minimum value, rather than an arbitary number

Stephen Post 7 年之前
父节点
当前提交
8714ebb20c
共有 4 个文件被更改,包括 11 次插入9 次删除
  1. 1 0
      dist/preview release/what's new.md
  2. 8 7
      src/Mesh/babylon.mesh.ts
  3. 2 1
      src/Mesh/babylon.mesh.vertexData.ts
  4. 0 1
      what's new.md

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

@@ -126,6 +126,7 @@
 - Improved performance of cached nodes but ensuring parent always updates cache. This removes failed isSynchronized test that meant computeWorldMatrix would always have to rebuild. On large scenes this could double framerate. ([Bolloxim](https://github.com/Bolloxim))
 - Added FXAA and MSAA support to the StandardRenderingPipeline ([julien-moreau](https://github.com/julien-moreau))
 - Make teleportCamera public in VR experience helper ([TrevorDev](https://github.com/TrevorDev))
+- Added optional alphaFilter parameter to ```CreateGroundFromHeightMap``` to allow for heightmaps to be created that ignore any transparent data ([Postman-nz](https://github.com/Postman-nz))
 
 
 ### glTF Loader

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

@@ -3130,13 +3130,14 @@
          * Creates a ground mesh from a height map.    
          * tuto : http://doc.babylonjs.com/babylon101/height_map   
          * Please consider using the same method from the MeshBuilder class instead.    
-         * The parameter `url` sets the URL of the height map image resource.  
-         * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.     
-         * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.  
-         * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.     
-         * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.   
-         * The parameter `onReady` is a javascript callback function that will be called  once the mesh is just built (the height map download can last some time).  
-         * The parameter `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)
+         * @param url sets the URL of the height map image resource.  
+         * @param width (positive float, default 10) set the ground width size.  
+         * @param height (positive float, default 10) set the ground height size.  
+         * @param subdivisions (positive integer, default 1) sets the number of subdivision per side.  
+         * @param minHeight (float, default 0) is the minimum altitude on the ground.     
+         * @param maxHeight (float, default 1) is the maximum altitude on the ground.   
+         * @param onReady is a javascript callback function that will be called  once the mesh is just built (the height map download can last some time).  
+         * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible).
          * This function is passed the newly built mesh : 
          * ```javascript
          * function(mesh) { // do things

+ 2 - 1
src/Mesh/babylon.mesh.vertexData.ts

@@ -1773,7 +1773,7 @@
                     if(a >= alphaFilter)
                         position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;
                     else {
-                        position.y = options.minHeight - 1; // We can't have a height below minHeight, normally.
+                        position.y = options.minHeight - BABYLON.Epsilon; // We can't have a height below minHeight, normally.
                     }
 
                     // Add  vertex
@@ -1794,6 +1794,7 @@
 
                     // Check that all indices are visible (based on our special height)
                     // Only display the vertex if all Indices are visible
+                    // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height
                     var isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;
                     var isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;
                     var isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;

+ 0 - 1
what's new.md

@@ -122,7 +122,6 @@
 - New `serialize` and `Parse` functions for SSAO2 Rendering Pipeline ([julien-moreau](https://github.com/julien-moreau))
 - Added `furOcclusion` property to FurMaterial to control the occlusion strength ([julien-moreau](https://github.com/julien-moreau))
 - Optimize ephimeral object creation to help GC ([menduz](https://github.com/menduz))
-- Added optional alphaFilter parameter to ```CreateGroundFromHeightMap``` to allow for heightmaps to be created that ignore any transparent data ([Postman-nz](https://github.com/Postman-nz))
 
 ## Bug fixes