@onerjs/core 8.41.4 → 8.41.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +16 -0
- package/Cameras/Inputs/geospatialCameraPointersInput.js +19 -3
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/Limits/geospatialLimits.d.ts +0 -6
- package/Cameras/Limits/geospatialLimits.js +0 -6
- package/Cameras/Limits/geospatialLimits.js.map +1 -1
- package/Cameras/geospatialCamera.d.ts +5 -0
- package/Cameras/geospatialCamera.js +38 -10
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Engines/abstractEngine.d.ts +2 -2
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -4
- package/Engines/webgpuEngine.js +8 -6
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/frameGraphContext.js +1 -1
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.js +2 -2
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/lightingVolume.js +1 -1
- package/Lights/lightingVolume.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Maths/math.path.js +3 -3
- package/Maths/math.path.js.map +1 -1
- package/Meshes/Builders/capsuleBuilder.js +0 -3
- package/Meshes/Builders/capsuleBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.d.ts +1 -1
- package/Meshes/Builders/cylinderBuilder.js +1 -2
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +2 -0
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/discBuilder.js +0 -1
- package/Meshes/Builders/discBuilder.js.map +1 -1
- package/Meshes/Builders/groundBuilder.d.ts +50 -54
- package/Meshes/Builders/groundBuilder.js +50 -54
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.d.ts +0 -26
- package/Meshes/Builders/tiledBoxBuilder.js +0 -26
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/tiledPlaneBuilder.d.ts +0 -25
- package/Meshes/Builders/tiledPlaneBuilder.js +0 -25
- package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
- package/Meshes/Builders/torusBuilder.d.ts +0 -13
- package/Meshes/Builders/torusBuilder.js +0 -13
- package/Meshes/Builders/torusBuilder.js.map +1 -1
- package/Meshes/Builders/torusKnotBuilder.d.ts +0 -19
- package/Meshes/Builders/torusKnotBuilder.js +0 -19
- package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
- package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
- package/Meshes/Compression/dracoDecoder.js.map +1 -1
- package/Meshes/Compression/dracoDecoder.types.d.ts +11 -0
- package/Meshes/Compression/dracoDecoder.types.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +0 -2
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +0 -8
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/scalingBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Matrices/scalingBlock.js +1 -0
- package/Meshes/Node/Blocks/Matrices/scalingBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/translationBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Matrices/translationBlock.js +1 -0
- package/Meshes/Node/Blocks/Matrices/translationBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/aggregatorBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/latticeBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Set/setUVsBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/discBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/pointListBlock.d.ts +2 -1
- package/Meshes/Node/Blocks/Sources/pointListBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/pointListBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -0
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js +1 -0
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.d.ts +3 -0
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +3 -0
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +1 -0
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/booleanGeometryBlock.js +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/cleanGeometryBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/cleanGeometryBlock.js +1 -0
- package/Meshes/Node/Blocks/cleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/conditionBlock.js +2 -0
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/geometryClampBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/geometryCollectionBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -0
- package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryEaseBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/geometryEaseBlock.js +2 -0
- package/Meshes/Node/Blocks/geometryEaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryInputBlock.d.ts +3 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js +3 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/geometryTransformBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -0
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/mappingBlock.js +1 -0
- package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/mathBlock.js +1 -0
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -0
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/randomBlock.js +2 -0
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/Node/Blocks/subdivideBlock.d.ts +1 -0
- package/Meshes/Node/Blocks/subdivideBlock.js +1 -0
- package/Meshes/Node/Blocks/subdivideBlock.js.map +1 -1
- package/Meshes/Node/Interfaces/nodeGeometryTextureData.d.ts +3 -0
- package/Meshes/Node/Interfaces/nodeGeometryTextureData.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +0 -2
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +0 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +0 -1
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/WebGL/webGLDataBuffer.d.ts +2 -0
- package/Meshes/WebGL/webGLDataBuffer.js +2 -0
- package/Meshes/WebGL/webGLDataBuffer.js.map +1 -1
- package/Meshes/WebGPU/webgpuDataBuffer.d.ts +4 -0
- package/Meshes/WebGPU/webgpuDataBuffer.js +4 -0
- package/Meshes/WebGPU/webgpuDataBuffer.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +1 -0
- package/Meshes/abstractMesh.decalMap.d.ts +1 -0
- package/Meshes/abstractMesh.decalMap.js.map +1 -1
- package/Meshes/abstractMesh.js +1 -6
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.js +0 -6
- package/Meshes/csg.js.map +1 -1
- package/Meshes/csg2.js +1 -2
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/geodesicMesh.d.ts +26 -0
- package/Meshes/geodesicMesh.js +18 -3
- package/Meshes/geodesicMesh.js.map +1 -1
- package/Meshes/groundMesh.d.ts +1 -0
- package/Meshes/groundMesh.js +1 -0
- package/Meshes/groundMesh.js.map +1 -1
- package/Meshes/index.js +0 -2
- package/Meshes/index.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +18 -3
- package/Meshes/instancedMesh.js +10 -3
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +286 -204
- package/Meshes/mesh.js +251 -197
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +15 -19
- package/Meshes/mesh.vertexData.js +15 -19
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/meshSimplification.d.ts +0 -1
- package/Meshes/meshSimplification.js +6 -1
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/meshSimplificationSceneComponent.d.ts +2 -0
- package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
- package/Meshes/meshUVSpaceRenderer.d.ts +1 -0
- package/Meshes/meshUVSpaceRenderer.js.map +1 -1
- package/Meshes/polygonMesh.js +4 -0
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/subMesh.project.d.ts +1 -0
- package/Meshes/subMesh.project.js.map +1 -1
- package/Meshes/thinInstanceMesh.d.ts +5 -0
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/transformNode.d.ts +1 -1
- package/Meshes/transformNode.js +1 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +75 -2
- package/Physics/v2/Plugins/havokPlugin.js +243 -52
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Probes/reflectionProbe.js +1 -1
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/depthRenderer.js +1 -1
- package/Rendering/depthRenderer.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +0 -3
- package/scene.js +18 -5
- package/scene.js.map +1 -1
|
@@ -7,11 +7,11 @@ import type { Nullable } from "../../types.js";
|
|
|
7
7
|
/**
|
|
8
8
|
* Creates the VertexData for a Ground
|
|
9
9
|
* @param options an object used to set the following optional parameters for the Ground, required but can be empty
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* - `width` the width (x direction) of the ground, optional, default 1
|
|
11
|
+
* - `height` the height (z direction) of the ground, optional, default 1
|
|
12
|
+
* - `subdivisions` the number of subdivisions per side, optional, default 1
|
|
13
|
+
* - `subdivisionsX` the number of subdivisions in the x direction, overrides options.subdivisions, optional, default undefined
|
|
14
|
+
* - `subdivisionsY` the number of subdivisions in the y direction, overrides options.subdivisions, optional, default undefined
|
|
15
15
|
* @returns the VertexData of the Ground
|
|
16
16
|
*/
|
|
17
17
|
export declare function CreateGroundVertexData(options: {
|
|
@@ -25,16 +25,12 @@ export declare function CreateGroundVertexData(options: {
|
|
|
25
25
|
/**
|
|
26
26
|
* Creates the VertexData for a TiledGround by subdividing the ground into tiles
|
|
27
27
|
* @param options an object used to set the following optional parameters for the Ground
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @param options.subdivisions.h positive integer, default 6
|
|
35
|
-
* @param options.precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}
|
|
36
|
-
* @param options.precision.w positive integer, default 2
|
|
37
|
-
* @param options.precision.h positive integer, default 2
|
|
28
|
+
* - `xmin` ground minimum X coordinate, default -1
|
|
29
|
+
* - `zmin` ground minimum Z coordinate, default -1
|
|
30
|
+
* - `xmax` ground maximum X coordinate, default 1
|
|
31
|
+
* - `zmax` ground maximum Z coordinate, default 1
|
|
32
|
+
* - `subdivisions` a javascript object `\{w: positive integer, h: positive integer\}`, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default `\{w: 6, h: 6\}`
|
|
33
|
+
* - `precision` a javascript object `\{w: positive integer, h: positive integer\}`, `w` and `h` are the numbers of subdivisions on the tile width and height, default `\{w: 2, h: 2\}`
|
|
38
34
|
* @returns the VertexData of the TiledGround
|
|
39
35
|
*/
|
|
40
36
|
export declare function CreateTiledGroundVertexData(options: {
|
|
@@ -54,17 +50,17 @@ export declare function CreateTiledGroundVertexData(options: {
|
|
|
54
50
|
/**
|
|
55
51
|
* Creates the VertexData of the Ground designed from a heightmap
|
|
56
52
|
* @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
53
|
+
* - `width` the width (x direction) of the ground
|
|
54
|
+
* - `height` the height (z direction) of the ground
|
|
55
|
+
* - `subdivisions` the number of subdivisions per side
|
|
56
|
+
* - `minHeight` the minimum altitude on the ground, optional, default 0
|
|
57
|
+
* - `maxHeight` the maximum altitude on the ground, optional default 1
|
|
58
|
+
* - `colorFilter` the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)
|
|
59
|
+
* - `buffer` the array holding the image color data
|
|
60
|
+
* - `bufferWidth` the width of image
|
|
61
|
+
* - `bufferHeight` the height of image
|
|
62
|
+
* - `alphaFilter` Remove any data where the alpha channel is below this value, defaults 0 (all data visible)
|
|
63
|
+
* - `heightBuffer` a array of floats where the height data can be saved, if its length is greater than zero.
|
|
68
64
|
* @returns the VertexData of the Ground designed from a heightmap
|
|
69
65
|
*/
|
|
70
66
|
export declare function CreateGroundFromHeightMapVertexData(options: {
|
|
@@ -84,12 +80,12 @@ export declare function CreateGroundFromHeightMapVertexData(options: {
|
|
|
84
80
|
* Creates a ground mesh
|
|
85
81
|
* @param name defines the name of the mesh
|
|
86
82
|
* @param options defines the options used to create the mesh
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
83
|
+
* - `width` set the width size (float, default 1)
|
|
84
|
+
* - `height` set the height size (float, default 1)
|
|
85
|
+
* - `subdivisions` sets the number of subdivision per side (default 1)
|
|
86
|
+
* - `subdivisionsX` sets the number of subdivision on the X axis (overrides subdivisions)
|
|
87
|
+
* - `subdivisionsY` sets the number of subdivision on the Y axis (overrides subdivisions)
|
|
88
|
+
* - `updatable` defines if the mesh must be flagged as updatable (default false)
|
|
93
89
|
* @param scene defines the hosting scene
|
|
94
90
|
* @returns the ground mesh
|
|
95
91
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground
|
|
@@ -106,17 +102,17 @@ export declare function CreateGround(name: string, options?: {
|
|
|
106
102
|
* Creates a tiled ground mesh
|
|
107
103
|
* @param name defines the name of the mesh
|
|
108
104
|
* @param options defines the options used to create the mesh
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
105
|
+
* - `xmin` ground minimum X coordinate (float, default -1)
|
|
106
|
+
* - `zmin` ground minimum Z coordinate (float, default -1)
|
|
107
|
+
* - `xmax` ground maximum X coordinate (float, default 1)
|
|
108
|
+
* - `zmax` ground maximum Z coordinate (float, default 1)
|
|
109
|
+
* - `subdivisions` a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile
|
|
110
|
+
* - `subdivisions.w` positive integer, default 6
|
|
111
|
+
* - `subdivisions.h` positive integer, default 6
|
|
112
|
+
* - `precision` a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile
|
|
113
|
+
* - `precision.w` positive integer, default 2
|
|
114
|
+
* - `precision.h` positive integer, default 2
|
|
115
|
+
* - `updatable` boolean, default false, true if the mesh must be flagged as updatable
|
|
120
116
|
* @param scene defines the hosting scene
|
|
121
117
|
* @returns the tiled ground mesh
|
|
122
118
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground
|
|
@@ -143,17 +139,17 @@ export declare function CreateTiledGround(name: string, options: {
|
|
|
143
139
|
* @param name defines the name of the mesh
|
|
144
140
|
* @param url sets the URL of the height map image resource.
|
|
145
141
|
* @param options defines the options used to create the mesh
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
142
|
+
* - `width` sets the ground width size (positive float, default 10)
|
|
143
|
+
* - `height` sets the ground height size (positive float, default 10)
|
|
144
|
+
* - `subdivisions` sets the number of subdivision per side (positive integer, default 1)
|
|
145
|
+
* - `minHeight` is the minimum altitude on the ground (float, default 0)
|
|
146
|
+
* - `maxHeight` is the maximum altitude on the ground (float, default 1)
|
|
147
|
+
* - `colorFilter` is the filter to apply to the image pixel colors to compute the height (optional Color3, default (0.3, 0.59, 0.11) )
|
|
148
|
+
* - `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)
|
|
149
|
+
* - `updatable` defines if the mesh must be flagged as updatable
|
|
150
|
+
* - `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)
|
|
151
|
+
* - `onError` is a javascript callback function that will be called if there is an error
|
|
152
|
+
* - `passHeightBufferInCallback` a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.
|
|
157
153
|
* @param scene defines the hosting scene
|
|
158
154
|
* @returns the ground mesh
|
|
159
155
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map
|
|
@@ -10,11 +10,11 @@ import { useOpenGLOrientationForUV } from "../../Compat/compatibilityOptions.js"
|
|
|
10
10
|
/**
|
|
11
11
|
* Creates the VertexData for a Ground
|
|
12
12
|
* @param options an object used to set the following optional parameters for the Ground, required but can be empty
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* - `width` the width (x direction) of the ground, optional, default 1
|
|
14
|
+
* - `height` the height (z direction) of the ground, optional, default 1
|
|
15
|
+
* - `subdivisions` the number of subdivisions per side, optional, default 1
|
|
16
|
+
* - `subdivisionsX` the number of subdivisions in the x direction, overrides options.subdivisions, optional, default undefined
|
|
17
|
+
* - `subdivisionsY` the number of subdivisions in the y direction, overrides options.subdivisions, optional, default undefined
|
|
18
18
|
* @returns the VertexData of the Ground
|
|
19
19
|
*/
|
|
20
20
|
export function CreateGroundVertexData(options) {
|
|
@@ -57,16 +57,12 @@ export function CreateGroundVertexData(options) {
|
|
|
57
57
|
/**
|
|
58
58
|
* Creates the VertexData for a TiledGround by subdividing the ground into tiles
|
|
59
59
|
* @param options an object used to set the following optional parameters for the Ground
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @param options.subdivisions.h positive integer, default 6
|
|
67
|
-
* @param options.precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}
|
|
68
|
-
* @param options.precision.w positive integer, default 2
|
|
69
|
-
* @param options.precision.h positive integer, default 2
|
|
60
|
+
* - `xmin` ground minimum X coordinate, default -1
|
|
61
|
+
* - `zmin` ground minimum Z coordinate, default -1
|
|
62
|
+
* - `xmax` ground maximum X coordinate, default 1
|
|
63
|
+
* - `zmax` ground maximum Z coordinate, default 1
|
|
64
|
+
* - `subdivisions` a javascript object `\{w: positive integer, h: positive integer\}`, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default `\{w: 6, h: 6\}`
|
|
65
|
+
* - `precision` a javascript object `\{w: positive integer, h: positive integer\}`, `w` and `h` are the numbers of subdivisions on the tile width and height, default `\{w: 2, h: 2\}`
|
|
70
66
|
* @returns the VertexData of the TiledGround
|
|
71
67
|
*/
|
|
72
68
|
export function CreateTiledGroundVertexData(options) {
|
|
@@ -134,17 +130,17 @@ export function CreateTiledGroundVertexData(options) {
|
|
|
134
130
|
/**
|
|
135
131
|
* Creates the VertexData of the Ground designed from a heightmap
|
|
136
132
|
* @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
133
|
+
* - `width` the width (x direction) of the ground
|
|
134
|
+
* - `height` the height (z direction) of the ground
|
|
135
|
+
* - `subdivisions` the number of subdivisions per side
|
|
136
|
+
* - `minHeight` the minimum altitude on the ground, optional, default 0
|
|
137
|
+
* - `maxHeight` the maximum altitude on the ground, optional default 1
|
|
138
|
+
* - `colorFilter` the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)
|
|
139
|
+
* - `buffer` the array holding the image color data
|
|
140
|
+
* - `bufferWidth` the width of image
|
|
141
|
+
* - `bufferHeight` the height of image
|
|
142
|
+
* - `alphaFilter` Remove any data where the alpha channel is below this value, defaults 0 (all data visible)
|
|
143
|
+
* - `heightBuffer` a array of floats where the height data can be saved, if its length is greater than zero.
|
|
148
144
|
* @returns the VertexData of the Ground designed from a heightmap
|
|
149
145
|
*/
|
|
150
146
|
export function CreateGroundFromHeightMapVertexData(options) {
|
|
@@ -239,12 +235,12 @@ export function CreateGroundFromHeightMapVertexData(options) {
|
|
|
239
235
|
* Creates a ground mesh
|
|
240
236
|
* @param name defines the name of the mesh
|
|
241
237
|
* @param options defines the options used to create the mesh
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
238
|
+
* - `width` set the width size (float, default 1)
|
|
239
|
+
* - `height` set the height size (float, default 1)
|
|
240
|
+
* - `subdivisions` sets the number of subdivision per side (default 1)
|
|
241
|
+
* - `subdivisionsX` sets the number of subdivision on the X axis (overrides subdivisions)
|
|
242
|
+
* - `subdivisionsY` sets the number of subdivision on the Y axis (overrides subdivisions)
|
|
243
|
+
* - `updatable` defines if the mesh must be flagged as updatable (default false)
|
|
248
244
|
* @param scene defines the hosting scene
|
|
249
245
|
* @returns the ground mesh
|
|
250
246
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground
|
|
@@ -269,17 +265,17 @@ export function CreateGround(name, options = {}, scene) {
|
|
|
269
265
|
* Creates a tiled ground mesh
|
|
270
266
|
* @param name defines the name of the mesh
|
|
271
267
|
* @param options defines the options used to create the mesh
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
268
|
+
* - `xmin` ground minimum X coordinate (float, default -1)
|
|
269
|
+
* - `zmin` ground minimum Z coordinate (float, default -1)
|
|
270
|
+
* - `xmax` ground maximum X coordinate (float, default 1)
|
|
271
|
+
* - `zmax` ground maximum Z coordinate (float, default 1)
|
|
272
|
+
* - `subdivisions` a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile
|
|
273
|
+
* - `subdivisions.w` positive integer, default 6
|
|
274
|
+
* - `subdivisions.h` positive integer, default 6
|
|
275
|
+
* - `precision` a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile
|
|
276
|
+
* - `precision.w` positive integer, default 2
|
|
277
|
+
* - `precision.h` positive integer, default 2
|
|
278
|
+
* - `updatable` boolean, default false, true if the mesh must be flagged as updatable
|
|
283
279
|
* @param scene defines the hosting scene
|
|
284
280
|
* @returns the tiled ground mesh
|
|
285
281
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground
|
|
@@ -297,17 +293,17 @@ export function CreateTiledGround(name, options, scene = null) {
|
|
|
297
293
|
* @param name defines the name of the mesh
|
|
298
294
|
* @param url sets the URL of the height map image resource.
|
|
299
295
|
* @param options defines the options used to create the mesh
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
296
|
+
* - `width` sets the ground width size (positive float, default 10)
|
|
297
|
+
* - `height` sets the ground height size (positive float, default 10)
|
|
298
|
+
* - `subdivisions` sets the number of subdivision per side (positive integer, default 1)
|
|
299
|
+
* - `minHeight` is the minimum altitude on the ground (float, default 0)
|
|
300
|
+
* - `maxHeight` is the maximum altitude on the ground (float, default 1)
|
|
301
|
+
* - `colorFilter` is the filter to apply to the image pixel colors to compute the height (optional Color3, default (0.3, 0.59, 0.11) )
|
|
302
|
+
* - `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)
|
|
303
|
+
* - `updatable` defines if the mesh must be flagged as updatable
|
|
304
|
+
* - `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)
|
|
305
|
+
* - `onError` is a javascript callback function that will be called if there is an error
|
|
306
|
+
* - `passHeightBufferInCallback` a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.
|
|
311
307
|
* @param scene defines the hosting scene
|
|
312
308
|
* @returns the ground mesh
|
|
313
309
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groundBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/groundBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAOtC;IACG,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,IAAI,GAAW,EAAE,GAAW,CAAC;IAE7B,MAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC;IACzD,MAAM,MAAM,GAAW,O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EAAE;IACN,MAAM,OAAO,GAAG;QACZ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,YAAY;QACZ,SAAS;QACT,SAAS;KACZ,CAAC;IAEF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAI,CAAC,yBAAyB,GAAG,CAC7B,IAAY,EACZ,GAAW,EACX,KAAa,EACb,MAAc,EACd,YAAoB,EACpB,SAAiB,EACjB,SAAiB,EACjB,KAAY,EACZ,SAAmB,EACnB,OAAoC,EACpC,WAAoB,EACV,EAAE;IACZ,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;QACT,SAAS;QACT,SAAS;QACT,OAAO;QACP,WAAW;KACd,CAAC;IAEF,OAAO,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { GroundMesh } from \"../groundMesh\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * @param options.width the width (x direction) of the ground, optional, default 1\r\n * @param options.height the height (z direction) of the ground, optional, default 1\r\n * @param options.subdivisions the number of subdivisions per side, optional, default 1\r\n * @param options.subdivisionsX the number of subdivisions in the x direction, overrides options.subdivisions, optional, default undefined\r\n * @param options.subdivisionsY the number of subdivisions in the y direction, overrides options.subdivisions, optional, default undefined\r\n * @returns the VertexData of the Ground\r\n */\r\nexport function CreateGroundVertexData(options: {\r\n size?: number;\r\n width?: number;\r\n height?: number;\r\n subdivisions?: number;\r\n subdivisionsX?: number;\r\n subdivisionsY?: number;\r\n}): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row: number, col: number;\r\n\r\n const width: number = options.width || options.size || 1;\r\n const height: number = options.height || options.size || 1;\r\n const subdivisionsX: number = (options.subdivisionsX || options.subdivisions || 1) | 0;\r\n const subdivisionsY: number = (options.subdivisionsY || options.subdivisions || 1) | 0;\r\n\r\n for (row = 0; row <= subdivisionsY; row++) {\r\n for (col = 0; col <= subdivisionsX; col++) {\r\n const position = new Vector3((col * width) / subdivisionsX - width / 2.0, 0, ((subdivisionsY - row) * height) / subdivisionsY - height / 2.0);\r\n const normal = new Vector3(0, 1.0, 0);\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / subdivisionsX, useOpenGLOrientationForUV ? row / subdivisionsY : 1.0 - row / subdivisionsY);\r\n }\r\n }\r\n\r\n for (row = 0; row < subdivisionsY; row++) {\r\n for (col = 0; col < subdivisionsX; col++) {\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + row * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n\r\n indices.push(col + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground\r\n * @param options.xmin ground minimum X coordinate, default -1\r\n * @param options.zmin ground minimum Z coordinate, default -1\r\n * @param options.xmax ground maximum X coordinate, default 1\r\n * @param options.zmax ground maximum Z coordinate, default 1\r\n * @param options.subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @returns the VertexData of the TiledGround\r\n */\r\nexport function CreateTiledGroundVertexData(options: {\r\n xmin: number;\r\n zmin: number;\r\n xmax: number;\r\n zmax: number;\r\n subdivisions?: { w: number; h: number };\r\n precision?: { w: number; h: number };\r\n}): VertexData {\r\n const xmin = options.xmin !== undefined && options.xmin !== null ? options.xmin : -1.0;\r\n const zmin = options.zmin !== undefined && options.zmin !== null ? options.zmin : -1.0;\r\n const xmax = options.xmax !== undefined && options.xmax !== null ? options.xmax : 1.0;\r\n const zmax = options.zmax !== undefined && options.zmax !== null ? options.zmax : 1.0;\r\n const subdivisions = options.subdivisions || { w: 1, h: 1 };\r\n const precision = options.precision || { w: 1, h: 1 };\r\n\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n let row: number, col: number, tileRow: number, tileCol: number;\r\n\r\n subdivisions.h = subdivisions.h < 1 ? 1 : subdivisions.h;\r\n subdivisions.w = subdivisions.w < 1 ? 1 : subdivisions.w;\r\n precision.w = precision.w < 1 ? 1 : precision.w;\r\n precision.h = precision.h < 1 ? 1 : precision.h;\r\n\r\n const tileSize = {\r\n w: (xmax - xmin) / subdivisions.w,\r\n h: (zmax - zmin) / subdivisions.h,\r\n };\r\n\r\n function applyTile(xTileMin: number, zTileMin: number, xTileMax: number, zTileMax: number) {\r\n // Indices\r\n const base = positions.length / 3;\r\n const rowLength = precision.w + 1;\r\n for (row = 0; row < precision.h; row++) {\r\n for (col = 0; col < precision.w; col++) {\r\n const square = [base + col + row * rowLength, base + (col + 1) + row * rowLength, base + (col + 1) + (row + 1) * rowLength, base + col + (row + 1) * rowLength];\r\n\r\n indices.push(square[1]);\r\n indices.push(square[2]);\r\n indices.push(square[3]);\r\n indices.push(square[0]);\r\n indices.push(square[1]);\r\n indices.push(square[3]);\r\n }\r\n }\r\n\r\n // Position, normals and uvs\r\n const position = Vector3.Zero();\r\n const normal = new Vector3(0, 1.0, 0);\r\n for (row = 0; row <= precision.h; row++) {\r\n position.z = (row * (zTileMax - zTileMin)) / precision.h + zTileMin;\r\n for (col = 0; col <= precision.w; col++) {\r\n position.x = (col * (xTileMax - xTileMin)) / precision.w + xTileMin;\r\n position.y = 0;\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / precision.w, row / precision.h);\r\n }\r\n }\r\n }\r\n\r\n for (tileRow = 0; tileRow < subdivisions.h; tileRow++) {\r\n for (tileCol = 0; tileCol < subdivisions.w; tileCol++) {\r\n applyTile(xmin + tileCol * tileSize.w, zmin + tileRow * tileSize.h, xmin + (tileCol + 1) * tileSize.w, zmin + (tileRow + 1) * tileSize.h);\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap\r\n * @param options.width the width (x direction) of the ground\r\n * @param options.height the height (z direction) of the ground\r\n * @param options.subdivisions the number of subdivisions per side\r\n * @param options.minHeight the minimum altitude on the ground, optional, default 0\r\n * @param options.maxHeight the maximum altitude on the ground, optional default 1\r\n * @param options.colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * @param options.buffer the array holding the image color data\r\n * @param options.bufferWidth the width of image\r\n * @param options.bufferHeight the height of image\r\n * @param options.alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @param options.heightBuffer a array of floats where the height data can be saved, if its length is greater than zero.\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\nexport function CreateGroundFromHeightMapVertexData(options: {\r\n width: number;\r\n height: number;\r\n subdivisions: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n colorFilter: Color3;\r\n buffer: Uint8Array;\r\n bufferWidth: number;\r\n bufferHeight: number;\r\n alphaFilter: number;\r\n heightBuffer?: Float32Array;\r\n}): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row, col;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n let invert = false;\r\n\r\n if (options.minHeight > options.maxHeight) {\r\n invert = true;\r\n const temp = options.maxHeight;\r\n options.maxHeight = options.minHeight;\r\n options.minHeight = temp;\r\n }\r\n\r\n // Vertices\r\n for (row = 0; row <= options.subdivisions; row++) {\r\n for (col = 0; col <= options.subdivisions; col++) {\r\n const position = new Vector3(\r\n (col * options.width) / options.subdivisions - options.width / 2.0,\r\n 0,\r\n ((options.subdivisions - row) * options.height) / options.subdivisions - options.height / 2.0\r\n );\r\n\r\n // Compute height\r\n const heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;\r\n const heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;\r\n const pos = (heightMapX + heightMapY * options.bufferWidth) * 4;\r\n let r = options.buffer[pos] / 255.0;\r\n let g = options.buffer[pos + 1] / 255.0;\r\n let b = options.buffer[pos + 2] / 255.0;\r\n const a = options.buffer[pos + 3] / 255.0;\r\n\r\n if (invert) {\r\n r = 1.0 - r;\r\n g = 1.0 - g;\r\n b = 1.0 - b;\r\n }\r\n\r\n const gradient = r * filter.r + g * filter.g + b * filter.b;\r\n\r\n // If our alpha channel is not within our filter then we will assign a 'special' height\r\n // Then when building the indices, we will ignore any vertex that is using the special height\r\n if (a >= alphaFilter) {\r\n position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;\r\n } else {\r\n position.y = options.minHeight - Epsilon; // We can't have a height below minHeight, normally.\r\n }\r\n if (options.heightBuffer) {\r\n // set the height buffer information in row major order.\r\n options.heightBuffer[row * (options.subdivisions + 1) + col] = position.y;\r\n }\r\n\r\n // Add vertex\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(0, 0, 0);\r\n uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);\r\n }\r\n }\r\n\r\n // Indices\r\n for (row = 0; row < options.subdivisions; row++) {\r\n for (col = 0; col < options.subdivisions; col++) {\r\n // Calculate Indices\r\n const idx1 = col + 1 + (row + 1) * (options.subdivisions + 1);\r\n const idx2 = col + 1 + row * (options.subdivisions + 1);\r\n const idx3 = col + row * (options.subdivisions + 1);\r\n const idx4 = col + (row + 1) * (options.subdivisions + 1);\r\n\r\n // Check that all indices are visible (based on our special height)\r\n // Only display the vertex if all Indices are visible\r\n // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height\r\n const isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx1 && isVisibleIdx2 && isVisibleIdx3) {\r\n indices.push(idx1);\r\n indices.push(idx2);\r\n indices.push(idx3);\r\n }\r\n\r\n const isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {\r\n indices.push(idx4);\r\n indices.push(idx1);\r\n indices.push(idx3);\r\n }\r\n }\r\n }\r\n\r\n // Normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param options.width set the width size (float, default 1)\r\n * @param options.height set the height size (float, default 1)\r\n * @param options.subdivisions sets the number of subdivision per side (default 1)\r\n * @param options.subdivisionsX sets the number of subdivision on the X axis (overrides subdivisions)\r\n * @param options.subdivisionsY sets the number of subdivision on the Y axis (overrides subdivisions)\r\n * @param options.updatable defines if the mesh must be flagged as updatable (default false)\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground\r\n */\r\nexport function CreateGround(\r\n name: string,\r\n options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; updatable?: boolean } = {},\r\n scene?: Scene\r\n): GroundMesh {\r\n const ground = new GroundMesh(name, scene);\r\n ground._setReady(false);\r\n ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n ground._width = options.width || 1;\r\n ground._height = options.height || 1;\r\n ground._maxX = ground._width / 2;\r\n ground._maxZ = ground._height / 2;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n const vertexData = CreateGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(ground, options.updatable);\r\n\r\n ground._setReady(true);\r\n\r\n return ground;\r\n}\r\n\r\n/**\r\n * Creates a tiled ground mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param options.xmin ground minimum X coordinate (float, default -1)\r\n * @param options.zmin ground minimum Z coordinate (float, default -1)\r\n * @param options.xmax ground maximum X coordinate (float, default 1)\r\n * @param options.zmax ground maximum Z coordinate (float, default 1)\r\n * @param options.subdivisions a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @param options.updatable boolean, default false, true if the mesh must be flagged as updatable\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground\r\n */\r\nexport function CreateTiledGround(\r\n name: string,\r\n options: { xmin: number; zmin: number; xmax: number; zmax: number; subdivisions?: { w: number; h: number }; precision?: { w: number; h: number }; updatable?: boolean },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const tiledGround = new Mesh(name, scene);\r\n\r\n const vertexData = CreateTiledGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(tiledGround, options.updatable);\r\n\r\n return tiledGround;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh from a height map. The height map download can take some frames,\r\n * so the mesh is not immediately ready. To wait for the mesh to be completely built,\r\n * you should use the `onReady` callback option.\r\n * @param name defines the name of the mesh\r\n * @param url sets the URL of the height map image resource.\r\n * @param options defines the options used to create the mesh\r\n * @param options.width sets the ground width size (positive float, default 10)\r\n * @param options.height sets the ground height size (positive float, default 10)\r\n * @param options.subdivisions sets the number of subdivision per side (positive integer, default 1)\r\n * @param options.minHeight is the minimum altitude on the ground (float, default 0)\r\n * @param options.maxHeight is the maximum altitude on the ground (float, default 1)\r\n * @param options.colorFilter is the filter to apply to the image pixel colors to compute the height (optional Color3, default (0.3, 0.59, 0.11) )\r\n * @param options.alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @param options.updatable defines if the mesh must be flagged as updatable\r\n * @param options.onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)\r\n * @param options.onError is a javascript callback function that will be called if there is an error\r\n * @param options.passHeightBufferInCallback a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground-from-a-height-map\r\n */\r\nexport function CreateGroundFromHeightMap(\r\n name: string,\r\n url: string | { data: Uint8Array; width: number; height: number },\r\n options: {\r\n width?: number;\r\n height?: number;\r\n subdivisions?: number;\r\n minHeight?: number;\r\n maxHeight?: number;\r\n colorFilter?: Color3;\r\n alphaFilter?: number;\r\n updatable?: boolean;\r\n onReady?: (mesh: GroundMesh, heightBuffer?: Float32Array) => void;\r\n onError?: (message?: string, exception?: any) => void;\r\n passHeightBufferInCallback?: boolean;\r\n } = {},\r\n scene: Nullable<Scene> = null\r\n): GroundMesh {\r\n const width = options.width || 10.0;\r\n const height = options.height || 10.0;\r\n const subdivisions = options.subdivisions || 1 | 0;\r\n const minHeight = options.minHeight || 0.0;\r\n const maxHeight = options.maxHeight || 1.0;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n const updatable = options.updatable;\r\n const onReady = options.onReady;\r\n\r\n scene = scene || EngineStore.LastCreatedScene!;\r\n\r\n const ground = new GroundMesh(name, scene);\r\n ground._subdivisionsX = subdivisions;\r\n ground._subdivisionsY = subdivisions;\r\n ground._width = width;\r\n ground._height = height;\r\n ground._maxX = ground._width / 2.0;\r\n ground._maxZ = ground._height / 2.0;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n ground._setReady(false);\r\n\r\n let heightBuffer: Float32Array;\r\n if (options.passHeightBufferInCallback) {\r\n heightBuffer = new Float32Array((subdivisions + 1) * (subdivisions + 1));\r\n }\r\n\r\n const onBufferLoaded = (buffer: Uint8Array, bufferWidth: number, bufferHeight: number) => {\r\n const vertexData = CreateGroundFromHeightMapVertexData({\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight,\r\n maxHeight: maxHeight,\r\n colorFilter: filter,\r\n buffer: buffer,\r\n bufferWidth: bufferWidth,\r\n bufferHeight: bufferHeight,\r\n alphaFilter: alphaFilter,\r\n heightBuffer,\r\n });\r\n\r\n vertexData.applyToMesh(ground, updatable);\r\n\r\n //execute ready callback, if set\r\n if (onReady) {\r\n onReady(ground, heightBuffer);\r\n }\r\n\r\n ground._setReady(true);\r\n };\r\n\r\n if (typeof url === \"string\") {\r\n const onload = (img: HTMLImageElement | ImageBitmap) => {\r\n const bufferWidth = img.width;\r\n const bufferHeight = img.height;\r\n\r\n if (scene.isDisposed) {\r\n return;\r\n }\r\n\r\n const buffer = scene?.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);\r\n\r\n onBufferLoaded(buffer, bufferWidth, bufferHeight);\r\n };\r\n\r\n Tools.LoadImage(url, onload, options.onError ? options.onError : () => {}, scene.offlineProvider);\r\n } else {\r\n onBufferLoaded(url.data, url.width, url.height);\r\n }\r\n\r\n return ground;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const GroundBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGround,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGroundFromHeightMap,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTiledGround,\r\n};\r\n\r\nVertexData.CreateGround = CreateGroundVertexData;\r\nVertexData.CreateTiledGround = CreateTiledGroundVertexData;\r\nVertexData.CreateGroundFromHeightMap = CreateGroundFromHeightMapVertexData;\r\n\r\nMesh.CreateGround = (name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n updatable,\r\n };\r\n\r\n return CreateGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateTiledGround = (\r\n name: string,\r\n xmin: number,\r\n zmin: number,\r\n xmax: number,\r\n zmax: number,\r\n subdivisions: { w: number; h: number },\r\n precision: { w: number; h: number },\r\n scene: Scene,\r\n updatable?: boolean\r\n): Mesh => {\r\n const options = {\r\n xmin,\r\n zmin,\r\n xmax,\r\n zmax,\r\n subdivisions,\r\n precision,\r\n updatable,\r\n };\r\n\r\n return CreateTiledGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateGroundFromHeightMap = (\r\n name: string,\r\n url: string,\r\n width: number,\r\n height: number,\r\n subdivisions: number,\r\n minHeight: number,\r\n maxHeight: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n onReady?: (mesh: GroundMesh) => void,\r\n alphaFilter?: number\r\n): GroundMesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n minHeight,\r\n maxHeight,\r\n updatable,\r\n onReady,\r\n alphaFilter,\r\n };\r\n\r\n return CreateGroundFromHeightMap(name, url, options, scene);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"groundBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/groundBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MA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,yBAAyB,GAAG,mCAAmC,CAAC;AAE3E,IAAI,CAAC,YAAY,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,MAAc,EAAE,YAAoB,EAAE,KAAa,EAAE,SAAmB,EAAQ,EAAE;IAChI,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;KACZ,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,IAAI,CAAC,iBAAiB,GAAG,CACrB,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,YAAsC,EACtC,SAAmC,EACnC,KAAY,EACZ,SAAmB,EACf,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,YAAY;QACZ,SAAS;QACT,SAAS;KACZ,CAAC;IAEF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAI,CAAC,yBAAyB,GAAG,CAC7B,IAAY,EACZ,GAAW,EACX,KAAa,EACb,MAAc,EACd,YAAoB,EACpB,SAAiB,EACjB,SAAiB,EACjB,KAAY,EACZ,SAAmB,EACnB,OAAoC,EACpC,WAAoB,EACV,EAAE;IACZ,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;QACT,SAAS;QACT,SAAS;QACT,OAAO;QACP,WAAW;KACd,CAAC;IAEF,OAAO,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { GroundMesh } from \"../groundMesh\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * - `width` the width (x direction) of the ground, optional, default 1\r\n * - `height` the height (z direction) of the ground, optional, default 1\r\n * - `subdivisions` the number of subdivisions per side, optional, default 1\r\n * - `subdivisionsX` the number of subdivisions in the x direction, overrides options.subdivisions, optional, default undefined\r\n * - `subdivisionsY` the number of subdivisions in the y direction, overrides options.subdivisions, optional, default undefined\r\n * @returns the VertexData of the Ground\r\n */\r\nexport function CreateGroundVertexData(options: {\r\n size?: number;\r\n width?: number;\r\n height?: number;\r\n subdivisions?: number;\r\n subdivisionsX?: number;\r\n subdivisionsY?: number;\r\n}): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row: number, col: number;\r\n\r\n const width: number = options.width || options.size || 1;\r\n const height: number = options.height || options.size || 1;\r\n const subdivisionsX: number = (options.subdivisionsX || options.subdivisions || 1) | 0;\r\n const subdivisionsY: number = (options.subdivisionsY || options.subdivisions || 1) | 0;\r\n\r\n for (row = 0; row <= subdivisionsY; row++) {\r\n for (col = 0; col <= subdivisionsX; col++) {\r\n const position = new Vector3((col * width) / subdivisionsX - width / 2.0, 0, ((subdivisionsY - row) * height) / subdivisionsY - height / 2.0);\r\n const normal = new Vector3(0, 1.0, 0);\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / subdivisionsX, useOpenGLOrientationForUV ? row / subdivisionsY : 1.0 - row / subdivisionsY);\r\n }\r\n }\r\n\r\n for (row = 0; row < subdivisionsY; row++) {\r\n for (col = 0; col < subdivisionsX; col++) {\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + row * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n\r\n indices.push(col + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground\r\n * - `xmin` ground minimum X coordinate, default -1\r\n * - `zmin` ground minimum Z coordinate, default -1\r\n * - `xmax` ground maximum X coordinate, default 1\r\n * - `zmax` ground maximum Z coordinate, default 1\r\n * - `subdivisions` a javascript object `\\{w: positive integer, h: positive integer\\}`, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default `\\{w: 6, h: 6\\}`\r\n * - `precision` a javascript object `\\{w: positive integer, h: positive integer\\}`, `w` and `h` are the numbers of subdivisions on the tile width and height, default `\\{w: 2, h: 2\\}`\r\n * @returns the VertexData of the TiledGround\r\n */\r\nexport function CreateTiledGroundVertexData(options: {\r\n xmin: number;\r\n zmin: number;\r\n xmax: number;\r\n zmax: number;\r\n subdivisions?: { w: number; h: number };\r\n precision?: { w: number; h: number };\r\n}): VertexData {\r\n const xmin = options.xmin !== undefined && options.xmin !== null ? options.xmin : -1.0;\r\n const zmin = options.zmin !== undefined && options.zmin !== null ? options.zmin : -1.0;\r\n const xmax = options.xmax !== undefined && options.xmax !== null ? options.xmax : 1.0;\r\n const zmax = options.zmax !== undefined && options.zmax !== null ? options.zmax : 1.0;\r\n const subdivisions = options.subdivisions || { w: 1, h: 1 };\r\n const precision = options.precision || { w: 1, h: 1 };\r\n\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n let row: number, col: number, tileRow: number, tileCol: number;\r\n\r\n subdivisions.h = subdivisions.h < 1 ? 1 : subdivisions.h;\r\n subdivisions.w = subdivisions.w < 1 ? 1 : subdivisions.w;\r\n precision.w = precision.w < 1 ? 1 : precision.w;\r\n precision.h = precision.h < 1 ? 1 : precision.h;\r\n\r\n const tileSize = {\r\n w: (xmax - xmin) / subdivisions.w,\r\n h: (zmax - zmin) / subdivisions.h,\r\n };\r\n\r\n function applyTile(xTileMin: number, zTileMin: number, xTileMax: number, zTileMax: number) {\r\n // Indices\r\n const base = positions.length / 3;\r\n const rowLength = precision.w + 1;\r\n for (row = 0; row < precision.h; row++) {\r\n for (col = 0; col < precision.w; col++) {\r\n const square = [base + col + row * rowLength, base + (col + 1) + row * rowLength, base + (col + 1) + (row + 1) * rowLength, base + col + (row + 1) * rowLength];\r\n\r\n indices.push(square[1]);\r\n indices.push(square[2]);\r\n indices.push(square[3]);\r\n indices.push(square[0]);\r\n indices.push(square[1]);\r\n indices.push(square[3]);\r\n }\r\n }\r\n\r\n // Position, normals and uvs\r\n const position = Vector3.Zero();\r\n const normal = new Vector3(0, 1.0, 0);\r\n for (row = 0; row <= precision.h; row++) {\r\n position.z = (row * (zTileMax - zTileMin)) / precision.h + zTileMin;\r\n for (col = 0; col <= precision.w; col++) {\r\n position.x = (col * (xTileMax - xTileMin)) / precision.w + xTileMin;\r\n position.y = 0;\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / precision.w, row / precision.h);\r\n }\r\n }\r\n }\r\n\r\n for (tileRow = 0; tileRow < subdivisions.h; tileRow++) {\r\n for (tileCol = 0; tileCol < subdivisions.w; tileCol++) {\r\n applyTile(xmin + tileCol * tileSize.w, zmin + tileRow * tileSize.h, xmin + (tileCol + 1) * tileSize.w, zmin + (tileRow + 1) * tileSize.h);\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap\r\n * - `width` the width (x direction) of the ground\r\n * - `height` the height (z direction) of the ground\r\n * - `subdivisions` the number of subdivisions per side\r\n * - `minHeight` the minimum altitude on the ground, optional, default 0\r\n * - `maxHeight` the maximum altitude on the ground, optional default 1\r\n * - `colorFilter` the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * - `buffer` the array holding the image color data\r\n * - `bufferWidth` the width of image\r\n * - `bufferHeight` the height of image\r\n * - `alphaFilter` Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * - `heightBuffer` a array of floats where the height data can be saved, if its length is greater than zero.\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\nexport function CreateGroundFromHeightMapVertexData(options: {\r\n width: number;\r\n height: number;\r\n subdivisions: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n colorFilter: Color3;\r\n buffer: Uint8Array;\r\n bufferWidth: number;\r\n bufferHeight: number;\r\n alphaFilter: number;\r\n heightBuffer?: Float32Array;\r\n}): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row, col;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n let invert = false;\r\n\r\n if (options.minHeight > options.maxHeight) {\r\n invert = true;\r\n const temp = options.maxHeight;\r\n options.maxHeight = options.minHeight;\r\n options.minHeight = temp;\r\n }\r\n\r\n // Vertices\r\n for (row = 0; row <= options.subdivisions; row++) {\r\n for (col = 0; col <= options.subdivisions; col++) {\r\n const position = new Vector3(\r\n (col * options.width) / options.subdivisions - options.width / 2.0,\r\n 0,\r\n ((options.subdivisions - row) * options.height) / options.subdivisions - options.height / 2.0\r\n );\r\n\r\n // Compute height\r\n const heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;\r\n const heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;\r\n const pos = (heightMapX + heightMapY * options.bufferWidth) * 4;\r\n let r = options.buffer[pos] / 255.0;\r\n let g = options.buffer[pos + 1] / 255.0;\r\n let b = options.buffer[pos + 2] / 255.0;\r\n const a = options.buffer[pos + 3] / 255.0;\r\n\r\n if (invert) {\r\n r = 1.0 - r;\r\n g = 1.0 - g;\r\n b = 1.0 - b;\r\n }\r\n\r\n const gradient = r * filter.r + g * filter.g + b * filter.b;\r\n\r\n // If our alpha channel is not within our filter then we will assign a 'special' height\r\n // Then when building the indices, we will ignore any vertex that is using the special height\r\n if (a >= alphaFilter) {\r\n position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;\r\n } else {\r\n position.y = options.minHeight - Epsilon; // We can't have a height below minHeight, normally.\r\n }\r\n if (options.heightBuffer) {\r\n // set the height buffer information in row major order.\r\n options.heightBuffer[row * (options.subdivisions + 1) + col] = position.y;\r\n }\r\n\r\n // Add vertex\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(0, 0, 0);\r\n uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);\r\n }\r\n }\r\n\r\n // Indices\r\n for (row = 0; row < options.subdivisions; row++) {\r\n for (col = 0; col < options.subdivisions; col++) {\r\n // Calculate Indices\r\n const idx1 = col + 1 + (row + 1) * (options.subdivisions + 1);\r\n const idx2 = col + 1 + row * (options.subdivisions + 1);\r\n const idx3 = col + row * (options.subdivisions + 1);\r\n const idx4 = col + (row + 1) * (options.subdivisions + 1);\r\n\r\n // Check that all indices are visible (based on our special height)\r\n // Only display the vertex if all Indices are visible\r\n // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height\r\n const isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx1 && isVisibleIdx2 && isVisibleIdx3) {\r\n indices.push(idx1);\r\n indices.push(idx2);\r\n indices.push(idx3);\r\n }\r\n\r\n const isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {\r\n indices.push(idx4);\r\n indices.push(idx1);\r\n indices.push(idx3);\r\n }\r\n }\r\n }\r\n\r\n // Normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * - `width` set the width size (float, default 1)\r\n * - `height` set the height size (float, default 1)\r\n * - `subdivisions` sets the number of subdivision per side (default 1)\r\n * - `subdivisionsX` sets the number of subdivision on the X axis (overrides subdivisions)\r\n * - `subdivisionsY` sets the number of subdivision on the Y axis (overrides subdivisions)\r\n * - `updatable` defines if the mesh must be flagged as updatable (default false)\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground\r\n */\r\nexport function CreateGround(\r\n name: string,\r\n options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; updatable?: boolean } = {},\r\n scene?: Scene\r\n): GroundMesh {\r\n const ground = new GroundMesh(name, scene);\r\n ground._setReady(false);\r\n ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n ground._width = options.width || 1;\r\n ground._height = options.height || 1;\r\n ground._maxX = ground._width / 2;\r\n ground._maxZ = ground._height / 2;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n const vertexData = CreateGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(ground, options.updatable);\r\n\r\n ground._setReady(true);\r\n\r\n return ground;\r\n}\r\n\r\n/**\r\n * Creates a tiled ground mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * - `xmin` ground minimum X coordinate (float, default -1)\r\n * - `zmin` ground minimum Z coordinate (float, default -1)\r\n * - `xmax` ground maximum X coordinate (float, default 1)\r\n * - `zmax` ground maximum Z coordinate (float, default 1)\r\n * - `subdivisions` a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * - `subdivisions.w` positive integer, default 6\r\n * - `subdivisions.h` positive integer, default 6\r\n * - `precision` a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * - `precision.w` positive integer, default 2\r\n * - `precision.h` positive integer, default 2\r\n * - `updatable` boolean, default false, true if the mesh must be flagged as updatable\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground\r\n */\r\nexport function CreateTiledGround(\r\n name: string,\r\n options: { xmin: number; zmin: number; xmax: number; zmax: number; subdivisions?: { w: number; h: number }; precision?: { w: number; h: number }; updatable?: boolean },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const tiledGround = new Mesh(name, scene);\r\n\r\n const vertexData = CreateTiledGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(tiledGround, options.updatable);\r\n\r\n return tiledGround;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh from a height map. The height map download can take some frames,\r\n * so the mesh is not immediately ready. To wait for the mesh to be completely built,\r\n * you should use the `onReady` callback option.\r\n * @param name defines the name of the mesh\r\n * @param url sets the URL of the height map image resource.\r\n * @param options defines the options used to create the mesh\r\n * - `width` sets the ground width size (positive float, default 10)\r\n * - `height` sets the ground height size (positive float, default 10)\r\n * - `subdivisions` sets the number of subdivision per side (positive integer, default 1)\r\n * - `minHeight` is the minimum altitude on the ground (float, default 0)\r\n * - `maxHeight` is the maximum altitude on the ground (float, default 1)\r\n * - `colorFilter` is the filter to apply to the image pixel colors to compute the height (optional Color3, default (0.3, 0.59, 0.11) )\r\n * - `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * - `updatable` defines if the mesh must be flagged as updatable\r\n * - `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)\r\n * - `onError` is a javascript callback function that will be called if there is an error\r\n * - `passHeightBufferInCallback` a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground-from-a-height-map\r\n */\r\nexport function CreateGroundFromHeightMap(\r\n name: string,\r\n url: string | { data: Uint8Array; width: number; height: number },\r\n options: {\r\n width?: number;\r\n height?: number;\r\n subdivisions?: number;\r\n minHeight?: number;\r\n maxHeight?: number;\r\n colorFilter?: Color3;\r\n alphaFilter?: number;\r\n updatable?: boolean;\r\n onReady?: (mesh: GroundMesh, heightBuffer?: Float32Array) => void;\r\n onError?: (message?: string, exception?: any) => void;\r\n passHeightBufferInCallback?: boolean;\r\n } = {},\r\n scene: Nullable<Scene> = null\r\n): GroundMesh {\r\n const width = options.width || 10.0;\r\n const height = options.height || 10.0;\r\n const subdivisions = options.subdivisions || 1 | 0;\r\n const minHeight = options.minHeight || 0.0;\r\n const maxHeight = options.maxHeight || 1.0;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n const updatable = options.updatable;\r\n const onReady = options.onReady;\r\n\r\n scene = scene || EngineStore.LastCreatedScene!;\r\n\r\n const ground = new GroundMesh(name, scene);\r\n ground._subdivisionsX = subdivisions;\r\n ground._subdivisionsY = subdivisions;\r\n ground._width = width;\r\n ground._height = height;\r\n ground._maxX = ground._width / 2.0;\r\n ground._maxZ = ground._height / 2.0;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n ground._setReady(false);\r\n\r\n let heightBuffer: Float32Array;\r\n if (options.passHeightBufferInCallback) {\r\n heightBuffer = new Float32Array((subdivisions + 1) * (subdivisions + 1));\r\n }\r\n\r\n const onBufferLoaded = (buffer: Uint8Array, bufferWidth: number, bufferHeight: number) => {\r\n const vertexData = CreateGroundFromHeightMapVertexData({\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight,\r\n maxHeight: maxHeight,\r\n colorFilter: filter,\r\n buffer: buffer,\r\n bufferWidth: bufferWidth,\r\n bufferHeight: bufferHeight,\r\n alphaFilter: alphaFilter,\r\n heightBuffer,\r\n });\r\n\r\n vertexData.applyToMesh(ground, updatable);\r\n\r\n //execute ready callback, if set\r\n if (onReady) {\r\n onReady(ground, heightBuffer);\r\n }\r\n\r\n ground._setReady(true);\r\n };\r\n\r\n if (typeof url === \"string\") {\r\n const onload = (img: HTMLImageElement | ImageBitmap) => {\r\n const bufferWidth = img.width;\r\n const bufferHeight = img.height;\r\n\r\n if (scene.isDisposed) {\r\n return;\r\n }\r\n\r\n const buffer = scene?.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);\r\n\r\n onBufferLoaded(buffer, bufferWidth, bufferHeight);\r\n };\r\n\r\n Tools.LoadImage(url, onload, options.onError ? options.onError : () => {}, scene.offlineProvider);\r\n } else {\r\n onBufferLoaded(url.data, url.width, url.height);\r\n }\r\n\r\n return ground;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const GroundBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGround,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGroundFromHeightMap,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTiledGround,\r\n};\r\n\r\nVertexData.CreateGround = CreateGroundVertexData;\r\nVertexData.CreateTiledGround = CreateTiledGroundVertexData;\r\nVertexData.CreateGroundFromHeightMap = CreateGroundFromHeightMapVertexData;\r\n\r\nMesh.CreateGround = (name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n updatable,\r\n };\r\n\r\n return CreateGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateTiledGround = (\r\n name: string,\r\n xmin: number,\r\n zmin: number,\r\n xmax: number,\r\n zmax: number,\r\n subdivisions: { w: number; h: number },\r\n precision: { w: number; h: number },\r\n scene: Scene,\r\n updatable?: boolean\r\n): Mesh => {\r\n const options = {\r\n xmin,\r\n zmin,\r\n xmax,\r\n zmax,\r\n subdivisions,\r\n precision,\r\n updatable,\r\n };\r\n\r\n return CreateTiledGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateGroundFromHeightMap = (\r\n name: string,\r\n url: string,\r\n width: number,\r\n height: number,\r\n subdivisions: number,\r\n minHeight: number,\r\n maxHeight: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n onReady?: (mesh: GroundMesh) => void,\r\n alphaFilter?: number\r\n): GroundMesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n minHeight,\r\n maxHeight,\r\n updatable,\r\n onReady,\r\n alphaFilter,\r\n };\r\n\r\n return CreateGroundFromHeightMap(name, url, options, scene);\r\n};\r\n"]}
|
|
@@ -20,19 +20,6 @@ import { VertexData } from "../mesh.vertexData.js";
|
|
|
20
20
|
* * faceColors an array of 6 Color4 elements used to set different colors to each box side
|
|
21
21
|
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
22
22
|
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
23
|
-
* @param options.pattern
|
|
24
|
-
* @param options.size
|
|
25
|
-
* @param options.width
|
|
26
|
-
* @param options.height
|
|
27
|
-
* @param options.depth
|
|
28
|
-
* @param options.tileSize
|
|
29
|
-
* @param options.tileWidth
|
|
30
|
-
* @param options.tileHeight
|
|
31
|
-
* @param options.faceUV
|
|
32
|
-
* @param options.faceColors
|
|
33
|
-
* @param options.alignHorizontal
|
|
34
|
-
* @param options.alignVertical
|
|
35
|
-
* @param options.sideOrientation
|
|
36
23
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
37
24
|
* @returns the VertexData of the TiledBox
|
|
38
25
|
*/
|
|
@@ -69,19 +56,6 @@ export declare function CreateTiledBoxVertexData(options: {
|
|
|
69
56
|
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
70
57
|
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
71
58
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
72
|
-
* @param options.pattern
|
|
73
|
-
* @param options.width
|
|
74
|
-
* @param options.height
|
|
75
|
-
* @param options.depth
|
|
76
|
-
* @param options.tileSize
|
|
77
|
-
* @param options.tileWidth
|
|
78
|
-
* @param options.tileHeight
|
|
79
|
-
* @param options.alignHorizontal
|
|
80
|
-
* @param options.alignVertical
|
|
81
|
-
* @param options.faceUV
|
|
82
|
-
* @param options.faceColors
|
|
83
|
-
* @param options.sideOrientation
|
|
84
|
-
* @param options.updatable
|
|
85
59
|
* @param scene defines the hosting scene
|
|
86
60
|
* @returns the box mesh
|
|
87
61
|
*/
|
|
@@ -22,19 +22,6 @@ const OP_SUB = -1;
|
|
|
22
22
|
* * faceColors an array of 6 Color4 elements used to set different colors to each box side
|
|
23
23
|
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
24
24
|
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
25
|
-
* @param options.pattern
|
|
26
|
-
* @param options.size
|
|
27
|
-
* @param options.width
|
|
28
|
-
* @param options.height
|
|
29
|
-
* @param options.depth
|
|
30
|
-
* @param options.tileSize
|
|
31
|
-
* @param options.tileWidth
|
|
32
|
-
* @param options.tileHeight
|
|
33
|
-
* @param options.faceUV
|
|
34
|
-
* @param options.faceColors
|
|
35
|
-
* @param options.alignHorizontal
|
|
36
|
-
* @param options.alignVertical
|
|
37
|
-
* @param options.sideOrientation
|
|
38
25
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
39
26
|
* @returns the VertexData of the TiledBox
|
|
40
27
|
*/
|
|
@@ -206,19 +193,6 @@ export function CreateTiledBoxVertexData(options) {
|
|
|
206
193
|
* * alignHorizontal places whole tiles aligned to the center, left or right of a row
|
|
207
194
|
* * alignVertical places whole tiles aligned to the center, left or right of a column
|
|
208
195
|
* * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
|
|
209
|
-
* @param options.pattern
|
|
210
|
-
* @param options.width
|
|
211
|
-
* @param options.height
|
|
212
|
-
* @param options.depth
|
|
213
|
-
* @param options.tileSize
|
|
214
|
-
* @param options.tileWidth
|
|
215
|
-
* @param options.tileHeight
|
|
216
|
-
* @param options.alignHorizontal
|
|
217
|
-
* @param options.alignVertical
|
|
218
|
-
* @param options.faceUV
|
|
219
|
-
* @param options.faceColors
|
|
220
|
-
* @param options.sideOrientation
|
|
221
|
-
* @param options.updatable
|
|
222
196
|
* @param scene defines the hosting scene
|
|
223
197
|
* @returns the box mesh
|
|
224
198
|
*/
|