@babylonjs/core 6.34.0 → 6.34.2

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.
Files changed (133) hide show
  1. package/Animations/animation.js +1 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/Buffers/storageBuffer.d.ts +2 -1
  4. package/Buffers/storageBuffer.js +3 -2
  5. package/Buffers/storageBuffer.js.map +1 -1
  6. package/Cameras/Inputs/followCameraMouseWheelInput.js +12 -9
  7. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  8. package/Cameras/Inputs/followCameraPointersInput.js +28 -9
  9. package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
  10. package/Cameras/arcRotateCamera.js +1 -1
  11. package/Cameras/arcRotateCamera.js.map +1 -1
  12. package/Cameras/followCameraInputsManager.js +2 -1
  13. package/Cameras/followCameraInputsManager.js.map +1 -1
  14. package/Debug/skeletonViewer.js +2 -1
  15. package/Debug/skeletonViewer.js.map +1 -1
  16. package/Engines/Extensions/engine.storageBuffer.d.ts +2 -1
  17. package/Engines/Extensions/engine.storageBuffer.js.map +1 -1
  18. package/Engines/Processors/shaderCodeInliner.js +15 -14
  19. package/Engines/Processors/shaderCodeInliner.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/engine.computeShader.js +3 -2
  21. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  22. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +14 -5
  23. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
  24. package/Engines/WebGPU/webgpuShaderProcessor.js +2 -1
  25. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  26. package/Engines/WebGPU/webgpuTintWASM.js +3 -2
  27. package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
  28. package/Engines/engine.d.ts +2 -4
  29. package/Engines/engine.js.map +1 -1
  30. package/Engines/nativeEngine.js +4 -2
  31. package/Engines/nativeEngine.js.map +1 -1
  32. package/Engines/thinEngine.js +4 -4
  33. package/Engines/thinEngine.js.map +1 -1
  34. package/Engines/webgpuEngine.js +75 -46
  35. package/Engines/webgpuEngine.js.map +1 -1
  36. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +2 -1
  37. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  38. package/FlowGraph/flowGraphBlock.js +1 -21
  39. package/FlowGraph/flowGraphBlock.js.map +1 -1
  40. package/FlowGraph/flowGraphExecutionBlock.d.ts +1 -0
  41. package/FlowGraph/flowGraphExecutionBlock.js +20 -0
  42. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  43. package/Gizmos/axisScaleGizmo.d.ts +1 -0
  44. package/Gizmos/axisScaleGizmo.js +12 -0
  45. package/Gizmos/axisScaleGizmo.js.map +1 -1
  46. package/Gizmos/lightGizmo.js +2 -1
  47. package/Gizmos/lightGizmo.js.map +1 -1
  48. package/Gizmos/rotationGizmo.js +1 -1
  49. package/Gizmos/rotationGizmo.js.map +1 -1
  50. package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
  51. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  52. package/Materials/Node/Blocks/Dual/lightBlock.js +2 -1
  53. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  54. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +3 -2
  55. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
  56. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js +2 -1
  57. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -1
  58. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +2 -1
  59. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  60. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +2 -1
  61. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  62. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +3 -2
  63. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  64. package/Materials/Node/Blocks/PBR/reflectionBlock.js +2 -1
  65. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  66. package/Materials/Node/nodeMaterial.js +9 -8
  67. package/Materials/Node/nodeMaterial.js.map +1 -1
  68. package/Materials/Node/nodeMaterialBlock.js +2 -1
  69. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  70. package/Materials/Textures/renderTargetTexture.js +1 -2
  71. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  72. package/Meshes/Builders/groundBuilder.d.ts +7 -1
  73. package/Meshes/Builders/groundBuilder.js +17 -8
  74. package/Meshes/Builders/groundBuilder.js.map +1 -1
  75. package/Meshes/Compression/dracoCompression.js.map +1 -1
  76. package/Meshes/Node/nodeGeometryBlock.js +2 -1
  77. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  78. package/Meshes/mesh.d.ts +2 -1
  79. package/Meshes/mesh.js +3 -2
  80. package/Meshes/mesh.js.map +1 -1
  81. package/Misc/assetsManager.js +2 -2
  82. package/Misc/assetsManager.js.map +1 -1
  83. package/Misc/dds.js +1 -1
  84. package/Misc/dds.js.map +1 -1
  85. package/Misc/fileTools.js +4 -0
  86. package/Misc/fileTools.js.map +1 -1
  87. package/Misc/logger.d.ts +3 -3
  88. package/Misc/logger.js +8 -4
  89. package/Misc/logger.js.map +1 -1
  90. package/Misc/sceneSerializer.js +2 -1
  91. package/Misc/sceneSerializer.js.map +1 -1
  92. package/Misc/tools.d.ts +2 -7
  93. package/Misc/tools.js.map +1 -1
  94. package/Navigation/Plugins/recastJSPlugin.js +3 -3
  95. package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
  96. package/Physics/v2/Plugins/havokPlugin.js +1 -1
  97. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  98. package/Physics/v2/index.d.ts +1 -0
  99. package/Physics/v2/index.js +1 -0
  100. package/Physics/v2/index.js.map +1 -1
  101. package/Physics/v2/physicsBody.d.ts +5 -0
  102. package/Physics/v2/physicsBody.js +7 -0
  103. package/Physics/v2/physicsBody.js.map +1 -1
  104. package/Physics/v2/ragdoll.d.ts +102 -0
  105. package/Physics/v2/ragdoll.js +221 -0
  106. package/Physics/v2/ragdoll.js.map +1 -0
  107. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +2 -2
  108. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  109. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +3 -2
  110. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  111. package/PostProcesses/screenSpaceCurvaturePostProcess.js +1 -1
  112. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  113. package/PostProcesses/screenSpaceReflectionPostProcess.js +3 -2
  114. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  115. package/Rendering/GaussianSplatting/gaussianSplatting.js.map +1 -1
  116. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +3 -2
  117. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  118. package/XR/features/WebXRControllerPhysics.js +2 -2
  119. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  120. package/XR/features/WebXRMeshDetector.js +2 -1
  121. package/XR/features/WebXRMeshDetector.js.map +1 -1
  122. package/XR/features/WebXRWalkingLocomotion.js +1 -1
  123. package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
  124. package/XR/motionController/webXRMotionControllerManager.js +1 -1
  125. package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
  126. package/XR/webXRExperienceHelper.js +2 -2
  127. package/XR/webXRExperienceHelper.js.map +1 -1
  128. package/assetContainer.js +2 -2
  129. package/assetContainer.js.map +1 -1
  130. package/package.json +1 -1
  131. package/scene.d.ts +2 -4
  132. package/scene.js +2 -1
  133. package/scene.js.map +1 -1
