@babylonjs/core 5.43.0 → 5.43.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/Audio/sound.d.ts +2 -1
  2. package/Audio/sound.js +27 -26
  3. package/Audio/sound.js.map +1 -1
  4. package/Debug/physicsViewer.d.ts +59 -4
  5. package/Debug/physicsViewer.js +115 -7
  6. package/Debug/physicsViewer.js.map +1 -1
  7. package/Engines/ICanvas.d.ts +1 -1
  8. package/Engines/ICanvas.js.map +1 -1
  9. package/Engines/WebGPU/Extensions/engine.renderTarget.js +10 -9
  10. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  11. package/Engines/thinEngine.js +2 -2
  12. package/Engines/thinEngine.js.map +1 -1
  13. package/Materials/effect.js +1 -1
  14. package/Materials/effect.js.map +1 -1
  15. package/Meshes/linesMesh.d.ts +2 -1
  16. package/Meshes/linesMesh.js +1 -2
  17. package/Meshes/linesMesh.js.map +1 -1
  18. package/Misc/observable.js +7 -4
  19. package/Misc/observable.js.map +1 -1
  20. package/Physics/joinedPhysicsEngineComponent.d.ts +84 -0
  21. package/Physics/joinedPhysicsEngineComponent.js +144 -0
  22. package/Physics/joinedPhysicsEngineComponent.js.map +1 -0
  23. package/Physics/physicsEngineComponent.d.ts +2 -84
  24. package/Physics/physicsEngineComponent.js +3 -143
  25. package/Physics/physicsEngineComponent.js.map +1 -1
  26. package/Physics/v2/IPhysicsEnginePlugin.d.ts +4 -2
  27. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  28. package/Physics/v2/physicsBody.d.ts +126 -28
  29. package/Physics/v2/physicsBody.js +127 -31
  30. package/Physics/v2/physicsBody.js.map +1 -1
  31. package/Physics/v2/physicsConstraint.d.ts +26 -7
  32. package/Physics/v2/physicsConstraint.js +23 -7
  33. package/Physics/v2/physicsConstraint.js.map +1 -1
  34. package/Physics/v2/physicsEngine.js +0 -7
  35. package/Physics/v2/physicsEngine.js.map +1 -1
  36. package/Physics/v2/physicsEngineComponent.d.ts +4 -3
  37. package/Physics/v2/physicsEngineComponent.js +6 -5
  38. package/Physics/v2/physicsEngineComponent.js.map +1 -1
  39. package/Physics/v2/physicsMaterial.d.ts +38 -11
  40. package/Physics/v2/physicsMaterial.js +35 -11
  41. package/Physics/v2/physicsMaterial.js.map +1 -1
  42. package/Physics/v2/physicsShape.d.ts +24 -15
  43. package/Physics/v2/physicsShape.js +17 -11
  44. package/Physics/v2/physicsShape.js.map +1 -1
  45. package/Shaders/fluidRenderingBilateralBlur.fragment.js +1 -1
  46. package/Shaders/fluidRenderingBilateralBlur.fragment.js.map +1 -1
  47. package/Shaders/fluidRenderingRender.fragment.js +2 -2
  48. package/Shaders/fluidRenderingRender.fragment.js.map +1 -1
  49. package/Shaders/fluidRenderingStandardBlur.fragment.js +1 -1
  50. package/Shaders/fluidRenderingStandardBlur.fragment.js.map +1 -1
  51. package/assetContainer.d.ts +4 -0
  52. package/assetContainer.js +17 -0
  53. package/assetContainer.js.map +1 -1
  54. package/package.json +1 -1
