Просмотр исходного кода

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

Stephen Post 7 лет назад
Родитель
Сommit
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))
 - 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))
 - 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))
 - 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
 ### glTF Loader

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

@@ -3130,13 +3130,14 @@
          * Creates a ground mesh from a height map.    
          * Creates a ground mesh from a height map.    
          * tuto : http://doc.babylonjs.com/babylon101/height_map   
          * tuto : http://doc.babylonjs.com/babylon101/height_map   
          * Please consider using the same method from the MeshBuilder class instead.    
          * 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 : 
          * This function is passed the newly built mesh : 
          * ```javascript
          * ```javascript
          * function(mesh) { // do things
          * function(mesh) { // do things

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

@@ -1773,7 +1773,7 @@
                     if(a >= alphaFilter)
                     if(a >= alphaFilter)
                         position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;
                         position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;
                     else {
                     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
                     // Add  vertex
@@ -1794,6 +1794,7 @@
 
 
                     // Check that all indices are visible (based on our special height)
                     // Check that all indices are visible (based on our special height)
                     // Only display the vertex if all Indices are visible
                     // 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 isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;
                     var isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;
                     var isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;
                     var isVisibleIdx3 = positions[idx3 * 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))
 - 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))
 - 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))
 - 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
 ## Bug fixes