@@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AI,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 { CompatibilityOptions } 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 * @param options.width\r\n * @param options.height\r\n * @param options.subdivisions\r\n * @param options.subdivisionsX\r\n * @param options.subdivisionsY\r\n * @returns the VertexData of the Ground\r\n */\r\nexport function CreateGroundVertexData(options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number }): 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 || 1;\r\n const height: number = options.height || 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, CompatibilityOptions.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, required but can be empty\r\n * * xmin the ground minimum X coordinate, optional, default -1\r\n * * zmin the ground minimum Z coordinate, optional, default -1\r\n * * xmax the ground maximum X coordinate, optional, default 1\r\n * * zmax the ground maximum Z coordinate, optional, 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 * @param options.xmin\r\n * @param options.zmin\r\n * @param options.xmax\r\n * @param options.zmax\r\n * @param options.subdivisions\r\n * @param options.subdivisions.w\r\n * @param options.subdivisions.h\r\n * @param options.precision\r\n * @param options.precision.w\r\n * @param options.precision.h\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 * @param options.width\r\n * @param options.height\r\n * @param options.subdivisions\r\n * @param options.minHeight\r\n * @param options.maxHeight\r\n * @param options.colorFilter\r\n * @param options.buffer\r\n * @param options.bufferWidth\r\n * @param options.bufferHeight\r\n * @param options.alphaFilter\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}): 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\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\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 * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground\r\n * * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\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\r\n * @param options.height\r\n * @param options.subdivisions\r\n * @param options.subdivisionsX\r\n * @param options.subdivisionsY\r\n * @param options.updatable\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 * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates\r\n * * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates\r\n * * The parameter `subdivisions` is 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 * * The parameter `precision` is 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 * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\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\r\n * @param options.zmin\r\n * @param options.xmax\r\n * @param options.zmax\r\n * @param options.subdivisions\r\n * @param options.subdivisions.w\r\n * @param options.subdivisions.h\r\n * @param options.precision\r\n * @param options.precision.w\r\n * @param options.precision.h\r\n * @param options.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\r\n * * The parameter `url` sets the URL of the height map image resource.\r\n * * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.\r\n * * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.\r\n * * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.\r\n * * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.\r\n * * The parameter `colorFilter` (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.\r\n * * 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).\r\n * * The parameter `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param url defines the url to the height map\r\n * @param options defines the options used to create the mesh\r\n * @param options.width\r\n * @param options.height\r\n * @param options.subdivisions\r\n * @param options.minHeight\r\n * @param options.maxHeight\r\n * @param options.colorFilter\r\n * @param options.alphaFilter\r\n * @param options.updatable\r\n * @param options.onReady\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,\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) => void;\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 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 = <Uint8Array>scene?.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);\r\n\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 });\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);\r\n }\r\n\r\n ground._setReady(true);\r\n };\r\n\r\n Tools.LoadImage(url, onload, () => {}, scene.offlineProvider);\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,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAmH;IACtJ,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,CAAC,CAAC;IACzC,MAAM,MAAM,GAAW,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;IAC3C,MAAM,aAAa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,CAAC,iBAAiB,GAAG,2BAA2B,CAAC;AAC3D,UAAU,CAAC,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 { CompatibilityOptions } 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 * @param options.width\r\n * @param options.height\r\n * @param options.subdivisions\r\n * @param options.subdivisionsX\r\n * @param options.subdivisionsY\r\n * @returns the VertexData of the Ground\r\n */\r\nexport function CreateGroundVertexData(options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number }): 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 || 1;\r\n const height: number = options.height || 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, CompatibilityOptions.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, required but can be empty\r\n * * xmin the ground minimum X coordinate, optional, default -1\r\n * * zmin the ground minimum Z coordinate, optional, default -1\r\n * * xmax the ground maximum X coordinate, optional, default 1\r\n * * zmax the ground maximum Z coordinate, optional, 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 * @param options.xmin\r\n * @param options.zmin\r\n * @param options.xmax\r\n * @param options.zmax\r\n * @param options.subdivisions\r\n * @param options.subdivisions.w\r\n * @param options.subdivisions.h\r\n * @param options.precision\r\n * @param options.precision.w\r\n * @param options.precision.h\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 * @param options.width\r\n * @param options.height\r\n * @param options.subdivisions\r\n * @param options.minHeight\r\n * @param options.maxHeight\r\n * @param options.colorFilter\r\n * @param options.buffer\r\n * @param options.bufferWidth\r\n * @param options.bufferHeight\r\n * @param options.alphaFilter\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}): 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\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\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 * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground\r\n * * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\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\r\n * @param options.height\r\n * @param options.subdivisions\r\n * @param options.subdivisionsX\r\n * @param options.subdivisionsY\r\n * @param options.updatable\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 * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates\r\n * * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates\r\n * * The parameter `subdivisions` is 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 * * The parameter `precision` is 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 * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\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\r\n * @param options.zmin\r\n * @param options.xmax\r\n * @param options.zmax\r\n * @param options.subdivisions\r\n * @param options.subdivisions.w\r\n * @param options.subdivisions.h\r\n * @param options.precision\r\n * @param options.precision.w\r\n * @param options.precision.h\r\n * @param options.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\r\n * * The parameter `url` sets the URL of the height map image resource.\r\n * * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.\r\n * * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.\r\n * * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.\r\n * * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.\r\n * * The parameter `colorFilter` (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.\r\n * * 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).\r\n * * The parameter `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param url defines the url to the height map\r\n * @param options defines the options used to create the mesh\r\n * @param options.width\r\n * @param options.height\r\n * @param options.subdivisions\r\n * @param options.minHeight\r\n * @param options.maxHeight\r\n * @param options.colorFilter\r\n * @param options.alphaFilter\r\n * @param options.updatable\r\n * @param options.onReady\r\n * @param options.onError\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) => void;\r\n onError?: (message?: string, exception?: any) => void;\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 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 });\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);\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 = <Uint8Array>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 +1 @@
1
-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KAAK,CAAC,cAAc,wBAAwB;KAC/D;CACJ,CAAC;AAUF;;GAEG;AACW,kCAAiB,GAAG,gBAAgB,CAAC,oBAAoB,EAAE,CAAC;AAW3D,yBAAQ,GAA+B,IAAI,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { AutoReleaseWorkerPool } from \"../../Misc/workerPool\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { IDisposable, Scene } from \"../../scene\";\r\nimport { Geometry } from \"../geometry\";\r\nimport { VertexBuffer } from \"../buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DracoDecoderModule } from \"draco3dgltf\";\r\nimport type { DecoderModule, DecoderBuffer, Decoder, Mesh, PointCloud, Status } from \"draco3dgltf\";\r\nimport { Logger } from \"../../Misc/logger\";\r\n\r\ndeclare let DracoDecoderModule: DracoDecoderModule;\r\n\r\ninterface AttributeData {\r\n kind: string;\r\n data: ArrayBufferView;\r\n size: number;\r\n byteOffset: number;\r\n byteStride: number;\r\n normalized: boolean;\r\n}\r\n\r\ninterface MeshData {\r\n indices?: Uint16Array | Uint32Array;\r\n attributes: Array<AttributeData>;\r\n totalVertices: number;\r\n}\r\n\r\ninterface InitDoneMessage {\r\n id: \"initDone\";\r\n}\r\n\r\ninterface DecodeMeshDoneMessage {\r\n id: \"decodeMeshDone\";\r\n totalVertices: number;\r\n}\r\n\r\ninterface IndicesMessage {\r\n id: \"indices\";\r\n data: Uint16Array | Uint32Array;\r\n}\r\n\r\ninterface AttributeMessage extends AttributeData {\r\n id: \"attribute\";\r\n}\r\n\r\ntype Message = InitDoneMessage | DecodeMeshDoneMessage | IndicesMessage | AttributeMessage;\r\n\r\n// WorkerGlobalScope\r\ndeclare function importScripts(...urls: string[]): void;\r\ndeclare function postMessage(message: Message, transfer?: any[]): void;\r\n\r\nfunction createDecoderAsync(wasmBinary?: ArrayBuffer): Promise<{ module: DecoderModule }> {\r\n return new Promise((resolve) => {\r\n DracoDecoderModule({ wasmBinary: wasmBinary }).then((module) => {\r\n resolve({ module: module });\r\n });\r\n });\r\n}\r\n\r\nfunction decodeMesh(\r\n decoderModule: DecoderModule,\r\n data: Int8Array,\r\n attributes: { [kind: string]: number } | undefined,\r\n onIndicesData: (indices: Uint16Array | Uint32Array) => void,\r\n onAttributeData: (kind: string, data: ArrayBufferView, size: number, offset: number, stride: number, normalized: boolean) => void\r\n): number {\r\n let decoder: Nullable<Decoder> = null;\r\n let buffer: Nullable<DecoderBuffer> = null;\r\n let geometry: Nullable<Mesh | PointCloud> = null;\r\n\r\n try {\r\n decoder = new decoderModule.Decoder();\r\n\r\n buffer = new decoderModule.DecoderBuffer();\r\n buffer.Init(data, data.byteLength);\r\n\r\n let status: Status;\r\n const type = decoder.GetEncodedGeometryType(buffer);\r\n switch (type) {\r\n case decoderModule.TRIANGULAR_MESH: {\r\n const mesh = new decoderModule.Mesh();\r\n status = decoder.DecodeBufferToMesh(buffer, mesh);\r\n if (!status.ok() || mesh.ptr === 0) {\r\n throw new Error(status.error_msg());\r\n }\r\n\r\n const numFaces = mesh.num_faces();\r\n const numIndices = numFaces * 3;\r\n const byteLength = numIndices * 4;\r\n\r\n const ptr = decoderModule._malloc(byteLength);\r\n try {\r\n decoder.GetTrianglesUInt32Array(mesh, byteLength, ptr);\r\n const indices = new Uint32Array(numIndices);\r\n indices.set(new Uint32Array(decoderModule.HEAPF32.buffer, ptr, numIndices));\r\n onIndicesData(indices);\r\n } finally {\r\n decoderModule._free(ptr);\r\n }\r\n\r\n geometry = mesh;\r\n break;\r\n }\r\n case decoderModule.POINT_CLOUD: {\r\n const pointCloud = new decoderModule.PointCloud();\r\n status = decoder.DecodeBufferToPointCloud(buffer, pointCloud);\r\n if (!status.ok() || !pointCloud.ptr) {\r\n throw new Error(status.error_msg());\r\n }\r\n\r\n geometry = pointCloud;\r\n break;\r\n }\r\n default: {\r\n throw new Error(`Invalid geometry type ${type}`);\r\n }\r\n }\r\n\r\n const numPoints = geometry.num_points();\r\n\r\n const processAttribute = (decoder: Decoder, geometry: Mesh | PointCloud, kind: string, attribute: any) => {\r\n const dataType = attribute.data_type();\r\n const numComponents = attribute.num_components();\r\n const normalized = attribute.normalized();\r\n const byteStride = attribute.byte_stride();\r\n const byteOffset = attribute.byte_offset();\r\n\r\n const dataTypeInfo = {\r\n [decoderModule.DT_FLOAT32]: { typedArrayConstructor: Float32Array, heap: decoderModule.HEAPF32 },\r\n [decoderModule.DT_INT8]: { typedArrayConstructor: Int8Array, heap: decoderModule.HEAP8 },\r\n [decoderModule.DT_INT16]: { typedArrayConstructor: Int16Array, heap: decoderModule.HEAP16 },\r\n [decoderModule.DT_INT32]: { typedArrayConstructor: Int32Array, heap: decoderModule.HEAP32 },\r\n [decoderModule.DT_UINT8]: { typedArrayConstructor: Uint8Array, heap: decoderModule.HEAPU8 },\r\n [decoderModule.DT_UINT16]: { typedArrayConstructor: Uint16Array, heap: decoderModule.HEAPU16 },\r\n [decoderModule.DT_UINT32]: { typedArrayConstructor: Uint32Array, heap: decoderModule.HEAPU32 },\r\n };\r\n\r\n const info = dataTypeInfo[dataType];\r\n if (!info) {\r\n throw new Error(`Invalid data type ${dataType}`);\r\n }\r\n\r\n const numValues = numPoints * numComponents;\r\n const byteLength = numValues * info.typedArrayConstructor.BYTES_PER_ELEMENT;\r\n\r\n const ptr = decoderModule._malloc(byteLength);\r\n try {\r\n decoder.GetAttributeDataArrayForAllPoints(geometry, attribute, dataType, byteLength, ptr);\r\n const data = new info.typedArrayConstructor(info.heap.buffer, ptr, numValues);\r\n onAttributeData(kind, data.slice(), numComponents, byteOffset, byteStride, normalized);\r\n } finally {\r\n decoderModule._free(ptr);\r\n }\r\n };\r\n\r\n if (attributes) {\r\n for (const kind in attributes) {\r\n const id = attributes[kind];\r\n const attribute = decoder.GetAttributeByUniqueId(geometry, id);\r\n processAttribute(decoder, geometry, kind, attribute);\r\n }\r\n } else {\r\n const dracoAttributeTypes: { [kind: string]: number } = {\r\n position: decoderModule.POSITION,\r\n normal: decoderModule.NORMAL,\r\n color: decoderModule.COLOR,\r\n uv: decoderModule.TEX_COORD,\r\n };\r\n\r\n for (const kind in dracoAttributeTypes) {\r\n const id = decoder.GetAttributeId(geometry, dracoAttributeTypes[kind]);\r\n if (id !== -1) {\r\n const attribute = decoder.GetAttribute(geometry, id);\r\n processAttribute(decoder, geometry, kind, attribute);\r\n }\r\n }\r\n }\r\n\r\n return numPoints;\r\n } finally {\r\n if (geometry) {\r\n decoderModule.destroy(geometry);\r\n }\r\n\r\n if (buffer) {\r\n decoderModule.destroy(buffer);\r\n }\r\n\r\n if (decoder) {\r\n decoderModule.destroy(decoder);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction worker(): void {\r\n let decoderPromise: PromiseLike<any> | undefined;\r\n\r\n onmessage = (event) => {\r\n const message = event.data;\r\n switch (message.id) {\r\n case \"init\": {\r\n const decoder = message.decoder;\r\n if (decoder.url) {\r\n importScripts(decoder.url);\r\n decoderPromise = DracoDecoderModule({ wasmBinary: decoder.wasmBinary });\r\n }\r\n postMessage({ id: \"initDone\" });\r\n break;\r\n }\r\n case \"decodeMesh\": {\r\n if (!decoderPromise) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n decoderPromise.then((decoder) => {\r\n const numPoints = decodeMesh(\r\n decoder,\r\n message.dataView,\r\n message.attributes,\r\n (indices) => {\r\n postMessage({ id: \"indices\", data: indices }, [indices.buffer]);\r\n },\r\n (kind, data, size, offset, stride, normalized) => {\r\n postMessage({ id: \"attribute\", kind, data, size, byteOffset: offset, byteStride: stride, normalized }, [data.buffer]);\r\n }\r\n );\r\n postMessage({ id: \"decodeMeshDone\", totalVertices: numPoints });\r\n });\r\n break;\r\n }\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Configuration for Draco compression\r\n */\r\nexport interface IDracoCompressionConfiguration {\r\n /**\r\n * Configuration for the decoder.\r\n */\r\n decoder: {\r\n /**\r\n * The url to the WebAssembly module.\r\n */\r\n wasmUrl?: string;\r\n\r\n /**\r\n * The url to the WebAssembly binary.\r\n */\r\n wasmBinaryUrl?: string;\r\n\r\n /**\r\n * The url to the fallback JavaScript module.\r\n */\r\n fallbackUrl?: string;\r\n };\r\n}\r\n\r\n/**\r\n * Draco compression (https://google.github.io/draco/)\r\n *\r\n * This class wraps the Draco module.\r\n *\r\n * **Encoder**\r\n *\r\n * The encoder is not currently implemented.\r\n *\r\n * **Decoder**\r\n *\r\n * By default, the configuration points to a copy of the Draco decoder files for glTF from the babylon.js preview cdn https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js.\r\n *\r\n * To update the configuration, use the following code:\r\n * ```javascript\r\n * DracoCompression.Configuration = {\r\n * decoder: {\r\n * wasmUrl: \"<url to the WebAssembly library>\",\r\n * wasmBinaryUrl: \"<url to the WebAssembly binary>\",\r\n * fallbackUrl: \"<url to the fallback JavaScript library>\",\r\n * }\r\n * };\r\n * ```\r\n *\r\n * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support WebAssembly or only support the JavaScript version.\r\n * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.\r\n * Use `DracoCompression.DecoderAvailable` to determine if the decoder configuration is available for the current context.\r\n *\r\n * To decode Draco compressed data, get the default DracoCompression object and call decodeMeshToGeometryAsync:\r\n * ```javascript\r\n * var geometry = await DracoCompression.Default.decodeMeshToGeometryAsync(data);\r\n * ```\r\n *\r\n * @see https://playground.babylonjs.com/#DMZIBD#0\r\n */\r\nexport class DracoCompression implements IDisposable {\r\n private _workerPoolPromise?: Promise<AutoReleaseWorkerPool>;\r\n private _decoderModulePromise?: Promise<{ module: DecoderModule }>;\r\n\r\n /**\r\n * The configuration. Defaults to the following urls:\r\n * - wasmUrl: \"https://cdn.babylonjs.com/draco_wasm_wrapper_gltf.js\"\r\n * - wasmBinaryUrl: \"https://cdn.babylonjs.com/draco_decoder_gltf.wasm\"\r\n * - fallbackUrl: \"https://cdn.babylonjs.com/draco_decoder_gltf.js\"\r\n */\r\n public static Configuration: IDracoCompressionConfiguration = {\r\n decoder: {\r\n wasmUrl: `${Tools._DefaultCdnUrl}/draco_wasm_wrapper_gltf.js`,\r\n wasmBinaryUrl: `${Tools._DefaultCdnUrl}/draco_decoder_gltf.wasm`,\r\n fallbackUrl: `${Tools._DefaultCdnUrl}/draco_decoder_gltf.js`,\r\n },\r\n };\r\n\r\n /**\r\n * Returns true if the decoder configuration is available.\r\n */\r\n public static get DecoderAvailable(): boolean {\r\n const decoder = DracoCompression.Configuration.decoder;\r\n return !!((decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\") || decoder.fallbackUrl);\r\n }\r\n\r\n /**\r\n * Default number of workers to create when creating the draco compression object.\r\n */\r\n public static DefaultNumWorkers = DracoCompression.GetDefaultNumWorkers();\r\n\r\n private static GetDefaultNumWorkers(): number {\r\n if (typeof navigator !== \"object\" || !navigator.hardwareConcurrency) {\r\n return 1;\r\n }\r\n\r\n // Use 50% of the available logical processors but capped at 4.\r\n return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);\r\n }\r\n\r\n private static _Default: Nullable<DracoCompression> = null;\r\n\r\n /**\r\n * Default instance for the draco compression object.\r\n */\r\n public static get Default(): DracoCompression {\r\n if (!DracoCompression._Default) {\r\n DracoCompression._Default = new DracoCompression();\r\n }\r\n\r\n return DracoCompression._Default;\r\n }\r\n\r\n /**\r\n * Constructor\r\n * @param numWorkers The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context.\r\n */\r\n constructor(numWorkers = DracoCompression.DefaultNumWorkers) {\r\n const decoder = DracoCompression.Configuration.decoder;\r\n\r\n const decoderInfo: { url: string | undefined; wasmBinaryPromise: Promise<ArrayBuffer | string | undefined> } =\r\n decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\"\r\n ? {\r\n url: Tools.GetBabylonScriptURL(decoder.wasmUrl, true),\r\n wasmBinaryPromise: Tools.LoadFileAsync(Tools.GetBabylonScriptURL(decoder.wasmBinaryUrl, true)),\r\n }\r\n : {\r\n url: Tools.GetBabylonScriptURL(decoder.fallbackUrl!),\r\n wasmBinaryPromise: Promise.resolve(undefined),\r\n };\r\n\r\n if (numWorkers && typeof Worker === \"function\" && typeof URL === \"function\") {\r\n this._workerPoolPromise = decoderInfo.wasmBinaryPromise.then((decoderWasmBinary) => {\r\n const workerContent = `${decodeMesh}(${worker})()`;\r\n const workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n\r\n return new AutoReleaseWorkerPool(numWorkers, () => {\r\n return new Promise((resolve, reject) => {\r\n const worker = new Worker(workerBlobUrl);\r\n const onError = (error: ErrorEvent) => {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n\r\n const onMessage = (event: MessageEvent<Message>) => {\r\n if (event.data.id === \"initDone\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(worker);\r\n }\r\n };\r\n\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n\r\n worker.postMessage({\r\n id: \"init\",\r\n decoder: {\r\n url: decoderInfo.url,\r\n wasmBinary: decoderWasmBinary,\r\n },\r\n });\r\n });\r\n });\r\n });\r\n } else {\r\n this._decoderModulePromise = decoderInfo.wasmBinaryPromise.then((decoderWasmBinary) => {\r\n if (!decoderInfo.url) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n\r\n return Tools.LoadBabylonScriptAsync(decoderInfo.url).then(() => {\r\n return createDecoderAsync(decoderWasmBinary as ArrayBuffer);\r\n });\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Stop all async operations and release resources.\r\n */\r\n public dispose(): void {\r\n if (this._workerPoolPromise) {\r\n this._workerPoolPromise.then((workerPool) => {\r\n workerPool.dispose();\r\n });\r\n }\r\n\r\n delete this._workerPoolPromise;\r\n delete this._decoderModulePromise;\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when ready. Call this manually to ensure draco compression is ready before use.\r\n * @returns a promise that resolves when ready\r\n */\r\n public whenReadyAsync(): Promise<void> {\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(() => {});\r\n }\r\n\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(() => {});\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n\r\n private _decodeMeshAsync(\r\n data: ArrayBuffer | ArrayBufferView,\r\n attributes?: { [kind: string]: number },\r\n gltfNormalizedOverride?: { [kind: string]: boolean }\r\n ): Promise<MeshData> {\r\n const dataView = data instanceof ArrayBuffer ? new Int8Array(data) : new Int8Array(data.buffer, data.byteOffset, data.byteLength);\r\n\r\n const applyGltfNormalizedOverride = (kind: string, normalized: boolean): boolean => {\r\n if (gltfNormalizedOverride && gltfNormalizedOverride[kind] !== undefined) {\r\n if (normalized !== gltfNormalizedOverride[kind]) {\r\n Logger.Warn(\r\n `Normalized flag from Draco data (${normalized}) does not match normalized flag from glTF accessor (${gltfNormalizedOverride[kind]}). Using flag from glTF accessor.`\r\n );\r\n }\r\n\r\n return gltfNormalizedOverride[kind];\r\n } else {\r\n return normalized;\r\n }\r\n };\r\n\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then((workerPool) => {\r\n return new Promise<MeshData>((resolve, reject) => {\r\n workerPool.push((worker, onComplete) => {\r\n let resultIndices: Nullable<Uint16Array | Uint32Array> = null;\r\n const resultAttributes: Array<AttributeData> = [];\r\n\r\n const onError = (error: ErrorEvent) => {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n onComplete();\r\n };\r\n\r\n const onMessage = (event: MessageEvent<Message>) => {\r\n const message = event.data;\r\n switch (message.id) {\r\n case \"decodeMeshDone\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve({ indices: resultIndices!, attributes: resultAttributes, totalVertices: message.totalVertices });\r\n onComplete();\r\n break;\r\n }\r\n case \"indices\": {\r\n resultIndices = message.data;\r\n break;\r\n }\r\n case \"attribute\": {\r\n resultAttributes.push({\r\n kind: message.kind,\r\n data: message.data,\r\n size: message.size,\r\n byteOffset: message.byteOffset,\r\n byteStride: message.byteStride,\r\n normalized: applyGltfNormalizedOverride(message.kind, message.normalized),\r\n });\r\n break;\r\n }\r\n }\r\n };\r\n\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n\r\n const dataViewCopy = dataView.slice();\r\n worker.postMessage({ id: \"decodeMesh\", dataView: dataViewCopy, attributes: attributes }, [dataViewCopy.buffer]);\r\n });\r\n });\r\n });\r\n }\r\n\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then((decoder) => {\r\n let resultIndices: Nullable<Uint16Array | Uint32Array> = null;\r\n const resultAttributes: Array<AttributeData> = [];\r\n\r\n const numPoints = decodeMesh(\r\n decoder.module,\r\n dataView,\r\n attributes,\r\n (indices) => {\r\n resultIndices = indices;\r\n },\r\n (kind, data, size, byteOffset, byteStride, normalized) => {\r\n resultAttributes.push({\r\n kind,\r\n data,\r\n size,\r\n byteOffset,\r\n byteStride,\r\n normalized,\r\n });\r\n }\r\n );\r\n\r\n return { indices: resultIndices!, attributes: resultAttributes, totalVertices: numPoints };\r\n });\r\n }\r\n\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n\r\n /**\r\n * Decode Draco compressed mesh data to Babylon geometry.\r\n * @param name The name to use when creating the geometry\r\n * @param scene The scene to use when creating the geometry\r\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\r\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\r\n * @returns A promise that resolves with the decoded geometry\r\n */\r\n public decodeMeshToGeometryAsync(name: string, scene: Scene, data: ArrayBuffer | ArrayBufferView, attributes?: { [kind: string]: number }): Promise<Geometry> {\r\n return this._decodeMeshAsync(data, attributes).then((meshData) => {\r\n const geometry = new Geometry(name, scene);\r\n\r\n if (meshData.indices) {\r\n geometry.setIndices(meshData.indices);\r\n }\r\n\r\n for (const attribute of meshData.attributes) {\r\n geometry.setVerticesBuffer(\r\n new VertexBuffer(\r\n scene.getEngine(),\r\n attribute.data,\r\n attribute.kind,\r\n false,\r\n undefined,\r\n attribute.byteStride,\r\n undefined,\r\n attribute.byteOffset,\r\n attribute.size,\r\n undefined,\r\n attribute.normalized,\r\n true\r\n ),\r\n meshData.totalVertices\r\n );\r\n }\r\n\r\n return geometry;\r\n });\r\n }\r\n\r\n /** @internal */\r\n public _decodeMeshToGeometryForGltfAsync(\r\n name: string,\r\n scene: Scene,\r\n data: ArrayBuffer | ArrayBufferView,\r\n attributes: { [kind: string]: number },\r\n gltfNormalizedOverride: { [kind: string]: boolean }\r\n ): Promise<Geometry> {\r\n return this._decodeMeshAsync(data, attributes, gltfNormalizedOverride).then((meshData) => {\r\n const geometry = new Geometry(name, scene);\r\n\r\n if (meshData.indices) {\r\n geometry.setIndices(meshData.indices);\r\n }\r\n\r\n for (const attribute of meshData.attributes) {\r\n geometry.setVerticesBuffer(\r\n new VertexBuffer(\r\n scene.getEngine(),\r\n attribute.data,\r\n attribute.kind,\r\n false,\r\n undefined,\r\n attribute.byteStride,\r\n undefined,\r\n attribute.byteOffset,\r\n attribute.size,\r\n undefined,\r\n attribute.normalized,\r\n true\r\n ),\r\n meshData.totalVertices\r\n );\r\n }\r\n\r\n return geometry;\r\n });\r\n }\r\n\r\n /**\r\n * Decode Draco compressed mesh data to Babylon vertex data.\r\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\r\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\r\n * @returns A promise that resolves with the decoded vertex data\r\n * @deprecated Use {@link decodeMeshToGeometryAsync} for better performance in some cases\r\n */\r\n public decodeMeshAsync(data: ArrayBuffer | ArrayBufferView, attributes?: { [kind: string]: number }): Promise<VertexData> {\r\n return this._decodeMeshAsync(data, attributes).then((meshData) => {\r\n const vertexData = new VertexData();\r\n\r\n if (meshData.indices) {\r\n vertexData.indices = meshData.indices;\r\n }\r\n\r\n for (const attribute of meshData.attributes) {\r\n const floatData = VertexBuffer.GetFloatData(\r\n attribute.data,\r\n attribute.size,\r\n VertexBuffer.GetDataType(attribute.data),\r\n attribute.byteOffset,\r\n attribute.byteStride,\r\n attribute.normalized,\r\n meshData.totalVertices\r\n );\r\n\r\n vertexData.set(floatData, attribute.kind);\r\n }\r\n\r\n return vertexData;\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"dracoCompression.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/dracoCompression.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA2C3C,SAAS,kBAAkB,CAAC,UAAwB;IAChD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,kBAAkB,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YAC3D,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,UAAU,CACf,aAA4B,EAC5B,IAAe,EACf,UAAkD,EAClD,aAA2D,EAC3D,eAAiI;IAEjI,IAAI,OAAO,GAAsB,IAAI,CAA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,CAAC,UAAU,EACpB,SAAS,CAAC,UAAU,EACpB,QAAQ,CAAC,aAAa,CACzB,CAAC;gBAEF,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;aAC7C;YAED,OAAO,UAAU,CAAC;QACtB,CAAC,CAAC,CAAC;IACP,CAAC;;AAvWD;;;;;GAKG;AACW,8BAAa,GAAmC;IAC1D,OAAO,EAAE;QACL,OAAO,EAAE,GAAG,KAAK,CAAC,cAAc,6BAA6B;QAC7D,aAAa,EAAE,GAAG,KAAK,CAAC,cAAc,0BAA0B;QAChE,WAAW,EAAE,GAAG,KAAK,CAAC,cAAc,wBAAwB;KAC/D;CACJ,CAAC;AAUF;;GAEG;AACW,kCAAiB,GAAG,gBAAgB,CAAC,oBAAoB,EAAE,CAAC;AAW3D,yBAAQ,GAA+B,IAAI,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { AutoReleaseWorkerPool } from \"../../Misc/workerPool\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { IDisposable, Scene } from \"../../scene\";\r\nimport { Geometry } from \"../geometry\";\r\nimport { VertexBuffer } from \"../buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DracoDecoderModule } from \"draco3dgltf\";\r\nimport type { DecoderModule, DecoderBuffer, Decoder, Mesh, PointCloud, Status } from \"draco3dgltf\";\r\nimport { Logger } from \"../../Misc/logger\";\r\n\r\ndeclare let DracoDecoderModule: DracoDecoderModule;\r\n\r\ninterface AttributeData {\r\n kind: string;\r\n data: ArrayBufferView;\r\n size: number;\r\n byteOffset: number;\r\n byteStride: number;\r\n normalized: boolean;\r\n}\r\n\r\ninterface MeshData {\r\n indices?: Uint16Array | Uint32Array;\r\n attributes: Array<AttributeData>;\r\n totalVertices: number;\r\n}\r\n\r\ninterface InitDoneMessage {\r\n id: \"initDone\";\r\n}\r\n\r\ninterface DecodeMeshDoneMessage {\r\n id: \"decodeMeshDone\";\r\n totalVertices: number;\r\n}\r\n\r\ninterface IndicesMessage {\r\n id: \"indices\";\r\n data: Uint16Array | Uint32Array;\r\n}\r\n\r\ninterface AttributeMessage extends AttributeData {\r\n id: \"attribute\";\r\n}\r\n\r\ntype Message = InitDoneMessage | DecodeMeshDoneMessage | IndicesMessage | AttributeMessage;\r\n\r\n// WorkerGlobalScope\r\ndeclare function importScripts(...urls: string[]): void;\r\ndeclare function postMessage(message: Message, transfer?: any[]): void;\r\n\r\nfunction createDecoderAsync(wasmBinary?: ArrayBuffer): Promise<{ module: DecoderModule }> {\r\n return new Promise((resolve) => {\r\n DracoDecoderModule({ wasmBinary: wasmBinary }).then((module) => {\r\n resolve({ module: module });\r\n });\r\n });\r\n}\r\n\r\nfunction decodeMesh(\r\n decoderModule: DecoderModule,\r\n data: Int8Array,\r\n attributes: { [kind: string]: number } | undefined,\r\n onIndicesData: (indices: Uint16Array | Uint32Array) => void,\r\n onAttributeData: (kind: string, data: ArrayBufferView, size: number, offset: number, stride: number, normalized: boolean) => void\r\n): number {\r\n let decoder: Nullable<Decoder> = null;\r\n let buffer: Nullable<DecoderBuffer> = null;\r\n let geometry: Nullable<Mesh | PointCloud> = null;\r\n\r\n try {\r\n decoder = new decoderModule.Decoder();\r\n\r\n buffer = new decoderModule.DecoderBuffer();\r\n buffer.Init(data, data.byteLength);\r\n\r\n let status: Status;\r\n const type = decoder.GetEncodedGeometryType(buffer);\r\n switch (type) {\r\n case decoderModule.TRIANGULAR_MESH: {\r\n const mesh = new decoderModule.Mesh();\r\n status = decoder.DecodeBufferToMesh(buffer, mesh);\r\n if (!status.ok() || mesh.ptr === 0) {\r\n throw new Error(status.error_msg());\r\n }\r\n\r\n const numFaces = mesh.num_faces();\r\n const numIndices = numFaces * 3;\r\n const byteLength = numIndices * 4;\r\n\r\n const ptr = decoderModule._malloc(byteLength);\r\n try {\r\n decoder.GetTrianglesUInt32Array(mesh, byteLength, ptr);\r\n const indices = new Uint32Array(numIndices);\r\n indices.set(new Uint32Array(decoderModule.HEAPF32.buffer, ptr, numIndices));\r\n onIndicesData(indices);\r\n } finally {\r\n decoderModule._free(ptr);\r\n }\r\n\r\n geometry = mesh;\r\n break;\r\n }\r\n case decoderModule.POINT_CLOUD: {\r\n const pointCloud = new decoderModule.PointCloud();\r\n status = decoder.DecodeBufferToPointCloud(buffer, pointCloud);\r\n if (!status.ok() || !pointCloud.ptr) {\r\n throw new Error(status.error_msg());\r\n }\r\n\r\n geometry = pointCloud;\r\n break;\r\n }\r\n default: {\r\n throw new Error(`Invalid geometry type ${type}`);\r\n }\r\n }\r\n\r\n const numPoints = geometry.num_points();\r\n\r\n const processAttribute = (decoder: Decoder, geometry: Mesh | PointCloud, kind: string, attribute: any) => {\r\n const dataType = attribute.data_type();\r\n const numComponents = attribute.num_components();\r\n const normalized = attribute.normalized();\r\n const byteStride = attribute.byte_stride();\r\n const byteOffset = attribute.byte_offset();\r\n\r\n const dataTypeInfo = {\r\n [decoderModule.DT_FLOAT32]: { typedArrayConstructor: Float32Array, heap: decoderModule.HEAPF32 },\r\n [decoderModule.DT_INT8]: { typedArrayConstructor: Int8Array, heap: decoderModule.HEAP8 },\r\n [decoderModule.DT_INT16]: { typedArrayConstructor: Int16Array, heap: decoderModule.HEAP16 },\r\n [decoderModule.DT_INT32]: { typedArrayConstructor: Int32Array, heap: decoderModule.HEAP32 },\r\n [decoderModule.DT_UINT8]: { typedArrayConstructor: Uint8Array, heap: decoderModule.HEAPU8 },\r\n [decoderModule.DT_UINT16]: { typedArrayConstructor: Uint16Array, heap: decoderModule.HEAPU16 },\r\n [decoderModule.DT_UINT32]: { typedArrayConstructor: Uint32Array, heap: decoderModule.HEAPU32 },\r\n };\r\n\r\n const info = dataTypeInfo[dataType];\r\n if (!info) {\r\n throw new Error(`Invalid data type ${dataType}`);\r\n }\r\n\r\n const numValues = numPoints * numComponents;\r\n const byteLength = numValues * info.typedArrayConstructor.BYTES_PER_ELEMENT;\r\n\r\n const ptr = decoderModule._malloc(byteLength);\r\n try {\r\n decoder.GetAttributeDataArrayForAllPoints(geometry, attribute, dataType, byteLength, ptr);\r\n const data = new info.typedArrayConstructor(info.heap.buffer, ptr, numValues);\r\n onAttributeData(kind, data.slice(), numComponents, byteOffset, byteStride, normalized);\r\n } finally {\r\n decoderModule._free(ptr);\r\n }\r\n };\r\n\r\n if (attributes) {\r\n for (const kind in attributes) {\r\n const id = attributes[kind];\r\n const attribute = decoder.GetAttributeByUniqueId(geometry, id);\r\n processAttribute(decoder, geometry, kind, attribute);\r\n }\r\n } else {\r\n const dracoAttributeTypes: { [kind: string]: number } = {\r\n position: decoderModule.POSITION,\r\n normal: decoderModule.NORMAL,\r\n color: decoderModule.COLOR,\r\n uv: decoderModule.TEX_COORD,\r\n };\r\n\r\n for (const kind in dracoAttributeTypes) {\r\n const id = decoder.GetAttributeId(geometry, dracoAttributeTypes[kind]);\r\n if (id !== -1) {\r\n const attribute = decoder.GetAttribute(geometry, id);\r\n processAttribute(decoder, geometry, kind, attribute);\r\n }\r\n }\r\n }\r\n\r\n return numPoints;\r\n } finally {\r\n if (geometry) {\r\n decoderModule.destroy(geometry);\r\n }\r\n\r\n if (buffer) {\r\n decoderModule.destroy(buffer);\r\n }\r\n\r\n if (decoder) {\r\n decoderModule.destroy(decoder);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction worker(): void {\r\n let decoderPromise: PromiseLike<any> | undefined;\r\n\r\n onmessage = (event) => {\r\n const message = event.data;\r\n switch (message.id) {\r\n case \"init\": {\r\n const decoder = message.decoder;\r\n if (decoder.url) {\r\n importScripts(decoder.url);\r\n decoderPromise = DracoDecoderModule({ wasmBinary: decoder.wasmBinary });\r\n }\r\n postMessage({ id: \"initDone\" });\r\n break;\r\n }\r\n case \"decodeMesh\": {\r\n if (!decoderPromise) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n decoderPromise.then((decoder) => {\r\n const numPoints = decodeMesh(\r\n decoder,\r\n message.dataView,\r\n message.attributes,\r\n (indices) => {\r\n postMessage({ id: \"indices\", data: indices }, [indices.buffer]);\r\n },\r\n (kind, data, size, offset, stride, normalized) => {\r\n postMessage({ id: \"attribute\", kind, data, size, byteOffset: offset, byteStride: stride, normalized }, [data.buffer]);\r\n }\r\n );\r\n postMessage({ id: \"decodeMeshDone\", totalVertices: numPoints });\r\n });\r\n break;\r\n }\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Configuration for Draco compression\r\n */\r\nexport interface IDracoCompressionConfiguration {\r\n /**\r\n * Configuration for the decoder.\r\n */\r\n decoder: {\r\n /**\r\n * The url to the WebAssembly module.\r\n */\r\n wasmUrl?: string;\r\n\r\n /**\r\n * The url to the WebAssembly binary.\r\n */\r\n wasmBinaryUrl?: string;\r\n\r\n /**\r\n * The url to the fallback JavaScript module.\r\n */\r\n fallbackUrl?: string;\r\n };\r\n}\r\n\r\n/**\r\n * Draco compression (https://google.github.io/draco/)\r\n *\r\n * This class wraps the Draco module.\r\n *\r\n * **Encoder**\r\n *\r\n * The encoder is not currently implemented.\r\n *\r\n * **Decoder**\r\n *\r\n * By default, the configuration points to a copy of the Draco decoder files for glTF from the babylon.js preview cdn https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js.\r\n *\r\n * To update the configuration, use the following code:\r\n * ```javascript\r\n * DracoCompression.Configuration = {\r\n * decoder: {\r\n * wasmUrl: \"<url to the WebAssembly library>\",\r\n * wasmBinaryUrl: \"<url to the WebAssembly binary>\",\r\n * fallbackUrl: \"<url to the fallback JavaScript library>\",\r\n * }\r\n * };\r\n * ```\r\n *\r\n * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support WebAssembly or only support the JavaScript version.\r\n * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.\r\n * Use `DracoCompression.DecoderAvailable` to determine if the decoder configuration is available for the current context.\r\n *\r\n * To decode Draco compressed data, get the default DracoCompression object and call decodeMeshToGeometryAsync:\r\n * ```javascript\r\n * var geometry = await DracoCompression.Default.decodeMeshToGeometryAsync(data);\r\n * ```\r\n *\r\n * @see https://playground.babylonjs.com/#DMZIBD#0\r\n */\r\nexport class DracoCompression implements IDisposable {\r\n private _workerPoolPromise?: Promise<AutoReleaseWorkerPool>;\r\n private _decoderModulePromise?: Promise<{ module: DecoderModule }>;\r\n\r\n /**\r\n * The configuration. Defaults to the following urls:\r\n * - wasmUrl: \"https://cdn.babylonjs.com/draco_wasm_wrapper_gltf.js\"\r\n * - wasmBinaryUrl: \"https://cdn.babylonjs.com/draco_decoder_gltf.wasm\"\r\n * - fallbackUrl: \"https://cdn.babylonjs.com/draco_decoder_gltf.js\"\r\n */\r\n public static Configuration: IDracoCompressionConfiguration = {\r\n decoder: {\r\n wasmUrl: `${Tools._DefaultCdnUrl}/draco_wasm_wrapper_gltf.js`,\r\n wasmBinaryUrl: `${Tools._DefaultCdnUrl}/draco_decoder_gltf.wasm`,\r\n fallbackUrl: `${Tools._DefaultCdnUrl}/draco_decoder_gltf.js`,\r\n },\r\n };\r\n\r\n /**\r\n * Returns true if the decoder configuration is available.\r\n */\r\n public static get DecoderAvailable(): boolean {\r\n const decoder = DracoCompression.Configuration.decoder;\r\n return !!((decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\") || decoder.fallbackUrl);\r\n }\r\n\r\n /**\r\n * Default number of workers to create when creating the draco compression object.\r\n */\r\n public static DefaultNumWorkers = DracoCompression.GetDefaultNumWorkers();\r\n\r\n private static GetDefaultNumWorkers(): number {\r\n if (typeof navigator !== \"object\" || !navigator.hardwareConcurrency) {\r\n return 1;\r\n }\r\n\r\n // Use 50% of the available logical processors but capped at 4.\r\n return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);\r\n }\r\n\r\n private static _Default: Nullable<DracoCompression> = null;\r\n\r\n /**\r\n * Default instance for the draco compression object.\r\n */\r\n public static get Default(): DracoCompression {\r\n if (!DracoCompression._Default) {\r\n DracoCompression._Default = new DracoCompression();\r\n }\r\n\r\n return DracoCompression._Default;\r\n }\r\n\r\n /**\r\n * Constructor\r\n * @param numWorkers The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context.\r\n */\r\n constructor(numWorkers = DracoCompression.DefaultNumWorkers) {\r\n const decoder = DracoCompression.Configuration.decoder;\r\n\r\n const decoderInfo: { url: string | undefined; wasmBinaryPromise: Promise<ArrayBuffer | undefined> } =\r\n decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\"\r\n ? {\r\n url: Tools.GetBabylonScriptURL(decoder.wasmUrl, true),\r\n wasmBinaryPromise: Tools.LoadFileAsync(Tools.GetBabylonScriptURL(decoder.wasmBinaryUrl, true)),\r\n }\r\n : {\r\n url: Tools.GetBabylonScriptURL(decoder.fallbackUrl!),\r\n wasmBinaryPromise: Promise.resolve(undefined),\r\n };\r\n\r\n if (numWorkers && typeof Worker === \"function\" && typeof URL === \"function\") {\r\n this._workerPoolPromise = decoderInfo.wasmBinaryPromise.then((decoderWasmBinary) => {\r\n const workerContent = `${decodeMesh}(${worker})()`;\r\n const workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n\r\n return new AutoReleaseWorkerPool(numWorkers, () => {\r\n return new Promise((resolve, reject) => {\r\n const worker = new Worker(workerBlobUrl);\r\n const onError = (error: ErrorEvent) => {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n\r\n const onMessage = (event: MessageEvent<Message>) => {\r\n if (event.data.id === \"initDone\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(worker);\r\n }\r\n };\r\n\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n\r\n worker.postMessage({\r\n id: \"init\",\r\n decoder: {\r\n url: decoderInfo.url,\r\n wasmBinary: decoderWasmBinary,\r\n },\r\n });\r\n });\r\n });\r\n });\r\n } else {\r\n this._decoderModulePromise = decoderInfo.wasmBinaryPromise.then((decoderWasmBinary) => {\r\n if (!decoderInfo.url) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n\r\n return Tools.LoadBabylonScriptAsync(decoderInfo.url).then(() => {\r\n return createDecoderAsync(decoderWasmBinary as ArrayBuffer);\r\n });\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Stop all async operations and release resources.\r\n */\r\n public dispose(): void {\r\n if (this._workerPoolPromise) {\r\n this._workerPoolPromise.then((workerPool) => {\r\n workerPool.dispose();\r\n });\r\n }\r\n\r\n delete this._workerPoolPromise;\r\n delete this._decoderModulePromise;\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when ready. Call this manually to ensure draco compression is ready before use.\r\n * @returns a promise that resolves when ready\r\n */\r\n public whenReadyAsync(): Promise<void> {\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(() => {});\r\n }\r\n\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(() => {});\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n\r\n private _decodeMeshAsync(\r\n data: ArrayBuffer | ArrayBufferView,\r\n attributes?: { [kind: string]: number },\r\n gltfNormalizedOverride?: { [kind: string]: boolean }\r\n ): Promise<MeshData> {\r\n const dataView = data instanceof ArrayBuffer ? new Int8Array(data) : new Int8Array(data.buffer, data.byteOffset, data.byteLength);\r\n\r\n const applyGltfNormalizedOverride = (kind: string, normalized: boolean): boolean => {\r\n if (gltfNormalizedOverride && gltfNormalizedOverride[kind] !== undefined) {\r\n if (normalized !== gltfNormalizedOverride[kind]) {\r\n Logger.Warn(\r\n `Normalized flag from Draco data (${normalized}) does not match normalized flag from glTF accessor (${gltfNormalizedOverride[kind]}). Using flag from glTF accessor.`\r\n );\r\n }\r\n\r\n return gltfNormalizedOverride[kind];\r\n } else {\r\n return normalized;\r\n }\r\n };\r\n\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then((workerPool) => {\r\n return new Promise<MeshData>((resolve, reject) => {\r\n workerPool.push((worker, onComplete) => {\r\n let resultIndices: Nullable<Uint16Array | Uint32Array> = null;\r\n const resultAttributes: Array<AttributeData> = [];\r\n\r\n const onError = (error: ErrorEvent) => {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n onComplete();\r\n };\r\n\r\n const onMessage = (event: MessageEvent<Message>) => {\r\n const message = event.data;\r\n switch (message.id) {\r\n case \"decodeMeshDone\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve({ indices: resultIndices!, attributes: resultAttributes, totalVertices: message.totalVertices });\r\n onComplete();\r\n break;\r\n }\r\n case \"indices\": {\r\n resultIndices = message.data;\r\n break;\r\n }\r\n case \"attribute\": {\r\n resultAttributes.push({\r\n kind: message.kind,\r\n data: message.data,\r\n size: message.size,\r\n byteOffset: message.byteOffset,\r\n byteStride: message.byteStride,\r\n normalized: applyGltfNormalizedOverride(message.kind, message.normalized),\r\n });\r\n break;\r\n }\r\n }\r\n };\r\n\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n\r\n const dataViewCopy = dataView.slice();\r\n worker.postMessage({ id: \"decodeMesh\", dataView: dataViewCopy, attributes: attributes }, [dataViewCopy.buffer]);\r\n });\r\n });\r\n });\r\n }\r\n\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then((decoder) => {\r\n let resultIndices: Nullable<Uint16Array | Uint32Array> = null;\r\n const resultAttributes: Array<AttributeData> = [];\r\n\r\n const numPoints = decodeMesh(\r\n decoder.module,\r\n dataView,\r\n attributes,\r\n (indices) => {\r\n resultIndices = indices;\r\n },\r\n (kind, data, size, byteOffset, byteStride, normalized) => {\r\n resultAttributes.push({\r\n kind,\r\n data,\r\n size,\r\n byteOffset,\r\n byteStride,\r\n normalized,\r\n });\r\n }\r\n );\r\n\r\n return { indices: resultIndices!, attributes: resultAttributes, totalVertices: numPoints };\r\n });\r\n }\r\n\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n\r\n /**\r\n * Decode Draco compressed mesh data to Babylon geometry.\r\n * @param name The name to use when creating the geometry\r\n * @param scene The scene to use when creating the geometry\r\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\r\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\r\n * @returns A promise that resolves with the decoded geometry\r\n */\r\n public decodeMeshToGeometryAsync(name: string, scene: Scene, data: ArrayBuffer | ArrayBufferView, attributes?: { [kind: string]: number }): Promise<Geometry> {\r\n return this._decodeMeshAsync(data, attributes).then((meshData) => {\r\n const geometry = new Geometry(name, scene);\r\n\r\n if (meshData.indices) {\r\n geometry.setIndices(meshData.indices);\r\n }\r\n\r\n for (const attribute of meshData.attributes) {\r\n geometry.setVerticesBuffer(\r\n new VertexBuffer(\r\n scene.getEngine(),\r\n attribute.data,\r\n attribute.kind,\r\n false,\r\n undefined,\r\n attribute.byteStride,\r\n undefined,\r\n attribute.byteOffset,\r\n attribute.size,\r\n undefined,\r\n attribute.normalized,\r\n true\r\n ),\r\n meshData.totalVertices\r\n );\r\n }\r\n\r\n return geometry;\r\n });\r\n }\r\n\r\n /** @internal */\r\n public _decodeMeshToGeometryForGltfAsync(\r\n name: string,\r\n scene: Scene,\r\n data: ArrayBuffer | ArrayBufferView,\r\n attributes: { [kind: string]: number },\r\n gltfNormalizedOverride: { [kind: string]: boolean }\r\n ): Promise<Geometry> {\r\n return this._decodeMeshAsync(data, attributes, gltfNormalizedOverride).then((meshData) => {\r\n const geometry = new Geometry(name, scene);\r\n\r\n if (meshData.indices) {\r\n geometry.setIndices(meshData.indices);\r\n }\r\n\r\n for (const attribute of meshData.attributes) {\r\n geometry.setVerticesBuffer(\r\n new VertexBuffer(\r\n scene.getEngine(),\r\n attribute.data,\r\n attribute.kind,\r\n false,\r\n undefined,\r\n attribute.byteStride,\r\n undefined,\r\n attribute.byteOffset,\r\n attribute.size,\r\n undefined,\r\n attribute.normalized,\r\n true\r\n ),\r\n meshData.totalVertices\r\n );\r\n }\r\n\r\n return geometry;\r\n });\r\n }\r\n\r\n /**\r\n * Decode Draco compressed mesh data to Babylon vertex data.\r\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\r\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\r\n * @returns A promise that resolves with the decoded vertex data\r\n * @deprecated Use {@link decodeMeshToGeometryAsync} for better performance in some cases\r\n */\r\n public decodeMeshAsync(data: ArrayBuffer | ArrayBufferView, attributes?: { [kind: string]: number }): Promise<VertexData> {\r\n return this._decodeMeshAsync(data, attributes).then((meshData) => {\r\n const vertexData = new VertexData();\r\n\r\n if (meshData.indices) {\r\n vertexData.indices = meshData.indices;\r\n }\r\n\r\n for (const attribute of meshData.attributes) {\r\n const floatData = VertexBuffer.GetFloatData(\r\n attribute.data,\r\n attribute.size,\r\n VertexBuffer.GetDataType(attribute.data),\r\n attribute.byteOffset,\r\n attribute.byteStride,\r\n attribute.normalized,\r\n meshData.totalVertices\r\n );\r\n\r\n vertexData.set(floatData, attribute.kind);\r\n }\r\n\r\n return vertexData;\r\n });\r\n }\r\n}\r\n"]}
@@ -5,6 +5,7 @@ import { UniqueIdGenerator } from "../../Misc/uniqueIdGenerator.js";
5
5
  import { NodeGeometryConnectionPoint, NodeGeometryConnectionPointDirection } from "./nodeGeometryBlockConnectionPoint.js";
