@babylonjs/core 5.0.0-alpha.65 → 5.0.0-beta.1

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 (117) hide show
  1. package/Animations/animation.js +3 -0
  2. package/Animations/animation.js.map +1 -1
  3. package/Bones/bone.js +3 -0
  4. package/Bones/bone.js.map +1 -1
  5. package/Cameras/Inputs/freeCameraTouchInput.d.ts +2 -2
  6. package/Cameras/Inputs/freeCameraTouchInput.js +6 -4
  7. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  8. package/Collisions/collider.d.ts +1 -1
  9. package/Collisions/collider.js +13 -3
  10. package/Collisions/collider.js.map +1 -1
  11. package/Engines/Extensions/engine.renderTarget.js +1 -0
  12. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  13. package/Engines/WebGPU/Extensions/engine.cubeTexture.js +1 -1
  14. package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
  15. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +1 -1
  16. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  17. package/Engines/WebGPU/Extensions/engine.rawTexture.js +5 -5
  18. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  19. package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -4
  20. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  21. package/Engines/WebGPU/Extensions/engine.videoTexture.js +1 -1
  22. package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
  23. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +4 -0
  24. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  25. package/Engines/WebGPU/webgpuClearQuad.d.ts +1 -0
  26. package/Engines/WebGPU/webgpuClearQuad.js +10 -7
  27. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  28. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -1
  29. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  30. package/Engines/WebGPU/webgpuTextureHelper.d.ts +4 -3
  31. package/Engines/WebGPU/webgpuTextureHelper.js +80 -45
  32. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  33. package/Engines/engine.d.ts +1 -0
  34. package/Engines/renderTargetWrapper.js +1 -1
  35. package/Engines/renderTargetWrapper.js.map +1 -1
  36. package/Engines/thinEngine.js +2 -2
  37. package/Engines/thinEngine.js.map +1 -1
  38. package/Engines/webgpuEngine.js +5 -5
  39. package/Engines/webgpuEngine.js.map +1 -1
  40. package/Layers/effectLayer.js +23 -0
  41. package/Layers/effectLayer.js.map +1 -1
  42. package/Layers/glowLayer.js +2 -0
  43. package/Layers/glowLayer.js.map +1 -1
  44. package/Lights/light.d.ts +1 -0
  45. package/Lights/light.js +2 -1
  46. package/Lights/light.js.map +1 -1
  47. package/Materials/Textures/baseTexture.d.ts +6 -2
  48. package/Materials/Textures/baseTexture.js +60 -16
  49. package/Materials/Textures/baseTexture.js.map +1 -1
  50. package/Materials/Textures/renderTargetTexture.d.ts +10 -5
  51. package/Materials/Textures/renderTargetTexture.js +18 -6
  52. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  53. package/Materials/Textures/texture.d.ts +3 -0
  54. package/Materials/Textures/texture.js +3 -0
  55. package/Materials/Textures/texture.js.map +1 -1
  56. package/Materials/materialDefines.d.ts +1 -0
  57. package/Materials/materialDefines.js +24 -15
  58. package/Materials/materialDefines.js.map +1 -1
  59. package/Materials/materialPluginBase.d.ts +6 -1
  60. package/Materials/materialPluginBase.js +7 -1
  61. package/Materials/materialPluginBase.js.map +1 -1
  62. package/Meshes/Builders/goldbergBuilder.d.ts +45 -42
  63. package/Meshes/Builders/goldbergBuilder.js +14 -225
  64. package/Meshes/Builders/goldbergBuilder.js.map +1 -1
  65. package/Meshes/Builders/index.d.ts +1 -0
  66. package/Meshes/Builders/index.js +1 -0
  67. package/Meshes/Builders/index.js.map +1 -1
  68. package/Meshes/Builders/shapeBuilder.d.ts +10 -2
  69. package/Meshes/Builders/shapeBuilder.js +11 -5
  70. package/Meshes/Builders/shapeBuilder.js.map +1 -1
  71. package/Meshes/abstractMesh.d.ts +4 -1
  72. package/Meshes/abstractMesh.js +8 -3
  73. package/Meshes/abstractMesh.js.map +1 -1
  74. package/Meshes/geodesicMesh.d.ts +1 -1
  75. package/Meshes/geodesicMesh.js +6 -6
  76. package/Meshes/geodesicMesh.js.map +1 -1
  77. package/Meshes/goldbergMesh.d.ts +107 -0
  78. package/Meshes/goldbergMesh.js +244 -0
  79. package/Meshes/goldbergMesh.js.map +1 -0
  80. package/Meshes/index.d.ts +1 -0
  81. package/Meshes/index.js +1 -0
  82. package/Meshes/index.js.map +1 -1
  83. package/Meshes/mesh.d.ts +5 -0
  84. package/Meshes/mesh.js +11 -0
  85. package/Meshes/mesh.js.map +1 -1
  86. package/Meshes/mesh.lts.d.ts +10 -6
  87. package/Meshes/mesh.lts.js +1 -1
  88. package/Meshes/mesh.lts.js.map +1 -1
  89. package/Meshes/subMesh.d.ts +2 -1
  90. package/Meshes/subMesh.js +11 -4
  91. package/Meshes/subMesh.js.map +1 -1
  92. package/Misc/timer.js +1 -0
  93. package/Misc/timer.js.map +1 -1
  94. package/Physics/Plugins/ammoJSPlugin.d.ts +4 -0
  95. package/Physics/Plugins/ammoJSPlugin.js +11 -6
  96. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  97. package/PostProcesses/volumetricLightScatteringPostProcess.js +22 -0
  98. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  99. package/Rendering/depthRenderer.js +18 -0
  100. package/Rendering/depthRenderer.js.map +1 -1
  101. package/Rendering/geometryBufferRenderer.js +23 -1
  102. package/Rendering/geometryBufferRenderer.js.map +1 -1
  103. package/XR/features/WebXRControllerPointerSelection.js +6 -4
  104. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  105. package/XR/features/WebXRNearInteraction.js +8 -6
  106. package/XR/features/WebXRNearInteraction.js.map +1 -1
  107. package/XR/webXRExperienceHelper.js +7 -0
  108. package/XR/webXRExperienceHelper.js.map +1 -1
  109. package/XR/webXRRenderTargetTextureProvider.js +1 -3
  110. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  111. package/XR/webXRSessionManager.d.ts +14 -1
  112. package/XR/webXRSessionManager.js +31 -8
  113. package/XR/webXRSessionManager.js.map +1 -1
  114. package/package.json +4 -1
  115. package/scene.d.ts +2 -1
  116. package/scene.js +3 -2
  117. package/scene.js.map +1 -1
@@ -4,6 +4,8 @@ import { Scene } from "../scene";
4
4
  import { Nullable } from "../types";
5
5
  import { AbstractMesh } from "./abstractMesh";
6
6
  import { ICreateCapsuleOptions } from "./Builders/capsuleBuilder";
7
+ import { GoldbergCreationOption } from "./Builders/goldbergBuilder";
8
+ declare type GoldbergMesh = import("./goldbergMesh").GoldbergMesh;
7
9
  declare type LinesMesh = import("./linesMesh").LinesMesh;
8
10
  declare type GroundMesh = import("./groundMesh").GroundMesh;
9
11
  /**
@@ -407,13 +409,15 @@ declare module "./mesh" {
407
409
  */
408
410
  function CreateCapsule(name: string, options: ICreateCapsuleOptions, scene: Scene): Mesh;
409
411
  /**
410
- * Extends a mesh to a Goldberg mesh
411
- * Warning the mesh to convert MUST be an import of a perviously exported Goldberg mesh
412
- * @param mesh the mesh to convert
413
- * @returns the extended mesh
414
- * @deprecated Please use ExtendMeshToGoldberg instead
412
+ * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces
413
+ * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron
414
+ * @param name defines the name of the mesh
415
+ * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
416
+ * @param scene defines the hosting scene
417
+ * @returns Goldberg mesh
418
+ * @deprecated Please use MeshBuilder instead
415
419
  */
416
- function ExtendToGoldberg(mesh: Mesh): Mesh;
420
+ function CreateGoldberg(name: string, options: GoldbergCreationOption, scene?: Nullable<Scene>): GoldbergMesh;
417
421
  }
418
422
  }
419
423
  /** @hidden */
@@ -19,6 +19,6 @@ export var _injectLTSMesh = function (Mesh) {
19
19
  Mesh.CreateIcoSphere = Mesh.CreateIcoSphere || (function () { throw _WarnImport("MeshBuilder"); });
20
20
  Mesh.CreateDecal = Mesh.CreateDecal || (function () { throw _WarnImport("MeshBuilder"); });
21
21
  Mesh.CreateCapsule = Mesh.CreateCapsule || (function () { throw _WarnImport("MeshBuilder"); });
22
- Mesh.ExtendToGoldberg = Mesh.ExtendToGoldberg || (function () { throw _WarnImport("MeshBuilder"); });
22
+ Mesh.CreateGoldberg = Mesh.CreateGoldberg || (function () { throw _WarnImport("MeshBuilder"); });
23
23
  };