@@ -39,8 +39,30 @@ export declare class PhysicsViewer {
39
39
  * @param scene defines the hosting scene
40
40
  */
41
41
  constructor(scene?: Scene);
42
- /** @internal */
42
+ /**
43
+ * Updates the debug meshes of the physics engine.
44
+ *
45
+ * This code is useful for synchronizing the debug meshes of the physics engine with the physics impostor and mesh.
46
+ * It checks if the impostor is disposed and if the plugin version is 1, then it syncs the mesh with the impostor.
47
+ * This ensures that the debug meshes are up to date with the physics engine.
48
+ */
43
49
  protected _updateDebugMeshes(): void;
50
+ /**
51
+ * Updates the debug meshes of the physics engine.
52
+ *
53
+ * This method is useful for synchronizing the debug meshes with the physics impostors.
54
+ * It iterates through the impostors and meshes, and if the plugin version is 1, it syncs the mesh with the impostor.
55
+ * This ensures that the debug meshes accurately reflect the physics impostors, which is important for debugging the physics engine.
56
+ */
57
+ protected _updateDebugMeshesV1(): void;
58
+ /**
59
+ * Updates the debug meshes of the physics engine for V2 plugin.
60
+ *
61
+ * This method is useful for synchronizing the debug meshes of the physics engine with the current state of the bodies.
62
+ * It iterates through the bodies array and updates the debug meshes with the current transform of each body.
63
+ * This ensures that the debug meshes accurately reflect the current state of the physics engine.
64
+ */
65
+ protected _updateDebugMeshesV2(): void;
44
66
  /**
45
67
  * Renders a specified physic impostor
46
68
  * @param impostor defines the impostor to render
@@ -49,14 +71,35 @@ export declare class PhysicsViewer {
49
71
  */
50
72
  showImpostor(impostor: PhysicsImpostor, targetMesh?: Mesh): Nullable<AbstractMesh>;
51
73
  /**
74
+ * Shows a debug mesh for a given physics body.
75
+ * @param body The physics body to show.
76
+ * @returns The debug mesh, or null if the body is already shown.
52
77
  *
78
+ * This function is useful for visualizing the physics body in the scene.
79
+ * It creates a debug mesh for the given body and adds it to the scene.
80
+ * It also registers a before render function to update the debug mesh position and rotation.
53
81
  */
54
82
  showBody(body: PhysicsBody): Nullable<AbstractMesh>;
55
83
  /**
56
- * Hides a specified physic impostor
57
- * @param impostor defines the impostor to hide
84
+ * Hides an impostor from the scene.
85
+ * @param impostor - The impostor to hide.
86
+ *
87
+ * This method is useful for hiding an impostor from the scene. It removes the
88
+ * impostor from the utility layer scene, disposes the mesh, and removes the
89
+ * impostor from the list of impostors. If the impostor is the last one in the
90
+ * list, it also unregisters the render function.
58
91
  */
59
92
  hideImpostor(impostor: Nullable<PhysicsImpostor>): void;
93
+ /**
94
+ * Hides a body from the physics engine.
95
+ * @param body - The body to hide.
96
+ *
97
+ * This function is useful for hiding a body from the physics engine.
98
+ * It removes the body from the utility layer scene and disposes the mesh associated with it.
99
+ * It also unregisters the render function if the number of bodies is 0.
100
+ * This is useful for hiding a body from the physics engine without deleting it.
101
+ */
102
+ hideBody(body: Nullable<PhysicsBody>): void;
60
103
  private _getDebugMaterial;
61
104
  private _getDebugBoxMesh;
62
105
  private _getDebugSphereMesh;
@@ -64,7 +107,19 @@ export declare class PhysicsViewer {
64
107
  private _getDebugCylinderMesh;
65
108
  private _getDebugMeshMesh;
66
109
  private _getDebugMesh;
110
+ /**
111
+ * Creates a debug mesh for a given physics body
112
+ * @param body The physics body to create the debug mesh for
113
+ * @returns The created debug mesh or null if the utility layer is not available
114
+ *
115
+ * This code is useful for creating a debug mesh for a given physics body.
116
+ * It creates a Mesh object with a VertexData object containing the positions and indices
117
+ * of the geometry of the body. The mesh is then assigned a debug material from the utility layer scene.
118
+ * This allows for visualizing the physics body in the scene.
119
+ */
67
120
  private _getDebugBodyMesh;
68
- /** Releases all resources */
121
+ /**
122
+ * Clean up physics debug display
123
+ */
69
124
  dispose(): void;
70
125
  }
@@ -45,8 +45,30 @@ export class PhysicsViewer {
45
45
  this._utilityLayer.pickUtilitySceneFirst = false;
46
46
  this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true;
47
47
  }
48
- /** @internal */
48
+ /**
49
+ * Updates the debug meshes of the physics engine.
50
+ *
51
+ * This code is useful for synchronizing the debug meshes of the physics engine with the physics impostor and mesh.
52
+ * It checks if the impostor is disposed and if the plugin version is 1, then it syncs the mesh with the impostor.
53
+ * This ensures that the debug meshes are up to date with the physics engine.
54
+ */
49
55
  _updateDebugMeshes() {
56
+ const plugin = this._physicsEnginePlugin;
57
+ if ((plugin === null || plugin === void 0 ? void 0 : plugin.getPluginVersion()) === 1) {
58
+ this._updateDebugMeshesV1();
59
+ }
60
+ else {
61
+ this._updateDebugMeshesV2();
62
+ }
63
+ }
64
+ /**
65
+ * Updates the debug meshes of the physics engine.
66
+ *
67
+ * This method is useful for synchronizing the debug meshes with the physics impostors.
68
+ * It iterates through the impostors and meshes, and if the plugin version is 1, it syncs the mesh with the impostor.
69
+ * This ensures that the debug meshes accurately reflect the physics impostors, which is important for debugging the physics engine.
70
+ */
71
+ _updateDebugMeshesV1() {
50
72
  const plugin = this._physicsEnginePlugin;
51
73
  for (let i = 0; i < this._numMeshes; i++) {
52
74
  const impostor = this._impostors[i];
@@ -61,12 +83,29 @@ export class PhysicsViewer {
61
83
  continue;
62
84
  }
63
85
  const mesh = this._meshes[i];
64
- if (mesh && plugin && plugin.getPluginVersion() === 1) {
86
+ if (mesh && plugin) {
65
87
  plugin.syncMeshWithImpostor(mesh, impostor);
66
88
  }
67
89
  }
68
90
  }
69
91
  }
92
+ /**
93
+ * Updates the debug meshes of the physics engine for V2 plugin.
94
+ *
95
+ * This method is useful for synchronizing the debug meshes of the physics engine with the current state of the bodies.
96
+ * It iterates through the bodies array and updates the debug meshes with the current transform of each body.
97
+ * This ensures that the debug meshes accurately reflect the current state of the physics engine.
98
+ */
99
+ _updateDebugMeshesV2() {
100
+ const plugin = this._physicsEnginePlugin;
101
+ for (let i = 0; i < this._numBodies; i++) {
102
+ const body = this._bodies[i];
103
+ const transform = this._bodyMeshes[i];
104
+ if (body && transform) {
105
+ plugin.syncTransform(body, transform);
106
+ }
107
+ }
108
+ }
70
109
  /**
71
110
  * Renders a specified physic impostor
72
111
  * @param impostor defines the impostor to render
@@ -95,7 +134,13 @@ export class PhysicsViewer {
95
134
  return debugMesh;
96
135
  }
97
136
  /**
137
+ * Shows a debug mesh for a given physics body.
138
+ * @param body The physics body to show.
139
+ * @returns The debug mesh, or null if the body is already shown.
98
140
  *
141
+ * This function is useful for visualizing the physics body in the scene.
142
+ * It creates a debug mesh for the given body and adds it to the scene.
143
+ * It also registers a before render function to update the debug mesh position and rotation.
99
144
  */
100
145
  showBody(body) {
101
146
  if (!this._scene) {
@@ -119,8 +164,13 @@ export class PhysicsViewer {
119
164
  return debugMesh;
120
165
  }
121
166
  /**
122
- * Hides a specified physic impostor
123
- * @param impostor defines the impostor to hide
167
+ * Hides an impostor from the scene.
168
+ * @param impostor - The impostor to hide.
169
+ *
170
+ * This method is useful for hiding an impostor from the scene. It removes the
171
+ * impostor from the utility layer scene, disposes the mesh, and removes the
172
+ * impostor from the list of impostors. If the impostor is the last one in the
173
+ * list, it also unregisters the render function.
124
174
  */
125
175
  hideImpostor(impostor) {
126
176
  if (!impostor || !this._scene || !this._utilityLayer) {
@@ -159,6 +209,48 @@ export class PhysicsViewer {
159
209
  this._scene.unregisterBeforeRender(this._renderFunction);
160
210
  }
161
211
  }
212
+ /**
213
+ * Hides a body from the physics engine.
214
+ * @param body - The body to hide.
215
+ *
216
+ * This function is useful for hiding a body from the physics engine.
217
+ * It removes the body from the utility layer scene and disposes the mesh associated with it.
218
+ * It also unregisters the render function if the number of bodies is 0.
219
+ * This is useful for hiding a body from the physics engine without deleting it.
220
+ */
221
+ hideBody(body) {
222
+ if (!body || !this._scene || !this._utilityLayer) {
223
+ return;
224
+ }
225
+ let removed = false;
226
+ const utilityLayerScene = this._utilityLayer.utilityLayerScene;
227
+ for (let i = 0; i < this._numBodies; i++) {
228
+ if (this._bodies[i] === body) {
229
+ const mesh = this._bodyMeshes[i];
230
+ if (!mesh) {
231
+ continue;
232
+ }
233
+ utilityLayerScene.removeMesh(mesh);
234
+ mesh.dispose();
235
+ this._numBodies--;
236
+ if (this._numBodies > 0) {
237
+ this._bodyMeshes[i] = this._meshes[this._numBodies];
238
+ this._bodies[i] = this._bodies[this._numBodies];
239
+ this._bodyMeshes[this._numBodies] = null;
240
+ this._bodies[this._numBodies] = null;
241
+ }
242
+ else {
243
+ this._bodyMeshes[0] = null;
244
+ this._bodies[0] = null;
245
+ }
246
+ removed = true;
247
+ break;
248
+ }
249
+ }
250
+ if (removed && this._numBodies === 0) {
251
+ this._scene.unregisterBeforeRender(this._renderFunction);
252
+ }
253
+ }
162
254
  _getDebugMaterial(scene) {
163
255
  if (!this._debugMaterial) {
164
256
  this._debugMaterial = new StandardMaterial("", scene);
@@ -305,6 +397,16 @@ export class PhysicsViewer {
305
397
  }
306
398
  return mesh;
307
399
  }
400
+ /**
401
+ * Creates a debug mesh for a given physics body
402
+ * @param body The physics body to create the debug mesh for
403
+ * @returns The created debug mesh or null if the utility layer is not available
404
+ *
405
+ * This code is useful for creating a debug mesh for a given physics body.
406
+ * It creates a Mesh object with a VertexData object containing the positions and indices
407
+ * of the geometry of the body. The mesh is then assigned a debug material from the utility layer scene.
408
+ * This allows for visualizing the physics body in the scene.
409
+ */
308
410
  _getDebugBodyMesh(body) {
309
411
  if (!this._utilityLayer) {
310
412
  return null;
@@ -319,12 +421,18 @@ export class PhysicsViewer {
319
421
  mesh.material = this._getDebugMaterial(utilityLayerScene);
320
422
  return mesh;
321
423
  }
322
- /** Releases all resources */
424
+ /**
425
+ * Clean up physics debug display
426
+ */
323
427
  dispose() {
324
- const count = this._numMeshes;
325
- for (let index = 0; index < count; index++) {
428
+ // impostors
429
+ for (let index = 0; index < this._numMeshes; index++) {
326
430
  this.hideImpostor(this._impostors[0]);
327
431
  }
432
+ // bodies
433
+ for (let index = 0; index < this._numBodies; index++) {
434
+ this.hideBody(this._bodies[0]);
435
+ }
328
436
  if (this._debugBoxMesh) {
329
437
  this._debugBoxMesh.dispose();
330
438
  }
@@ -1 +1 @@
1
- {"version":3,"file":"physicsViewer.js","sourceRoot":"","sources":["../../../../lts/core/generated/Debug/physicsViewer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,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AC,OAAO,EAAE,CAAC;SACnC;QACD,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;SACrC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QAED,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEjC,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC7B;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { IPhysicsEnginePlugin as IPhysicsEnginePluginV1 } from \"../Physics/v1/IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2 } from \"../Physics/v2/IPhysicsEnginePlugin\";\r\nimport { PhysicsImpostor } from \"../Physics/v1/physicsImpostor\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport type { ICreateCapsuleOptions } from \"../Meshes/Builders/capsuleBuilder\";\r\nimport { CreateCapsule } from \"../Meshes/Builders/capsuleBuilder\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { PhysicsBody } from \"../Physics/v2/physicsBody\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\n\r\n/**\r\n * Used to show the physics impostor around the specific mesh\r\n */\r\nexport class PhysicsViewer {\r\n /** @internal */\r\n protected _impostors: Array<Nullable<PhysicsImpostor>> = [];\r\n /** @internal */\r\n protected _meshes: Array<Nullable<AbstractMesh>> = [];\r\n /** @internal */\r\n protected _bodies: Array<Nullable<PhysicsBody>> = [];\r\n /** @internal */\r\n protected _bodyMeshes: Array<Nullable<AbstractMesh>> = [];\r\n /** @internal */\r\n protected _scene: Nullable<Scene>;\r\n /** @internal */\r\n protected _numMeshes = 0;\r\n /** @internal */\r\n protected _numBodies = 0;\r\n /** @internal */\r\n protected _physicsEnginePlugin: IPhysicsEnginePluginV1 | IPhysicsEnginePluginV2 | null;\r\n private _renderFunction: () => void;\r\n private _utilityLayer: Nullable<UtilityLayerRenderer>;\r\n\r\n private _debugBoxMesh: Mesh;\r\n private _debugSphereMesh: Mesh;\r\n private _debugCapsuleMesh: Mesh;\r\n private _debugCylinderMesh: Mesh;\r\n private _debugMaterial: StandardMaterial;\r\n private _debugMeshMeshes = new Array<Mesh>();\r\n\r\n /**\r\n * Creates a new PhysicsViewer\r\n * @param scene defines the hosting scene\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n const physicEngine = this._scene.getPhysicsEngine();\r\n\r\n if (physicEngine) {\r\n this._physicsEnginePlugin = physicEngine.getPhysicsPlugin();\r\n }\r\n\r\n this._utilityLayer = new UtilityLayerRenderer(this._scene, false);\r\n this._utilityLayer.pickUtilitySceneFirst = false;\r\n this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true;\r\n }\r\n\r\n /** @internal */\r\n protected _updateDebugMeshes(): void {\r\n const plugin = this._physicsEnginePlugin;\r\n\r\n for (let i = 0; i < this._numMeshes; i++) {\r\n const impostor = this._impostors[i];\r\n\r\n if (!impostor) {\r\n continue;\r\n }\r\n\r\n if (impostor.isDisposed) {\r\n this.hideImpostor(this._impostors[i--]);\r\n } else {\r\n if (impostor.type === PhysicsImpostor.MeshImpostor) {\r\n continue;\r\n }\r\n const mesh = this._meshes[i];\r\n\r\n if (mesh && plugin && plugin.getPluginVersion() === 1) {\r\n (plugin as IPhysicsEnginePluginV1).syncMeshWithImpostor(mesh, impostor);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Renders a specified physic impostor\r\n * @param impostor defines the impostor to render\r\n * @param targetMesh defines the mesh represented by the impostor\r\n * @returns the new debug mesh used to render the impostor\r\n */\r\n public showImpostor(impostor: PhysicsImpostor, targetMesh?: Mesh): Nullable<AbstractMesh> {\r\n if (!this._scene) {\r\n return null;\r\n }\r\n\r\n for (let i = 0; i < this._numMeshes; i++) {\r\n if (this._impostors[i] == impostor) {\r\n return null;\r\n }\r\n }\r\n\r\n const debugMesh = this._getDebugMesh(impostor, targetMesh);\r\n\r\n if (debugMesh) {\r\n this._impostors[this._numMeshes] = impostor;\r\n this._meshes[this._numMeshes] = debugMesh;\r\n\r\n if (this._numMeshes === 0) {\r\n this._renderFunction = this._updateDebugMeshes.bind(this);\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n\r\n this._numMeshes++;\r\n }\r\n\r\n return debugMesh;\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public showBody(body: PhysicsBody): Nullable<AbstractMesh> {\r\n if (!this._scene) {\r\n return null;\r\n }\r\n\r\n for (let i = 0; i < this._numBodies; i++) {\r\n if (this._bodies[i] == body) {\r\n return null;\r\n }\r\n }\r\n\r\n const debugMesh = this._getDebugBodyMesh(body);\r\n\r\n if (debugMesh) {\r\n this._bodies[this._numBodies] = body;\r\n this._bodyMeshes[this._numBodies] = debugMesh;\r\n\r\n if (this._numBodies === 0) {\r\n this._renderFunction = this._updateDebugMeshes.bind(this);\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n\r\n this._numBodies++;\r\n }\r\n\r\n return debugMesh;\r\n }\r\n /**\r\n * Hides a specified physic impostor\r\n * @param impostor defines the impostor to hide\r\n */\r\n public hideImpostor(impostor: Nullable<PhysicsImpostor>) {\r\n if (!impostor || !this._scene || !this._utilityLayer) {\r\n return;\r\n }\r\n\r\n let removed = false;\r\n const utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n\r\n for (let i = 0; i < this._numMeshes; i++) {\r\n if (this._impostors[i] == impostor) {\r\n const mesh = this._meshes[i];\r\n\r\n if (!mesh) {\r\n continue;\r\n }\r\n\r\n utilityLayerScene.removeMesh(mesh);\r\n mesh.dispose();\r\n\r\n const index = this._debugMeshMeshes.indexOf(mesh as Mesh);\r\n if (index > -1) {\r\n this._debugMeshMeshes.splice(index, 1);\r\n }\r\n\r\n this._numMeshes--;\r\n if (this._numMeshes > 0) {\r\n this._meshes[i] = this._meshes[this._numMeshes];\r\n this._impostors[i] = this._impostors[this._numMeshes];\r\n this._meshes[this._numMeshes] = null;\r\n this._impostors[this._numMeshes] = null;\r\n } else {\r\n this._meshes[0] = null;\r\n this._impostors[0] = null;\r\n }\r\n removed = true;\r\n break;\r\n }\r\n }\r\n\r\n if (removed && this._numMeshes === 0) {\r\n this._scene.unregisterBeforeRender(this._renderFunction);\r\n }\r\n }\r\n\r\n private _getDebugMaterial(scene: Scene): Material {\r\n if (!this._debugMaterial) {\r\n this._debugMaterial = new StandardMaterial(\"\", scene);\r\n this._debugMaterial.wireframe = true;\r\n this._debugMaterial.emissiveColor = Color3.White();\r\n this._debugMaterial.disableLighting = true;\r\n }\r\n\r\n return this._debugMaterial;\r\n }\r\n\r\n private _getDebugBoxMesh(scene: Scene): AbstractMesh {\r\n if (!this._debugBoxMesh) {\r\n this._debugBoxMesh = CreateBox(\"physicsBodyBoxViewMesh\", { size: 1 }, scene);\r\n this._debugBoxMesh.rotationQuaternion = Quaternion.Identity();\r\n this._debugBoxMesh.material = this._getDebugMaterial(scene);\r\n this._debugBoxMesh.setEnabled(false);\r\n }\r\n\r\n return this._debugBoxMesh.createInstance(\"physicsBodyBoxViewInstance\");\r\n }\r\n\r\n private _getDebugSphereMesh(scene: Scene): AbstractMesh {\r\n if (!this._debugSphereMesh) {\r\n this._debugSphereMesh = CreateSphere(\"physicsBodySphereViewMesh\", { diameter: 1 }, scene);\r\n this._debugSphereMesh.rotationQuaternion = Quaternion.Identity();\r\n this._debugSphereMesh.material = this._getDebugMaterial(scene);\r\n this._debugSphereMesh.setEnabled(false);\r\n }\r\n\r\n return this._debugSphereMesh.createInstance(\"physicsBodySphereViewInstance\");\r\n }\r\n\r\n private _getDebugCapsuleMesh(scene: Scene): AbstractMesh {\r\n if (!this._debugCapsuleMesh) {\r\n this._debugCapsuleMesh = CreateCapsule(\"physicsBodyCapsuleViewMesh\", { height: 1 } as ICreateCapsuleOptions, scene);\r\n this._debugCapsuleMesh.rotationQuaternion = Quaternion.Identity();\r\n this._debugCapsuleMesh.material = this._getDebugMaterial(scene);\r\n this._debugCapsuleMesh.setEnabled(false);\r\n }\r\n\r\n return this._debugCapsuleMesh.createInstance(\"physicsBodyCapsuleViewInstance\");\r\n }\r\n\r\n private _getDebugCylinderMesh(scene: Scene): AbstractMesh {\r\n if (!this._debugCylinderMesh) {\r\n this._debugCylinderMesh = CreateCylinder(\"physicsBodyCylinderViewMesh\", { diameterTop: 1, diameterBottom: 1, height: 1 }, scene);\r\n this._debugCylinderMesh.rotationQuaternion = Quaternion.Identity();\r\n this._debugCylinderMesh.material = this._getDebugMaterial(scene);\r\n this._debugCylinderMesh.setEnabled(false);\r\n }\r\n\r\n return this._debugCylinderMesh.createInstance(\"physicsBodyCylinderViewInstance\");\r\n }\r\n\r\n private _getDebugMeshMesh(mesh: Mesh, scene: Scene): AbstractMesh {\r\n const wireframeOver = new Mesh(mesh.name, scene, null, mesh);\r\n wireframeOver.setParent(mesh);\r\n wireframeOver.position = Vector3.Zero();\r\n wireframeOver.material = this._getDebugMaterial(scene);\r\n\r\n this._debugMeshMeshes.push(wireframeOver);\r\n\r\n return wireframeOver;\r\n }\r\n\r\n private _getDebugMesh(impostor: PhysicsImpostor, targetMesh?: Mesh): Nullable<AbstractMesh> {\r\n if (!this._utilityLayer) {\r\n return null;\r\n }\r\n\r\n // Only create child impostor debug meshes when evaluating the parent\r\n if (targetMesh && targetMesh.parent && (targetMesh.parent as Mesh).physicsImpostor) {\r\n return null;\r\n }\r\n\r\n let mesh: Nullable<AbstractMesh> = null;\r\n const utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n if (!impostor.physicsBody) {\r\n Logger.Warn(\"Unable to get physicsBody of impostor. It might be initialized later by its parent's impostor.\");\r\n return null;\r\n }\r\n switch (impostor.type) {\r\n case PhysicsImpostor.BoxImpostor:\r\n mesh = this._getDebugBoxMesh(utilityLayerScene);\r\n impostor.getBoxSizeToRef(mesh.scaling);\r\n break;\r\n case PhysicsImpostor.SphereImpostor: {\r\n mesh = this._getDebugSphereMesh(utilityLayerScene);\r\n const radius = impostor.getRadius();\r\n mesh.scaling.x = radius * 2;\r\n mesh.scaling.y = radius * 2;\r\n mesh.scaling.z = radius * 2;\r\n break;\r\n }\r\n case PhysicsImpostor.CapsuleImpostor: {\r\n mesh = this._getDebugCapsuleMesh(utilityLayerScene);\r\n const bi = impostor.object.getBoundingInfo();\r\n mesh.scaling.x = (bi.boundingBox.maximum.x - bi.boundingBox.minimum.x) * 2 * impostor.object.scaling.x;\r\n mesh.scaling.y = (bi.boundingBox.maximum.y - bi.boundingBox.minimum.y) * impostor.object.scaling.y;\r\n mesh.scaling.z = (bi.boundingBox.maximum.z - bi.boundingBox.minimum.z) * 2 * impostor.object.scaling.z;\r\n break;\r\n }\r\n case PhysicsImpostor.MeshImpostor:\r\n if (targetMesh) {\r\n mesh = this._getDebugMeshMesh(targetMesh, utilityLayerScene);\r\n }\r\n break;\r\n case PhysicsImpostor.NoImpostor:\r\n if (targetMesh) {\r\n // Handle compound impostors\r\n const childMeshes = targetMesh.getChildMeshes().filter((c) => {\r\n return c.physicsImpostor ? 1 : 0;\r\n });\r\n childMeshes.forEach((m) => {\r\n if (m.physicsImpostor && m.getClassName() === \"Mesh\") {\r\n const boundingInfo = m.getBoundingInfo();\r\n const min = boundingInfo.boundingBox.minimum;\r\n const max = boundingInfo.boundingBox.maximum;\r\n switch (m.physicsImpostor.type) {\r\n case PhysicsImpostor.BoxImpostor:\r\n mesh = this._getDebugBoxMesh(utilityLayerScene);\r\n mesh.position.copyFrom(min);\r\n mesh.position.addInPlace(max);\r\n mesh.position.scaleInPlace(0.5);\r\n break;\r\n case PhysicsImpostor.SphereImpostor:\r\n mesh = this._getDebugSphereMesh(utilityLayerScene);\r\n break;\r\n case PhysicsImpostor.CylinderImpostor:\r\n mesh = this._getDebugCylinderMesh(utilityLayerScene);\r\n break;\r\n default:\r\n mesh = null;\r\n break;\r\n }\r\n if (mesh) {\r\n mesh.scaling.x = max.x - min.x;\r\n mesh.scaling.y = max.y - min.y;\r\n mesh.scaling.z = max.z - min.z;\r\n mesh.parent = m;\r\n }\r\n }\r\n });\r\n } else {\r\n Logger.Warn(\"No target mesh parameter provided for NoImpostor. Skipping.\");\r\n }\r\n mesh = null;\r\n break;\r\n case PhysicsImpostor.CylinderImpostor: {\r\n mesh = this._getDebugCylinderMesh(utilityLayerScene);\r\n const bi = impostor.object.getBoundingInfo();\r\n mesh.scaling.x = (bi.boundingBox.maximum.x - bi.boundingBox.minimum.x) * impostor.object.scaling.x;\r\n mesh.scaling.y = (bi.boundingBox.maximum.y - bi.boundingBox.minimum.y) * impostor.object.scaling.y;\r\n mesh.scaling.z = (bi.boundingBox.maximum.z - bi.boundingBox.minimum.z) * impostor.object.scaling.z;\r\n break;\r\n }\r\n }\r\n return mesh;\r\n }\r\n\r\n private _getDebugBodyMesh(body: PhysicsBody): Nullable<AbstractMesh> {\r\n if (!this._utilityLayer) {\r\n return null;\r\n }\r\n\r\n const utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n\r\n const mesh = new Mesh(\"custom\", utilityLayerScene);\r\n const vertexData = new VertexData();\r\n const geometry = body.getGeometry() as any;\r\n vertexData.positions = geometry.positions;\r\n vertexData.indices = geometry.indices;\r\n vertexData.applyToMesh(mesh);\r\n mesh.material = this._getDebugMaterial(utilityLayerScene);\r\n return mesh;\r\n }\r\n\r\n /** Releases all resources */\r\n public dispose() {\r\n const count = this._numMeshes;\r\n for (let index = 0; index < count; index++) {\r\n this.hideImpostor(this._impostors[0]);\r\n }\r\n\r\n if (this._debugBoxMesh) {\r\n this._debugBoxMesh.dispose();\r\n }\r\n if (this._debugSphereMesh) {\r\n this._debugSphereMesh.dispose();\r\n }\r\n if (this._debugCylinderMesh) {\r\n this._debugCylinderMesh.dispose();\r\n }\r\n if (this._debugMaterial) {\r\n this._debugMaterial.dispose();\r\n }\r\n\r\n this._impostors.length = 0;\r\n this._scene = null;\r\n this._physicsEnginePlugin = null;\r\n\r\n if (this._utilityLayer) {\r\n this._utilityLayer.dispose();\r\n this._utilityLayer = null;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsViewer.js","sourceRoot":"","sources":["../../../../lts/core/generated/Debug/physicsViewer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE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QACD,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;SACrC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;QAED,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAEjC,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC7B;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { IPhysicsEnginePlugin as IPhysicsEnginePluginV1 } from \"../Physics/v1/IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2 } from \"../Physics/v2/IPhysicsEnginePlugin\";\r\nimport { PhysicsImpostor } from \"../Physics/v1/physicsImpostor\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport type { ICreateCapsuleOptions } from \"../Meshes/Builders/capsuleBuilder\";\r\nimport { CreateCapsule } from \"../Meshes/Builders/capsuleBuilder\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { PhysicsBody } from \"../Physics/v2/physicsBody\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\n\r\n/**\r\n * Used to show the physics impostor around the specific mesh\r\n */\r\nexport class PhysicsViewer {\r\n /** @internal */\r\n protected _impostors: Array<Nullable<PhysicsImpostor>> = [];\r\n /** @internal */\r\n protected _meshes: Array<Nullable<AbstractMesh>> = [];\r\n /** @internal */\r\n protected _bodies: Array<Nullable<PhysicsBody>> = [];\r\n /** @internal */\r\n protected _bodyMeshes: Array<Nullable<AbstractMesh>> = [];\r\n /** @internal */\r\n protected _scene: Nullable<Scene>;\r\n /** @internal */\r\n protected _numMeshes = 0;\r\n /** @internal */\r\n protected _numBodies = 0;\r\n /** @internal */\r\n protected _physicsEnginePlugin: IPhysicsEnginePluginV1 | IPhysicsEnginePluginV2 | null;\r\n private _renderFunction: () => void;\r\n private _utilityLayer: Nullable<UtilityLayerRenderer>;\r\n\r\n private _debugBoxMesh: Mesh;\r\n private _debugSphereMesh: Mesh;\r\n private _debugCapsuleMesh: Mesh;\r\n private _debugCylinderMesh: Mesh;\r\n private _debugMaterial: StandardMaterial;\r\n private _debugMeshMeshes = new Array<Mesh>();\r\n\r\n /**\r\n * Creates a new PhysicsViewer\r\n * @param scene defines the hosting scene\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n const physicEngine = this._scene.getPhysicsEngine();\r\n\r\n if (physicEngine) {\r\n this._physicsEnginePlugin = physicEngine.getPhysicsPlugin();\r\n }\r\n\r\n this._utilityLayer = new UtilityLayerRenderer(this._scene, false);\r\n this._utilityLayer.pickUtilitySceneFirst = false;\r\n this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true;\r\n }\r\n\r\n /**\r\n * Updates the debug meshes of the physics engine.\r\n *\r\n * This code is useful for synchronizing the debug meshes of the physics engine with the physics impostor and mesh.\r\n * It checks if the impostor is disposed and if the plugin version is 1, then it syncs the mesh with the impostor.\r\n * This ensures that the debug meshes are up to date with the physics engine.\r\n */\r\n protected _updateDebugMeshes(): void {\r\n const plugin = this._physicsEnginePlugin;\r\n\r\n if (plugin?.getPluginVersion() === 1) {\r\n this._updateDebugMeshesV1();\r\n } else {\r\n this._updateDebugMeshesV2();\r\n }\r\n }\r\n\r\n /**\r\n * Updates the debug meshes of the physics engine.\r\n *\r\n * This method is useful for synchronizing the debug meshes with the physics impostors.\r\n * It iterates through the impostors and meshes, and if the plugin version is 1, it syncs the mesh with the impostor.\r\n * This ensures that the debug meshes accurately reflect the physics impostors, which is important for debugging the physics engine.\r\n */\r\n protected _updateDebugMeshesV1(): void {\r\n const plugin = this._physicsEnginePlugin as IPhysicsEnginePluginV1;\r\n for (let i = 0; i < this._numMeshes; i++) {\r\n const impostor = this._impostors[i];\r\n\r\n if (!impostor) {\r\n continue;\r\n }\r\n\r\n if (impostor.isDisposed) {\r\n this.hideImpostor(this._impostors[i--]);\r\n } else {\r\n if (impostor.type === PhysicsImpostor.MeshImpostor) {\r\n continue;\r\n }\r\n const mesh = this._meshes[i];\r\n\r\n if (mesh && plugin) {\r\n plugin.syncMeshWithImpostor(mesh, impostor);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Updates the debug meshes of the physics engine for V2 plugin.\r\n *\r\n * This method is useful for synchronizing the debug meshes of the physics engine with the current state of the bodies.\r\n * It iterates through the bodies array and updates the debug meshes with the current transform of each body.\r\n * This ensures that the debug meshes accurately reflect the current state of the physics engine.\r\n */\r\n protected _updateDebugMeshesV2(): void {\r\n const plugin = this._physicsEnginePlugin as IPhysicsEnginePluginV2;\r\n for (let i = 0; i < this._numBodies; i++) {\r\n const body = this._bodies[i];\r\n const transform = this._bodyMeshes[i];\r\n if (body && transform) {\r\n plugin.syncTransform(body, transform);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Renders a specified physic impostor\r\n * @param impostor defines the impostor to render\r\n * @param targetMesh defines the mesh represented by the impostor\r\n * @returns the new debug mesh used to render the impostor\r\n */\r\n public showImpostor(impostor: PhysicsImpostor, targetMesh?: Mesh): Nullable<AbstractMesh> {\r\n if (!this._scene) {\r\n return null;\r\n }\r\n\r\n for (let i = 0; i < this._numMeshes; i++) {\r\n if (this._impostors[i] == impostor) {\r\n return null;\r\n }\r\n }\r\n\r\n const debugMesh = this._getDebugMesh(impostor, targetMesh);\r\n\r\n if (debugMesh) {\r\n this._impostors[this._numMeshes] = impostor;\r\n this._meshes[this._numMeshes] = debugMesh;\r\n\r\n if (this._numMeshes === 0) {\r\n this._renderFunction = this._updateDebugMeshes.bind(this);\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n\r\n this._numMeshes++;\r\n }\r\n\r\n return debugMesh;\r\n }\r\n\r\n /**\r\n * Shows a debug mesh for a given physics body.\r\n * @param body The physics body to show.\r\n * @returns The debug mesh, or null if the body is already shown.\r\n *\r\n * This function is useful for visualizing the physics body in the scene.\r\n * It creates a debug mesh for the given body and adds it to the scene.\r\n * It also registers a before render function to update the debug mesh position and rotation.\r\n */\r\n public showBody(body: PhysicsBody): Nullable<AbstractMesh> {\r\n if (!this._scene) {\r\n return null;\r\n }\r\n\r\n for (let i = 0; i < this._numBodies; i++) {\r\n if (this._bodies[i] == body) {\r\n return null;\r\n }\r\n }\r\n\r\n const debugMesh = this._getDebugBodyMesh(body);\r\n\r\n if (debugMesh) {\r\n this._bodies[this._numBodies] = body;\r\n this._bodyMeshes[this._numBodies] = debugMesh;\r\n\r\n if (this._numBodies === 0) {\r\n this._renderFunction = this._updateDebugMeshes.bind(this);\r\n this._scene.registerBeforeRender(this._renderFunction);\r\n }\r\n\r\n this._numBodies++;\r\n }\r\n\r\n return debugMesh;\r\n }\r\n\r\n /**\r\n * Hides an impostor from the scene.\r\n * @param impostor - The impostor to hide.\r\n *\r\n * This method is useful for hiding an impostor from the scene. It removes the\r\n * impostor from the utility layer scene, disposes the mesh, and removes the\r\n * impostor from the list of impostors. If the impostor is the last one in the\r\n * list, it also unregisters the render function.\r\n */\r\n public hideImpostor(impostor: Nullable<PhysicsImpostor>) {\r\n if (!impostor || !this._scene || !this._utilityLayer) {\r\n return;\r\n }\r\n\r\n let removed = false;\r\n const utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n\r\n for (let i = 0; i < this._numMeshes; i++) {\r\n if (this._impostors[i] == impostor) {\r\n const mesh = this._meshes[i];\r\n\r\n if (!mesh) {\r\n continue;\r\n }\r\n\r\n utilityLayerScene.removeMesh(mesh);\r\n mesh.dispose();\r\n\r\n const index = this._debugMeshMeshes.indexOf(mesh as Mesh);\r\n if (index > -1) {\r\n this._debugMeshMeshes.splice(index, 1);\r\n }\r\n\r\n this._numMeshes--;\r\n if (this._numMeshes > 0) {\r\n this._meshes[i] = this._meshes[this._numMeshes];\r\n this._impostors[i] = this._impostors[this._numMeshes];\r\n this._meshes[this._numMeshes] = null;\r\n this._impostors[this._numMeshes] = null;\r\n } else {\r\n this._meshes[0] = null;\r\n this._impostors[0] = null;\r\n }\r\n removed = true;\r\n break;\r\n }\r\n }\r\n\r\n if (removed && this._numMeshes === 0) {\r\n this._scene.unregisterBeforeRender(this._renderFunction);\r\n }\r\n }\r\n\r\n /**\r\n * Hides a body from the physics engine.\r\n * @param body - The body to hide.\r\n *\r\n * This function is useful for hiding a body from the physics engine.\r\n * It removes the body from the utility layer scene and disposes the mesh associated with it.\r\n * It also unregisters the render function if the number of bodies is 0.\r\n * This is useful for hiding a body from the physics engine without deleting it.\r\n */\r\n public hideBody(body: Nullable<PhysicsBody>) {\r\n if (!body || !this._scene || !this._utilityLayer) {\r\n return;\r\n }\r\n\r\n let removed = false;\r\n const utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n\r\n for (let i = 0; i < this._numBodies; i++) {\r\n if (this._bodies[i] === body) {\r\n const mesh = this._bodyMeshes[i];\r\n\r\n if (!mesh) {\r\n continue;\r\n }\r\n\r\n utilityLayerScene.removeMesh(mesh);\r\n mesh.dispose();\r\n\r\n this._numBodies--;\r\n if (this._numBodies > 0) {\r\n this._bodyMeshes[i] = this._meshes[this._numBodies];\r\n this._bodies[i] = this._bodies[this._numBodies];\r\n this._bodyMeshes[this._numBodies] = null;\r\n this._bodies[this._numBodies] = null;\r\n } else {\r\n this._bodyMeshes[0] = null;\r\n this._bodies[0] = null;\r\n }\r\n removed = true;\r\n break;\r\n }\r\n }\r\n\r\n if (removed && this._numBodies === 0) {\r\n this._scene.unregisterBeforeRender(this._renderFunction);\r\n }\r\n }\r\n\r\n private _getDebugMaterial(scene: Scene): Material {\r\n if (!this._debugMaterial) {\r\n this._debugMaterial = new StandardMaterial(\"\", scene);\r\n this._debugMaterial.wireframe = true;\r\n this._debugMaterial.emissiveColor = Color3.White();\r\n this._debugMaterial.disableLighting = true;\r\n }\r\n\r\n return this._debugMaterial;\r\n }\r\n\r\n private _getDebugBoxMesh(scene: Scene): AbstractMesh {\r\n if (!this._debugBoxMesh) {\r\n this._debugBoxMesh = CreateBox(\"physicsBodyBoxViewMesh\", { size: 1 }, scene);\r\n this._debugBoxMesh.rotationQuaternion = Quaternion.Identity();\r\n this._debugBoxMesh.material = this._getDebugMaterial(scene);\r\n this._debugBoxMesh.setEnabled(false);\r\n }\r\n\r\n return this._debugBoxMesh.createInstance(\"physicsBodyBoxViewInstance\");\r\n }\r\n\r\n private _getDebugSphereMesh(scene: Scene): AbstractMesh {\r\n if (!this._debugSphereMesh) {\r\n this._debugSphereMesh = CreateSphere(\"physicsBodySphereViewMesh\", { diameter: 1 }, scene);\r\n this._debugSphereMesh.rotationQuaternion = Quaternion.Identity();\r\n this._debugSphereMesh.material = this._getDebugMaterial(scene);\r\n this._debugSphereMesh.setEnabled(false);\r\n }\r\n\r\n return this._debugSphereMesh.createInstance(\"physicsBodySphereViewInstance\");\r\n }\r\n\r\n private _getDebugCapsuleMesh(scene: Scene): AbstractMesh {\r\n if (!this._debugCapsuleMesh) {\r\n this._debugCapsuleMesh = CreateCapsule(\"physicsBodyCapsuleViewMesh\", { height: 1 } as ICreateCapsuleOptions, scene);\r\n this._debugCapsuleMesh.rotationQuaternion = Quaternion.Identity();\r\n this._debugCapsuleMesh.material = this._getDebugMaterial(scene);\r\n this._debugCapsuleMesh.setEnabled(false);\r\n }\r\n\r\n return this._debugCapsuleMesh.createInstance(\"physicsBodyCapsuleViewInstance\");\r\n }\r\n\r\n private _getDebugCylinderMesh(scene: Scene): AbstractMesh {\r\n if (!this._debugCylinderMesh) {\r\n this._debugCylinderMesh = CreateCylinder(\"physicsBodyCylinderViewMesh\", { diameterTop: 1, diameterBottom: 1, height: 1 }, scene);\r\n this._debugCylinderMesh.rotationQuaternion = Quaternion.Identity();\r\n this._debugCylinderMesh.material = this._getDebugMaterial(scene);\r\n this._debugCylinderMesh.setEnabled(false);\r\n }\r\n\r\n return this._debugCylinderMesh.createInstance(\"physicsBodyCylinderViewInstance\");\r\n }\r\n\r\n private _getDebugMeshMesh(mesh: Mesh, scene: Scene): AbstractMesh {\r\n const wireframeOver = new Mesh(mesh.name, scene, null, mesh);\r\n wireframeOver.setParent(mesh);\r\n wireframeOver.position = Vector3.Zero();\r\n wireframeOver.material = this._getDebugMaterial(scene);\r\n\r\n this._debugMeshMeshes.push(wireframeOver);\r\n\r\n return wireframeOver;\r\n }\r\n\r\n private _getDebugMesh(impostor: PhysicsImpostor, targetMesh?: Mesh): Nullable<AbstractMesh> {\r\n if (!this._utilityLayer) {\r\n return null;\r\n }\r\n\r\n // Only create child impostor debug meshes when evaluating the parent\r\n if (targetMesh && targetMesh.parent && (targetMesh.parent as Mesh).physicsImpostor) {\r\n return null;\r\n }\r\n\r\n let mesh: Nullable<AbstractMesh> = null;\r\n const utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n if (!impostor.physicsBody) {\r\n Logger.Warn(\"Unable to get physicsBody of impostor. It might be initialized later by its parent's impostor.\");\r\n return null;\r\n }\r\n switch (impostor.type) {\r\n case PhysicsImpostor.BoxImpostor:\r\n mesh = this._getDebugBoxMesh(utilityLayerScene);\r\n impostor.getBoxSizeToRef(mesh.scaling);\r\n break;\r\n case PhysicsImpostor.SphereImpostor: {\r\n mesh = this._getDebugSphereMesh(utilityLayerScene);\r\n const radius = impostor.getRadius();\r\n mesh.scaling.x = radius * 2;\r\n mesh.scaling.y = radius * 2;\r\n mesh.scaling.z = radius * 2;\r\n break;\r\n }\r\n case PhysicsImpostor.CapsuleImpostor: {\r\n mesh = this._getDebugCapsuleMesh(utilityLayerScene);\r\n const bi = impostor.object.getBoundingInfo();\r\n mesh.scaling.x = (bi.boundingBox.maximum.x - bi.boundingBox.minimum.x) * 2 * impostor.object.scaling.x;\r\n mesh.scaling.y = (bi.boundingBox.maximum.y - bi.boundingBox.minimum.y) * impostor.object.scaling.y;\r\n mesh.scaling.z = (bi.boundingBox.maximum.z - bi.boundingBox.minimum.z) * 2 * impostor.object.scaling.z;\r\n break;\r\n }\r\n case PhysicsImpostor.MeshImpostor:\r\n if (targetMesh) {\r\n mesh = this._getDebugMeshMesh(targetMesh, utilityLayerScene);\r\n }\r\n break;\r\n case PhysicsImpostor.NoImpostor:\r\n if (targetMesh) {\r\n // Handle compound impostors\r\n const childMeshes = targetMesh.getChildMeshes().filter((c) => {\r\n return c.physicsImpostor ? 1 : 0;\r\n });\r\n childMeshes.forEach((m) => {\r\n if (m.physicsImpostor && m.getClassName() === \"Mesh\") {\r\n const boundingInfo = m.getBoundingInfo();\r\n const min = boundingInfo.boundingBox.minimum;\r\n const max = boundingInfo.boundingBox.maximum;\r\n switch (m.physicsImpostor.type) {\r\n case PhysicsImpostor.BoxImpostor:\r\n mesh = this._getDebugBoxMesh(utilityLayerScene);\r\n mesh.position.copyFrom(min);\r\n mesh.position.addInPlace(max);\r\n mesh.position.scaleInPlace(0.5);\r\n break;\r\n case PhysicsImpostor.SphereImpostor:\r\n mesh = this._getDebugSphereMesh(utilityLayerScene);\r\n break;\r\n case PhysicsImpostor.CylinderImpostor:\r\n mesh = this._getDebugCylinderMesh(utilityLayerScene);\r\n break;\r\n default:\r\n mesh = null;\r\n break;\r\n }\r\n if (mesh) {\r\n mesh.scaling.x = max.x - min.x;\r\n mesh.scaling.y = max.y - min.y;\r\n mesh.scaling.z = max.z - min.z;\r\n mesh.parent = m;\r\n }\r\n }\r\n });\r\n } else {\r\n Logger.Warn(\"No target mesh parameter provided for NoImpostor. Skipping.\");\r\n }\r\n mesh = null;\r\n break;\r\n case PhysicsImpostor.CylinderImpostor: {\r\n mesh = this._getDebugCylinderMesh(utilityLayerScene);\r\n const bi = impostor.object.getBoundingInfo();\r\n mesh.scaling.x = (bi.boundingBox.maximum.x - bi.boundingBox.minimum.x) * impostor.object.scaling.x;\r\n mesh.scaling.y = (bi.boundingBox.maximum.y - bi.boundingBox.minimum.y) * impostor.object.scaling.y;\r\n mesh.scaling.z = (bi.boundingBox.maximum.z - bi.boundingBox.minimum.z) * impostor.object.scaling.z;\r\n break;\r\n }\r\n }\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Creates a debug mesh for a given physics body\r\n * @param body The physics body to create the debug mesh for\r\n * @returns The created debug mesh or null if the utility layer is not available\r\n *\r\n * This code is useful for creating a debug mesh for a given physics body.\r\n * It creates a Mesh object with a VertexData object containing the positions and indices\r\n * of the geometry of the body. The mesh is then assigned a debug material from the utility layer scene.\r\n * This allows for visualizing the physics body in the scene.\r\n */\r\n private _getDebugBodyMesh(body: PhysicsBody): Nullable<AbstractMesh> {\r\n if (!this._utilityLayer) {\r\n return null;\r\n }\r\n\r\n const utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n\r\n const mesh = new Mesh(\"custom\", utilityLayerScene);\r\n const vertexData = new VertexData();\r\n const geometry = body.getGeometry() as any;\r\n vertexData.positions = geometry.positions;\r\n vertexData.indices = geometry.indices;\r\n vertexData.applyToMesh(mesh);\r\n mesh.material = this._getDebugMaterial(utilityLayerScene);\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Clean up physics debug display\r\n */\r\n public dispose() {\r\n // impostors\r\n for (let index = 0; index < this._numMeshes; index++) {\r\n this.hideImpostor(this._impostors[0]);\r\n }\r\n // bodies\r\n for (let index = 0; index < this._numBodies; index++) {\r\n this.hideBody(this._bodies[0]);\r\n }\r\n\r\n if (this._debugBoxMesh) {\r\n this._debugBoxMesh.dispose();\r\n }\r\n if (this._debugSphereMesh) {\r\n this._debugSphereMesh.dispose();\r\n }\r\n if (this._debugCylinderMesh) {\r\n this._debugCylinderMesh.dispose();\r\n }\r\n if (this._debugMaterial) {\r\n this._debugMaterial.dispose();\r\n }\r\n\r\n this._impostors.length = 0;\r\n this._scene = null;\r\n this._physicsEnginePlugin = null;\r\n\r\n if (this._utilityLayer) {\r\n this._utilityLayer.dispose();\r\n this._utilityLayer = null;\r\n }\r\n }\r\n}\r\n"]}
@@ -116,7 +116,7 @@ export interface ICanvasRenderingContext {
116
116
  /**
117
117
  * Color or style to use for the lines around shapes. Default #000 (black).
118
118
  */
119
- strokeStyle: string;
119
+ strokeStyle: string | ICanvasGradient;
120
120
  /**
121
121
  * Color or style to use inside shapes. Default #000 (black).
122
122
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ICanvas.js","sourceRoot":"","sources":["../../../../lts/core/generated/Engines/ICanvas.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Class used to abstract a canvas\r\n */\r\nexport interface ICanvas {\r\n /**\r\n * Canvas width.\r\n */\r\n width: number;\r\n\r\n /**\r\n * Canvas height.\r\n */\r\n height: number;\r\n\r\n /**\r\n * returns a drawing context on the canvas.\r\n * @param contextType context identifier.\r\n * @param contextAttributes context attributes.\r\n * @returns ICanvasRenderingContext object.\r\n */\r\n getContext(contextType: string, contextAttributes?: any): ICanvasRenderingContext;\r\n\r\n /**\r\n * returns a data URI containing a representation of the image in the format specified by the type parameter.\r\n * @param mime the image format.\r\n * @returns string containing the requested data URI.\r\n */\r\n toDataURL(mime: string): string;\r\n}\r\n\r\n/**\r\n * Class used to abstract am image to use with the canvas and its context\r\n */\r\nexport interface IImage {\r\n /**\r\n * onload callback.\r\n */\r\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Error callback.\r\n */\r\n onerror: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Image source.\r\n */\r\n src: string;\r\n\r\n /**\r\n * Image width.\r\n */\r\n readonly width: number;\r\n\r\n /**\r\n * Image height.\r\n */\r\n readonly height: number;\r\n\r\n /**\r\n * The original height of the image resource before sizing.\r\n */\r\n readonly naturalHeight: number;\r\n\r\n /**\r\n * The original width of the image resource before sizing.\r\n */\r\n readonly naturalWidth: number;\r\n\r\n /**\r\n * provides support for CORS, defining how the element handles crossorigin requests,\r\n * thereby enabling the configuration of the CORS requests for the element's fetched data.\r\n */\r\n crossOrigin: string | null;\r\n\r\n /**\r\n * provides support for referrer policy on xhr load request,\r\n * it is used to control the request header.\r\n */\r\n referrerPolicy: string;\r\n}\r\n\r\n/**\r\n * Class used to abstract a canvas gradient\r\n */\r\nexport interface ICanvasGradient {\r\n /**\r\n * adds a new color stop, defined by an offset and a color, to a given canvas gradient.\r\n * @param offset A number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end.\r\n * @param color value representing the color of the stop.\r\n */\r\n addColorStop(offset: number, color: string): void;\r\n}\r\n\r\n/**\r\n * Class used to abstract a text measurement\r\n */\r\nexport interface ITextMetrics {\r\n /**\r\n * Text width.\r\n */\r\n readonly width: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the left side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxLeft: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the right side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxRight: number;\r\n}\r\n\r\n/**\r\n * Class used to abstract canvas rendering\r\n */\r\nexport interface ICanvasRenderingContext {\r\n /**\r\n * Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default).\r\n */\r\n lineJoin: string;\r\n\r\n /**\r\n * Miter limit ratio. Default 10.\r\n */\r\n miterLimit: number;\r\n\r\n /**\r\n * Font setting. Default value 10px sans-serif.\r\n */\r\n font: string;\r\n\r\n /**\r\n * Color or style to use for the lines around shapes. Default #000 (black).\r\n */\r\n strokeStyle: string;\r\n\r\n /**\r\n * Color or style to use inside shapes. Default #000 (black).\r\n */\r\n fillStyle: string | ICanvasGradient;\r\n\r\n /**\r\n * Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).\r\n */\r\n globalAlpha: number;\r\n\r\n /**\r\n * Color of the shadow. Default: fully-transparent black.\r\n */\r\n shadowColor: string;\r\n\r\n /**\r\n * Specifies the blurring effect. Default: 0.\r\n */\r\n shadowBlur: number;\r\n\r\n /**\r\n * Horizontal distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetX: number;\r\n\r\n /**\r\n * Vertical distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetY: number;\r\n\r\n /**\r\n * Width of lines. Default 1.0.\r\n */\r\n lineWidth: number;\r\n\r\n /**\r\n * canvas is a read-only reference to ICanvas.\r\n */\r\n readonly canvas: ICanvas;\r\n\r\n /**\r\n * Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n clearRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Saves the current drawing style state using a stack so you can revert any change you make to it using restore().\r\n */\r\n save(): void;\r\n\r\n /**\r\n * Restores the drawing style state to the last element on the 'state stack' saved by save().\r\n */\r\n restore(): void;\r\n\r\n /**\r\n * Draws a filled rectangle at (x, y) position whose size is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n fillRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Adds a scaling transformation to the canvas units by x horizontally and by y vertically.\r\n * @param x Scaling factor in the horizontal direction. A negative value flips pixels across the vertical axis. A value of 1 results in no horizontal scaling.\r\n * @param y Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling.\r\n */\r\n scale(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is expressed in radians.\r\n * @param angle The rotation angle, clockwise in radians. You can use degree * Math.PI / 180 to calculate a radian from a degree.\r\n */\r\n rotate(angle: number): void;\r\n\r\n /**\r\n * Adds a translation transformation by moving the canvas and its origin x horizontally and y vertically on the grid.\r\n * @param x Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.\r\n * @param y Distance to move in the vertical direction. Positive values are down, and negative are up.\r\n */\r\n translate(x: number, y: number): void;\r\n\r\n /**\r\n * Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n strokeRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a path for a rectangle at position (x, y) with a size that is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n rect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only.\r\n */\r\n clip(): void;\r\n\r\n /**\r\n * Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted.\r\n * @param imageData An ImageData object containing the array of pixel values.\r\n * @param dx Horizontal position (x coordinate) at which to place the image data in the destination canvas.\r\n * @param dy Vertical position (y coordinate) at which to place the image data in the destination canvas.\r\n */\r\n putImageData(imageData: ImageData, dx: number, dy: number): void;\r\n\r\n /**\r\n * Adds a circular arc to the current path.\r\n * @param x The horizontal coordinate of the arc's center.\r\n * @param y The vertical coordinate of the arc's center.\r\n * @param radius The arc's radius. Must be positive.\r\n * @param startAngle The angle at which the arc starts in radians, measured from the positive x-axis.\r\n * @param endAngle The angle at which the arc ends in radians, measured from the positive x-axis.\r\n * @param anticlockwise An optional Boolean. If true, draws the arc counter-clockwise between the start and end angles. The default is false (clockwise).\r\n */\r\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n\r\n /**\r\n * Starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.\r\n */\r\n beginPath(): void;\r\n\r\n /**\r\n * Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start.\r\n * If the shape has already been closed or has only one point, this function does nothing.\r\n */\r\n closePath(): void;\r\n\r\n /**\r\n * Moves the starting point of a new sub-path to the (x, y) coordinates.\r\n * @param x The x-axis (horizontal) coordinate of the point.\r\n * @param y The y-axis (vertical) coordinate of the point.\r\n */\r\n moveTo(x: number, y: number): void;\r\n\r\n /**\r\n * Connects the last point in the current sub-path to the specified (x, y) coordinates with a straight line.\r\n * @param x The x-axis coordinate of the line's end point.\r\n * @param y The y-axis coordinate of the line's end point.\r\n */\r\n lineTo(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a quadratic Bézier curve to the current path.\r\n * @param cpx The x-axis coordinate of the control point.\r\n * @param cpy The y-axis coordinate of the control point.\r\n * @param x The x-axis coordinate of the end point.\r\n * @param y The y-axis coordinate of the end point.\r\n */\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\r\n\r\n /**\r\n * Returns a TextMetrics object.\r\n * @param text The text String to measure.\r\n * @returns ITextMetrics A ITextMetrics object.\r\n */\r\n measureText(text: string): ITextMetrics;\r\n\r\n /**\r\n * Strokes the current sub-paths with the current stroke style.\r\n */\r\n stroke(): void;\r\n\r\n /**\r\n * Fills the current sub-paths with the current fill style.\r\n */\r\n fill(): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param sx The x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sy The y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sWidth The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.\r\n * @param sHeight The height of the sub-rectangle of the source image to draw into the destination context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n\r\n drawImage(image: any, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n drawImage(image: any, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n */\r\n drawImage(image: any, dx: number, dy: number): void;\r\n\r\n /**\r\n * Returns an ImageData object representing the underlying pixel data for the area of the canvas denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height.\r\n * @param sx The x-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sy The y-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sw The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left.\r\n * @param sh The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up.\r\n * @returns ImageData An ImageData object containing the image data for the rectangle of the canvas specified.\r\n */\r\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\r\n\r\n /**\r\n * Sets the current line dash pattern.\r\n * @param segments An Array of numbers that specify distances to alternately draw a line and a gap (in coordinate space units).\r\n */\r\n setLineDash(segments: Array<number>): void;\r\n\r\n /**\r\n * Draws (fills) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Draws (strokes) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Creates a linear gradient along the line given by the coordinates represented by the parameters.\r\n * @param x0 The x-axis coordinate of the start point.\r\n * @param y0 The y-axis coordinate of the start point.\r\n * @param x1 The x-axis coordinate of the end point.\r\n * @param y1 The y-axis coordinate of the end point.\r\n * @returns ICanvasGradient A linear ICanvasGradient initialized with the specified line.\r\n */\r\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): ICanvasGradient;\r\n\r\n /**\r\n * Creates a linear gradient along the line given by the coordinates represented by the parameters.\r\n * @param x0 The x-axis coordinate of the start circle.\r\n * @param y0 The y-axis coordinate of the start circle.\r\n * @param r0 The radius of the start circle. Must be non-negative and finite.\r\n * @param x1 The x-axis coordinate of the end point.\r\n * @param y1 The y-axis coordinate of the end point.\r\n * @param r1 The radius of the end circle. Must be non-negative and finite.\r\n * @returns ICanvasGradient A linear ICanvasGradient initialized with the two specified circles.\r\n */\r\n createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): ICanvasGradient;\r\n\r\n /**\r\n * Resets the current transform to matrix composed with a, b, c, d, e, f.\r\n * @param a Horizontal scaling. A value of 1 results in no scaling.\r\n * @param b Vertical skewing.\r\n * @param c Horizontal skewing.\r\n * @param d Vertical scaling. A value of 1 results in no scaling.\r\n * @param e Horizontal translation (moving).\r\n * @param f Vertical translation (moving).\r\n */\r\n setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"ICanvas.js","sourceRoot":"","sources":["../../../../lts/core/generated/Engines/ICanvas.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Class used to abstract a canvas\r\n */\r\nexport interface ICanvas {\r\n /**\r\n * Canvas width.\r\n */\r\n width: number;\r\n\r\n /**\r\n * Canvas height.\r\n */\r\n height: number;\r\n\r\n /**\r\n * returns a drawing context on the canvas.\r\n * @param contextType context identifier.\r\n * @param contextAttributes context attributes.\r\n * @returns ICanvasRenderingContext object.\r\n */\r\n getContext(contextType: string, contextAttributes?: any): ICanvasRenderingContext;\r\n\r\n /**\r\n * returns a data URI containing a representation of the image in the format specified by the type parameter.\r\n * @param mime the image format.\r\n * @returns string containing the requested data URI.\r\n */\r\n toDataURL(mime: string): string;\r\n}\r\n\r\n/**\r\n * Class used to abstract am image to use with the canvas and its context\r\n */\r\nexport interface IImage {\r\n /**\r\n * onload callback.\r\n */\r\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Error callback.\r\n */\r\n onerror: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Image source.\r\n */\r\n src: string;\r\n\r\n /**\r\n * Image width.\r\n */\r\n readonly width: number;\r\n\r\n /**\r\n * Image height.\r\n */\r\n readonly height: number;\r\n\r\n /**\r\n * The original height of the image resource before sizing.\r\n */\r\n readonly naturalHeight: number;\r\n\r\n /**\r\n * The original width of the image resource before sizing.\r\n */\r\n readonly naturalWidth: number;\r\n\r\n /**\r\n * provides support for CORS, defining how the element handles crossorigin requests,\r\n * thereby enabling the configuration of the CORS requests for the element's fetched data.\r\n */\r\n crossOrigin: string | null;\r\n\r\n /**\r\n * provides support for referrer policy on xhr load request,\r\n * it is used to control the request header.\r\n */\r\n referrerPolicy: string;\r\n}\r\n\r\n/**\r\n * Class used to abstract a canvas gradient\r\n */\r\nexport interface ICanvasGradient {\r\n /**\r\n * adds a new color stop, defined by an offset and a color, to a given canvas gradient.\r\n * @param offset A number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end.\r\n * @param color value representing the color of the stop.\r\n */\r\n addColorStop(offset: number, color: string): void;\r\n}\r\n\r\n/**\r\n * Class used to abstract a text measurement\r\n */\r\nexport interface ITextMetrics {\r\n /**\r\n * Text width.\r\n */\r\n readonly width: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the left side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxLeft: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the right side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxRight: number;\r\n}\r\n\r\n/**\r\n * Class used to abstract canvas rendering\r\n */\r\nexport interface ICanvasRenderingContext {\r\n /**\r\n * Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default).\r\n */\r\n lineJoin: string;\r\n\r\n /**\r\n * Miter limit ratio. Default 10.\r\n */\r\n miterLimit: number;\r\n\r\n /**\r\n * Font setting. Default value 10px sans-serif.\r\n */\r\n font: string;\r\n\r\n /**\r\n * Color or style to use for the lines around shapes. Default #000 (black).\r\n */\r\n strokeStyle: string | ICanvasGradient;\r\n\r\n /**\r\n * Color or style to use inside shapes. Default #000 (black).\r\n */\r\n fillStyle: string | ICanvasGradient;\r\n\r\n /**\r\n * Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).\r\n */\r\n globalAlpha: number;\r\n\r\n /**\r\n * Color of the shadow. Default: fully-transparent black.\r\n */\r\n shadowColor: string;\r\n\r\n /**\r\n * Specifies the blurring effect. Default: 0.\r\n */\r\n shadowBlur: number;\r\n\r\n /**\r\n * Horizontal distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetX: number;\r\n\r\n /**\r\n * Vertical distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetY: number;\r\n\r\n /**\r\n * Width of lines. Default 1.0.\r\n */\r\n lineWidth: number;\r\n\r\n /**\r\n * canvas is a read-only reference to ICanvas.\r\n */\r\n readonly canvas: ICanvas;\r\n\r\n /**\r\n * Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n clearRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Saves the current drawing style state using a stack so you can revert any change you make to it using restore().\r\n */\r\n save(): void;\r\n\r\n /**\r\n * Restores the drawing style state to the last element on the 'state stack' saved by save().\r\n */\r\n restore(): void;\r\n\r\n /**\r\n * Draws a filled rectangle at (x, y) position whose size is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n fillRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Adds a scaling transformation to the canvas units by x horizontally and by y vertically.\r\n * @param x Scaling factor in the horizontal direction. A negative value flips pixels across the vertical axis. A value of 1 results in no horizontal scaling.\r\n * @param y Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling.\r\n */\r\n scale(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is expressed in radians.\r\n * @param angle The rotation angle, clockwise in radians. You can use degree * Math.PI / 180 to calculate a radian from a degree.\r\n */\r\n rotate(angle: number): void;\r\n\r\n /**\r\n * Adds a translation transformation by moving the canvas and its origin x horizontally and y vertically on the grid.\r\n * @param x Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.\r\n * @param y Distance to move in the vertical direction. Positive values are down, and negative are up.\r\n */\r\n translate(x: number, y: number): void;\r\n\r\n /**\r\n * Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n strokeRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a path for a rectangle at position (x, y) with a size that is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n rect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only.\r\n */\r\n clip(): void;\r\n\r\n /**\r\n * Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted.\r\n * @param imageData An ImageData object containing the array of pixel values.\r\n * @param dx Horizontal position (x coordinate) at which to place the image data in the destination canvas.\r\n * @param dy Vertical position (y coordinate) at which to place the image data in the destination canvas.\r\n */\r\n putImageData(imageData: ImageData, dx: number, dy: number): void;\r\n\r\n /**\r\n * Adds a circular arc to the current path.\r\n * @param x The horizontal coordinate of the arc's center.\r\n * @param y The vertical coordinate of the arc's center.\r\n * @param radius The arc's radius. Must be positive.\r\n * @param startAngle The angle at which the arc starts in radians, measured from the positive x-axis.\r\n * @param endAngle The angle at which the arc ends in radians, measured from the positive x-axis.\r\n * @param anticlockwise An optional Boolean. If true, draws the arc counter-clockwise between the start and end angles. The default is false (clockwise).\r\n */\r\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n\r\n /**\r\n * Starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.\r\n */\r\n beginPath(): void;\r\n\r\n /**\r\n * Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start.\r\n * If the shape has already been closed or has only one point, this function does nothing.\r\n */\r\n closePath(): void;\r\n\r\n /**\r\n * Moves the starting point of a new sub-path to the (x, y) coordinates.\r\n * @param x The x-axis (horizontal) coordinate of the point.\r\n * @param y The y-axis (vertical) coordinate of the point.\r\n */\r\n moveTo(x: number, y: number): void;\r\n\r\n /**\r\n * Connects the last point in the current sub-path to the specified (x, y) coordinates with a straight line.\r\n * @param x The x-axis coordinate of the line's end point.\r\n * @param y The y-axis coordinate of the line's end point.\r\n */\r\n lineTo(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a quadratic Bézier curve to the current path.\r\n * @param cpx The x-axis coordinate of the control point.\r\n * @param cpy The y-axis coordinate of the control point.\r\n * @param x The x-axis coordinate of the end point.\r\n * @param y The y-axis coordinate of the end point.\r\n */\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\r\n\r\n /**\r\n * Returns a TextMetrics object.\r\n * @param text The text String to measure.\r\n * @returns ITextMetrics A ITextMetrics object.\r\n */\r\n measureText(text: string): ITextMetrics;\r\n\r\n /**\r\n * Strokes the current sub-paths with the current stroke style.\r\n */\r\n stroke(): void;\r\n\r\n /**\r\n * Fills the current sub-paths with the current fill style.\r\n */\r\n fill(): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param sx The x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sy The y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sWidth The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.\r\n * @param sHeight The height of the sub-rectangle of the source image to draw into the destination context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n\r\n drawImage(image: any, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n drawImage(image: any, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n */\r\n drawImage(image: any, dx: number, dy: number): void;\r\n\r\n /**\r\n * Returns an ImageData object representing the underlying pixel data for the area of the canvas denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height.\r\n * @param sx The x-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sy The y-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sw The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left.\r\n * @param sh The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up.\r\n * @returns ImageData An ImageData object containing the image data for the rectangle of the canvas specified.\r\n */\r\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\r\n\r\n /**\r\n * Sets the current line dash pattern.\r\n * @param segments An Array of numbers that specify distances to alternately draw a line and a gap (in coordinate space units).\r\n */\r\n setLineDash(segments: Array<number>): void;\r\n\r\n /**\r\n * Draws (fills) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Draws (strokes) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Creates a linear gradient along the line given by the coordinates represented by the parameters.\r\n * @param x0 The x-axis coordinate of the start point.\r\n * @param y0 The y-axis coordinate of the start point.\r\n * @param x1 The x-axis coordinate of the end point.\r\n * @param y1 The y-axis coordinate of the end point.\r\n * @returns ICanvasGradient A linear ICanvasGradient initialized with the specified line.\r\n */\r\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): ICanvasGradient;\r\n\r\n /**\r\n * Creates a linear gradient along the line given by the coordinates represented by the parameters.\r\n * @param x0 The x-axis coordinate of the start circle.\r\n * @param y0 The y-axis coordinate of the start circle.\r\n * @param r0 The radius of the start circle. Must be non-negative and finite.\r\n * @param x1 The x-axis coordinate of the end point.\r\n * @param y1 The y-axis coordinate of the end point.\r\n * @param r1 The radius of the end circle. Must be non-negative and finite.\r\n * @returns ICanvasGradient A linear ICanvasGradient initialized with the two specified circles.\r\n */\r\n createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): ICanvasGradient;\r\n\r\n /**\r\n * Resets the current transform to matrix composed with a, b, c, d, e, f.\r\n * @param a Horizontal scaling. A value of 1 results in no scaling.\r\n * @param b Vertical skewing.\r\n * @param c Horizontal skewing.\r\n * @param d Vertical scaling. A value of 1 results in no scaling.\r\n * @param e Horizontal translation (moving).\r\n * @param f Vertical translation (moving).\r\n */\r\n setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;\r\n}\r\n"]}
@@ -34,15 +34,16 @@ WebGPUEngine.prototype.createRenderTargetTexture = function (size, options) {
34
34
  rtWrapper._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;
35
35
  rtWrapper.setTextures(texture);
36
36
  if (rtWrapper._generateDepthBuffer || rtWrapper._generateStencilBuffer) {
37
- rtWrapper.createDepthStencilTexture(0, fullOptions.samplingMode === undefined ||
38
- fullOptions.samplingMode === 2 ||
39
- fullOptions.samplingMode === 2 ||
40
- fullOptions.samplingMode === 3 ||
41
- fullOptions.samplingMode === 3 ||
42
- fullOptions.samplingMode === 5 ||
43
- fullOptions.samplingMode === 6 ||
44
- fullOptions.samplingMode === 7 ||
45
- fullOptions.samplingMode === 11, rtWrapper._generateStencilBuffer, rtWrapper.samples);
37
+ rtWrapper.createDepthStencilTexture(0, this._caps.textureFloatLinearFiltering &&
38
+ (fullOptions.samplingMode === undefined ||
39
+ fullOptions.samplingMode === 2 ||
40
+ fullOptions.samplingMode === 2 ||
41
+ fullOptions.samplingMode === 3 ||
42
+ fullOptions.samplingMode === 3 ||
43
+ fullOptions.samplingMode === 5 ||
44
+ fullOptions.samplingMode === 6 ||
45
+ fullOptions.samplingMode === 7 ||
46
+ fullOptions.samplingMode === 11), rtWrapper._generateStencilBuffer, rtWrapper.samples);
46
47
  }
47
48
  if (texture) {
48
49
  if (options !== undefined && typeof options === "object" && options.createMipMaps && !fullOptions.generateMipMaps) {