6
6
  import { Observable } from "../../Misc/observable.js";
7
7
  import { PrecisionDate } from "../../Misc/precisionDate.js";
8
+ import { Logger } from "../../Misc/logger.js";
8
9
  /**
9
10
  * Defines a block that can be used inside a node based geometry
10
11
  */
@@ -243,7 +244,7 @@ export class NodeGeometryBlock {
243
244
  this._customBuildStep(state);
244
245
  // Logs
245
246
  if (state.verbose) {
246
- console.log(`Building ${this.name} [${this.getClassName()}]`);
247
+ Logger.Log(`Building ${this.name} [${this.getClassName()}]`);
247
248
  }
248
249
  const now = PrecisionDate.Now;
249
250
  this._buildBlock(state);
@@ -1 +1 @@
1
- {"version":3,"file":"nodeGeometryBlock.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometryBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,2BAA2B,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAEvH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAwB1B;;OAEG;IACH,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,qCAAqC;IACrC,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAOD;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAW,IAAI,CAAC,KAAa;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;I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CAAC;CACJ;AApeU;IADN,SAAS,CAAC,SAAS,CAAC;mDACG","sourcesContent":["import { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { UniqueIdGenerator } from \"../../Misc/uniqueIdGenerator\";\r\nimport type { NodeGeometryBlockConnectionPointTypes } from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryConnectionPoint, NodeGeometryConnectionPointDirection } from \"./nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\n\r\n/**\r\n * Defines a block that can be used inside a node based geometry\r\n */\r\nexport class NodeGeometryBlock {\r\n private _name = \"\";\r\n private _buildId: number;\r\n protected _isInput = false;\r\n protected _isTeleportOut = false;\r\n protected _isTeleportIn = false;\r\n protected _isDebug = false;\r\n protected _isUnique = false;\r\n private _buildExecutionTime: number = 0;\r\n\r\n /**\r\n * Gets an observable raised when the block is built\r\n */\r\n public onBuildObservable = new Observable<NodeGeometryBlock>();\r\n\r\n /** @internal */\r\n public _inputs = new Array<NodeGeometryConnectionPoint>();\r\n /** @internal */\r\n public _outputs = new Array<NodeGeometryConnectionPoint>();\r\n /** @internal */\r\n public _preparationId: number;\r\n /** @internal */\r\n public _codeVariableName = \"\";\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public get buildExecutionTime() {\r\n return this._buildExecutionTime;\r\n }\r\n\r\n /**\r\n * Gets the list of input points\r\n */\r\n public get inputs(): NodeGeometryConnectionPoint[] {\r\n return this._inputs;\r\n }\r\n\r\n /** Gets the list of output points */\r\n public get outputs(): NodeGeometryConnectionPoint[] {\r\n return this._outputs;\r\n }\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * Gets or set the name of the block\r\n */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is an input\r\n */\r\n public get isInput(): boolean {\r\n return this._isInput;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport out\r\n */\r\n public get isTeleportOut(): boolean {\r\n return this._isTeleportOut;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport in\r\n */\r\n public get isTeleportIn(): boolean {\r\n return this._isTeleportIn;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a debug block\r\n */\r\n public get isDebug(): boolean {\r\n return this._isDebug;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that this block can only be used once per NodeGeometry\r\n */\r\n public get isUnique() {\r\n return this._isUnique;\r\n }\r\n\r\n /**\r\n * A free comment about the block\r\n */\r\n @serialize(\"comment\")\r\n public comments: string;\r\n\r\n /** Gets or sets a boolean indicating that this input can be edited from a collapsed frame */\r\n public visibleOnFrame = false;\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeGeometryBlock\"\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"NodeGeometryBlock\";\r\n }\r\n\r\n protected _inputRename(name: string) {\r\n return name;\r\n }\r\n\r\n protected _outputRename(name: string) {\r\n return name;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given block\r\n * @param block defines the potential descendant block to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOf(block: NodeGeometryBlock): boolean {\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock === block) {\r\n return true;\r\n }\r\n if (endpoint.ownerBlock.isAnAncestorOf(block)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given type\r\n * @param type defines the potential type to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOfType(type: string): boolean {\r\n if (this.getClassName() === type) {\r\n return true;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock.isAnAncestorOfType(type)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Get the first descendant using a predicate\r\n * @param predicate defines the predicate to check\r\n * @returns descendant or null if none found\r\n */\r\n public getDescendantOfPredicate(predicate: (block: NodeGeometryBlock) => boolean): Nullable<NodeGeometryBlock> {\r\n if (predicate(this)) {\r\n return this;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n const descendant = endpoint.ownerBlock.getDescendantOfPredicate(predicate);\r\n\r\n if (descendant) {\r\n return descendant;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates a new NodeGeometryBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n this._name = name;\r\n this.uniqueId = UniqueIdGenerator.UniqueId;\r\n }\r\n\r\n /**\r\n * Register a new input. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param isOptional defines a boolean indicating that this input can be omitted\r\n * @param value value to return if there is no connection\r\n * @param valueMin min value accepted for value\r\n * @param valueMax max value accepted for value\r\n * @returns the current block\r\n */\r\n public registerInput(name: string, type: NodeGeometryBlockConnectionPointTypes, isOptional: boolean = false, value?: any, valueMin?: any, valueMax?: any) {\r\n const point = new NodeGeometryConnectionPoint(name, this, NodeGeometryConnectionPointDirection.Input);\r\n point.type = type;\r\n point.isOptional = isOptional;\r\n point.defaultValue = value;\r\n point.value = value;\r\n point.valueMin = valueMin;\r\n point.valueMax = valueMax;\r\n\r\n this._inputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Register a new output. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param point an already created connection point. If not provided, create a new one\r\n * @returns the current block\r\n */\r\n public registerOutput(name: string, type: NodeGeometryBlockConnectionPointTypes, point?: NodeGeometryConnectionPoint) {\r\n point = point ?? new NodeGeometryConnectionPoint(name, this, NodeGeometryConnectionPointDirection.Output);\r\n point.type = type;\r\n\r\n this._outputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n // Empty. Must be defined by child nodes\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _customBuildStep(state: NodeGeometryBuildState): void {\r\n // Must be implemented by children\r\n }\r\n\r\n /**\r\n * Build the current node and generate the vertex data\r\n * @param state defines the current generation state\r\n * @returns true if already built\r\n */\r\n public build(state: NodeGeometryBuildState): boolean {\r\n if (this._buildId === state.buildId) {\r\n return true;\r\n }\r\n\r\n if (this._outputs.length > 0) {\r\n if (!this._outputs.some((o) => o.hasEndpoints) && !this.isDebug) {\r\n return false;\r\n }\r\n\r\n this.outputs.forEach((o) => o._resetCounters());\r\n }\r\n\r\n this._buildId = state.buildId;\r\n\r\n // Check if \"parent\" blocks are compiled\r\n for (const input of this._inputs) {\r\n if (!input.connectedPoint) {\r\n if (!input.isOptional) {\r\n // Emit a warning\r\n state.notConnectedNonOptionalInputs.push(input);\r\n }\r\n continue;\r\n }\r\n\r\n const block = input.connectedPoint.ownerBlock;\r\n if (block && block !== this) {\r\n block.build(state);\r\n }\r\n }\r\n\r\n this._customBuildStep(state);\r\n\r\n // Logs\r\n if (state.verbose) {\r\n console.log(`Building ${this.name} [${this.getClassName()}]`);\r\n }\r\n\r\n const now = PrecisionDate.Now;\r\n this._buildBlock(state);\r\n this._buildExecutionTime = PrecisionDate.Now - now;\r\n\r\n // Compile connected blocks\r\n for (const output of this._outputs) {\r\n for (const endpoint of output.endpoints) {\r\n const block = endpoint.ownerBlock;\r\n\r\n if (block) {\r\n block.build(state);\r\n }\r\n }\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n return false;\r\n }\r\n\r\n protected _linkConnectionTypes(inputIndex0: number, inputIndex1: number, looseCoupling = false) {\r\n if (looseCoupling) {\r\n this._inputs[inputIndex1]._acceptedConnectionPointType = this._inputs[inputIndex0];\r\n } else {\r\n this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];\r\n }\r\n this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n */\r\n public initialize() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Lets the block try to connect some inputs automatically\r\n */\r\n public autoConfigure() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Find an input by its name\r\n * @param name defines the name of the input to look for\r\n * @returns the input or null if not found\r\n */\r\n public getInputByName(name: string) {\r\n const filter = this._inputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Find an output by its name\r\n * @param name defines the name of the output to look for\r\n * @returns the output or null if not found\r\n */\r\n public getOutputByName(name: string) {\r\n const filter = this._outputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.name = this.name;\r\n\r\n serializationObject.inputs = [];\r\n serializationObject.outputs = [];\r\n\r\n for (const input of this.inputs) {\r\n serializationObject.inputs.push(input.serialize());\r\n }\r\n\r\n for (const output of this.outputs) {\r\n serializationObject.outputs.push(output.serialize(false));\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _deserialize(serializationObject: any) {\r\n this._name = serializationObject.name;\r\n this.comments = serializationObject.comments;\r\n this.visibleOnFrame = !!serializationObject.visibleOnFrame;\r\n this._deserializePortDisplayNamesAndExposedOnFrame(serializationObject);\r\n }\r\n\r\n private _deserializePortDisplayNamesAndExposedOnFrame(serializationObject: any) {\r\n const serializedInputs = serializationObject.inputs;\r\n const serializedOutputs = serializationObject.outputs;\r\n if (serializedInputs) {\r\n serializedInputs.forEach((port: any) => {\r\n const input = this.inputs.find((i) => i.name === port.name);\r\n\r\n if (!input) {\r\n return;\r\n }\r\n\r\n if (port.displayName) {\r\n input.displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n input.isExposedOnFrame = port.isExposedOnFrame;\r\n input.exposedPortPosition = port.exposedPortPosition;\r\n }\r\n if (port.value !== undefined && port.value !== null) {\r\n if (port.valueType === \"number\") {\r\n input.value = port.value;\r\n } else {\r\n const valueType = GetClass(port.valueType);\r\n\r\n if (valueType) {\r\n input.value = valueType.FromArray(port.value);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n if (serializedOutputs) {\r\n serializedOutputs.forEach((port: any, i: number) => {\r\n if (port.displayName) {\r\n this.outputs[i].displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;\r\n this.outputs[i].exposedPortPosition = port.exposedPortPosition;\r\n }\r\n });\r\n }\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const variableName = this._codeVariableName;\r\n return `${variableName}.visibleOnFrame = ${this.visibleOnFrame};\\n`;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _dumpCodeForOutputConnections(alreadyDumped: NodeGeometryBlock[]) {\r\n let codeString = \"\";\r\n\r\n if (alreadyDumped.indexOf(this) !== -1) {\r\n return codeString;\r\n }\r\n\r\n alreadyDumped.push(this);\r\n\r\n for (const input of this.inputs) {\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n\r\n const connectedOutput = input.connectedPoint!;\r\n const connectedBlock = connectedOutput.ownerBlock;\r\n\r\n codeString += connectedBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n codeString += `${connectedBlock._codeVariableName}.${connectedBlock._outputRename(connectedOutput.name)}.connectTo(${this._codeVariableName}.${this._inputRename(\r\n input.name\r\n )});\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _dumpCode(uniqueNames: string[], alreadyDumped: NodeGeometryBlock[]) {\r\n alreadyDumped.push(this);\r\n\r\n // Get unique name\r\n const nameAsVariableName = this.name.replace(/[^A-Za-z_]+/g, \"\");\r\n this._codeVariableName = nameAsVariableName || `${this.getClassName()}_${this.uniqueId}`;\r\n\r\n if (uniqueNames.indexOf(this._codeVariableName) !== -1) {\r\n let index = 0;\r\n do {\r\n index++;\r\n this._codeVariableName = nameAsVariableName + index;\r\n } while (uniqueNames.indexOf(this._codeVariableName) !== -1);\r\n }\r\n\r\n uniqueNames.push(this._codeVariableName);\r\n\r\n // Declaration\r\n let codeString = `\\n// ${this.getClassName()}\\n`;\r\n if (this.comments) {\r\n codeString += `// ${this.comments}\\n`;\r\n }\r\n const className = this.getClassName();\r\n if (className === \"GeometryInputBlock\") {\r\n const block = this as unknown as GeometryInputBlock;\r\n const blockType = block.type;\r\n codeString += `var ${this._codeVariableName} = new BABYLON.GeometryInputBlock(\"${this.name}\", ${blockType});\\n`;\r\n } else {\r\n codeString += `var ${this._codeVariableName} = new BABYLON.${className}(\"${this.name}\");\\n`;\r\n }\r\n\r\n // Properties\r\n codeString += this._dumpPropertiesCode();\r\n\r\n // Inputs\r\n for (const input of this.inputs) {\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n\r\n const connectedOutput = input.connectedPoint!;\r\n const connectedBlock = connectedOutput.ownerBlock;\r\n\r\n if (alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n // Outputs\r\n for (const output of this.outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n const connectedBlock = endpoint.ownerBlock;\r\n if (connectedBlock && alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Clone the current block to a new identical block\r\n * @returns a copy of the current block\r\n */\r\n public clone() {\r\n const serializationObject = this.serialize();\r\n\r\n const blockType = GetClass(serializationObject.customType);\r\n if (blockType) {\r\n const block: NodeGeometryBlock = new blockType();\r\n block._deserialize(serializationObject);\r\n\r\n return block;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n for (const input of this.inputs) {\r\n input.dispose();\r\n }\r\n\r\n for (const output of this.outputs) {\r\n output.dispose();\r\n }\r\n\r\n this.onBuildObservable.clear();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"nodeGeometryBlock.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometryBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,2BAA2B,EAAE,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAEvH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,MAAM,EAAE,6BAAyB;AAE1C;;GAEG;AACH,MAAM,OAAO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AC,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;iBACtE;aACJ;SACJ;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACI,KAAK;QACR,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAE7C,MAAM,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,SAAS,EAAE;YACX,MAAM,KAAK,GAAsB,IAAI,SAAS,EAAE,CAAC;YACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;YAExC,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;YAC7B,KAAK,CAAC,OAAO,EAAE,CAAC;SACnB;QAED,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;YAC/B,MAAM,CAAC,OAAO,EAAE,CAAC;SACpB;QAED,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACnC,CAAC;CACJ;AApeU;IADN,SAAS,CAAC,SAAS,CAAC;mDACG","sourcesContent":["import { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { UniqueIdGenerator } from \"../../Misc/uniqueIdGenerator\";\r\nimport type { NodeGeometryBlockConnectionPointTypes } from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryConnectionPoint, NodeGeometryConnectionPointDirection } from \"./nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Defines a block that can be used inside a node based geometry\r\n */\r\nexport class NodeGeometryBlock {\r\n private _name = \"\";\r\n private _buildId: number;\r\n protected _isInput = false;\r\n protected _isTeleportOut = false;\r\n protected _isTeleportIn = false;\r\n protected _isDebug = false;\r\n protected _isUnique = false;\r\n private _buildExecutionTime: number = 0;\r\n\r\n /**\r\n * Gets an observable raised when the block is built\r\n */\r\n public onBuildObservable = new Observable<NodeGeometryBlock>();\r\n\r\n /** @internal */\r\n public _inputs = new Array<NodeGeometryConnectionPoint>();\r\n /** @internal */\r\n public _outputs = new Array<NodeGeometryConnectionPoint>();\r\n /** @internal */\r\n public _preparationId: number;\r\n /** @internal */\r\n public _codeVariableName = \"\";\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public get buildExecutionTime() {\r\n return this._buildExecutionTime;\r\n }\r\n\r\n /**\r\n * Gets the list of input points\r\n */\r\n public get inputs(): NodeGeometryConnectionPoint[] {\r\n return this._inputs;\r\n }\r\n\r\n /** Gets the list of output points */\r\n public get outputs(): NodeGeometryConnectionPoint[] {\r\n return this._outputs;\r\n }\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * Gets or set the name of the block\r\n */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is an input\r\n */\r\n public get isInput(): boolean {\r\n return this._isInput;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport out\r\n */\r\n public get isTeleportOut(): boolean {\r\n return this._isTeleportOut;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport in\r\n */\r\n public get isTeleportIn(): boolean {\r\n return this._isTeleportIn;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a debug block\r\n */\r\n public get isDebug(): boolean {\r\n return this._isDebug;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that this block can only be used once per NodeGeometry\r\n */\r\n public get isUnique() {\r\n return this._isUnique;\r\n }\r\n\r\n /**\r\n * A free comment about the block\r\n */\r\n @serialize(\"comment\")\r\n public comments: string;\r\n\r\n /** Gets or sets a boolean indicating that this input can be edited from a collapsed frame */\r\n public visibleOnFrame = false;\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeGeometryBlock\"\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"NodeGeometryBlock\";\r\n }\r\n\r\n protected _inputRename(name: string) {\r\n return name;\r\n }\r\n\r\n protected _outputRename(name: string) {\r\n return name;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given block\r\n * @param block defines the potential descendant block to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOf(block: NodeGeometryBlock): boolean {\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock === block) {\r\n return true;\r\n }\r\n if (endpoint.ownerBlock.isAnAncestorOf(block)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given type\r\n * @param type defines the potential type to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOfType(type: string): boolean {\r\n if (this.getClassName() === type) {\r\n return true;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock.isAnAncestorOfType(type)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Get the first descendant using a predicate\r\n * @param predicate defines the predicate to check\r\n * @returns descendant or null if none found\r\n */\r\n public getDescendantOfPredicate(predicate: (block: NodeGeometryBlock) => boolean): Nullable<NodeGeometryBlock> {\r\n if (predicate(this)) {\r\n return this;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n const descendant = endpoint.ownerBlock.getDescendantOfPredicate(predicate);\r\n\r\n if (descendant) {\r\n return descendant;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates a new NodeGeometryBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n this._name = name;\r\n this.uniqueId = UniqueIdGenerator.UniqueId;\r\n }\r\n\r\n /**\r\n * Register a new input. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param isOptional defines a boolean indicating that this input can be omitted\r\n * @param value value to return if there is no connection\r\n * @param valueMin min value accepted for value\r\n * @param valueMax max value accepted for value\r\n * @returns the current block\r\n */\r\n public registerInput(name: string, type: NodeGeometryBlockConnectionPointTypes, isOptional: boolean = false, value?: any, valueMin?: any, valueMax?: any) {\r\n const point = new NodeGeometryConnectionPoint(name, this, NodeGeometryConnectionPointDirection.Input);\r\n point.type = type;\r\n point.isOptional = isOptional;\r\n point.defaultValue = value;\r\n point.value = value;\r\n point.valueMin = valueMin;\r\n point.valueMax = valueMax;\r\n\r\n this._inputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Register a new output. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param point an already created connection point. If not provided, create a new one\r\n * @returns the current block\r\n */\r\n public registerOutput(name: string, type: NodeGeometryBlockConnectionPointTypes, point?: NodeGeometryConnectionPoint) {\r\n point = point ?? new NodeGeometryConnectionPoint(name, this, NodeGeometryConnectionPointDirection.Output);\r\n point.type = type;\r\n\r\n this._outputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n // Empty. Must be defined by child nodes\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _customBuildStep(state: NodeGeometryBuildState): void {\r\n // Must be implemented by children\r\n }\r\n\r\n /**\r\n * Build the current node and generate the vertex data\r\n * @param state defines the current generation state\r\n * @returns true if already built\r\n */\r\n public build(state: NodeGeometryBuildState): boolean {\r\n if (this._buildId === state.buildId) {\r\n return true;\r\n }\r\n\r\n if (this._outputs.length > 0) {\r\n if (!this._outputs.some((o) => o.hasEndpoints) && !this.isDebug) {\r\n return false;\r\n }\r\n\r\n this.outputs.forEach((o) => o._resetCounters());\r\n }\r\n\r\n this._buildId = state.buildId;\r\n\r\n // Check if \"parent\" blocks are compiled\r\n for (const input of this._inputs) {\r\n if (!input.connectedPoint) {\r\n if (!input.isOptional) {\r\n // Emit a warning\r\n state.notConnectedNonOptionalInputs.push(input);\r\n }\r\n continue;\r\n }\r\n\r\n const block = input.connectedPoint.ownerBlock;\r\n if (block && block !== this) {\r\n block.build(state);\r\n }\r\n }\r\n\r\n this._customBuildStep(state);\r\n\r\n // Logs\r\n if (state.verbose) {\r\n Logger.Log(`Building ${this.name} [${this.getClassName()}]`);\r\n }\r\n\r\n const now = PrecisionDate.Now;\r\n this._buildBlock(state);\r\n this._buildExecutionTime = PrecisionDate.Now - now;\r\n\r\n // Compile connected blocks\r\n for (const output of this._outputs) {\r\n for (const endpoint of output.endpoints) {\r\n const block = endpoint.ownerBlock;\r\n\r\n if (block) {\r\n block.build(state);\r\n }\r\n }\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n return false;\r\n }\r\n\r\n protected _linkConnectionTypes(inputIndex0: number, inputIndex1: number, looseCoupling = false) {\r\n if (looseCoupling) {\r\n this._inputs[inputIndex1]._acceptedConnectionPointType = this._inputs[inputIndex0];\r\n } else {\r\n this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];\r\n }\r\n this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n */\r\n public initialize() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Lets the block try to connect some inputs automatically\r\n */\r\n public autoConfigure() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Find an input by its name\r\n * @param name defines the name of the input to look for\r\n * @returns the input or null if not found\r\n */\r\n public getInputByName(name: string) {\r\n const filter = this._inputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Find an output by its name\r\n * @param name defines the name of the output to look for\r\n * @returns the output or null if not found\r\n */\r\n public getOutputByName(name: string) {\r\n const filter = this._outputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.name = this.name;\r\n\r\n serializationObject.inputs = [];\r\n serializationObject.outputs = [];\r\n\r\n for (const input of this.inputs) {\r\n serializationObject.inputs.push(input.serialize());\r\n }\r\n\r\n for (const output of this.outputs) {\r\n serializationObject.outputs.push(output.serialize(false));\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _deserialize(serializationObject: any) {\r\n this._name = serializationObject.name;\r\n this.comments = serializationObject.comments;\r\n this.visibleOnFrame = !!serializationObject.visibleOnFrame;\r\n this._deserializePortDisplayNamesAndExposedOnFrame(serializationObject);\r\n }\r\n\r\n private _deserializePortDisplayNamesAndExposedOnFrame(serializationObject: any) {\r\n const serializedInputs = serializationObject.inputs;\r\n const serializedOutputs = serializationObject.outputs;\r\n if (serializedInputs) {\r\n serializedInputs.forEach((port: any) => {\r\n const input = this.inputs.find((i) => i.name === port.name);\r\n\r\n if (!input) {\r\n return;\r\n }\r\n\r\n if (port.displayName) {\r\n input.displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n input.isExposedOnFrame = port.isExposedOnFrame;\r\n input.exposedPortPosition = port.exposedPortPosition;\r\n }\r\n if (port.value !== undefined && port.value !== null) {\r\n if (port.valueType === \"number\") {\r\n input.value = port.value;\r\n } else {\r\n const valueType = GetClass(port.valueType);\r\n\r\n if (valueType) {\r\n input.value = valueType.FromArray(port.value);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n if (serializedOutputs) {\r\n serializedOutputs.forEach((port: any, i: number) => {\r\n if (port.displayName) {\r\n this.outputs[i].displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;\r\n this.outputs[i].exposedPortPosition = port.exposedPortPosition;\r\n }\r\n });\r\n }\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const variableName = this._codeVariableName;\r\n return `${variableName}.visibleOnFrame = ${this.visibleOnFrame};\\n`;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _dumpCodeForOutputConnections(alreadyDumped: NodeGeometryBlock[]) {\r\n let codeString = \"\";\r\n\r\n if (alreadyDumped.indexOf(this) !== -1) {\r\n return codeString;\r\n }\r\n\r\n alreadyDumped.push(this);\r\n\r\n for (const input of this.inputs) {\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n\r\n const connectedOutput = input.connectedPoint!;\r\n const connectedBlock = connectedOutput.ownerBlock;\r\n\r\n codeString += connectedBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n codeString += `${connectedBlock._codeVariableName}.${connectedBlock._outputRename(connectedOutput.name)}.connectTo(${this._codeVariableName}.${this._inputRename(\r\n input.name\r\n )});\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _dumpCode(uniqueNames: string[], alreadyDumped: NodeGeometryBlock[]) {\r\n alreadyDumped.push(this);\r\n\r\n // Get unique name\r\n const nameAsVariableName = this.name.replace(/[^A-Za-z_]+/g, \"\");\r\n this._codeVariableName = nameAsVariableName || `${this.getClassName()}_${this.uniqueId}`;\r\n\r\n if (uniqueNames.indexOf(this._codeVariableName) !== -1) {\r\n let index = 0;\r\n do {\r\n index++;\r\n this._codeVariableName = nameAsVariableName + index;\r\n } while (uniqueNames.indexOf(this._codeVariableName) !== -1);\r\n }\r\n\r\n uniqueNames.push(this._codeVariableName);\r\n\r\n // Declaration\r\n let codeString = `\\n// ${this.getClassName()}\\n`;\r\n if (this.comments) {\r\n codeString += `// ${this.comments}\\n`;\r\n }\r\n const className = this.getClassName();\r\n if (className === \"GeometryInputBlock\") {\r\n const block = this as unknown as GeometryInputBlock;\r\n const blockType = block.type;\r\n codeString += `var ${this._codeVariableName} = new BABYLON.GeometryInputBlock(\"${this.name}\", ${blockType});\\n`;\r\n } else {\r\n codeString += `var ${this._codeVariableName} = new BABYLON.${className}(\"${this.name}\");\\n`;\r\n }\r\n\r\n // Properties\r\n codeString += this._dumpPropertiesCode();\r\n\r\n // Inputs\r\n for (const input of this.inputs) {\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n\r\n const connectedOutput = input.connectedPoint!;\r\n const connectedBlock = connectedOutput.ownerBlock;\r\n\r\n if (alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n // Outputs\r\n for (const output of this.outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n const connectedBlock = endpoint.ownerBlock;\r\n if (connectedBlock && alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Clone the current block to a new identical block\r\n * @returns a copy of the current block\r\n */\r\n public clone() {\r\n const serializationObject = this.serialize();\r\n\r\n const blockType = GetClass(serializationObject.customType);\r\n if (blockType) {\r\n const block: NodeGeometryBlock = new blockType();\r\n block._deserialize(serializationObject);\r\n\r\n return block;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n for (const input of this.inputs) {\r\n input.dispose();\r\n }\r\n\r\n for (const output of this.outputs) {\r\n output.dispose();\r\n }\r\n\r\n this.onBuildObservable.clear();\r\n }\r\n}\r\n"]}
package/Meshes/mesh.d.ts CHANGED
@@ -856,9 +856,10 @@ export declare class Mesh extends AbstractMesh implements IGetSetVerticesData {
856
856
  * @param uvOffset is an optional vector2 used to offset UV.
857
857
  * @param uvScale is an optional vector2 used to scale UV.
858
858
  * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.
859
+ * @param onError defines a callback called when an error occurs during the processing of the request.
859
860
  * @returns the Mesh.
860
861
  */
861
- applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void, uvOffset?: Vector2, uvScale?: Vector2, forceUpdate?: boolean): Mesh;
862
+ applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void, uvOffset?: Vector2, uvScale?: Vector2, forceUpdate?: boolean, onError?: (message?: string, exception?: any) => void): Mesh;
862
863
  /**
863
864
  * Modifies the mesh geometry according to a displacementMap buffer.
864
865
  * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.