24
24
  //# sourceMappingURL=mesh.lts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mesh.lts.js","sourceRoot":"","sources":["../../../sourceES6/core/Meshes/mesh.lts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAgiB/C,cAAc;AACd,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,IAAgB;IAC3C,IAAI,CAAC,SAAS,CAAC,eAAe,GAAG,UAAU,EAAU;QACjD,OAAO,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC;IAEF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,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,CAAC,CAAC;IAC7F,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnG,CAAC,CAAC","sourcesContent":["import { Color4 } from \"../Maths/math.color\";\r\nimport { Vector3, Vector4 } from \"../Maths/math.vector\";\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport { Scene } from \"../scene\";\r\nimport { Nullable } from \"../types\";\r\nimport { AbstractMesh } from \"./abstractMesh\";\r\nimport { ICreateCapsuleOptions } from \"./Builders/capsuleBuilder\";\r\n\r\ndeclare type LinesMesh = import(\"./linesMesh\").LinesMesh;\r\ndeclare type GroundMesh = import(\"./groundMesh\").GroundMesh;\r\ndeclare type Mesh = import('./mesh').Mesh;\r\n/**\r\n * @hidden\r\n */\r\ndeclare type TypeofMesh = typeof import('./mesh').Mesh;\r\n\r\ndeclare var earcut: any;\r\n\r\ndeclare module \"./mesh\" {\r\n interface Mesh {\r\n /**\r\n * Sets the mesh material by the material or multiMaterial `id` property\r\n * @param id is a string identifying the material or the multiMaterial\r\n * @returns the current mesh\r\n * @deprecated Please use MeshBuilder instead Please use setMaterialById instead\r\n */\r\n setMaterialByID(id: string): Mesh;\r\n }\r\n namespace Mesh {\r\n /**\r\n * Creates a ribbon mesh.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.\r\n * @param closeArray creates a seam between the first and the last paths of the path array (default is false)\r\n * @param closePath creates a seam between the first and the last points of each path of the path array\r\n * @param offset is taken in account only if the `pathArray` is containing a single path\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#ribbon)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateRibbon(\r\n name: string,\r\n pathArray: Vector3[][],\r\n closeArray: boolean,\r\n closePath: boolean,\r\n offset: number,\r\n scene?: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc.\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the radius size (float) of the polygon (default 0.5)\r\n * @param tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateDisc(name: string, radius: number, tessellation: number, scene: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a box mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of each box side (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateBox(name: string, size: number, scene: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a sphere mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a hemisphere mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateHemisphere(name: string, segments: number, diameter: number, scene?: Scene): Mesh;\r\n\r\n /**\r\n * Creates a cylinder or a cone mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param height sets the height size (float) of the cylinder/cone (float, default 2)\r\n * @param diameterTop set the top cap diameter (floats, default 1)\r\n * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero\r\n * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance\r\n * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateCylinder(\r\n name: string,\r\n height: number,\r\n diameterTop: number,\r\n diameterBottom: number,\r\n tessellation: number,\r\n subdivisions: any,\r\n scene?: Scene,\r\n updatable?: any,\r\n sideOrientation?: number\r\n ): Mesh;\r\n\r\n // Torus (Code from SharpDX.org)\r\n /**\r\n * Creates a torus mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param diameter sets the diameter size (float) of the torus (default 1)\r\n * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param tessellation sets the number of torus sides (positive integer, default 16)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a torus knot mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the global radius size (float) of the torus knot (default 2)\r\n * @param tube sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)\r\n * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * @param p the number of windings on X axis (positive integers, default 2)\r\n * @param q the number of windings on Y axis (positive integers, default 3)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateTorusKnot(\r\n name: string,\r\n radius: number,\r\n tube: number,\r\n radialSegments: number,\r\n tubularSegments: number,\r\n p: number,\r\n q: number,\r\n scene?: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a line mesh..\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#lines-and-dashedlines).\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateLines(name: string, points: Vector3[], scene: Nullable<Scene>, updatable: boolean, instance?: Nullable<LinesMesh>): LinesMesh;\r\n\r\n /**\r\n * Creates a dashed line mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)\r\n * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * @param dashNb is the intended total number of dashes (positive integer, default 200)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#lines-and-dashedlines)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateDashedLines(\r\n name: string,\r\n points: Vector3[],\r\n dashSize: number,\r\n gapSize: number,\r\n dashNb: number,\r\n scene: Nullable<Scene>,\r\n updatable?: boolean,\r\n instance?: LinesMesh\r\n ): LinesMesh;\r\n\r\n /**\r\n * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.\r\n * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.\r\n * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\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 * Remember you can only change the shape positions, not their number when updating a polygon.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreatePolygon(name: string, shape: Vector3[], scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number, earcutInjection?: any): Mesh;\r\n\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction..\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param depth defines the height of extrusion\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function ExtrudePolygon(\r\n name: string,\r\n shape: Vector3[],\r\n depth: number,\r\n scene: Scene,\r\n holes?: Vector3[][],\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n earcutInjection?: any\r\n ): Mesh;\r\n\r\n /**\r\n * Creates an extruded shape mesh.\r\n * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scale is the value to scale the shape\r\n * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#extruded-shape)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function ExtrudeShape(\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scale: number,\r\n rotation: number,\r\n cap: number,\r\n scene: Nullable<Scene>,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n ): Mesh;\r\n\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n *\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scaleFunction is a custom Javascript function called on each path point\r\n * @param rotationFunction is a custom Javascript function called on each path point\r\n * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#extruded-shape)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function ExtrudeShapeCustom(\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotationFunction: Nullable<{ (i: number, distance: number): number }>,\r\n ribbonCloseArray: boolean,\r\n ribbonClosePath: boolean,\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n ): Mesh;\r\n\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe.\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * @param radius is the radius value of the lathe\r\n * @param tessellation is the side number of the lathe.\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a plane mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of both sides of the plane at once (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a ground mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param width set the width of the ground\r\n * @param height set the height of the ground\r\n * @param subdivisions sets the number of subdivisions per side\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateGround(name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh;\r\n\r\n /**\r\n * Creates a tiled ground mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param xmin set the ground minimum X coordinate\r\n * @param zmin set the ground minimum Y coordinate\r\n * @param xmax set the ground maximum X coordinate\r\n * @param zmax set the ground maximum Z coordinate\r\n * @param subdivisions is an object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param precision is an object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function 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\r\n /**\r\n * Creates a ground mesh from a height map.\r\n * @see https://doc.babylonjs.com/babylon101/height_map\r\n * @param name defines the name of the mesh to create\r\n * @param url sets the URL of the height map image resource\r\n * @param width set the ground width size\r\n * @param height set the ground height size\r\n * @param subdivisions sets the number of subdivision per side\r\n * @param minHeight is the minimum altitude on the ground\r\n * @param maxHeight is the maximum altitude on the ground\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)\r\n * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function 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\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n *\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * @param radius sets the tube radius size\r\n * @param tessellation is the number of sides on the tubular surface\r\n * @param radiusFunction is a custom function. If it is not null, it overrides the parameter `radius`. This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#tube)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateTube(\r\n name: string,\r\n path: Vector3[],\r\n radius: number,\r\n tessellation: number,\r\n radiusFunction: { (i: number, distance: number): number },\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a polyhedron mesh.\r\n *.\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embedded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\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 to create\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreatePolyhedron(\r\n name: string,\r\n options: {\r\n type?: number;\r\n size?: number;\r\n sizeX?: number;\r\n sizeY?: number;\r\n sizeZ?: number;\r\n custom?: any;\r\n faceUV?: Vector4[];\r\n faceColors?: Color4[];\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n },\r\n scene: Scene\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\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 * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/icosphere\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 scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateIcoSphere(\r\n name: string,\r\n options: { radius?: number; flat?: boolean; subdivisions?: number; sideOrientation?: number; updatable?: boolean },\r\n scene: Scene\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a decal mesh.\r\n *.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh receiving the decal\r\n * @param position sets the position of the decal in world coordinates\r\n * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates\r\n * @param size sets the decal scaling\r\n * @param angle sets the angle to rotate the decal\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;\r\n\r\n /** Creates a Capsule Mesh\r\n * @param name defines the name of the mesh.\r\n * @param options the constructors options used to shape the mesh.\r\n * @param scene defines the scene the mesh is scoped to.\r\n * @returns the capsule mesh\r\n * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/capsule\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateCapsule(name: string, options: ICreateCapsuleOptions, scene: Scene): Mesh;\r\n\r\n /**\r\n * Extends a mesh to a Goldberg mesh\r\n * Warning the mesh to convert MUST be an import of a perviously exported Goldberg mesh\r\n * @param mesh the mesh to convert\r\n * @returns the extended mesh\r\n * @deprecated Please use ExtendMeshToGoldberg instead\r\n */\r\n function ExtendToGoldberg(mesh: Mesh): Mesh;\r\n }\r\n}\r\n\r\n/** @hidden */\r\nexport const _injectLTSMesh = (Mesh: TypeofMesh) => {\r\n Mesh.prototype.setMaterialByID = function (id: string): Mesh {\r\n return this.setMaterialById(id);\r\n };\r\n\r\n Mesh.CreateDisc = Mesh.CreateDisc || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateBox = Mesh.CreateBox || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateSphere = Mesh.CreateSphere || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateCylinder = Mesh.CreateCylinder || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateTorusKnot = Mesh.CreateTorusKnot || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateTorus = Mesh.CreateTorus || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreatePlane = Mesh.CreatePlane || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateGround = Mesh.CreateGround || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateTiledGround = Mesh.CreateTiledGround || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateGroundFromHeightMap = Mesh.CreateGroundFromHeightMap || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateTube = Mesh.CreateTube || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreatePolyhedron = Mesh.CreatePolyhedron || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateIcoSphere = Mesh.CreateIcoSphere || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateDecal = Mesh.CreateDecal || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateCapsule = Mesh.CreateCapsule || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.ExtendToGoldberg = Mesh.ExtendToGoldberg || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n};"]}
1
+ {"version":3,"file":"mesh.lts.js","sourceRoot":"","sources":["../../../sourceES6/core/Meshes/mesh.lts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAoiB/C,cAAc;AACd,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,IAAgB;IAC3C,IAAI,CAAC,SAAS,CAAC,eAAe,GAAG,UAAU,EAAU;QACjD,OAAO,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC;IAEF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC,cAAQ,MAAM,WA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AC,eAAe,GAAG,IAAI,CAAC,eAAe,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,IAAI,CAAC,cAAQ,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/F,CAAC,CAAC","sourcesContent":["import { Color4 } from \"../Maths/math.color\";\r\nimport { Vector3, Vector4 } from \"../Maths/math.vector\";\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport { Scene } from \"../scene\";\r\nimport { Nullable } from \"../types\";\r\nimport { AbstractMesh } from \"./abstractMesh\";\r\nimport { ICreateCapsuleOptions } from \"./Builders/capsuleBuilder\";\r\nimport { GoldbergCreationOption } from \"./Builders/goldbergBuilder\";\r\n\r\ndeclare type GoldbergMesh = import(\"./goldbergMesh\").GoldbergMesh;\r\ndeclare type LinesMesh = import(\"./linesMesh\").LinesMesh;\r\ndeclare type GroundMesh = import(\"./groundMesh\").GroundMesh;\r\ndeclare type Mesh = import('./mesh').Mesh;\r\n/**\r\n * @hidden\r\n */\r\ndeclare type TypeofMesh = typeof import('./mesh').Mesh;\r\n\r\ndeclare var earcut: any;\r\n\r\ndeclare module \"./mesh\" {\r\n interface Mesh {\r\n /**\r\n * Sets the mesh material by the material or multiMaterial `id` property\r\n * @param id is a string identifying the material or the multiMaterial\r\n * @returns the current mesh\r\n * @deprecated Please use MeshBuilder instead Please use setMaterialById instead\r\n */\r\n setMaterialByID(id: string): Mesh;\r\n }\r\n namespace Mesh {\r\n /**\r\n * Creates a ribbon mesh.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.\r\n * @param closeArray creates a seam between the first and the last paths of the path array (default is false)\r\n * @param closePath creates a seam between the first and the last points of each path of the path array\r\n * @param offset is taken in account only if the `pathArray` is containing a single path\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#ribbon)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateRibbon(\r\n name: string,\r\n pathArray: Vector3[][],\r\n closeArray: boolean,\r\n closePath: boolean,\r\n offset: number,\r\n scene?: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc.\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the radius size (float) of the polygon (default 0.5)\r\n * @param tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateDisc(name: string, radius: number, tessellation: number, scene: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a box mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of each box side (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateBox(name: string, size: number, scene: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a sphere mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a hemisphere mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateHemisphere(name: string, segments: number, diameter: number, scene?: Scene): Mesh;\r\n\r\n /**\r\n * Creates a cylinder or a cone mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param height sets the height size (float) of the cylinder/cone (float, default 2)\r\n * @param diameterTop set the top cap diameter (floats, default 1)\r\n * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero\r\n * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance\r\n * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateCylinder(\r\n name: string,\r\n height: number,\r\n diameterTop: number,\r\n diameterBottom: number,\r\n tessellation: number,\r\n subdivisions: any,\r\n scene?: Scene,\r\n updatable?: any,\r\n sideOrientation?: number\r\n ): Mesh;\r\n\r\n // Torus (Code from SharpDX.org)\r\n /**\r\n * Creates a torus mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param diameter sets the diameter size (float) of the torus (default 1)\r\n * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param tessellation sets the number of torus sides (positive integer, default 16)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a torus knot mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the global radius size (float) of the torus knot (default 2)\r\n * @param tube sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)\r\n * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * @param p the number of windings on X axis (positive integers, default 2)\r\n * @param q the number of windings on Y axis (positive integers, default 3)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateTorusKnot(\r\n name: string,\r\n radius: number,\r\n tube: number,\r\n radialSegments: number,\r\n tubularSegments: number,\r\n p: number,\r\n q: number,\r\n scene?: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a line mesh..\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#lines-and-dashedlines).\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateLines(name: string, points: Vector3[], scene: Nullable<Scene>, updatable: boolean, instance?: Nullable<LinesMesh>): LinesMesh;\r\n\r\n /**\r\n * Creates a dashed line mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)\r\n * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * @param dashNb is the intended total number of dashes (positive integer, default 200)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#lines-and-dashedlines)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateDashedLines(\r\n name: string,\r\n points: Vector3[],\r\n dashSize: number,\r\n gapSize: number,\r\n dashNb: number,\r\n scene: Nullable<Scene>,\r\n updatable?: boolean,\r\n instance?: LinesMesh\r\n ): LinesMesh;\r\n\r\n /**\r\n * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.\r\n * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.\r\n * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\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 * Remember you can only change the shape positions, not their number when updating a polygon.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreatePolygon(name: string, shape: Vector3[], scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number, earcutInjection?: any): Mesh;\r\n\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction..\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param depth defines the height of extrusion\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function ExtrudePolygon(\r\n name: string,\r\n shape: Vector3[],\r\n depth: number,\r\n scene: Scene,\r\n holes?: Vector3[][],\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n earcutInjection?: any\r\n ): Mesh;\r\n\r\n /**\r\n * Creates an extruded shape mesh.\r\n * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scale is the value to scale the shape\r\n * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#extruded-shape)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function ExtrudeShape(\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scale: number,\r\n rotation: number,\r\n cap: number,\r\n scene: Nullable<Scene>,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n ): Mesh;\r\n\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n *\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scaleFunction is a custom Javascript function called on each path point\r\n * @param rotationFunction is a custom Javascript function called on each path point\r\n * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#extruded-shape)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function ExtrudeShapeCustom(\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotationFunction: Nullable<{ (i: number, distance: number): number }>,\r\n ribbonCloseArray: boolean,\r\n ribbonClosePath: boolean,\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n ): Mesh;\r\n\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe.\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * @param radius is the radius value of the lathe\r\n * @param tessellation is the side number of the lathe.\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a plane mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of both sides of the plane at once (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;\r\n\r\n /**\r\n * Creates a ground mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param width set the width of the ground\r\n * @param height set the height of the ground\r\n * @param subdivisions sets the number of subdivisions per side\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateGround(name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh;\r\n\r\n /**\r\n * Creates a tiled ground mesh.\r\n * @param name defines the name of the mesh to create\r\n * @param xmin set the ground minimum X coordinate\r\n * @param zmin set the ground minimum Y coordinate\r\n * @param xmax set the ground maximum X coordinate\r\n * @param zmax set the ground maximum Z coordinate\r\n * @param subdivisions is an object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param precision is an object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function 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\r\n /**\r\n * Creates a ground mesh from a height map.\r\n * @see https://doc.babylonjs.com/babylon101/height_map\r\n * @param name defines the name of the mesh to create\r\n * @param url sets the URL of the height map image resource\r\n * @param width set the ground width size\r\n * @param height set the ground height size\r\n * @param subdivisions sets the number of subdivision per side\r\n * @param minHeight is the minimum altitude on the ground\r\n * @param maxHeight is the maximum altitude on the ground\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)\r\n * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function 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\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n *\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * @param radius sets the tube radius size\r\n * @param tessellation is the number of sides on the tubular surface\r\n * @param radiusFunction is a custom function. If it is not null, it overrides the parameter `radius`. This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/divingDeeper/mesh/dynamicMeshMorph#tube)\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateTube(\r\n name: string,\r\n path: Vector3[],\r\n radius: number,\r\n tessellation: number,\r\n radiusFunction: { (i: number, distance: number): number },\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a polyhedron mesh.\r\n *.\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embedded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\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 to create\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreatePolyhedron(\r\n name: string,\r\n options: {\r\n type?: number;\r\n size?: number;\r\n sizeX?: number;\r\n sizeY?: number;\r\n sizeZ?: number;\r\n custom?: any;\r\n faceUV?: Vector4[];\r\n faceColors?: Color4[];\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n },\r\n scene: Scene\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\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 * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/icosphere\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 scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateIcoSphere(\r\n name: string,\r\n options: { radius?: number; flat?: boolean; subdivisions?: number; sideOrientation?: number; updatable?: boolean },\r\n scene: Scene\r\n ): Mesh;\r\n\r\n /**\r\n * Creates a decal mesh.\r\n *.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh receiving the decal\r\n * @param position sets the position of the decal in world coordinates\r\n * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates\r\n * @param size sets the decal scaling\r\n * @param angle sets the angle to rotate the decal\r\n * @returns a new Mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;\r\n\r\n /** Creates a Capsule Mesh\r\n * @param name defines the name of the mesh.\r\n * @param options the constructors options used to shape the mesh.\r\n * @param scene defines the scene the mesh is scoped to.\r\n * @returns the capsule mesh\r\n * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/capsule\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateCapsule(name: string, options: ICreateCapsuleOptions, scene: Scene): Mesh;\r\n\r\n /**\r\n * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces\r\n * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param scene defines the hosting scene\r\n * @returns Goldberg mesh\r\n * @deprecated Please use MeshBuilder instead\r\n */\r\n function CreateGoldberg(name: string, options: GoldbergCreationOption, scene?: Nullable<Scene>): GoldbergMesh;\r\n }\r\n}\r\n\r\n/** @hidden */\r\nexport const _injectLTSMesh = (Mesh: TypeofMesh) => {\r\n Mesh.prototype.setMaterialByID = function (id: string): Mesh {\r\n return this.setMaterialById(id);\r\n };\r\n\r\n Mesh.CreateDisc = Mesh.CreateDisc || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateBox = Mesh.CreateBox || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateSphere = Mesh.CreateSphere || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateCylinder = Mesh.CreateCylinder || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateTorusKnot = Mesh.CreateTorusKnot || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateTorus = Mesh.CreateTorus || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreatePlane = Mesh.CreatePlane || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateGround = Mesh.CreateGround || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateTiledGround = Mesh.CreateTiledGround || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateGroundFromHeightMap = Mesh.CreateGroundFromHeightMap || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateTube = Mesh.CreateTube || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreatePolyhedron = Mesh.CreatePolyhedron || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateIcoSphere = Mesh.CreateIcoSphere || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateDecal = Mesh.CreateDecal || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateCapsule = Mesh.CreateCapsule || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n Mesh.CreateGoldberg = Mesh.CreateGoldberg || (() => { throw _WarnImport(\"MeshBuilder\"); });\r\n};"]}
@@ -65,8 +65,9 @@ export declare class SubMesh implements ICullable {
65
65
  setEffect(effect: Nullable<Effect>, defines?: Nullable<string | MaterialDefines>, materialContext?: IMaterialContext, resetContext?: boolean): void;
66
66
  /**
67
67
  * Resets the draw wrappers cache
68
+ * @param passId If provided, releases only the draw wrapper corresponding to this render pass id
68
69
  */
69
- resetDrawCache(): void;
70
+ resetDrawCache(passId?: number): void;
70
71
  /** @hidden */
71
72
  _linesIndexCount: number;
72
73
  private _mesh;
package/Meshes/subMesh.js CHANGED
@@ -158,12 +158,19 @@ var SubMesh = /** @class */ (function () {
158
158
  };
159
159
  /**
160
160
  * Resets the draw wrappers cache
161
+ * @param passId If provided, releases only the draw wrapper corresponding to this render pass id
161
162
  */
162
- SubMesh.prototype.resetDrawCache = function () {
163
+ SubMesh.prototype.resetDrawCache = function (passId) {
163
164
  if (this._drawWrappers) {
164
- for (var _i = 0, _a = this._drawWrappers; _i < _a.length; _i++) {
165
- var drawWrapper = _a[_i];
166
- drawWrapper === null || drawWrapper === void 0 ? void 0 : drawWrapper.dispose();
165
+ if (passId !== undefined) {
166
+ this._removeDrawWrapper(passId);
167
+ return;
168
+ }
169
+ else {
170
+ for (var _i = 0, _a = this._drawWrappers; _i < _a.length; _i++) {
171
+ var drawWrapper = _a[_i];
172
+ drawWrapper === null || drawWrapper === void 0 ? void 0 : drawWrapper.dispose();
173
+ }
167
174
  }
168
175
  }
169
176
  this._drawWrappers = [];
@@ -1 +1 @@
1
- {"version":3,"file":"subMesh.js","sourceRoot":"","sources":["../../../sourceES6/core/Meshes/subMesh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAa,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIlE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAYvD;;GAEG;AACH;IA6II;;;;;;;;;;;OAWG;IACH;IACI,gCAAgC;IACzB,aAAqB;IAC5B,yBAAyB;IAClB,aAAqB;IAC5B,qBAAqB;IACd,aAAqB;IAC5B,kBAAkB;IACX,UAAkB;IACzB,oBAAoB;IACb,UAAkB,EACzB,IAAkB,EAClB,aAAoB,EACpB,iBAAiC,EACjC,SAAgB;QADhB,kCAAA,EAAA,wBAAiC;QACjC,0BAAA,EAAA,gBAAgB;QAZT,kBAAa,GAAb,aAAa,CAAQ;QAErB,kBAAa,GAAb,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cAAc,GAAG,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC;IAC3J,CAAC;IACL,cAAC;AAAD,CAAC,AA5rBD,IA4rBC","sourcesContent":["import { Nullable, IndicesArray, DeepImmutable, FloatArray } from \"../types\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo\";\r\nimport { ICullable, BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Effect } from \"../Materials/effect\";\r\n\r\nimport { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { extractMinAndMaxIndexed } from \"../Maths/math.functions\";\r\nimport { Plane } from \"../Maths/math.plane\";\r\nimport { DrawWrapper } from \"../Materials/drawWrapper\";\r\nimport { IMaterialContext } from \"../Engines/IMaterialContext\";\r\n\r\ndeclare type Collider = import(\"../Collisions/collider\").Collider;\r\ndeclare type Material = import(\"../Materials/material\").Material;\r\ndeclare type MaterialDefines = import(\"../Materials/materialDefines\").MaterialDefines;\r\ndeclare type MultiMaterial = import(\"../Materials/multiMaterial\").MultiMaterial;\r\ndeclare type AbstractMesh = import(\"./abstractMesh\").AbstractMesh;\r\ndeclare type Mesh = import(\"./mesh\").Mesh;\r\ndeclare type Ray = import(\"../Culling/ray\").Ray;\r\ndeclare type TrianglePickingPredicate = import(\"../Culling/ray\").TrianglePickingPredicate;\r\n\r\n/**\r\n * Defines a subdivision inside a mesh\r\n */\r\nexport class SubMesh implements ICullable {\r\n private _engine: Engine;\r\n /** @hidden */\r\n public _drawWrappers: Array<DrawWrapper>; // index in this array = pass id\r\n private _mainDrawWrapperOverride: Nullable<DrawWrapper> = null;\r\n\r\n /**\r\n * Gets material defines used by the effect associated to the sub mesh\r\n */\r\n public get materialDefines(): Nullable<MaterialDefines> {\r\n return this._mainDrawWrapperOverride ? (this._mainDrawWrapperOverride.defines as MaterialDefines) : this._getDrawWrapper()?.defines as Nullable<MaterialDefines>;\r\n }\r\n\r\n /**\r\n * Sets material defines used by the effect associated to the sub mesh\r\n */\r\n public set materialDefines(defines: Nullable<MaterialDefines>) {\r\n const drawWrapper = this._mainDrawWrapperOverride ?? this._getDrawWrapper(undefined, true)!;\r\n drawWrapper.defines = defines;\r\n }\r\n\r\n /** @hidden */\r\n public _getDrawWrapper(passId?: number, createIfNotExisting = false): DrawWrapper | undefined {\r\n passId = passId ?? this._engine.currentRenderPassId;\r\n let drawWrapper = this._drawWrappers[passId];\r\n if (!drawWrapper && createIfNotExisting) {\r\n this._drawWrappers[passId] = drawWrapper = new DrawWrapper(this._mesh.getScene().getEngine());\r\n }\r\n return drawWrapper;\r\n }\r\n\r\n /** @hidden */\r\n public _removeDrawWrapper(passId: number, disposeWrapper = true) {\r\n if (disposeWrapper) {\r\n this._drawWrappers[passId]?.dispose();\r\n }\r\n this._drawWrappers[passId] = undefined as any;\r\n }\r\n\r\n /**\r\n * Gets associated (main) effect (possibly the effect override if defined)\r\n */\r\n public get effect(): Nullable<Effect> {\r\n return this._mainDrawWrapperOverride ? this._mainDrawWrapperOverride.effect : (this._getDrawWrapper()?.effect ?? null);\r\n }\r\n\r\n /** @hidden */\r\n public get _drawWrapper(): DrawWrapper {\r\n return this._mainDrawWrapperOverride ?? this._getDrawWrapper(undefined, true)!;\r\n }\r\n\r\n /** @hidden */\r\n public get _drawWrapperOverride(): Nullable<DrawWrapper> {\r\n return this._mainDrawWrapperOverride;\r\n }\r\n\r\n /** @hidden */\r\n public _setMainDrawWrapperOverride(wrapper: Nullable<DrawWrapper>): void {\r\n this._mainDrawWrapperOverride = wrapper;\r\n }\r\n\r\n /**\r\n * Sets associated effect (effect used to render this submesh)\r\n * @param effect defines the effect to associate with\r\n * @param defines defines the set of defines used to compile this effect\r\n * @param materialContext material context associated to the effect\r\n * @param resetContext true to reset the draw context\r\n */\r\n public setEffect(effect: Nullable<Effect>, defines: Nullable<string | MaterialDefines> = null, materialContext?: IMaterialContext, resetContext = true) {\r\n const drawWrapper = this._drawWrapper;\r\n drawWrapper.setEffect(effect, defines, resetContext);\r\n if (materialContext !== undefined) {\r\n drawWrapper.materialContext = materialContext;\r\n }\r\n if (!effect) {\r\n drawWrapper.defines = null;\r\n drawWrapper.materialContext = undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Resets the draw wrappers cache\r\n */\r\n public resetDrawCache(): void {\r\n if (this._drawWrappers) {\r\n for (const drawWrapper of this._drawWrappers) {\r\n drawWrapper?.dispose();\r\n }\r\n }\r\n this._drawWrappers = [];\r\n }\r\n\r\n /** @hidden */\r\n public _linesIndexCount: number = 0;\r\n private _mesh: AbstractMesh;\r\n private _renderingMesh: Mesh;\r\n private _boundingInfo: BoundingInfo;\r\n private _linesIndexBuffer: Nullable<DataBuffer> = null;\r\n /** @hidden */\r\n public _lastColliderWorldVertices: Nullable<Vector3[]> = null;\r\n /** @hidden */\r\n public _trianglePlanes: Plane[];\r\n /** @hidden */\r\n public _lastColliderTransformMatrix: Nullable<Matrix> = null;\r\n\r\n /** @hidden */\r\n public _renderId = 0;\r\n /** @hidden */\r\n public _alphaIndex: number = 0;\r\n /** @hidden */\r\n public _distanceToCamera: number = 0;\r\n /** @hidden */\r\n public _id: number;\r\n\r\n private _currentMaterial: Nullable<Material> = null;\r\n\r\n /**\r\n * Add a new submesh to a mesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @returns the new submesh\r\n */\r\n public static AddToMesh(\r\n materialIndex: number,\r\n verticesStart: number,\r\n verticesCount: number,\r\n indexStart: number,\r\n indexCount: number,\r\n mesh: AbstractMesh,\r\n renderingMesh?: Mesh,\r\n createBoundingBox: boolean = true\r\n ): SubMesh {\r\n return new SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox);\r\n }\r\n\r\n /**\r\n * Creates a new submesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @param addToMesh defines a boolean indicating that the submesh must be added to the mesh.subMeshes array (true by default)\r\n */\r\n constructor(\r\n /** the material index to use */\r\n public materialIndex: number,\r\n /** vertex index start */\r\n public verticesStart: number,\r\n /** vertices count */\r\n public verticesCount: number,\r\n /** index start */\r\n public indexStart: number,\r\n /** indices count */\r\n public indexCount: number,\r\n mesh: AbstractMesh,\r\n renderingMesh?: Mesh,\r\n createBoundingBox: boolean = true,\r\n addToMesh = true\r\n ) {\r\n this._mesh = mesh;\r\n this._renderingMesh = renderingMesh || <Mesh>mesh;\r\n if (addToMesh) {\r\n mesh.subMeshes.push(this);\r\n }\r\n\r\n this._engine = this._mesh.getScene().getEngine();\r\n this.resetDrawCache();\r\n this._trianglePlanes = [];\r\n\r\n this._id = mesh.subMeshes.length - 1;\r\n\r\n if (createBoundingBox) {\r\n this.refreshBoundingInfo();\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if this submesh covers the entire parent mesh\r\n * @ignorenaming\r\n */\r\n public get IsGlobal(): boolean {\r\n return this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices();\r\n }\r\n\r\n /**\r\n * Returns the submesh BoundingInfo object\r\n * @returns current bounding info (or mesh's one if the submesh is global)\r\n */\r\n public getBoundingInfo(): BoundingInfo {\r\n if (this.IsGlobal) {\r\n return this._mesh.getBoundingInfo();\r\n }\r\n\r\n return this._boundingInfo;\r\n }\r\n\r\n /**\r\n * Sets the submesh BoundingInfo\r\n * @param boundingInfo defines the new bounding info to use\r\n * @returns the SubMesh\r\n */\r\n public setBoundingInfo(boundingInfo: BoundingInfo): SubMesh {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n }\r\n\r\n /**\r\n * Returns the mesh of the current submesh\r\n * @return the parent mesh\r\n */\r\n public getMesh(): AbstractMesh {\r\n return this._mesh;\r\n }\r\n\r\n /**\r\n * Returns the rendering mesh of the submesh\r\n * @returns the rendering mesh (could be different from parent mesh)\r\n */\r\n public getRenderingMesh(): Mesh {\r\n return this._renderingMesh;\r\n }\r\n\r\n /**\r\n * Returns the replacement mesh of the submesh\r\n * @returns the replacement mesh (could be different from parent mesh)\r\n */\r\n public getReplacementMesh(): Nullable<AbstractMesh> {\r\n return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\r\n }\r\n\r\n /**\r\n * Returns the effective mesh of the submesh\r\n * @returns the effective mesh (could be different from parent mesh)\r\n */\r\n public getEffectiveMesh(): AbstractMesh {\r\n const replacementMesh = this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\r\n\r\n return replacementMesh ? replacementMesh : this._renderingMesh;\r\n }\r\n\r\n /**\r\n * Returns the submesh material\r\n * @returns null or the current material\r\n */\r\n public getMaterial(): Nullable<Material> {\r\n var rootMaterial = this._renderingMesh.getMaterialForRenderPass(this._engine.currentRenderPassId) ?? this._renderingMesh.material;\r\n\r\n if (rootMaterial === null || rootMaterial === undefined) {\r\n return this._mesh.getScene().defaultMaterial;\r\n } else if (this._IsMultiMaterial(rootMaterial)) {\r\n var effectiveMaterial = rootMaterial.getSubMaterial(this.materialIndex);\r\n\r\n if (this._currentMaterial !== effectiveMaterial) {\r\n this._currentMaterial = effectiveMaterial;\r\n this.resetDrawCache();\r\n }\r\n\r\n return effectiveMaterial;\r\n }\r\n\r\n return rootMaterial;\r\n }\r\n\r\n private _IsMultiMaterial(material: Material): material is MultiMaterial {\r\n return (material as MultiMaterial).getSubMaterial !== undefined;\r\n }\r\n\r\n // Methods\r\n\r\n /**\r\n * Sets a new updated BoundingInfo object to the submesh\r\n * @param data defines an optional position array to use to determine the bounding info\r\n * @returns the SubMesh\r\n */\r\n public refreshBoundingInfo(data: Nullable<FloatArray> = null): SubMesh {\r\n this._lastColliderWorldVertices = null;\r\n\r\n if (this.IsGlobal || !this._renderingMesh || !this._renderingMesh.geometry) {\r\n return this;\r\n }\r\n\r\n if (!data) {\r\n data = this._renderingMesh.getVerticesData(VertexBuffer.PositionKind);\r\n }\r\n\r\n if (!data) {\r\n this._boundingInfo = this._mesh.getBoundingInfo();\r\n return this;\r\n }\r\n\r\n var indices = <IndicesArray>this._renderingMesh.getIndices();\r\n var extend: { minimum: Vector3; maximum: Vector3 };\r\n\r\n //is this the only submesh?\r\n if (this.indexStart === 0 && this.indexCount === indices.length) {\r\n let boundingInfo = this._renderingMesh.getBoundingInfo();\r\n\r\n //the rendering mesh's bounding info can be used, it is the standard submesh for all indices.\r\n extend = { minimum: boundingInfo.minimum.clone(), maximum: boundingInfo.maximum.clone() };\r\n } else {\r\n extend = extractMinAndMaxIndexed(data, indices, this.indexStart, this.indexCount, this._renderingMesh.geometry.boundingBias);\r\n }\r\n\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n } else {\r\n this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);\r\n }\r\n return this;\r\n }\r\n\r\n /** @hidden */\r\n public _checkCollision(collider: Collider): boolean {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n return boundingInfo._checkCollision(collider);\r\n }\r\n\r\n /**\r\n * Updates the submesh BoundingInfo\r\n * @param world defines the world matrix to use to update the bounding info\r\n * @returns the submesh\r\n */\r\n public updateBoundingInfo(world: DeepImmutable<Matrix>): SubMesh {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n this.refreshBoundingInfo();\r\n boundingInfo = this.getBoundingInfo();\r\n }\r\n if (boundingInfo) {\r\n (<BoundingInfo>boundingInfo).update(world);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * True is the submesh bounding box intersects the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is intersecting with the frustum\r\n */\r\n public isInFrustum(frustumPlanes: Plane[]): boolean {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isInFrustum(frustumPlanes, this._mesh.cullingStrategy);\r\n }\r\n\r\n /**\r\n * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is inside the frustum\r\n */\r\n public isCompletelyInFrustum(frustumPlanes: Plane[]): boolean {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n }\r\n\r\n /**\r\n * Renders the submesh\r\n * @param enableAlphaMode defines if alpha needs to be used\r\n * @returns the submesh\r\n */\r\n public render(enableAlphaMode: boolean): SubMesh {\r\n this._renderingMesh.render(this, enableAlphaMode, this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : undefined);\r\n return this;\r\n }\r\n\r\n /**\r\n * @hidden\r\n */\r\n public _getLinesIndexBuffer(indices: IndicesArray, engine: Engine): DataBuffer {\r\n if (!this._linesIndexBuffer) {\r\n var linesIndices = [];\r\n\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {\r\n linesIndices.push(indices[index], indices[index + 1], indices[index + 1], indices[index + 2], indices[index + 2], indices[index]);\r\n }\r\n\r\n this._linesIndexBuffer = engine.createIndexBuffer(linesIndices);\r\n this._linesIndexCount = linesIndices.length;\r\n }\r\n return this._linesIndexBuffer;\r\n }\r\n\r\n /**\r\n * Checks if the submesh intersects with a ray\r\n * @param ray defines the ray to test\r\n * @returns true is the passed ray intersects the submesh bounding box\r\n */\r\n public canIntersects(ray: Ray): boolean {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return ray.intersectsBox(boundingInfo.boundingBox);\r\n }\r\n\r\n /**\r\n * Intersects current submesh with a ray\r\n * @param ray defines the ray to test\r\n * @param positions defines mesh's positions array\r\n * @param indices defines mesh's indices array\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns intersection info or null if no intersection\r\n */\r\n public intersects(ray: Ray, positions: Vector3[], indices: IndicesArray, fastCheck?: boolean, trianglePredicate?: TrianglePickingPredicate): Nullable<IntersectionInfo> {\r\n const material = this.getMaterial();\r\n if (!material) {\r\n return null;\r\n }\r\n let step = 3;\r\n let checkStopper = false;\r\n\r\n switch (material.fillMode) {\r\n case 3:\r\n case 4:\r\n case 5:\r\n case 6:\r\n case 8:\r\n return null;\r\n case 7:\r\n step = 1;\r\n checkStopper = true;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n // LineMesh first as it's also a Mesh...\r\n if (this._mesh.getClassName() === \"InstancedLinesMesh\" || this._mesh.getClassName() === \"LinesMesh\") {\r\n // Check if mesh is unindexed\r\n if (!indices.length) {\r\n return this._intersectUnIndexedLines(ray, positions, indices, (this._mesh as any).intersectionThreshold, fastCheck);\r\n }\r\n return this._intersectLines(ray, positions, indices, (this._mesh as any).intersectionThreshold, fastCheck);\r\n } else {\r\n // Check if mesh is unindexed\r\n if (!indices.length && this._mesh._unIndexed) {\r\n return this._intersectUnIndexedTriangles(ray, positions, indices, fastCheck, trianglePredicate);\r\n }\r\n\r\n return this._intersectTriangles(ray, positions, indices, step, checkStopper, fastCheck, trianglePredicate);\r\n }\r\n }\r\n\r\n /** @hidden */\r\n private _intersectLines(ray: Ray, positions: Vector3[], indices: IndicesArray, intersectionThreshold: number, fastCheck?: boolean): Nullable<IntersectionInfo> {\r\n var intersectInfo: Nullable<IntersectionInfo> = null;\r\n\r\n // Line test\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 2) {\r\n var p0 = positions[indices[index]];\r\n var p1 = positions[indices[index + 1]];\r\n\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new IntersectionInfo(null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n }\r\n\r\n /** @hidden */\r\n private _intersectUnIndexedLines(ray: Ray, positions: Vector3[], indices: IndicesArray, intersectionThreshold: number, fastCheck?: boolean): Nullable<IntersectionInfo> {\r\n var intersectInfo: Nullable<IntersectionInfo> = null;\r\n\r\n // Line test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 2) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new IntersectionInfo(null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return intersectInfo;\r\n }\r\n\r\n /** @hidden */\r\n private _intersectTriangles(\r\n ray: Ray,\r\n positions: Vector3[],\r\n indices: IndicesArray,\r\n step: number,\r\n checkStopper: boolean,\r\n fastCheck?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate\r\n ): Nullable<IntersectionInfo> {\r\n var intersectInfo: Nullable<IntersectionInfo> = null;\r\n\r\n // Triangles test\r\n let faceId = -1;\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount - (3 - step); index += step) {\r\n faceId++;\r\n const indexA = indices[index];\r\n const indexB = indices[index + 1];\r\n const indexC = indices[index + 2];\r\n\r\n if (checkStopper && indexC === 0xffffffff) {\r\n index += 2;\r\n continue;\r\n }\r\n\r\n var p0 = positions[indexA];\r\n var p1 = positions[indexB];\r\n var p2 = positions[indexC];\r\n\r\n // stay defensive and don't check against undefined positions.\r\n if (!p0 || !p1 || !p2) {\r\n continue;\r\n }\r\n\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = faceId;\r\n\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n }\r\n\r\n /** @hidden */\r\n private _intersectUnIndexedTriangles(\r\n ray: Ray,\r\n positions: Vector3[],\r\n indices: IndicesArray,\r\n fastCheck?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate\r\n ): Nullable<IntersectionInfo> {\r\n var intersectInfo: Nullable<IntersectionInfo> = null;\r\n // Triangles test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 3) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var p2 = positions[index + 2];\r\n\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = index / 3;\r\n\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n }\r\n\r\n /** @hidden */\r\n public _rebuild(): void {\r\n if (this._linesIndexBuffer) {\r\n this._linesIndexBuffer = null;\r\n }\r\n }\r\n\r\n // Clone\r\n /**\r\n * Creates a new submesh from the passed mesh\r\n * @param newMesh defines the new hosting mesh\r\n * @param newRenderingMesh defines an optional rendering mesh\r\n * @returns the new submesh\r\n */\r\n public clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh {\r\n var result = new SubMesh(this.materialIndex, this.verticesStart, this.verticesCount, this.indexStart, this.indexCount, newMesh, newRenderingMesh, false);\r\n\r\n if (!this.IsGlobal) {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return result;\r\n }\r\n\r\n result._boundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // Dispose\r\n\r\n /**\r\n * Release associated resources\r\n */\r\n public dispose(): void {\r\n if (this._linesIndexBuffer) {\r\n this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer);\r\n this._linesIndexBuffer = null;\r\n }\r\n\r\n // Remove from mesh\r\n var index = this._mesh.subMeshes.indexOf(this);\r\n this._mesh.subMeshes.splice(index, 1);\r\n\r\n this.resetDrawCache();\r\n }\r\n\r\n /**\r\n * Gets the class name\r\n * @returns the string \"SubMesh\".\r\n */\r\n public getClassName(): string {\r\n return \"SubMesh\";\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates a new submesh from indices data\r\n * @param materialIndex the index of the main mesh material\r\n * @param startIndex the index where to start the copy in the mesh indices array\r\n * @param indexCount the number of indices to copy then from the startIndex\r\n * @param mesh the main mesh to create the submesh from\r\n * @param renderingMesh the optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @returns a new submesh\r\n */\r\n public static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox: boolean = true): SubMesh {\r\n var minVertexIndex = Number.MAX_VALUE;\r\n var maxVertexIndex = -Number.MAX_VALUE;\r\n\r\n const whatWillRender = renderingMesh || mesh;\r\n var indices = whatWillRender!.getIndices()!;\r\n\r\n for (var index = startIndex; index < startIndex + indexCount; index++) {\r\n var vertexIndex = indices[index];\r\n\r\n if (vertexIndex < minVertexIndex) {\r\n minVertexIndex = vertexIndex;\r\n }\r\n if (vertexIndex > maxVertexIndex) {\r\n maxVertexIndex = vertexIndex;\r\n }\r\n }\r\n\r\n return new SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh, createBoundingBox);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"subMesh.js","sourceRoot":"","sources":["../../../sourceES6/core/Meshes/subMesh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAa,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIlE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAYvD;;GAEG;AACH;IAmJI;;;;;;;;;;;OAWG;IACH;IACI,gCAAgC;IACzB,aAAqB;IAC5B,yBAAyB;IAClB,aAAqB;IAC5B,qBAAqB;IACd,aAAqB;IAC5B,kBAAkB;IACX,UAAkB;IACzB,oBAAoB;IACb,UAAkB,EACzB,IAAkB,EAClB,aAAoB,EACpB,iBAAiC,EACjC,SAAgB;QADhB,kCAAA,EAAA,wBAAiC;QACjC,0BAAA,EAAA,gBAAgB;QAZT,kBAAa,GAAb,aAAa,CAAQ;QAErB,kBAAa,GAAb,aAAa,CAAQ;QAErB,kBAAa,GAAb,aAAa,CAAQ;QAErB,eAAU,GAAV,UAAU,CAAQ;QAElB,eAAU,GAAV,UAAU,CAAQ;QArKrB,6BAAwB,GAA0B,IAAI,CAAC;QA8F/D,cAAc;QACP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AU,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC;IAC3J,CAAC;IACL,cAAC;AAAD,CAAC,AAlsBD,IAksBC","sourcesContent":["import { Nullable, IndicesArray, DeepImmutable, FloatArray } from \"../types\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo\";\r\nimport { ICullable, BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Effect } from \"../Materials/effect\";\r\n\r\nimport { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { extractMinAndMaxIndexed } from \"../Maths/math.functions\";\r\nimport { Plane } from \"../Maths/math.plane\";\r\nimport { DrawWrapper } from \"../Materials/drawWrapper\";\r\nimport { IMaterialContext } from \"../Engines/IMaterialContext\";\r\n\r\ndeclare type Collider = import(\"../Collisions/collider\").Collider;\r\ndeclare type Material = import(\"../Materials/material\").Material;\r\ndeclare type MaterialDefines = import(\"../Materials/materialDefines\").MaterialDefines;\r\ndeclare type MultiMaterial = import(\"../Materials/multiMaterial\").MultiMaterial;\r\ndeclare type AbstractMesh = import(\"./abstractMesh\").AbstractMesh;\r\ndeclare type Mesh = import(\"./mesh\").Mesh;\r\ndeclare type Ray = import(\"../Culling/ray\").Ray;\r\ndeclare type TrianglePickingPredicate = import(\"../Culling/ray\").TrianglePickingPredicate;\r\n\r\n/**\r\n * Defines a subdivision inside a mesh\r\n */\r\nexport class SubMesh implements ICullable {\r\n private _engine: Engine;\r\n /** @hidden */\r\n public _drawWrappers: Array<DrawWrapper>; // index in this array = pass id\r\n private _mainDrawWrapperOverride: Nullable<DrawWrapper> = null;\r\n\r\n /**\r\n * Gets material defines used by the effect associated to the sub mesh\r\n */\r\n public get materialDefines(): Nullable<MaterialDefines> {\r\n return this._mainDrawWrapperOverride ? (this._mainDrawWrapperOverride.defines as MaterialDefines) : this._getDrawWrapper()?.defines as Nullable<MaterialDefines>;\r\n }\r\n\r\n /**\r\n * Sets material defines used by the effect associated to the sub mesh\r\n */\r\n public set materialDefines(defines: Nullable<MaterialDefines>) {\r\n const drawWrapper = this._mainDrawWrapperOverride ?? this._getDrawWrapper(undefined, true)!;\r\n drawWrapper.defines = defines;\r\n }\r\n\r\n /** @hidden */\r\n public _getDrawWrapper(passId?: number, createIfNotExisting = false): DrawWrapper | undefined {\r\n passId = passId ?? this._engine.currentRenderPassId;\r\n let drawWrapper = this._drawWrappers[passId];\r\n if (!drawWrapper && createIfNotExisting) {\r\n this._drawWrappers[passId] = drawWrapper = new DrawWrapper(this._mesh.getScene().getEngine());\r\n }\r\n return drawWrapper;\r\n }\r\n\r\n /** @hidden */\r\n public _removeDrawWrapper(passId: number, disposeWrapper = true) {\r\n if (disposeWrapper) {\r\n this._drawWrappers[passId]?.dispose();\r\n }\r\n this._drawWrappers[passId] = undefined as any;\r\n }\r\n\r\n /**\r\n * Gets associated (main) effect (possibly the effect override if defined)\r\n */\r\n public get effect(): Nullable<Effect> {\r\n return this._mainDrawWrapperOverride ? this._mainDrawWrapperOverride.effect : (this._getDrawWrapper()?.effect ?? null);\r\n }\r\n\r\n /** @hidden */\r\n public get _drawWrapper(): DrawWrapper {\r\n return this._mainDrawWrapperOverride ?? this._getDrawWrapper(undefined, true)!;\r\n }\r\n\r\n /** @hidden */\r\n public get _drawWrapperOverride(): Nullable<DrawWrapper> {\r\n return this._mainDrawWrapperOverride;\r\n }\r\n\r\n /** @hidden */\r\n public _setMainDrawWrapperOverride(wrapper: Nullable<DrawWrapper>): void {\r\n this._mainDrawWrapperOverride = wrapper;\r\n }\r\n\r\n /**\r\n * Sets associated effect (effect used to render this submesh)\r\n * @param effect defines the effect to associate with\r\n * @param defines defines the set of defines used to compile this effect\r\n * @param materialContext material context associated to the effect\r\n * @param resetContext true to reset the draw context\r\n */\r\n public setEffect(effect: Nullable<Effect>, defines: Nullable<string | MaterialDefines> = null, materialContext?: IMaterialContext, resetContext = true) {\r\n const drawWrapper = this._drawWrapper;\r\n drawWrapper.setEffect(effect, defines, resetContext);\r\n if (materialContext !== undefined) {\r\n drawWrapper.materialContext = materialContext;\r\n }\r\n if (!effect) {\r\n drawWrapper.defines = null;\r\n drawWrapper.materialContext = undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Resets the draw wrappers cache\r\n * @param passId If provided, releases only the draw wrapper corresponding to this render pass id\r\n */\r\n public resetDrawCache(passId?: number): void {\r\n if (this._drawWrappers) {\r\n if (passId !== undefined) {\r\n this._removeDrawWrapper(passId);\r\n return;\r\n } else {\r\n for (const drawWrapper of this._drawWrappers) {\r\n drawWrapper?.dispose();\r\n }\r\n }\r\n }\r\n this._drawWrappers = [];\r\n }\r\n\r\n /** @hidden */\r\n public _linesIndexCount: number = 0;\r\n private _mesh: AbstractMesh;\r\n private _renderingMesh: Mesh;\r\n private _boundingInfo: BoundingInfo;\r\n private _linesIndexBuffer: Nullable<DataBuffer> = null;\r\n /** @hidden */\r\n public _lastColliderWorldVertices: Nullable<Vector3[]> = null;\r\n /** @hidden */\r\n public _trianglePlanes: Plane[];\r\n /** @hidden */\r\n public _lastColliderTransformMatrix: Nullable<Matrix> = null;\r\n\r\n /** @hidden */\r\n public _renderId = 0;\r\n /** @hidden */\r\n public _alphaIndex: number = 0;\r\n /** @hidden */\r\n public _distanceToCamera: number = 0;\r\n /** @hidden */\r\n public _id: number;\r\n\r\n private _currentMaterial: Nullable<Material> = null;\r\n\r\n /**\r\n * Add a new submesh to a mesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @returns the new submesh\r\n */\r\n public static AddToMesh(\r\n materialIndex: number,\r\n verticesStart: number,\r\n verticesCount: number,\r\n indexStart: number,\r\n indexCount: number,\r\n mesh: AbstractMesh,\r\n renderingMesh?: Mesh,\r\n createBoundingBox: boolean = true\r\n ): SubMesh {\r\n return new SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox);\r\n }\r\n\r\n /**\r\n * Creates a new submesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @param addToMesh defines a boolean indicating that the submesh must be added to the mesh.subMeshes array (true by default)\r\n */\r\n constructor(\r\n /** the material index to use */\r\n public materialIndex: number,\r\n /** vertex index start */\r\n public verticesStart: number,\r\n /** vertices count */\r\n public verticesCount: number,\r\n /** index start */\r\n public indexStart: number,\r\n /** indices count */\r\n public indexCount: number,\r\n mesh: AbstractMesh,\r\n renderingMesh?: Mesh,\r\n createBoundingBox: boolean = true,\r\n addToMesh = true\r\n ) {\r\n this._mesh = mesh;\r\n this._renderingMesh = renderingMesh || <Mesh>mesh;\r\n if (addToMesh) {\r\n mesh.subMeshes.push(this);\r\n }\r\n\r\n this._engine = this._mesh.getScene().getEngine();\r\n this.resetDrawCache();\r\n this._trianglePlanes = [];\r\n\r\n this._id = mesh.subMeshes.length - 1;\r\n\r\n if (createBoundingBox) {\r\n this.refreshBoundingInfo();\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if this submesh covers the entire parent mesh\r\n * @ignorenaming\r\n */\r\n public get IsGlobal(): boolean {\r\n return this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices();\r\n }\r\n\r\n /**\r\n * Returns the submesh BoundingInfo object\r\n * @returns current bounding info (or mesh's one if the submesh is global)\r\n */\r\n public getBoundingInfo(): BoundingInfo {\r\n if (this.IsGlobal) {\r\n return this._mesh.getBoundingInfo();\r\n }\r\n\r\n return this._boundingInfo;\r\n }\r\n\r\n /**\r\n * Sets the submesh BoundingInfo\r\n * @param boundingInfo defines the new bounding info to use\r\n * @returns the SubMesh\r\n */\r\n public setBoundingInfo(boundingInfo: BoundingInfo): SubMesh {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n }\r\n\r\n /**\r\n * Returns the mesh of the current submesh\r\n * @return the parent mesh\r\n */\r\n public getMesh(): AbstractMesh {\r\n return this._mesh;\r\n }\r\n\r\n /**\r\n * Returns the rendering mesh of the submesh\r\n * @returns the rendering mesh (could be different from parent mesh)\r\n */\r\n public getRenderingMesh(): Mesh {\r\n return this._renderingMesh;\r\n }\r\n\r\n /**\r\n * Returns the replacement mesh of the submesh\r\n * @returns the replacement mesh (could be different from parent mesh)\r\n */\r\n public getReplacementMesh(): Nullable<AbstractMesh> {\r\n return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\r\n }\r\n\r\n /**\r\n * Returns the effective mesh of the submesh\r\n * @returns the effective mesh (could be different from parent mesh)\r\n */\r\n public getEffectiveMesh(): AbstractMesh {\r\n const replacementMesh = this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\r\n\r\n return replacementMesh ? replacementMesh : this._renderingMesh;\r\n }\r\n\r\n /**\r\n * Returns the submesh material\r\n * @returns null or the current material\r\n */\r\n public getMaterial(): Nullable<Material> {\r\n var rootMaterial = this._renderingMesh.getMaterialForRenderPass(this._engine.currentRenderPassId) ?? this._renderingMesh.material;\r\n\r\n if (rootMaterial === null || rootMaterial === undefined) {\r\n return this._mesh.getScene().defaultMaterial;\r\n } else if (this._IsMultiMaterial(rootMaterial)) {\r\n var effectiveMaterial = rootMaterial.getSubMaterial(this.materialIndex);\r\n\r\n if (this._currentMaterial !== effectiveMaterial) {\r\n this._currentMaterial = effectiveMaterial;\r\n this.resetDrawCache();\r\n }\r\n\r\n return effectiveMaterial;\r\n }\r\n\r\n return rootMaterial;\r\n }\r\n\r\n private _IsMultiMaterial(material: Material): material is MultiMaterial {\r\n return (material as MultiMaterial).getSubMaterial !== undefined;\r\n }\r\n\r\n // Methods\r\n\r\n /**\r\n * Sets a new updated BoundingInfo object to the submesh\r\n * @param data defines an optional position array to use to determine the bounding info\r\n * @returns the SubMesh\r\n */\r\n public refreshBoundingInfo(data: Nullable<FloatArray> = null): SubMesh {\r\n this._lastColliderWorldVertices = null;\r\n\r\n if (this.IsGlobal || !this._renderingMesh || !this._renderingMesh.geometry) {\r\n return this;\r\n }\r\n\r\n if (!data) {\r\n data = this._renderingMesh.getVerticesData(VertexBuffer.PositionKind);\r\n }\r\n\r\n if (!data) {\r\n this._boundingInfo = this._mesh.getBoundingInfo();\r\n return this;\r\n }\r\n\r\n var indices = <IndicesArray>this._renderingMesh.getIndices();\r\n var extend: { minimum: Vector3; maximum: Vector3 };\r\n\r\n //is this the only submesh?\r\n if (this.indexStart === 0 && this.indexCount === indices.length) {\r\n let boundingInfo = this._renderingMesh.getBoundingInfo();\r\n\r\n //the rendering mesh's bounding info can be used, it is the standard submesh for all indices.\r\n extend = { minimum: boundingInfo.minimum.clone(), maximum: boundingInfo.maximum.clone() };\r\n } else {\r\n extend = extractMinAndMaxIndexed(data, indices, this.indexStart, this.indexCount, this._renderingMesh.geometry.boundingBias);\r\n }\r\n\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n } else {\r\n this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);\r\n }\r\n return this;\r\n }\r\n\r\n /** @hidden */\r\n public _checkCollision(collider: Collider): boolean {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n return boundingInfo._checkCollision(collider);\r\n }\r\n\r\n /**\r\n * Updates the submesh BoundingInfo\r\n * @param world defines the world matrix to use to update the bounding info\r\n * @returns the submesh\r\n */\r\n public updateBoundingInfo(world: DeepImmutable<Matrix>): SubMesh {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n this.refreshBoundingInfo();\r\n boundingInfo = this.getBoundingInfo();\r\n }\r\n if (boundingInfo) {\r\n (<BoundingInfo>boundingInfo).update(world);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * True is the submesh bounding box intersects the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is intersecting with the frustum\r\n */\r\n public isInFrustum(frustumPlanes: Plane[]): boolean {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isInFrustum(frustumPlanes, this._mesh.cullingStrategy);\r\n }\r\n\r\n /**\r\n * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is inside the frustum\r\n */\r\n public isCompletelyInFrustum(frustumPlanes: Plane[]): boolean {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n }\r\n\r\n /**\r\n * Renders the submesh\r\n * @param enableAlphaMode defines if alpha needs to be used\r\n * @returns the submesh\r\n */\r\n public render(enableAlphaMode: boolean): SubMesh {\r\n this._renderingMesh.render(this, enableAlphaMode, this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : undefined);\r\n return this;\r\n }\r\n\r\n /**\r\n * @hidden\r\n */\r\n public _getLinesIndexBuffer(indices: IndicesArray, engine: Engine): DataBuffer {\r\n if (!this._linesIndexBuffer) {\r\n var linesIndices = [];\r\n\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {\r\n linesIndices.push(indices[index], indices[index + 1], indices[index + 1], indices[index + 2], indices[index + 2], indices[index]);\r\n }\r\n\r\n this._linesIndexBuffer = engine.createIndexBuffer(linesIndices);\r\n this._linesIndexCount = linesIndices.length;\r\n }\r\n return this._linesIndexBuffer;\r\n }\r\n\r\n /**\r\n * Checks if the submesh intersects with a ray\r\n * @param ray defines the ray to test\r\n * @returns true is the passed ray intersects the submesh bounding box\r\n */\r\n public canIntersects(ray: Ray): boolean {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return ray.intersectsBox(boundingInfo.boundingBox);\r\n }\r\n\r\n /**\r\n * Intersects current submesh with a ray\r\n * @param ray defines the ray to test\r\n * @param positions defines mesh's positions array\r\n * @param indices defines mesh's indices array\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns intersection info or null if no intersection\r\n */\r\n public intersects(ray: Ray, positions: Vector3[], indices: IndicesArray, fastCheck?: boolean, trianglePredicate?: TrianglePickingPredicate): Nullable<IntersectionInfo> {\r\n const material = this.getMaterial();\r\n if (!material) {\r\n return null;\r\n }\r\n let step = 3;\r\n let checkStopper = false;\r\n\r\n switch (material.fillMode) {\r\n case 3:\r\n case 4:\r\n case 5:\r\n case 6:\r\n case 8:\r\n return null;\r\n case 7:\r\n step = 1;\r\n checkStopper = true;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n // LineMesh first as it's also a Mesh...\r\n if (this._mesh.getClassName() === \"InstancedLinesMesh\" || this._mesh.getClassName() === \"LinesMesh\") {\r\n // Check if mesh is unindexed\r\n if (!indices.length) {\r\n return this._intersectUnIndexedLines(ray, positions, indices, (this._mesh as any).intersectionThreshold, fastCheck);\r\n }\r\n return this._intersectLines(ray, positions, indices, (this._mesh as any).intersectionThreshold, fastCheck);\r\n } else {\r\n // Check if mesh is unindexed\r\n if (!indices.length && this._mesh._unIndexed) {\r\n return this._intersectUnIndexedTriangles(ray, positions, indices, fastCheck, trianglePredicate);\r\n }\r\n\r\n return this._intersectTriangles(ray, positions, indices, step, checkStopper, fastCheck, trianglePredicate);\r\n }\r\n }\r\n\r\n /** @hidden */\r\n private _intersectLines(ray: Ray, positions: Vector3[], indices: IndicesArray, intersectionThreshold: number, fastCheck?: boolean): Nullable<IntersectionInfo> {\r\n var intersectInfo: Nullable<IntersectionInfo> = null;\r\n\r\n // Line test\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 2) {\r\n var p0 = positions[indices[index]];\r\n var p1 = positions[indices[index + 1]];\r\n\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new IntersectionInfo(null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n }\r\n\r\n /** @hidden */\r\n private _intersectUnIndexedLines(ray: Ray, positions: Vector3[], indices: IndicesArray, intersectionThreshold: number, fastCheck?: boolean): Nullable<IntersectionInfo> {\r\n var intersectInfo: Nullable<IntersectionInfo> = null;\r\n\r\n // Line test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 2) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new IntersectionInfo(null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return intersectInfo;\r\n }\r\n\r\n /** @hidden */\r\n private _intersectTriangles(\r\n ray: Ray,\r\n positions: Vector3[],\r\n indices: IndicesArray,\r\n step: number,\r\n checkStopper: boolean,\r\n fastCheck?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate\r\n ): Nullable<IntersectionInfo> {\r\n var intersectInfo: Nullable<IntersectionInfo> = null;\r\n\r\n // Triangles test\r\n let faceId = -1;\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount - (3 - step); index += step) {\r\n faceId++;\r\n const indexA = indices[index];\r\n const indexB = indices[index + 1];\r\n const indexC = indices[index + 2];\r\n\r\n if (checkStopper && indexC === 0xffffffff) {\r\n index += 2;\r\n continue;\r\n }\r\n\r\n var p0 = positions[indexA];\r\n var p1 = positions[indexB];\r\n var p2 = positions[indexC];\r\n\r\n // stay defensive and don't check against undefined positions.\r\n if (!p0 || !p1 || !p2) {\r\n continue;\r\n }\r\n\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = faceId;\r\n\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n }\r\n\r\n /** @hidden */\r\n private _intersectUnIndexedTriangles(\r\n ray: Ray,\r\n positions: Vector3[],\r\n indices: IndicesArray,\r\n fastCheck?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate\r\n ): Nullable<IntersectionInfo> {\r\n var intersectInfo: Nullable<IntersectionInfo> = null;\r\n // Triangles test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 3) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var p2 = positions[index + 2];\r\n\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = index / 3;\r\n\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n }\r\n\r\n /** @hidden */\r\n public _rebuild(): void {\r\n if (this._linesIndexBuffer) {\r\n this._linesIndexBuffer = null;\r\n }\r\n }\r\n\r\n // Clone\r\n /**\r\n * Creates a new submesh from the passed mesh\r\n * @param newMesh defines the new hosting mesh\r\n * @param newRenderingMesh defines an optional rendering mesh\r\n * @returns the new submesh\r\n */\r\n public clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh {\r\n var result = new SubMesh(this.materialIndex, this.verticesStart, this.verticesCount, this.indexStart, this.indexCount, newMesh, newRenderingMesh, false);\r\n\r\n if (!this.IsGlobal) {\r\n let boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return result;\r\n }\r\n\r\n result._boundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // Dispose\r\n\r\n /**\r\n * Release associated resources\r\n */\r\n public dispose(): void {\r\n if (this._linesIndexBuffer) {\r\n this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer);\r\n this._linesIndexBuffer = null;\r\n }\r\n\r\n // Remove from mesh\r\n var index = this._mesh.subMeshes.indexOf(this);\r\n this._mesh.subMeshes.splice(index, 1);\r\n\r\n this.resetDrawCache();\r\n }\r\n\r\n /**\r\n * Gets the class name\r\n * @returns the string \"SubMesh\".\r\n */\r\n public getClassName(): string {\r\n return \"SubMesh\";\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates a new submesh from indices data\r\n * @param materialIndex the index of the main mesh material\r\n * @param startIndex the index where to start the copy in the mesh indices array\r\n * @param indexCount the number of indices to copy then from the startIndex\r\n * @param mesh the main mesh to create the submesh from\r\n * @param renderingMesh the optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @returns a new submesh\r\n */\r\n public static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox: boolean = true): SubMesh {\r\n var minVertexIndex = Number.MAX_VALUE;\r\n var maxVertexIndex = -Number.MAX_VALUE;\r\n\r\n const whatWillRender = renderingMesh || mesh;\r\n var indices = whatWillRender!.getIndices()!;\r\n\r\n for (var index = startIndex; index < startIndex + indexCount; index++) {\r\n var vertexIndex = indices[index];\r\n\r\n if (vertexIndex < minVertexIndex) {\r\n minVertexIndex = vertexIndex;\r\n }\r\n if (vertexIndex > maxVertexIndex) {\r\n maxVertexIndex = vertexIndex;\r\n }\r\n }\r\n\r\n return new SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh, createBoundingBox);\r\n }\r\n}\r\n"]}
package/Misc/timer.js CHANGED
@@ -100,6 +100,7 @@ var AdvancedTimer = /** @class */ (function () {
100
100
  this._contextObservable = options.contextObservable;
101
101
  this._observableParameters = (_a = options.observableParameters) !== null && _a !== void 0 ? _a : {};
102
102
  this._breakCondition = (_b = options.breakCondition) !== null && _b !== void 0 ? _b : (function () { return false; });
103
+ this._timeToEnd = options.timeout;
103
104
  if (options.onEnded) {
104
105
  this.onTimerEndedObservable.add(options.onEnded);
105
106
  }
package/Misc/timer.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"timer.js","sourceRoot":"","sources":["../../../sourceES6/core/Misc/timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,oBAAoB,CAAC;AAuE1D;;GAEG;AACH,MAAM,CAAN,IAAY,UAaX;AAbD,WAAY,UAAU;IAClB;;OAEG;IACH,2CAAI,CAAA;IACJ;;OAEG;IACH,iDAAO,CAAA;IACP;;OAEG;IACH,6CAAK,CAAA;AACT,CAAC,EAbW,UAAU,KAAV,UAAU,QAarB;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA2B;;IACxD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAM,SAAS,GAAG,IAAI,C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CAAC,WAAW,EAAE,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;QACpK,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACI,4BAAI,GAAX;QACI,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,OAAO,EAAE;YACpC,OAAO;SACV;QACD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,+BAAO,GAAd;QACI,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAClD;QACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAEO,iCAAS,GAAjB,UAAkB,QAAoB;QAClC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAoBO,6BAAK,GAAb,UAAc,IAAmB,EAAE,OAAwB;QAAxB,wBAAA,EAAA,eAAwB;QACvD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,OAAO,EAAE;YACT,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACvD;aAAM;YACH,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACrD;IACL,CAAC;IACL,oBAAC;AAAD,CAAC,AA3ID,IA2IC","sourcesContent":["import { Observable, Observer } from '../Misc/observable';\r\nimport { Nullable } from '../types';\r\nimport { IDisposable } from '../scene';\r\n\r\n/**\r\n * Construction options for a timer\r\n */\r\nexport interface ITimerOptions<T> {\r\n /**\r\n * Time-to-end\r\n */\r\n timeout: number;\r\n /**\r\n * The context observable is used to calculate time deltas and provides the context of the timer's callbacks. Will usually be OnBeforeRenderObservable.\r\n * Countdown calculation is done ONLY when the observable is notifying its observers, meaning that if\r\n * you choose an observable that doesn't trigger too often, the wait time might extend further than the requested max time\r\n */\r\n contextObservable: Observable<T>;\r\n /**\r\n * Optional parameters when adding an observer to the observable\r\n */\r\n observableParameters?: {\r\n mask?: number;\r\n insertFirst?: boolean;\r\n scope?: any;\r\n };\r\n /**\r\n * An optional break condition that will stop the times prematurely. In this case onEnded will not be triggered!\r\n */\r\n breakCondition?: (data?: ITimerData<T>) => boolean;\r\n /**\r\n * Will be triggered when the time condition has met\r\n */\r\n onEnded?: (data: ITimerData<any>) => void;\r\n /**\r\n * Will be triggered when the break condition has met (prematurely ended)\r\n */\r\n onAborted?: (data: ITimerData<any>) => void;\r\n /**\r\n * Optional function to execute on each tick (or count)\r\n */\r\n onTick?: (data: ITimerData<any>) => void;\r\n}\r\n\r\n/**\r\n * An interface defining the data sent by the timer\r\n */\r\nexport interface ITimerData<T> {\r\n /**\r\n * When did it start\r\n */\r\n startTime: number;\r\n /**\r\n * Time now\r\n */\r\n currentTime: number;\r\n /**\r\n * Time passed since started\r\n */\r\n deltaTime: number;\r\n /**\r\n * How much is completed, in [0.0...1.0].\r\n * Note that this CAN be higher than 1 due to the fact that we don't actually measure time but delta between observable calls\r\n */\r\n completeRate: number;\r\n /**\r\n * What the registered observable sent in the last count\r\n */\r\n payload: T;\r\n}\r\n\r\n/**\r\n * The current state of the timer\r\n */\r\nexport enum TimerState {\r\n /**\r\n * Timer initialized, not yet started\r\n */\r\n INIT,\r\n /**\r\n * Timer started and counting\r\n */\r\n STARTED,\r\n /**\r\n * Timer ended (whether aborted or time reached)\r\n */\r\n ENDED\r\n}\r\n\r\n/**\r\n * A simple version of the timer. Will take options and start the timer immediately after calling it\r\n *\r\n * @param options options with which to initialize this timer\r\n */\r\nexport function setAndStartTimer(options: ITimerOptions<any>): Nullable<Observer<any>> {\r\n let timer = 0;\r\n const startTime = Date.now();\r\n options.observableParameters = options.observableParameters ?? {};\r\n const observer = options.contextObservable.add((payload: any) => {\r\n const now = Date.now();\r\n timer = now - startTime;\r\n const data: ITimerData<any> = {\r\n startTime,\r\n currentTime: now,\r\n deltaTime: timer,\r\n completeRate: timer / options.timeout,\r\n payload\r\n };\r\n options.onTick && options.onTick(data);\r\n if (options.breakCondition && options.breakCondition()) {\r\n options.contextObservable.remove(observer);\r\n options.onAborted && options.onAborted(data);\r\n }\r\n if (timer >= options.timeout) {\r\n options.contextObservable.remove(observer);\r\n options.onEnded && options.onEnded(data);\r\n }\r\n }, options.observableParameters.mask, options.observableParameters.insertFirst, options.observableParameters.scope);\r\n return observer;\r\n}\r\n\r\n/**\r\n * An advanced implementation of a timer class\r\n */\r\nexport class AdvancedTimer<T = any> implements IDisposable {\r\n\r\n /**\r\n * Will notify each time the timer calculates the remaining time\r\n */\r\n public onEachCountObservable: Observable<ITimerData<T>> = new Observable();\r\n /**\r\n * Will trigger when the timer was aborted due to the break condition\r\n */\r\n public onTimerAbortedObservable: Observable<ITimerData<T>> = new Observable();\r\n /**\r\n * Will trigger when the timer ended successfully\r\n */\r\n public onTimerEndedObservable: Observable<ITimerData<T>> = new Observable();\r\n /**\r\n * Will trigger when the timer state has changed\r\n */\r\n public onStateChangedObservable: Observable<TimerState> = new Observable();\r\n\r\n private _observer: Nullable<Observer<T>> = null;\r\n private _contextObservable: Observable<T>;\r\n private _observableParameters: {\r\n mask?: number;\r\n insertFirst?: boolean;\r\n scope?: any;\r\n };\r\n private _startTime: number;\r\n private _timer: number;\r\n private _state: TimerState;\r\n private _breakCondition: (data: ITimerData<T>) => boolean;\r\n private _timeToEnd: number;\r\n private _breakOnNextTick: boolean = false;\r\n\r\n /**\r\n * Will construct a new advanced timer based on the options provided. Timer will not start until start() is called.\r\n * @param options construction options for this advanced timer\r\n */\r\n constructor(options: ITimerOptions<T>) {\r\n this._setState(TimerState.INIT);\r\n this._contextObservable = options.contextObservable;\r\n this._observableParameters = options.observableParameters ?? {};\r\n this._breakCondition = options.breakCondition ?? (() => false);\r\n if (options.onEnded) {\r\n this.onTimerEndedObservable.add(options.onEnded);\r\n }\r\n if (options.onTick) {\r\n this.onEachCountObservable.add(options.onTick);\r\n }\r\n if (options.onAborted) {\r\n this.onTimerAbortedObservable.add(options.onAborted);\r\n }\r\n }\r\n\r\n /**\r\n * set a breaking condition for this timer. Default is to never break during count\r\n * @param predicate the new break condition. Returns true to break, false otherwise\r\n */\r\n public set breakCondition(predicate: (data: ITimerData<T>) => boolean) {\r\n this._breakCondition = predicate;\r\n }\r\n\r\n /**\r\n * Reset ALL associated observables in this advanced timer\r\n */\r\n public clearObservables() {\r\n this.onEachCountObservable.clear();\r\n this.onTimerAbortedObservable.clear();\r\n this.onTimerEndedObservable.clear();\r\n this.onStateChangedObservable.clear();\r\n }\r\n\r\n /**\r\n * Will start a new iteration of this timer. Only one instance of this timer can run at a time.\r\n *\r\n * @param timeToEnd how much time to measure until timer ended\r\n */\r\n public start(timeToEnd: number = this._timeToEnd) {\r\n if (this._state === TimerState.STARTED) {\r\n throw new Error('Timer already started. Please stop it before starting again');\r\n }\r\n this._timeToEnd = timeToEnd;\r\n this._startTime = Date.now();\r\n this._timer = 0;\r\n this._observer = this._contextObservable.add(this._tick, this._observableParameters.mask, this._observableParameters.insertFirst, this._observableParameters.scope);\r\n this._setState(TimerState.STARTED);\r\n }\r\n\r\n /**\r\n * Will force a stop on the next tick.\r\n */\r\n public stop() {\r\n if (this._state !== TimerState.STARTED) {\r\n return;\r\n }\r\n this._breakOnNextTick = true;\r\n }\r\n\r\n /**\r\n * Dispose this timer, clearing all resources\r\n */\r\n public dispose() {\r\n if (this._observer) {\r\n this._contextObservable.remove(this._observer);\r\n }\r\n this.clearObservables();\r\n }\r\n\r\n private _setState(newState: TimerState) {\r\n this._state = newState;\r\n this.onStateChangedObservable.notifyObservers(this._state);\r\n }\r\n\r\n private _tick = (payload: T) => {\r\n const now = Date.now();\r\n this._timer = now - this._startTime;\r\n const data: ITimerData<T> = {\r\n startTime: this._startTime,\r\n currentTime: now,\r\n deltaTime: this._timer,\r\n completeRate: this._timer / this._timeToEnd,\r\n payload\r\n };\r\n const shouldBreak = this._breakOnNextTick || this._breakCondition(data);\r\n if (shouldBreak || this._timer >= this._timeToEnd) {\r\n this._stop(data, shouldBreak);\r\n } else {\r\n this.onEachCountObservable.notifyObservers(data);\r\n }\r\n }\r\n\r\n private _stop(data: ITimerData<T>, aborted: boolean = false) {\r\n this._contextObservable.remove(this._observer);\r\n this._setState(TimerState.ENDED);\r\n if (aborted) {\r\n this.onTimerAbortedObservable.notifyObservers(data);\r\n } else {\r\n this.onTimerEndedObservable.notifyObservers(data);\r\n }\r\n }\r\n}"]}
1
+ {"version":3,"file":"timer.js","sourceRoot":"","sources":["../../../sourceES6/core/Misc/timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,oBAAoB,CAAC;AAuE1D;;GAEG;AACH,MAAM,CAAN,IAAY,UAaX;AAbD,WAAY,UAAU;IAClB;;OAEG;IACH,2CAAI,CAAA;IACJ;;OAEG;IACH,iDAAO,CAAA;IACP;;OAEG;IACH,6CAAK,CAAA;AACT,CAAC,EAbW,UAAU,KAAV,UAAU,QAarB;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA2B;;IACxD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,OAAO,CAAC,oBAAoB,GAAG,MAAA,OAAO,CAAC,oBAAoB,mCAAI,EAAE,CAAC;IAClE,IAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAC,OAAY;QACxD,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,GAAG,GAAG,GAAG,SAAS,CAAC;QACxB,IAAM,IAAI,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V;QACD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,+BAAO,GAAd;QACI,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAClD;QACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAEO,iCAAS,GAAjB,UAAkB,QAAoB;QAClC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAoBO,6BAAK,GAAb,UAAc,IAAmB,EAAE,OAAwB;QAAxB,wBAAA,EAAA,eAAwB;QACvD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,OAAO,EAAE;YACT,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACvD;aAAM;YACH,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACrD;IACL,CAAC;IACL,oBAAC;AAAD,CAAC,AA5ID,IA4IC","sourcesContent":["import { Observable, Observer } from '../Misc/observable';\r\nimport { Nullable } from '../types';\r\nimport { IDisposable } from '../scene';\r\n\r\n/**\r\n * Construction options for a timer\r\n */\r\nexport interface ITimerOptions<T> {\r\n /**\r\n * Time-to-end\r\n */\r\n timeout: number;\r\n /**\r\n * The context observable is used to calculate time deltas and provides the context of the timer's callbacks. Will usually be OnBeforeRenderObservable.\r\n * Countdown calculation is done ONLY when the observable is notifying its observers, meaning that if\r\n * you choose an observable that doesn't trigger too often, the wait time might extend further than the requested max time\r\n */\r\n contextObservable: Observable<T>;\r\n /**\r\n * Optional parameters when adding an observer to the observable\r\n */\r\n observableParameters?: {\r\n mask?: number;\r\n insertFirst?: boolean;\r\n scope?: any;\r\n };\r\n /**\r\n * An optional break condition that will stop the times prematurely. In this case onEnded will not be triggered!\r\n */\r\n breakCondition?: (data?: ITimerData<T>) => boolean;\r\n /**\r\n * Will be triggered when the time condition has met\r\n */\r\n onEnded?: (data: ITimerData<any>) => void;\r\n /**\r\n * Will be triggered when the break condition has met (prematurely ended)\r\n */\r\n onAborted?: (data: ITimerData<any>) => void;\r\n /**\r\n * Optional function to execute on each tick (or count)\r\n */\r\n onTick?: (data: ITimerData<any>) => void;\r\n}\r\n\r\n/**\r\n * An interface defining the data sent by the timer\r\n */\r\nexport interface ITimerData<T> {\r\n /**\r\n * When did it start\r\n */\r\n startTime: number;\r\n /**\r\n * Time now\r\n */\r\n currentTime: number;\r\n /**\r\n * Time passed since started\r\n */\r\n deltaTime: number;\r\n /**\r\n * How much is completed, in [0.0...1.0].\r\n * Note that this CAN be higher than 1 due to the fact that we don't actually measure time but delta between observable calls\r\n */\r\n completeRate: number;\r\n /**\r\n * What the registered observable sent in the last count\r\n */\r\n payload: T;\r\n}\r\n\r\n/**\r\n * The current state of the timer\r\n */\r\nexport enum TimerState {\r\n /**\r\n * Timer initialized, not yet started\r\n */\r\n INIT,\r\n /**\r\n * Timer started and counting\r\n */\r\n STARTED,\r\n /**\r\n * Timer ended (whether aborted or time reached)\r\n */\r\n ENDED\r\n}\r\n\r\n/**\r\n * A simple version of the timer. Will take options and start the timer immediately after calling it\r\n *\r\n * @param options options with which to initialize this timer\r\n */\r\nexport function setAndStartTimer(options: ITimerOptions<any>): Nullable<Observer<any>> {\r\n let timer = 0;\r\n const startTime = Date.now();\r\n options.observableParameters = options.observableParameters ?? {};\r\n const observer = options.contextObservable.add((payload: any) => {\r\n const now = Date.now();\r\n timer = now - startTime;\r\n const data: ITimerData<any> = {\r\n startTime,\r\n currentTime: now,\r\n deltaTime: timer,\r\n completeRate: timer / options.timeout,\r\n payload\r\n };\r\n options.onTick && options.onTick(data);\r\n if (options.breakCondition && options.breakCondition()) {\r\n options.contextObservable.remove(observer);\r\n options.onAborted && options.onAborted(data);\r\n }\r\n if (timer >= options.timeout) {\r\n options.contextObservable.remove(observer);\r\n options.onEnded && options.onEnded(data);\r\n }\r\n }, options.observableParameters.mask, options.observableParameters.insertFirst, options.observableParameters.scope);\r\n return observer;\r\n}\r\n\r\n/**\r\n * An advanced implementation of a timer class\r\n */\r\nexport class AdvancedTimer<T = any> implements IDisposable {\r\n\r\n /**\r\n * Will notify each time the timer calculates the remaining time\r\n */\r\n public onEachCountObservable: Observable<ITimerData<T>> = new Observable();\r\n /**\r\n * Will trigger when the timer was aborted due to the break condition\r\n */\r\n public onTimerAbortedObservable: Observable<ITimerData<T>> = new Observable();\r\n /**\r\n * Will trigger when the timer ended successfully\r\n */\r\n public onTimerEndedObservable: Observable<ITimerData<T>> = new Observable();\r\n /**\r\n * Will trigger when the timer state has changed\r\n */\r\n public onStateChangedObservable: Observable<TimerState> = new Observable();\r\n\r\n private _observer: Nullable<Observer<T>> = null;\r\n private _contextObservable: Observable<T>;\r\n private _observableParameters: {\r\n mask?: number;\r\n insertFirst?: boolean;\r\n scope?: any;\r\n };\r\n private _startTime: number;\r\n private _timer: number;\r\n private _state: TimerState;\r\n private _breakCondition: (data: ITimerData<T>) => boolean;\r\n private _timeToEnd: number;\r\n private _breakOnNextTick: boolean = false;\r\n\r\n /**\r\n * Will construct a new advanced timer based on the options provided. Timer will not start until start() is called.\r\n * @param options construction options for this advanced timer\r\n */\r\n constructor(options: ITimerOptions<T>) {\r\n this._setState(TimerState.INIT);\r\n this._contextObservable = options.contextObservable;\r\n this._observableParameters = options.observableParameters ?? {};\r\n this._breakCondition = options.breakCondition ?? (() => false);\r\n this._timeToEnd = options.timeout;\r\n if (options.onEnded) {\r\n this.onTimerEndedObservable.add(options.onEnded);\r\n }\r\n if (options.onTick) {\r\n this.onEachCountObservable.add(options.onTick);\r\n }\r\n if (options.onAborted) {\r\n this.onTimerAbortedObservable.add(options.onAborted);\r\n }\r\n }\r\n\r\n /**\r\n * set a breaking condition for this timer. Default is to never break during count\r\n * @param predicate the new break condition. Returns true to break, false otherwise\r\n */\r\n public set breakCondition(predicate: (data: ITimerData<T>) => boolean) {\r\n this._breakCondition = predicate;\r\n }\r\n\r\n /**\r\n * Reset ALL associated observables in this advanced timer\r\n */\r\n public clearObservables() {\r\n this.onEachCountObservable.clear();\r\n this.onTimerAbortedObservable.clear();\r\n this.onTimerEndedObservable.clear();\r\n this.onStateChangedObservable.clear();\r\n }\r\n\r\n /**\r\n * Will start a new iteration of this timer. Only one instance of this timer can run at a time.\r\n *\r\n * @param timeToEnd how much time to measure until timer ended\r\n */\r\n public start(timeToEnd: number = this._timeToEnd) {\r\n if (this._state === TimerState.STARTED) {\r\n throw new Error('Timer already started. Please stop it before starting again');\r\n }\r\n this._timeToEnd = timeToEnd;\r\n this._startTime = Date.now();\r\n this._timer = 0;\r\n this._observer = this._contextObservable.add(this._tick, this._observableParameters.mask, this._observableParameters.insertFirst, this._observableParameters.scope);\r\n this._setState(TimerState.STARTED);\r\n }\r\n\r\n /**\r\n * Will force a stop on the next tick.\r\n */\r\n public stop() {\r\n if (this._state !== TimerState.STARTED) {\r\n return;\r\n }\r\n this._breakOnNextTick = true;\r\n }\r\n\r\n /**\r\n * Dispose this timer, clearing all resources\r\n */\r\n public dispose() {\r\n if (this._observer) {\r\n this._contextObservable.remove(this._observer);\r\n }\r\n this.clearObservables();\r\n }\r\n\r\n private _setState(newState: TimerState) {\r\n this._state = newState;\r\n this.onStateChangedObservable.notifyObservers(this._state);\r\n }\r\n\r\n private _tick = (payload: T) => {\r\n const now = Date.now();\r\n this._timer = now - this._startTime;\r\n const data: ITimerData<T> = {\r\n startTime: this._startTime,\r\n currentTime: now,\r\n deltaTime: this._timer,\r\n completeRate: this._timer / this._timeToEnd,\r\n payload\r\n };\r\n const shouldBreak = this._breakOnNextTick || this._breakCondition(data);\r\n if (shouldBreak || this._timer >= this._timeToEnd) {\r\n this._stop(data, shouldBreak);\r\n } else {\r\n this.onEachCountObservable.notifyObservers(data);\r\n }\r\n }\r\n\r\n private _stop(data: ITimerData<T>, aborted: boolean = false) {\r\n this._contextObservable.remove(this._observer);\r\n this._setState(TimerState.ENDED);\r\n if (aborted) {\r\n this.onTimerAbortedObservable.notifyObservers(data);\r\n } else {\r\n this.onTimerEndedObservable.notifyObservers(data);\r\n }\r\n }\r\n}"]}
@@ -85,6 +85,10 @@ export declare class AmmoJSPlugin implements IPhysicsEnginePlugin {
85
85
  * The create custom shape handler function to be called when using BABYLON.PhysicsImposter.CustomImpostor
86
86
  */
87
87
  onCreateCustomShape: (impostor: PhysicsImpostor) => any;
88
+ /**
89
+ * The create custom mesh impostor handler function to support building custom mesh impostor vertex data (Ex: Ammo.btSmoothTriangleMesh)
90
+ */
91
+ onCreateCustomMeshImpostor: (impostor: PhysicsImpostor) => any;
88
92
  private _isImpostorInContact;
89
93
  private _isImpostorPairInContact;
90
94
  private _stepSimulation;
@@ -879,14 +879,19 @@ var AmmoJSPlugin = /** @class */ (function () {
879
879
  if (impostor.getParam("mass") == 0) {
880
880
  // Only create btBvhTriangleMeshShape impostor is static
881
881
  // See https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=7283
882
- var tetraMesh = new this.bjsAMMO.btTriangleMesh();
883
- impostor._pluginData.toDispose.push(tetraMesh);
884
- var triangeCount = this._addMeshVerts(tetraMesh, object, object);
885
- if (triangeCount == 0) {
886
- returnValue = new this.bjsAMMO.btCompoundShape();
882
+ if (this.onCreateCustomMeshImpostor) {
883
+ returnValue = this.onCreateCustomMeshImpostor(impostor);
887
884
  }
888
885
  else {
889
- returnValue = new this.bjsAMMO.btBvhTriangleMeshShape(tetraMesh);
886
+ var tetraMesh = new this.bjsAMMO.btTriangleMesh();
887
+ impostor._pluginData.toDispose.push(tetraMesh);
888
+ var triangeCount = this._addMeshVerts(tetraMesh, object, object);
889
+ if (triangeCount == 0) {
890
+ returnValue = new this.bjsAMMO.btCompoundShape();
891
+ }
892
+ else {
893
+ returnValue = new this.bjsAMMO.btBvhTriangleMeshShape(tetraMesh);
894
+ }
890
895
  }
891
896
  break;
892
897
  }