@onerjs/core 8.30.4 → 8.30.5

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 (141) hide show
  1. package/Audio/audioSceneComponent.d.ts +9 -5
  2. package/Audio/audioSceneComponent.js +1 -0
  3. package/Audio/audioSceneComponent.js.map +1 -1
  4. package/AudioV2/abstractAudio/audioEngineV2.d.ts +8 -0
  5. package/AudioV2/abstractAudio/audioEngineV2.js +19 -0
  6. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  7. package/AudioV2/webAudio/webAudioEngine.d.ts +5 -0
  8. package/AudioV2/webAudio/webAudioEngine.js +8 -0
  9. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  10. package/AudioV2/webAudio/webAudioStaticSound.js +2 -2
  11. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  12. package/AudioV2/webAudio/webAudioStreamingSound.js +5 -2
  13. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  14. package/Cameras/camera.d.ts +4 -0
  15. package/Cameras/camera.js +18 -9
  16. package/Cameras/camera.js.map +1 -1
  17. package/Engines/WebGPU/webgpuDrawContext.d.ts +8 -0
  18. package/Engines/WebGPU/webgpuDrawContext.js +8 -0
  19. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  20. package/Engines/abstractEngine.js +2 -2
  21. package/Engines/abstractEngine.js.map +1 -1
  22. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +1 -1
  23. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
  24. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +1 -1
  25. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -1
  26. package/FrameGraph/Node/Blocks/computeShaderBlock.d.ts +42 -0
  27. package/FrameGraph/Node/Blocks/computeShaderBlock.js +74 -0
  28. package/FrameGraph/Node/Blocks/computeShaderBlock.js.map +1 -0
  29. package/FrameGraph/Node/Blocks/executeBlock.d.ts +11 -1
  30. package/FrameGraph/Node/Blocks/executeBlock.js +18 -0
  31. package/FrameGraph/Node/Blocks/executeBlock.js.map +1 -1
  32. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  33. package/FrameGraph/Node/Blocks/index.js +1 -0
  34. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  35. package/FrameGraph/Node/Blocks/inputBlock.js +2 -0
  36. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  37. package/FrameGraph/Node/Blocks/outputBlock.js +1 -0
  38. package/FrameGraph/Node/Blocks/outputBlock.js.map +1 -1
  39. package/FrameGraph/Node/nodeRenderGraph.d.ts +1 -1
  40. package/FrameGraph/Node/nodeRenderGraph.js +7 -3
  41. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  42. package/FrameGraph/Node/nodeRenderGraphBlock.js +7 -0
  43. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  44. package/FrameGraph/Passes/pass.d.ts +11 -1
  45. package/FrameGraph/Passes/pass.js +11 -1
  46. package/FrameGraph/Passes/pass.js.map +1 -1
  47. package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +115 -0
  48. package/FrameGraph/Tasks/Misc/computeShaderTask.js +174 -0
  49. package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -0
  50. package/FrameGraph/Tasks/Misc/executeTask.d.ts +5 -0
  51. package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
  52. package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
  53. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -1
  54. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +1 -1
  55. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  56. package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
  57. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +7 -0
  58. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
  59. package/FrameGraph/frameGraph.d.ts +1 -1
  60. package/FrameGraph/frameGraph.js +3 -6
  61. package/FrameGraph/frameGraph.js.map +1 -1
  62. package/FrameGraph/frameGraphTask.d.ts +3 -2
  63. package/FrameGraph/frameGraphTask.js +5 -2
  64. package/FrameGraph/frameGraphTask.js.map +1 -1
  65. package/FrameGraph/frameGraphTextureManager.js +2 -2
  66. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  67. package/FrameGraph/index.d.ts +1 -0
  68. package/FrameGraph/index.js +1 -0
  69. package/FrameGraph/index.js.map +1 -1
  70. package/Lights/directionalLight.js +1 -4
  71. package/Lights/directionalLight.js.map +1 -1
  72. package/Lights/pointLight.js +2 -5
  73. package/Lights/pointLight.js.map +1 -1
  74. package/Materials/materialHelper.functions.d.ts +8 -0
  75. package/Materials/materialHelper.functions.js +31 -0
  76. package/Materials/materialHelper.functions.js.map +1 -1
  77. package/Materials/shaderMaterial.js +20 -0
  78. package/Materials/shaderMaterial.js.map +1 -1
  79. package/Maths/math.vector.functions.d.ts +26 -13
  80. package/Maths/math.vector.functions.js +29 -8
  81. package/Maths/math.vector.functions.js.map +1 -1
  82. package/Misc/decorators.d.ts +1 -1
  83. package/Misc/decorators.js.map +1 -1
  84. package/Misc/dumpTools.d.ts +20 -0
  85. package/Misc/dumpTools.js +60 -49
  86. package/Misc/dumpTools.js.map +1 -1
  87. package/Misc/index.d.ts +1 -2
  88. package/Misc/index.js +1 -2
  89. package/Misc/index.js.map +1 -1
  90. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  91. package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +57 -0
  92. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +163 -0
  93. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -0
  94. package/Particles/Node/Blocks/Emitters/index.d.ts +5 -4
  95. package/Particles/Node/Blocks/Emitters/index.js +5 -4
  96. package/Particles/Node/Blocks/Emitters/index.js.map +1 -1
  97. package/Particles/Node/Blocks/particleInputBlock.js +2 -0
  98. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  99. package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
  100. package/Particles/Node/Blocks/systemBlock.js +8 -0
  101. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  102. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +5 -1
  103. package/Particles/Node/Enums/nodeParticleContextualSources.js +4 -0
  104. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  105. package/Particles/Node/nodeParticleBuildState.js +5 -0
  106. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  107. package/Particles/Node/nodeParticleSystemSet.helper.d.ts +4 -3
  108. package/Particles/Node/nodeParticleSystemSet.helper.js +182 -115
  109. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  110. package/Physics/physicsRaycastResult.d.ts +3 -0
  111. package/Physics/physicsRaycastResult.js.map +1 -1
  112. package/Physics/v2/Plugins/havokPlugin.js +1 -1
  113. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  114. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -0
  115. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +9 -1
  116. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  117. package/PostProcesses/thinSSAO2PostProcess.d.ts +1 -0
  118. package/PostProcesses/thinSSAO2PostProcess.js +18 -6
  119. package/PostProcesses/thinSSAO2PostProcess.js.map +1 -1
  120. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +1 -0
  121. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  122. package/Shaders/ShadersInclude/openpbrDirectLighting.js +5 -2
  123. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  124. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +1 -1
  125. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  126. package/Shaders/particles.vertex.js +1 -1
  127. package/Shaders/particles.vertex.js.map +1 -1
  128. package/ShadersWGSL/ShadersInclude/bonesDeclaration.js +2 -2
  129. package/ShadersWGSL/ShadersInclude/bonesDeclaration.js.map +1 -1
  130. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +5 -2
  131. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  132. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
  133. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  134. package/ShadersWGSL/iblVoxelGrid.vertex.js +77 -3
  135. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  136. package/ShadersWGSL/particles.vertex.js +1 -1
  137. package/ShadersWGSL/particles.vertex.js.map +1 -1
  138. package/package.json +1 -1
  139. package/scene.d.ts +2 -0
  140. package/scene.js +9 -1
  141. package/scene.js.map +1 -1
@@ -1,7 +1,6 @@
1
1
  import type { DeepImmutable } from "../types.js";
2
- import type { IVector2Like, IVector3Like } from "./math.like.js";
2
+ import type { IQuaternionLike, IVector2Like, IVector3Like, IVector4Like } from "./math.like.js";
3
3
  import { Quaternion, Vector3 } from "./math.vector.js";
4
- import type { Vector4 } from "./math.vector.js";
5
4
  /**
6
5
  * Creates a string representation of the IVector2Like
7
6
  * @param vector defines the IVector2Like to stringify
@@ -15,7 +14,7 @@ export declare function Vector2ToFixed(vector: IVector2Like, decimalCount: numbe
15
14
  * @param b defines the second vector
16
15
  * @returns the dot product
17
16
  */
18
- export declare function Vector3Dot<T extends IVector3Like, U extends IVector3Like>(a: DeepImmutable<T>, b: DeepImmutable<U>): number;
17
+ export declare function Vector3Dot(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number;
19
18
  /**
20
19
  * Sets the given floats into the result.
21
20
  * @param x defines the x coordinate
@@ -32,28 +31,42 @@ export declare function Vector3FromFloatsToRef<T extends IVector3Like>(x: number
32
31
  * @param result defines the target vector
33
32
  * @returns the scaled vector
34
33
  */
35
- export declare function Vector3ScaleToRef<T extends IVector3Like, ResultT extends IVector3Like>(a: DeepImmutable<T>, scale: number, result: ResultT): ResultT;
34
+ export declare function Vector3ScaleToRef<T extends IVector3Like>(a: DeepImmutable<IVector3Like>, scale: number, result: T): T;
36
35
  /**
37
- * Creates a string representation of the Vector3
38
- * @param vector defines the Vector3 to stringify
36
+ * Scales the current vector values in place by a factor
37
+ * @param vector defines the vector to scale
38
+ * @param scale defines the scale factor
39
+ * @returns the input scaled vector
40
+ */
41
+ export declare function Vector3ScaleInPlace<T extends IVector3Like>(vector: T, scale: number): T;
42
+ /**
43
+ * Creates a string representation of the IVector3Like
44
+ * @param vector defines the IVector3Like to stringify
39
45
  * @param decimalCount defines the number of decimals to use
40
- * @returns a string with the Vector3 coordinates.
46
+ * @returns a string with the IVector3Like coordinates.
47
+ */
48
+ export declare function Vector3ToFixed(vector: DeepImmutable<IVector3Like>, decimalCount: number): string;
49
+ /**
50
+ * Computes the dot product of two IVector4Like objects
51
+ * @param a defines the first vector
52
+ * @param b defines the second vector
53
+ * @returns the dot product
41
54
  */
42
- export declare function Vector3ToFixed(vector: Vector3, decimalCount: number): string;
55
+ export declare function Vector4Dot(a: DeepImmutable<IVector4Like>, b: DeepImmutable<IVector4Like>): number;
43
56
  /**
44
- * Creates a string representation of the Vector4
45
- * @param vector defines the Vector4 to stringify
57
+ * Creates a string representation of the IVector4Like
58
+ * @param vector defines the IVector4Like to stringify
46
59
  * @param decimalCount defines the number of decimals to use
47
- * @returns a string with the Vector4 coordinates.
60
+ * @returns a string with the IVector4Like coordinates.
48
61
  */
49
- export declare function Vector4ToFixed(vector: Vector4, decimalCount: number): string;
62
+ export declare function Vector4ToFixed(vector: DeepImmutable<IVector4Like>, decimalCount: number): string;
50
63
  /**
51
64
  * Returns the angle in radians between two quaternions
52
65
  * @param q1 defines the first quaternion
53
66
  * @param q2 defines the second quaternion
54
67
  * @returns the angle in radians between the two quaternions
55
68
  */
56
- export declare function GetAngleBetweenQuaternions(q1: DeepImmutable<Quaternion>, q2: DeepImmutable<Quaternion>): number;
69
+ export declare function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number;
57
70
  /**
58
71
  * Creates a quaternion from two direction vectors
59
72
  * @param a defines the first direction vector
@@ -46,19 +46,40 @@ export function Vector3ScaleToRef(a, scale, result) {
46
46
  return result;
47
47
  }
48
48
  /**
49
- * Creates a string representation of the Vector3
50
- * @param vector defines the Vector3 to stringify
49
+ * Scales the current vector values in place by a factor
50
+ * @param vector defines the vector to scale
51
+ * @param scale defines the scale factor
52
+ * @returns the input scaled vector
53
+ */
54
+ export function Vector3ScaleInPlace(vector, scale) {
55
+ vector.x *= scale;
56
+ vector.y *= scale;
57
+ vector.z *= scale;
58
+ return vector;
59
+ }
60
+ /**
61
+ * Creates a string representation of the IVector3Like
62
+ * @param vector defines the IVector3Like to stringify
51
63
  * @param decimalCount defines the number of decimals to use
52
- * @returns a string with the Vector3 coordinates.
64
+ * @returns a string with the IVector3Like coordinates.
53
65
  */
54
66
  export function Vector3ToFixed(vector, decimalCount) {
55
- return `{X: ${vector._x.toFixed(decimalCount)} Y: ${vector._y.toFixed(decimalCount)} Z: ${vector._z.toFixed(decimalCount)}}`;
67
+ return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)}}`;
68
+ }
69
+ /**
70
+ * Computes the dot product of two IVector4Like objects
71
+ * @param a defines the first vector
72
+ * @param b defines the second vector
73
+ * @returns the dot product
74
+ */
75
+ export function Vector4Dot(a, b) {
76
+ return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
56
77
  }
57
78
  /**
58
- * Creates a string representation of the Vector4
59
- * @param vector defines the Vector4 to stringify
79
+ * Creates a string representation of the IVector4Like
80
+ * @param vector defines the IVector4Like to stringify
60
81
  * @param decimalCount defines the number of decimals to use
61
- * @returns a string with the Vector4 coordinates.
82
+ * @returns a string with the IVector4Like coordinates.
62
83
  */
63
84
  export function Vector4ToFixed(vector, decimalCount) {
64
85
  return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`;
@@ -70,7 +91,7 @@ export function Vector4ToFixed(vector, decimalCount) {
70
91
  * @returns the angle in radians between the two quaternions
71
92
  */
72
93
  export function GetAngleBetweenQuaternions(q1, q2) {
73
- return Math.acos(Clamp(Quaternion.Dot(q1, q2))) * 2;
94
+ return Math.acos(Clamp(Vector4Dot(q1, q2))) * 2;
74
95
  }
75
96
  /**
76
97
  * Creates a quaternion from two direction vectors
@@ -1 +1 @@
1
- {"version":3,"file":"math.vector.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.vector.functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGpD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAoB,EAAE,YAAoB;IACrE,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACzF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAiD,CAAmB,EAAE,CAAmB;IAC/G,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBA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C,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACxD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAoB,CAAmB,EAAE,CAAmB;IACnG,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,gCAAgC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAAgD,CAAmB,EAAE,CAAmB,EAAE,MAAe;IACrJ,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { Clamp } from \"./math.scalar.functions\";\r\nimport type { DeepImmutable } from \"../types\";\r\nimport type { IVector2Like, IVector3Like } from \"./math.like\";\r\nimport { Quaternion, Vector3 } from \"./math.vector\";\r\nimport type { Vector4 } from \"./math.vector\";\r\n\r\n/**\r\n * Creates a string representation of the IVector2Like\r\n * @param vector defines the IVector2Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector2Like coordinates.\r\n */\r\nexport function Vector2ToFixed(vector: IVector2Like, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector3Like objects.\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector3Dot<T extends IVector3Like, U extends IVector3Like>(a: DeepImmutable<T>, b: DeepImmutable<U>) {\r\n return a.x * b.x + a.y * b.y + a.z * b.z;\r\n}\r\n\r\n/**\r\n * Sets the given floats into the result.\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param result defines the target vector\r\n * @returns the result vector\r\n */\r\nexport function Vector3FromFloatsToRef<T extends IVector3Like>(x: number, y: number, z: number, result: T): T {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n return result;\r\n}\r\n\r\n/**\r\n * Stores the scaled values of a vector into the result.\r\n * @param a defines the source vector\r\n * @param scale defines the scale factor\r\n * @param result defines the target vector\r\n * @returns the scaled vector\r\n */\r\nexport function Vector3ScaleToRef<T extends IVector3Like, ResultT extends IVector3Like>(a: DeepImmutable<T>, scale: number, result: ResultT): ResultT {\r\n result.x = a.x * scale;\r\n result.y = a.y * scale;\r\n result.z = a.z * scale;\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the Vector3\r\n * @param vector defines the Vector3 to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the Vector3 coordinates.\r\n */\r\nexport function Vector3ToFixed(vector: Vector3, decimalCount: number): string {\r\n return `{X: ${vector._x.toFixed(decimalCount)} Y: ${vector._y.toFixed(decimalCount)} Z: ${vector._z.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the Vector4\r\n * @param vector defines the Vector4 to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the Vector4 coordinates.\r\n */\r\nexport function Vector4ToFixed(vector: Vector4, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Returns the angle in radians between two quaternions\r\n * @param q1 defines the first quaternion\r\n * @param q2 defines the second quaternion\r\n * @returns the angle in radians between the two quaternions\r\n */\r\nexport function GetAngleBetweenQuaternions(q1: DeepImmutable<Quaternion>, q2: DeepImmutable<Quaternion>): number {\r\n return Math.acos(Clamp(Quaternion.Dot(q1, q2))) * 2;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion {\r\n const result = new Quaternion();\r\n GetQuaternionFromDirectionsToRef(a, b, result);\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT {\r\n const axis = Vector3.Cross(a, b);\r\n const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));\r\n Quaternion.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n}\r\n"]}
1
+ {"version":3,"file":"math.vector.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.vector.functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAoB,EAAE,YAAoB;IACrE,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACzF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,CAA8B,EAAE,CAA8B;IACrF,OAAO,CAAC,CAAC,CAAC,GAA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,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { Clamp } from \"./math.scalar.functions\";\r\nimport type { DeepImmutable } from \"../types\";\r\nimport type { IQuaternionLike, IVector2Like, IVector3Like, IVector4Like } from \"./math.like\";\r\nimport { Quaternion, Vector3 } from \"./math.vector\";\r\n\r\n/**\r\n * Creates a string representation of the IVector2Like\r\n * @param vector defines the IVector2Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector2Like coordinates.\r\n */\r\nexport function Vector2ToFixed(vector: IVector2Like, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector3Like objects.\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector3Dot(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number {\r\n return a.x * b.x + a.y * b.y + a.z * b.z;\r\n}\r\n/**\r\n * Sets the given floats into the result.\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param result defines the target vector\r\n * @returns the result vector\r\n */\r\nexport function Vector3FromFloatsToRef<T extends IVector3Like>(x: number, y: number, z: number, result: T): T {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n return result;\r\n}\r\n\r\n/**\r\n * Stores the scaled values of a vector into the result.\r\n * @param a defines the source vector\r\n * @param scale defines the scale factor\r\n * @param result defines the target vector\r\n * @returns the scaled vector\r\n */\r\nexport function Vector3ScaleToRef<T extends IVector3Like>(a: DeepImmutable<IVector3Like>, scale: number, result: T): T {\r\n result.x = a.x * scale;\r\n result.y = a.y * scale;\r\n result.z = a.z * scale;\r\n return result;\r\n}\r\n\r\n/**\r\n * Scales the current vector values in place by a factor\r\n * @param vector defines the vector to scale\r\n * @param scale defines the scale factor\r\n * @returns the input scaled vector\r\n */\r\nexport function Vector3ScaleInPlace<T extends IVector3Like>(vector: T, scale: number): T {\r\n vector.x *= scale;\r\n vector.y *= scale;\r\n vector.z *= scale;\r\n return vector;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the IVector3Like\r\n * @param vector defines the IVector3Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector3Like coordinates.\r\n */\r\nexport function Vector3ToFixed(vector: DeepImmutable<IVector3Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector4Like objects\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector4Dot(a: DeepImmutable<IVector4Like>, b: DeepImmutable<IVector4Like>): number {\r\n return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the IVector4Like\r\n * @param vector defines the IVector4Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector4Like coordinates.\r\n */\r\nexport function Vector4ToFixed(vector: DeepImmutable<IVector4Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Returns the angle in radians between two quaternions\r\n * @param q1 defines the first quaternion\r\n * @param q2 defines the second quaternion\r\n * @returns the angle in radians between the two quaternions\r\n */\r\nexport function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number {\r\n return Math.acos(Clamp(Vector4Dot(q1, q2))) * 2;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion {\r\n const result = new Quaternion();\r\n GetQuaternionFromDirectionsToRef(a, b, result);\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT {\r\n const axis = Vector3.Cross(a, b);\r\n const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));\r\n Quaternion.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n}\r\n"]}
@@ -22,7 +22,7 @@ export declare function serializeAsCameraReference(sourceName?: string): (target
22
22
  * Decorator used to redirect a function to a native implementation if available.
23
23
  * @internal
24
24
  */
25
- export declare function nativeOverride<T extends (...params: any[]) => boolean>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => unknown>, predicate?: T): void;
25
+ export declare function nativeOverride<T extends (...params: any[]) => boolean>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => any>, predicate?: T): void;
26
26
  export declare namespace nativeOverride {
27
27
  var filter: <T extends (...params: any) => boolean>(predicate: T) => (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => unknown>) => void;
28
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/decorators.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,SAAS,0BAA0B,CAAC,IAAY,EAAE,UAAmB;IACjE,O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;YACpC,CAAC;YACD,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,IAAI;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../types\";\r\nimport { GetDirectStore } from \"./decorators.functions\";\r\nimport { _WarnImport } from \"./devTools\";\r\n\r\nfunction generateSerializableMember(type: number, sourceName?: string) {\r\n return (target: any, propertyKey: string | symbol) => {\r\n const classStore = GetDirectStore(target);\r\n\r\n if (!classStore[propertyKey]) {\r\n classStore[propertyKey] = { type: type, sourceName: sourceName };\r\n }\r\n };\r\n}\r\n\r\nfunction generateExpandMember(setCallback: string, targetKey: Nullable<string> = null) {\r\n return (target: any, propertyKey: string) => {\r\n const key = targetKey || \"_\" + propertyKey;\r\n Object.defineProperty(target, propertyKey, {\r\n get: function (this: any) {\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n return this[key];\r\n },\r\n set: function (this: any, value) {\r\n // does this object (i.e. vector3) has an equals function? use it!\r\n // Note - not using \"with epsilon\" here, it is expected te behave like the internal cache does.\r\n if (typeof this[key]?.equals === \"function\") {\r\n if (this[key].equals(value)) {\r\n return;\r\n }\r\n }\r\n if (this[key] === value) {\r\n return;\r\n }\r\n this[key] = value;\r\n\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n };\r\n}\r\n\r\nexport function expandToProperty(callback: string, targetKey: Nullable<string> = null) {\r\n return generateExpandMember(callback, targetKey);\r\n}\r\n\r\nexport function serialize(sourceName?: string) {\r\n return generateSerializableMember(0, sourceName); // value member\r\n}\r\n\r\nexport function serializeAsTexture(sourceName?: string) {\r\n return generateSerializableMember(1, sourceName); // texture member\r\n}\r\n\r\nexport function serializeAsColor3(sourceName?: string) {\r\n return generateSerializableMember(2, sourceName); // color3 member\r\n}\r\n\r\nexport function serializeAsFresnelParameters(sourceName?: string) {\r\n return generateSerializableMember(3, sourceName); // fresnel parameters member\r\n}\r\n\r\nexport function serializeAsVector2(sourceName?: string) {\r\n return generateSerializableMember(4, sourceName); // vector2 member\r\n}\r\n\r\nexport function serializeAsVector3(sourceName?: string) {\r\n return generateSerializableMember(5, sourceName); // vector3 member\r\n}\r\n\r\nexport function serializeAsMeshReference(sourceName?: string) {\r\n return generateSerializableMember(6, sourceName); // mesh reference member\r\n}\r\n\r\nexport function serializeAsColorCurves(sourceName?: string) {\r\n return generateSerializableMember(7, sourceName); // color curves\r\n}\r\n\r\nexport function serializeAsColor4(sourceName?: string) {\r\n return generateSerializableMember(8, sourceName); // color 4\r\n}\r\n\r\nexport function serializeAsImageProcessingConfiguration(sourceName?: string) {\r\n return generateSerializableMember(9, sourceName); // image processing\r\n}\r\n\r\nexport function serializeAsQuaternion(sourceName?: string) {\r\n return generateSerializableMember(10, sourceName); // quaternion member\r\n}\r\n\r\nexport function serializeAsMatrix(sourceName?: string) {\r\n return generateSerializableMember(12, sourceName); // matrix member\r\n}\r\n\r\n/**\r\n * Decorator used to define property that can be serialized as reference to a camera\r\n * @param sourceName defines the name of the property to decorate\r\n * @returns Property Decorator\r\n */\r\nexport function serializeAsCameraReference(sourceName?: string) {\r\n return generateSerializableMember(11, sourceName); // camera reference member\r\n}\r\n\r\n/** @internal */\r\ndeclare const _native: any;\r\n\r\n/**\r\n * Decorator used to redirect a function to a native implementation if available.\r\n * @internal\r\n */\r\nexport function nativeOverride<T extends (...params: any[]) => boolean>(\r\n target: any,\r\n propertyKey: string,\r\n descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => unknown>,\r\n predicate?: T\r\n) {\r\n // Cache the original JS function for later.\r\n const jsFunc = descriptor.value!;\r\n\r\n // Override the JS function to check for a native override on first invocation. Setting descriptor.value overrides the function at the early stage of code being loaded/imported.\r\n descriptor.value = (...params: Parameters<T>): unknown => {\r\n // Assume the resolved function will be the original JS function, then we will check for the Babylon Native context.\r\n let func = jsFunc;\r\n\r\n // Check if we are executing in a Babylon Native context (e.g. check the presence of the _native global property) and if so also check if a function override is available.\r\n if (typeof _native !== \"undefined\" && _native[propertyKey]) {\r\n const nativeFunc = _native[propertyKey] as (...params: Parameters<T>) => unknown;\r\n // If a predicate was provided, then we'll need to invoke the predicate on each invocation of the underlying function to determine whether to call the native function or the JS function.\r\n if (predicate) {\r\n // The resolved function will execute the predicate and then either execute the native function or the JS function.\r\n func = (...params: Parameters<T>) => (predicate(...params) ? nativeFunc(...params) : jsFunc(...params));\r\n } else {\r\n // The resolved function will directly execute the native function.\r\n func = nativeFunc;\r\n }\r\n }\r\n\r\n // Override the JS function again with the final resolved target function.\r\n target[propertyKey] = func;\r\n\r\n // The JS function has now been overridden based on whether we're executing in the context of Babylon Native, but we still need to invoke that function.\r\n // Future invocations of the function will just directly invoke the final overridden function, not any of the decorator setup logic above.\r\n return func(...params);\r\n };\r\n}\r\n\r\n/**\r\n * Decorator factory that applies the nativeOverride decorator, but determines whether to redirect to the native implementation based on a filter function that evaluates the function arguments.\r\n * @param predicate\r\n * @example @nativeOverride.filter((...[arg1]: Parameters<typeof someClass.someMethod>) => arg1.length > 20)\r\n * public someMethod(arg1: string, arg2: number): string {\r\n * @internal\r\n */\r\nnativeOverride.filter = function <T extends (...params: any) => boolean>(predicate: T) {\r\n return (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => unknown>) =>\r\n nativeOverride(target, propertyKey, descriptor, predicate);\r\n};\r\n\r\n/**\r\n * Adds accessors for a material property.\r\n * @param setCallback - The name of the callback function to call when the property is set.\r\n * @param targetKey - The key to use for the target property (defaults to the original property key).\r\n * @returns A property decorator.\r\n */\r\nexport function addAccessorsForMaterialProperty(setCallback: string, targetKey: Nullable<string> = null) {\r\n return (target: any, propertyKey: string) => {\r\n const key = propertyKey;\r\n const newKey = targetKey || \"\";\r\n Object.defineProperty(target, newKey, {\r\n get: function (this: any) {\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n return this[key].value;\r\n },\r\n set: function (this: any, value) {\r\n // does this object (i.e. vector3) has an equals function? use it!\r\n // Note - not using \"with epsilon\" here, it is expected te behave like the internal cache does.\r\n if (typeof this[key]?.value?.equals === \"function\") {\r\n if (this[key].value.equals(value)) {\r\n return;\r\n }\r\n }\r\n if (this[key].value === value) {\r\n return;\r\n }\r\n this[key].value = value;\r\n\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/decorators.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,SAAS,0BAA0B,CAAC,IAAY,EAAE,UAAmB;IACjE,OAAO,CAAC,MAAW,EAAE,WAA4B,EAAE,EAAE;QACjD,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC3B,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QACrE,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED,SAAS,oBAAoB,CAAC,WAAmB,EAAE,YAA8B,IAAI;IACjF,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QACxC,MAAM,GAAG,GAAG,SAAS,IAAI,GAAG,GAAG,WAAW,CAAC;QAC3C,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE;YACvC,GAAG,EAAE;gBACD,+DAA+D;gBAC/D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;YACD,GAAG,EAAE,UAAqB,KAAK;gBAC3B,kEAAkE;gBAClE,+FAA+F;gBAC/F,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,UAAU,EAAE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G,EAAE,UAAqB,KAAK;gBAC3B,kEAAkE;gBAClE,+FAA+F;gBAC/F,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;oBACjD,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;wBAChC,OAAO;oBACX,CAAC;gBACL,CAAC;gBACD,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;oBAC5B,OAAO;gBACX,CAAC;gBACD,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC;gBAExB,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC;YACD,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,IAAI;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../types\";\r\nimport { GetDirectStore } from \"./decorators.functions\";\r\nimport { _WarnImport } from \"./devTools\";\r\n\r\nfunction generateSerializableMember(type: number, sourceName?: string) {\r\n return (target: any, propertyKey: string | symbol) => {\r\n const classStore = GetDirectStore(target);\r\n\r\n if (!classStore[propertyKey]) {\r\n classStore[propertyKey] = { type: type, sourceName: sourceName };\r\n }\r\n };\r\n}\r\n\r\nfunction generateExpandMember(setCallback: string, targetKey: Nullable<string> = null) {\r\n return (target: any, propertyKey: string) => {\r\n const key = targetKey || \"_\" + propertyKey;\r\n Object.defineProperty(target, propertyKey, {\r\n get: function (this: any) {\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n return this[key];\r\n },\r\n set: function (this: any, value) {\r\n // does this object (i.e. vector3) has an equals function? use it!\r\n // Note - not using \"with epsilon\" here, it is expected te behave like the internal cache does.\r\n if (typeof this[key]?.equals === \"function\") {\r\n if (this[key].equals(value)) {\r\n return;\r\n }\r\n }\r\n if (this[key] === value) {\r\n return;\r\n }\r\n this[key] = value;\r\n\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n };\r\n}\r\n\r\nexport function expandToProperty(callback: string, targetKey: Nullable<string> = null) {\r\n return generateExpandMember(callback, targetKey);\r\n}\r\n\r\nexport function serialize(sourceName?: string) {\r\n return generateSerializableMember(0, sourceName); // value member\r\n}\r\n\r\nexport function serializeAsTexture(sourceName?: string) {\r\n return generateSerializableMember(1, sourceName); // texture member\r\n}\r\n\r\nexport function serializeAsColor3(sourceName?: string) {\r\n return generateSerializableMember(2, sourceName); // color3 member\r\n}\r\n\r\nexport function serializeAsFresnelParameters(sourceName?: string) {\r\n return generateSerializableMember(3, sourceName); // fresnel parameters member\r\n}\r\n\r\nexport function serializeAsVector2(sourceName?: string) {\r\n return generateSerializableMember(4, sourceName); // vector2 member\r\n}\r\n\r\nexport function serializeAsVector3(sourceName?: string) {\r\n return generateSerializableMember(5, sourceName); // vector3 member\r\n}\r\n\r\nexport function serializeAsMeshReference(sourceName?: string) {\r\n return generateSerializableMember(6, sourceName); // mesh reference member\r\n}\r\n\r\nexport function serializeAsColorCurves(sourceName?: string) {\r\n return generateSerializableMember(7, sourceName); // color curves\r\n}\r\n\r\nexport function serializeAsColor4(sourceName?: string) {\r\n return generateSerializableMember(8, sourceName); // color 4\r\n}\r\n\r\nexport function serializeAsImageProcessingConfiguration(sourceName?: string) {\r\n return generateSerializableMember(9, sourceName); // image processing\r\n}\r\n\r\nexport function serializeAsQuaternion(sourceName?: string) {\r\n return generateSerializableMember(10, sourceName); // quaternion member\r\n}\r\n\r\nexport function serializeAsMatrix(sourceName?: string) {\r\n return generateSerializableMember(12, sourceName); // matrix member\r\n}\r\n\r\n/**\r\n * Decorator used to define property that can be serialized as reference to a camera\r\n * @param sourceName defines the name of the property to decorate\r\n * @returns Property Decorator\r\n */\r\nexport function serializeAsCameraReference(sourceName?: string) {\r\n return generateSerializableMember(11, sourceName); // camera reference member\r\n}\r\n\r\n/** @internal */\r\ndeclare const _native: any;\r\n\r\n/**\r\n * Decorator used to redirect a function to a native implementation if available.\r\n * @internal\r\n */\r\nexport function nativeOverride<T extends (...params: any[]) => boolean>(\r\n target: any,\r\n propertyKey: string,\r\n descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => any>,\r\n predicate?: T\r\n) {\r\n // Cache the original JS function for later.\r\n const jsFunc = descriptor.value!;\r\n\r\n // Override the JS function to check for a native override on first invocation. Setting descriptor.value overrides the function at the early stage of code being loaded/imported.\r\n descriptor.value = (...params: Parameters<T>): unknown => {\r\n // Assume the resolved function will be the original JS function, then we will check for the Babylon Native context.\r\n let func = jsFunc;\r\n\r\n // Check if we are executing in a Babylon Native context (e.g. check the presence of the _native global property) and if so also check if a function override is available.\r\n if (typeof _native !== \"undefined\" && _native[propertyKey]) {\r\n const nativeFunc = _native[propertyKey] as (...params: Parameters<T>) => unknown;\r\n // If a predicate was provided, then we'll need to invoke the predicate on each invocation of the underlying function to determine whether to call the native function or the JS function.\r\n if (predicate) {\r\n // The resolved function will execute the predicate and then either execute the native function or the JS function.\r\n func = (...params: Parameters<T>) => (predicate(...params) ? nativeFunc(...params) : jsFunc(...params));\r\n } else {\r\n // The resolved function will directly execute the native function.\r\n func = nativeFunc;\r\n }\r\n }\r\n\r\n // Override the JS function again with the final resolved target function.\r\n target[propertyKey] = func;\r\n\r\n // The JS function has now been overridden based on whether we're executing in the context of Babylon Native, but we still need to invoke that function.\r\n // Future invocations of the function will just directly invoke the final overridden function, not any of the decorator setup logic above.\r\n return func(...params);\r\n };\r\n}\r\n\r\n/**\r\n * Decorator factory that applies the nativeOverride decorator, but determines whether to redirect to the native implementation based on a filter function that evaluates the function arguments.\r\n * @param predicate\r\n * @example @nativeOverride.filter((...[arg1]: Parameters<typeof someClass.someMethod>) => arg1.length > 20)\r\n * public someMethod(arg1: string, arg2: number): string {\r\n * @internal\r\n */\r\nnativeOverride.filter = function <T extends (...params: any) => boolean>(predicate: T) {\r\n return (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<(...params: Parameters<T>) => unknown>) =>\r\n nativeOverride(target, propertyKey, descriptor, predicate);\r\n};\r\n\r\n/**\r\n * Adds accessors for a material property.\r\n * @param setCallback - The name of the callback function to call when the property is set.\r\n * @param targetKey - The key to use for the target property (defaults to the original property key).\r\n * @returns A property decorator.\r\n */\r\nexport function addAccessorsForMaterialProperty(setCallback: string, targetKey: Nullable<string> = null) {\r\n return (target: any, propertyKey: string) => {\r\n const key = propertyKey;\r\n const newKey = targetKey || \"\";\r\n Object.defineProperty(target, newKey, {\r\n get: function (this: any) {\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n return this[key].value;\r\n },\r\n set: function (this: any, value) {\r\n // does this object (i.e. vector3) has an equals function? use it!\r\n // Note - not using \"with epsilon\" here, it is expected te behave like the internal cache does.\r\n if (typeof this[key]?.value?.equals === \"function\") {\r\n if (this[key].value.equals(value)) {\r\n return;\r\n }\r\n }\r\n if (this[key].value === value) {\r\n return;\r\n }\r\n this[key].value = value;\r\n\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n };\r\n}\r\n"]}
@@ -1,4 +1,23 @@
1
1
  import type { AbstractEngine } from "../Engines/abstractEngine.js";
2
+ declare class EncodingHelper {
3
+ /**
4
+ * Encodes image data to the given mime type.
5
+ * This is put into a helper class so we can apply the nativeOverride decorator to it.
6
+ * @internal
7
+ */
8
+ static EncodeImageAsync(pixelData: ArrayBufferView, width: number, height: number, mimeType?: string, invertY?: boolean, quality?: number): Promise<Blob>;
9
+ }
10
+ /**
11
+ * Encodes pixel data to an image
12
+ * @param pixelData 8-bit RGBA pixel data
13
+ * @param width the width of the image
14
+ * @param height the height of the image
15
+ * @param mimeType the requested MIME type
16
+ * @param invertY true to invert the image in the Y direction
17
+ * @param quality the quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
18
+ * @returns a promise that resolves to the encoded image data. Note that the `blob.type` may differ from `mimeType` if it was not supported.
19
+ */
20
+ export declare const EncodeImageAsync: typeof EncodingHelper.EncodeImageAsync;
2
21
  /**
3
22
  * Dumps the current bound framebuffer
4
23
  * @param width defines the rendering width
@@ -40,3 +59,4 @@ export declare const DumpTools: {
40
59
  DumpFramebuffer: typeof DumpFramebuffer;
41
60
  Dispose: typeof Dispose;
42
61
  };
62
+ export {};
package/Misc/dumpTools.js CHANGED
@@ -1,9 +1,12 @@
1
+ import { __decorate } from "../tslib.es6.js";
1
2
 
2
3
  import { EffectRenderer, EffectWrapper } from "../Materials/effectRenderer.js";
3
4
  import { Tools } from "./tools.js";
4
5
  import { Clamp } from "../Maths/math.scalar.functions.js";
5
6
  import { EngineStore } from "../Engines/engineStore.js";
6
7
  import { Logger } from "./logger.js";
8
+ import { EncodeArrayBufferToBase64 } from "./stringTools.js";
9
+ import { nativeOverride } from "./decorators.js";
7
10
  let ResourcesPromise = null;
8
11
  async function _CreateDumpResourcesAsync() {
9
12
  // Create a compatible canvas. Prefer an HTMLCanvasElement if possible to avoid alpha issues with OffscreenCanvas + WebGL in many browsers.
@@ -11,14 +14,11 @@ async function _CreateDumpResourcesAsync() {
11
14
  if (canvas instanceof OffscreenCanvas) {
12
15
  Logger.Warn("DumpData: OffscreenCanvas will be used for dumping data. This may result in lossy alpha values.");
13
16
  }
14
- // If WebGL via ThinEngine is not available (e.g. Native), use the BitmapRenderer.
17
+ // If WebGL via ThinEngine is not available, we cannot encode the data.
15
18
  // If https://github.com/whatwg/html/issues/10142 is resolved, we can migrate to just BitmapRenderer and avoid an engine dependency altogether.
16
19
  const { ThinEngine: thinEngineClass } = await import("../Engines/thinEngine.js");
17
20
  if (!thinEngineClass.IsSupported) {
18
- if (!canvas.getContext("bitmaprenderer")) {
19
- throw new Error("DumpData: No WebGL or bitmap rendering context available. Cannot dump data.");
20
- }
21
- return { canvas };
21
+ throw new Error("DumpData: No WebGL context available. Cannot dump data.");
22
22
  }
23
23
  const options = {
24
24
  preserveDrawingBuffer: true,
@@ -61,6 +61,49 @@ async function _GetDumpResourcesAsync() {
61
61
  }
62
62
  return await ResourcesPromise;
63
63
  }
64
+ class EncodingHelper {
65
+ /**
66
+ * Encodes image data to the given mime type.
67
+ * This is put into a helper class so we can apply the nativeOverride decorator to it.
68
+ * @internal
69
+ */
70
+ static async EncodeImageAsync(pixelData, width, height, mimeType, invertY, quality) {
71
+ const resources = await _GetDumpResourcesAsync();
72
+ const dumpEngine = resources.dumpEngine;
73
+ dumpEngine.engine.setSize(width, height, true);
74
+ // Create the image
75
+ const texture = dumpEngine.engine.createRawTexture(pixelData, width, height, 5, false, !invertY, 1);
76
+ dumpEngine.renderer.setViewport();
77
+ dumpEngine.renderer.applyEffectWrapper(dumpEngine.wrapper);
78
+ dumpEngine.wrapper.effect._bindTexture("textureSampler", texture);
79
+ dumpEngine.renderer.draw();
80
+ texture.dispose();
81
+ return await new Promise((resolve, reject) => {
82
+ Tools.ToBlob(resources.canvas, (blob) => {
83
+ if (!blob) {
84
+ reject(new Error("EncodeImageAsync: Failed to convert canvas to blob."));
85
+ }
86
+ else {
87
+ resolve(blob);
88
+ }
89
+ }, mimeType, quality);
90
+ });
91
+ }
92
+ }
93
+ __decorate([
94
+ nativeOverride
95
+ ], EncodingHelper, "EncodeImageAsync", null);
96
+ /**
97
+ * Encodes pixel data to an image
98
+ * @param pixelData 8-bit RGBA pixel data
99
+ * @param width the width of the image
100
+ * @param height the height of the image
101
+ * @param mimeType the requested MIME type
102
+ * @param invertY true to invert the image in the Y direction
103
+ * @param quality the quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
104
+ * @returns a promise that resolves to the encoded image data. Note that the `blob.type` may differ from `mimeType` if it was not supported.
105
+ */
106
+ export const EncodeImageAsync = EncodingHelper.EncodeImageAsync;
64
107
  /**
65
108
  * Dumps the current bound framebuffer
66
109
  * @param width defines the rendering width
@@ -103,50 +146,18 @@ export async function DumpDataAsync(width, height, data, mimeType = "image/png",
103
146
  }
104
147
  data = data2;
105
148
  }
106
- const resources = await _GetDumpResourcesAsync();
107
- // Keep the async render + read from the shared canvas atomic
108
- // eslint-disable-next-line no-async-promise-executor
109
- return await new Promise(async (resolve) => {
110
- if (resources.dumpEngine) {
111
- const dumpEngine = resources.dumpEngine;
112
- dumpEngine.engine.setSize(width, height, true);
113
- // Create the image
114
- const texture = dumpEngine.engine.createRawTexture(data, width, height, 5, false, !invertY, 1);
115
- dumpEngine.renderer.setViewport();
116
- dumpEngine.renderer.applyEffectWrapper(dumpEngine.wrapper);
117
- dumpEngine.wrapper.effect._bindTexture("textureSampler", texture);
118
- dumpEngine.renderer.draw();
119
- texture.dispose();
120
- }
121
- else {
122
- const ctx = resources.canvas.getContext("bitmaprenderer");
123
- resources.canvas.width = width;
124
- resources.canvas.height = height;
125
- const imageData = new ImageData(width, height); // ImageData(data, sw, sh) ctor not yet widely implemented
126
- imageData.data.set(data);
127
- const imageBitmap = await createImageBitmap(imageData, { premultiplyAlpha: "none", imageOrientation: invertY ? "flipY" : "from-image" });
128
- ctx.transferFromImageBitmap(imageBitmap);
129
- }
130
- Tools.ToBlob(resources.canvas, (blob) => {
131
- if (!blob) {
132
- throw new Error("DumpData: Failed to convert canvas to blob.");
133
- }
134
- if (fileName !== undefined) {
135
- Tools.DownloadBlob(blob, fileName);
136
- }
137
- const fileReader = new FileReader();
138
- fileReader.onload = (event) => {
139
- const result = event.target.result;
140
- resolve(result);
141
- };
142
- if (toArrayBuffer) {
143
- fileReader.readAsArrayBuffer(blob);
144
- }
145
- else {
146
- fileReader.readAsDataURL(blob);
147
- }
148
- }, mimeType, quality);
149
- });
149
+ const blob = await EncodingHelper.EncodeImageAsync(data, width, height, mimeType, invertY, quality);
150
+ if (fileName !== undefined) {
151
+ Tools.DownloadBlob(blob, fileName);
152
+ }
153
+ if (blob.type !== mimeType) {
154
+ Logger.Warn(`DumpData: The requested mimeType '${mimeType}' is not supported. The result has mimeType '${blob.type}' instead.`);
155
+ }
156
+ const buffer = await blob.arrayBuffer();
157
+ if (toArrayBuffer) {
158
+ return buffer;
159
+ }
160
+ return `data:${mimeType};base64,${EncodeArrayBufferToBase64(buffer)}`;
150
161
  }
151
162
  /**
152
163
  * Dumps an array buffer
@@ -1 +1 @@
1
- {"version":3,"file":"dumpTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/dumpTools.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAWlC,IAAI,gBAAgB,GAAkC,IAAI,CAAC;AAE3D,KAAK,UAAU,yBAAyB;IACpC,2IAA2I;IAC3I,MAAM,MAAM,GAAG,CAAC,WAAW,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,IAAI,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAwC,CAAC,CAAC,wBAAwB;IACxK,IAAI,MAAM,YAAY,eAAe,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,iGAAiG,CAAC,CAAC;IACnH,CAAC;IAED,kFAAkF;IAClF,+IAA+I;IAC/I,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,C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,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,gEAAgE;IAChE,QAAQ;IACR,gEAAgE;IAChE,aAAa;IACb,gEAAgE;IAChE,eAAe;IACf,gEAAgE;IAChE,OAAO;CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,GAAG,EAAE;IACzB,+BAA+B;IAC/B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;AAC5C,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { _WarnImport } from \"./devTools\";\r\n\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { EffectRenderer, EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Tools } from \"./tools\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"./logger\";\r\n\r\ntype DumpResources = {\r\n canvas: HTMLCanvasElement | OffscreenCanvas;\r\n dumpEngine?: {\r\n engine: ThinEngine;\r\n renderer: EffectRenderer;\r\n wrapper: EffectWrapper;\r\n };\r\n};\r\n\r\nlet ResourcesPromise: Promise<DumpResources> | null = null;\r\n\r\nasync function _CreateDumpResourcesAsync(): Promise<DumpResources> {\r\n // Create a compatible canvas. Prefer an HTMLCanvasElement if possible to avoid alpha issues with OffscreenCanvas + WebGL in many browsers.\r\n const canvas = (EngineStore.LastCreatedEngine?.createCanvas(100, 100) ?? new OffscreenCanvas(100, 100)) as HTMLCanvasElement | OffscreenCanvas; // will be resized later\r\n if (canvas instanceof OffscreenCanvas) {\r\n Logger.Warn(\"DumpData: OffscreenCanvas will be used for dumping data. This may result in lossy alpha values.\");\r\n }\r\n\r\n // If WebGL via ThinEngine is not available (e.g. Native), use the BitmapRenderer.\r\n // If https://github.com/whatwg/html/issues/10142 is resolved, we can migrate to just BitmapRenderer and avoid an engine dependency altogether.\r\n const { ThinEngine: thinEngineClass } = await import(\"../Engines/thinEngine\");\r\n if (!thinEngineClass.IsSupported) {\r\n if (!canvas.getContext(\"bitmaprenderer\")) {\r\n throw new Error(\"DumpData: No WebGL or bitmap rendering context available. Cannot dump data.\");\r\n }\r\n return { canvas };\r\n }\r\n\r\n const options = {\r\n preserveDrawingBuffer: true,\r\n depth: false,\r\n stencil: false,\r\n alpha: true,\r\n premultipliedAlpha: false,\r\n antialias: false,\r\n failIfMajorPerformanceCaveat: false,\r\n };\r\n const engine = new thinEngineClass(canvas, false, options);\r\n\r\n // remove this engine from the list of instances to avoid using it for other purposes\r\n EngineStore.Instances.pop();\r\n // However, make sure to dispose it when no other engines are left\r\n EngineStore.OnEnginesDisposedObservable.add((e) => {\r\n // guaranteed to run when no other instances are left\r\n // only dispose if it's not the current engine\r\n if (engine && e !== engine && !engine.isDisposed && EngineStore.Instances.length === 0) {\r\n // Dump the engine and the associated resources\r\n Dispose();\r\n }\r\n });\r\n\r\n engine.getCaps().parallelShaderCompile = undefined;\r\n\r\n const renderer = new EffectRenderer(engine);\r\n const { passPixelShader } = await import(\"../Shaders/pass.fragment\");\r\n const wrapper = new EffectWrapper({\r\n engine,\r\n name: passPixelShader.name,\r\n fragmentShader: passPixelShader.shader,\r\n samplerNames: [\"textureSampler\"],\r\n });\r\n\r\n return {\r\n canvas: canvas,\r\n dumpEngine: { engine, renderer, wrapper },\r\n };\r\n}\r\n\r\nasync function _GetDumpResourcesAsync() {\r\n if (!ResourcesPromise) {\r\n ResourcesPromise = _CreateDumpResourcesAsync();\r\n }\r\n return await ResourcesPromise;\r\n}\r\n\r\n/**\r\n * Dumps the current bound framebuffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param engine defines the hosting engine\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a void promise\r\n */\r\n// Should have \"Async\" in the name but this is a public API and we can't break it now\r\n// eslint-disable-next-line no-restricted-syntax\r\nexport async function DumpFramebuffer(\r\n width: number,\r\n height: number,\r\n engine: AbstractEngine,\r\n successCallback?: (data: string) => void,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n quality?: number\r\n) {\r\n // Read the contents of the framebuffer\r\n const bufferView = await engine.readPixels(0, 0, width, height);\r\n\r\n const data = new Uint8Array(bufferView.buffer);\r\n\r\n DumpData(width, height, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true, undefined, quality);\r\n}\r\n\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType: string | undefined,\r\n fileName: string | undefined,\r\n invertY: boolean | undefined,\r\n toArrayBuffer: true,\r\n quality?: number\r\n): Promise<ArrayBuffer>;\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType?: string,\r\n fileName?: string,\r\n invertY?: boolean,\r\n toArrayBuffer?: boolean,\r\n quality?: number\r\n): Promise<string>;\r\n/**\r\n * Dumps an array buffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param data the data array\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n * @param invertY true to invert the picture in the Y dimension\r\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a promise that resolve to the final data\r\n */\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n invertY = false,\r\n toArrayBuffer = false,\r\n quality?: number\r\n): Promise<string | ArrayBuffer> {\r\n // Convert if data are float32\r\n if (data instanceof Float32Array) {\r\n const data2 = new Uint8Array(data.length);\r\n let n = data.length;\r\n while (n--) {\r\n const v = data[n];\r\n data2[n] = Math.round(Clamp(v) * 255);\r\n }\r\n data = data2;\r\n }\r\n\r\n const resources = await _GetDumpResourcesAsync();\r\n\r\n // Keep the async render + read from the shared canvas atomic\r\n // eslint-disable-next-line no-async-promise-executor\r\n return await new Promise<string | ArrayBuffer>(async (resolve) => {\r\n if (resources.dumpEngine) {\r\n const dumpEngine = resources.dumpEngine;\r\n dumpEngine.engine.setSize(width, height, true);\r\n\r\n // Create the image\r\n const texture = dumpEngine.engine.createRawTexture(data, width, height, Constants.TEXTUREFORMAT_RGBA, false, !invertY, Constants.TEXTURE_NEAREST_NEAREST);\r\n\r\n dumpEngine.renderer.setViewport();\r\n dumpEngine.renderer.applyEffectWrapper(dumpEngine.wrapper);\r\n dumpEngine.wrapper.effect._bindTexture(\"textureSampler\", texture);\r\n dumpEngine.renderer.draw();\r\n\r\n texture.dispose();\r\n } else {\r\n const ctx = resources.canvas.getContext(\"bitmaprenderer\") as ImageBitmapRenderingContext;\r\n resources.canvas.width = width;\r\n resources.canvas.height = height;\r\n\r\n const imageData = new ImageData(width, height); // ImageData(data, sw, sh) ctor not yet widely implemented\r\n imageData.data.set(data as Uint8ClampedArray);\r\n const imageBitmap = await createImageBitmap(imageData, { premultiplyAlpha: \"none\", imageOrientation: invertY ? \"flipY\" : \"from-image\" });\r\n\r\n ctx.transferFromImageBitmap(imageBitmap);\r\n }\r\n\r\n Tools.ToBlob(\r\n resources.canvas,\r\n (blob) => {\r\n if (!blob) {\r\n throw new Error(\"DumpData: Failed to convert canvas to blob.\");\r\n }\r\n\r\n if (fileName !== undefined) {\r\n Tools.DownloadBlob(blob, fileName);\r\n }\r\n\r\n const fileReader = new FileReader();\r\n fileReader.onload = (event: any) => {\r\n const result = event.target!.result as string | ArrayBuffer;\r\n resolve(result);\r\n };\r\n\r\n if (toArrayBuffer) {\r\n fileReader.readAsArrayBuffer(blob);\r\n } else {\r\n fileReader.readAsDataURL(blob);\r\n }\r\n },\r\n mimeType,\r\n quality\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Dumps an array buffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param data the data array\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName The name of the file to download. If present, the result will automatically be downloaded. If not defined, and `successCallback` is also not defined, the result will automatically be downloaded with an auto-generated file name.\r\n * @param invertY true to invert the picture in the Y dimension\r\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n */\r\nexport function DumpData(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n successCallback?: (data: string | ArrayBuffer) => void,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n invertY = false,\r\n toArrayBuffer = false,\r\n quality?: number\r\n): void {\r\n // For back-compat: if no fileName and no callback, force download the result\r\n if (fileName === undefined && !successCallback) {\r\n fileName = \"\";\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n DumpDataAsync(width, height, data, mimeType, fileName, invertY, toArrayBuffer, quality)\r\n // eslint-disable-next-line github/no-then\r\n .then((result) => {\r\n if (successCallback) {\r\n successCallback(result);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Dispose the dump tools associated resources\r\n */\r\nexport function Dispose() {\r\n if (!ResourcesPromise) {\r\n return;\r\n }\r\n\r\n // in cases where the engine is not yet created, we need to wait for it to dispose it\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n ResourcesPromise?.then((resources) => {\r\n if (resources.canvas instanceof HTMLCanvasElement) {\r\n resources.canvas.remove();\r\n }\r\n if (resources.dumpEngine) {\r\n resources.dumpEngine.engine.dispose();\r\n resources.dumpEngine.renderer.dispose();\r\n resources.dumpEngine.wrapper.dispose();\r\n }\r\n });\r\n\r\n ResourcesPromise = null;\r\n}\r\n\r\n/**\r\n * Object containing a set of static utilities functions to dump data from a canvas\r\n * @deprecated use functions\r\n */\r\nexport const DumpTools = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpData,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpDataAsync,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpFramebuffer,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Dispose,\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst InitSideEffects = () => {\r\n // References the dependencies.\r\n Tools.DumpData = DumpData;\r\n Tools.DumpDataAsync = DumpDataAsync;\r\n Tools.DumpFramebuffer = DumpFramebuffer;\r\n};\r\n\r\nInitSideEffects();\r\n"]}
1
+ {"version":3,"file":"dumpTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/dumpTools.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD,O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AAE,CAAC;QAC9B,CAAC;QACD,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;YACvB,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACtC,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACxC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3C,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,gBAAgB,GAAG,IAAI,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,gEAAgE;IAChE,QAAQ;IACR,gEAAgE;IAChE,aAAa;IACb,gEAAgE;IAChE,eAAe;IACf,gEAAgE;IAChE,OAAO;CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,GAAG,EAAE;IACzB,+BAA+B;IAC/B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;AAC5C,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { _WarnImport } from \"./devTools\";\r\n\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { EffectRenderer, EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Tools } from \"./tools\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"./logger\";\r\nimport { EncodeArrayBufferToBase64 } from \"./stringTools\";\r\nimport { nativeOverride } from \"./decorators\";\r\n\r\ntype DumpResources = {\r\n canvas: HTMLCanvasElement | OffscreenCanvas;\r\n dumpEngine: {\r\n engine: ThinEngine;\r\n renderer: EffectRenderer;\r\n wrapper: EffectWrapper;\r\n };\r\n};\r\n\r\nlet ResourcesPromise: Promise<DumpResources> | null = null;\r\n\r\nasync function _CreateDumpResourcesAsync(): Promise<DumpResources> {\r\n // Create a compatible canvas. Prefer an HTMLCanvasElement if possible to avoid alpha issues with OffscreenCanvas + WebGL in many browsers.\r\n const canvas = (EngineStore.LastCreatedEngine?.createCanvas(100, 100) ?? new OffscreenCanvas(100, 100)) as HTMLCanvasElement | OffscreenCanvas; // will be resized later\r\n if (canvas instanceof OffscreenCanvas) {\r\n Logger.Warn(\"DumpData: OffscreenCanvas will be used for dumping data. This may result in lossy alpha values.\");\r\n }\r\n\r\n // If WebGL via ThinEngine is not available, we cannot encode the data.\r\n // If https://github.com/whatwg/html/issues/10142 is resolved, we can migrate to just BitmapRenderer and avoid an engine dependency altogether.\r\n const { ThinEngine: thinEngineClass } = await import(\"../Engines/thinEngine\");\r\n if (!thinEngineClass.IsSupported) {\r\n throw new Error(\"DumpData: No WebGL context available. Cannot dump data.\");\r\n }\r\n\r\n const options = {\r\n preserveDrawingBuffer: true,\r\n depth: false,\r\n stencil: false,\r\n alpha: true,\r\n premultipliedAlpha: false,\r\n antialias: false,\r\n failIfMajorPerformanceCaveat: false,\r\n };\r\n const engine = new thinEngineClass(canvas, false, options);\r\n\r\n // remove this engine from the list of instances to avoid using it for other purposes\r\n EngineStore.Instances.pop();\r\n // However, make sure to dispose it when no other engines are left\r\n EngineStore.OnEnginesDisposedObservable.add((e) => {\r\n // guaranteed to run when no other instances are left\r\n // only dispose if it's not the current engine\r\n if (engine && e !== engine && !engine.isDisposed && EngineStore.Instances.length === 0) {\r\n // Dump the engine and the associated resources\r\n Dispose();\r\n }\r\n });\r\n\r\n engine.getCaps().parallelShaderCompile = undefined;\r\n\r\n const renderer = new EffectRenderer(engine);\r\n const { passPixelShader } = await import(\"../Shaders/pass.fragment\");\r\n const wrapper = new EffectWrapper({\r\n engine,\r\n name: passPixelShader.name,\r\n fragmentShader: passPixelShader.shader,\r\n samplerNames: [\"textureSampler\"],\r\n });\r\n\r\n return {\r\n canvas: canvas,\r\n dumpEngine: { engine, renderer, wrapper },\r\n };\r\n}\r\n\r\nasync function _GetDumpResourcesAsync() {\r\n if (!ResourcesPromise) {\r\n ResourcesPromise = _CreateDumpResourcesAsync();\r\n }\r\n return await ResourcesPromise;\r\n}\r\n\r\nclass EncodingHelper {\r\n /**\r\n * Encodes image data to the given mime type.\r\n * This is put into a helper class so we can apply the nativeOverride decorator to it.\r\n * @internal\r\n */\r\n @nativeOverride\r\n public static async EncodeImageAsync(pixelData: ArrayBufferView, width: number, height: number, mimeType?: string, invertY?: boolean, quality?: number): Promise<Blob> {\r\n const resources = await _GetDumpResourcesAsync();\r\n\r\n const dumpEngine = resources.dumpEngine;\r\n dumpEngine.engine.setSize(width, height, true);\r\n\r\n // Create the image\r\n const texture = dumpEngine.engine.createRawTexture(pixelData, width, height, Constants.TEXTUREFORMAT_RGBA, false, !invertY, Constants.TEXTURE_NEAREST_NEAREST);\r\n\r\n dumpEngine.renderer.setViewport();\r\n dumpEngine.renderer.applyEffectWrapper(dumpEngine.wrapper);\r\n dumpEngine.wrapper.effect._bindTexture(\"textureSampler\", texture);\r\n dumpEngine.renderer.draw();\r\n\r\n texture.dispose();\r\n\r\n return await new Promise<Blob>((resolve, reject) => {\r\n Tools.ToBlob(\r\n resources.canvas,\r\n (blob) => {\r\n if (!blob) {\r\n reject(new Error(\"EncodeImageAsync: Failed to convert canvas to blob.\"));\r\n } else {\r\n resolve(blob);\r\n }\r\n },\r\n mimeType,\r\n quality\r\n );\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Encodes pixel data to an image\r\n * @param pixelData 8-bit RGBA pixel data\r\n * @param width the width of the image\r\n * @param height the height of the image\r\n * @param mimeType the requested MIME type\r\n * @param invertY true to invert the image in the Y direction\r\n * @param quality the quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a promise that resolves to the encoded image data. Note that the `blob.type` may differ from `mimeType` if it was not supported.\r\n */\r\nexport const EncodeImageAsync = EncodingHelper.EncodeImageAsync;\r\n\r\n/**\r\n * Dumps the current bound framebuffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param engine defines the hosting engine\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a void promise\r\n */\r\n// Should have \"Async\" in the name but this is a public API and we can't break it now\r\n// eslint-disable-next-line no-restricted-syntax\r\nexport async function DumpFramebuffer(\r\n width: number,\r\n height: number,\r\n engine: AbstractEngine,\r\n successCallback?: (data: string) => void,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n quality?: number\r\n) {\r\n // Read the contents of the framebuffer\r\n const bufferView = await engine.readPixels(0, 0, width, height);\r\n\r\n const data = new Uint8Array(bufferView.buffer);\r\n\r\n DumpData(width, height, data, successCallback as (data: string | ArrayBuffer) => void, mimeType, fileName, true, undefined, quality);\r\n}\r\n\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType: string | undefined,\r\n fileName: string | undefined,\r\n invertY: boolean | undefined,\r\n toArrayBuffer: true,\r\n quality?: number\r\n): Promise<ArrayBuffer>;\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType?: string,\r\n fileName?: string,\r\n invertY?: boolean,\r\n toArrayBuffer?: boolean,\r\n quality?: number\r\n): Promise<string>;\r\n/**\r\n * Dumps an array buffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param data the data array\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n * @param invertY true to invert the picture in the Y dimension\r\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n * @returns a promise that resolve to the final data\r\n */\r\nexport async function DumpDataAsync(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n invertY = false,\r\n toArrayBuffer = false,\r\n quality?: number\r\n): Promise<string | ArrayBuffer> {\r\n // Convert if data are float32\r\n if (data instanceof Float32Array) {\r\n const data2 = new Uint8Array(data.length);\r\n let n = data.length;\r\n while (n--) {\r\n const v = data[n];\r\n data2[n] = Math.round(Clamp(v) * 255);\r\n }\r\n data = data2;\r\n }\r\n\r\n const blob = await EncodingHelper.EncodeImageAsync(data, width, height, mimeType, invertY, quality);\r\n\r\n if (fileName !== undefined) {\r\n Tools.DownloadBlob(blob, fileName);\r\n }\r\n\r\n if (blob.type !== mimeType) {\r\n Logger.Warn(`DumpData: The requested mimeType '${mimeType}' is not supported. The result has mimeType '${blob.type}' instead.`);\r\n }\r\n\r\n const buffer = await blob.arrayBuffer();\r\n\r\n if (toArrayBuffer) {\r\n return buffer;\r\n }\r\n\r\n return `data:${mimeType};base64,${EncodeArrayBufferToBase64(buffer)}`;\r\n}\r\n\r\n/**\r\n * Dumps an array buffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param data the data array\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName The name of the file to download. If present, the result will automatically be downloaded. If not defined, and `successCallback` is also not defined, the result will automatically be downloaded with an auto-generated file name.\r\n * @param invertY true to invert the picture in the Y dimension\r\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\r\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\r\n */\r\nexport function DumpData(\r\n width: number,\r\n height: number,\r\n data: ArrayBufferView,\r\n successCallback?: (data: string | ArrayBuffer) => void,\r\n mimeType = \"image/png\",\r\n fileName?: string,\r\n invertY = false,\r\n toArrayBuffer = false,\r\n quality?: number\r\n): void {\r\n // For back-compat: if no fileName and no callback, force download the result\r\n if (fileName === undefined && !successCallback) {\r\n fileName = \"\";\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n DumpDataAsync(width, height, data, mimeType, fileName, invertY, toArrayBuffer, quality)\r\n // eslint-disable-next-line github/no-then\r\n .then((result) => {\r\n if (successCallback) {\r\n successCallback(result);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Dispose the dump tools associated resources\r\n */\r\nexport function Dispose() {\r\n if (!ResourcesPromise) {\r\n return;\r\n }\r\n\r\n // in cases where the engine is not yet created, we need to wait for it to dispose it\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n ResourcesPromise?.then((resources) => {\r\n if (resources.canvas instanceof HTMLCanvasElement) {\r\n resources.canvas.remove();\r\n }\r\n if (resources.dumpEngine) {\r\n resources.dumpEngine.engine.dispose();\r\n resources.dumpEngine.renderer.dispose();\r\n resources.dumpEngine.wrapper.dispose();\r\n }\r\n });\r\n\r\n ResourcesPromise = null;\r\n}\r\n\r\n/**\r\n * Object containing a set of static utilities functions to dump data from a canvas\r\n * @deprecated use functions\r\n */\r\nexport const DumpTools = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpData,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpDataAsync,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n DumpFramebuffer,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Dispose,\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst InitSideEffects = () => {\r\n // References the dependencies.\r\n Tools.DumpData = DumpData;\r\n Tools.DumpDataAsync = DumpDataAsync;\r\n Tools.DumpFramebuffer = DumpFramebuffer;\r\n};\r\n\r\nInitSideEffects();\r\n"]}
package/Misc/index.d.ts CHANGED
@@ -67,8 +67,7 @@ export * from "./error.js";
67
67
  export * from "./snapshotRenderingHelper.js";
68
68
  export * from "./observableCoroutine.js";
69
69
  export * from "./copyTextureToTexture.js";
70
- /** @deprecated Use individual exports */
71
- export { DumpTools } from "./dumpTools.js";
70
+ export { DumpTools, EncodeImageAsync } from "./dumpTools.js";
72
71
  export * from "./greasedLineTools.js";
73
72
  export * from "./equirectangularCapture.js";
74
73
  export * from "./decorators.serialization.js";
package/Misc/index.js CHANGED
@@ -70,8 +70,7 @@ export * from "./snapshotRenderingHelper.js";
70
70
  // eslint-disable-next-line import/export
71
71
  export * from "./observableCoroutine.js";
72
72
  export * from "./copyTextureToTexture.js";
73
- /** @deprecated Use individual exports */
74
- export { DumpTools } from "./dumpTools.js";
73
+ export { DumpTools, EncodeImageAsync } from "./dumpTools.js";
75
74
  export * from "./greasedLineTools.js";
76
75
  export * from "./equirectangularCapture.js";
77
76
  export * from "./decorators.serialization.js";
package/Misc/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc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AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,yCAAyC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,yCAAyC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AAEvB,mBAAmB;AACnB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AAEnD,uBAAuB;AACvB,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAE7D,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./observable.extensions\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\n// loaded from texture tools\r\nexport * from \"../Shaders/lodCube.fragment\";\r\nexport * from \"../Shaders/lod.fragment\";\r\nexport * from \"../ShadersWGSL/lodCube.fragment\";\r\nexport * from \"../ShadersWGSL/lod.fragment\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./deepMerger\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./pressureObserverWrapper\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\nexport * from \"./snapshotRenderingHelper\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\n/** @deprecated Use individual exports */\r\nexport { DumpTools } from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\nexport * from \"./decorators.serialization\";\r\nexport * from \"./asyncLock\";\r\nexport * from \"./bitArray\";\r\nexport * from \"./urlTools\";\r\nexport * from \"./lazy\";\r\n\r\n// RGBDTextureTools\r\nexport * from \"../Shaders/rgbdDecode.fragment\";\r\nexport * from \"../Shaders/rgbdEncode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdDecode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdEncode.fragment\";\r\n\r\n// CopyTextureToTexture\r\nexport * from \"../Shaders/copyTextureToTexture.fragment\";\r\nexport * from \"../ShadersWGSL/copyTextureToTexture.fragment\";\r\n\r\nexport * from \"./tools.internals\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/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;AAC1C,yCAAyC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AAEvB,mBAAmB;AACnB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AAEnD,uBAAuB;AACvB,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAE7D,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./observable.extensions\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\n// loaded from texture tools\r\nexport * from \"../Shaders/lodCube.fragment\";\r\nexport * from \"../Shaders/lod.fragment\";\r\nexport * from \"../ShadersWGSL/lodCube.fragment\";\r\nexport * from \"../ShadersWGSL/lod.fragment\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./deepMerger\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./pressureObserverWrapper\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\nexport * from \"./snapshotRenderingHelper\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\nexport { DumpTools, EncodeImageAsync } from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\nexport * from \"./decorators.serialization\";\r\nexport * from \"./asyncLock\";\r\nexport * from \"./bitArray\";\r\nexport * from \"./urlTools\";\r\nexport * from \"./lazy\";\r\n\r\n// RGBDTextureTools\r\nexport * from \"../Shaders/rgbdDecode.fragment\";\r\nexport * from \"../Shaders/rgbdEncode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdDecode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdEncode.fragment\";\r\n\r\n// CopyTextureToTexture\r\nexport * from \"../Shaders/copyTextureToTexture.fragment\";\r\nexport * from \"../ShadersWGSL/copyTextureToTexture.fragment\";\r\n\r\nexport * from \"./tools.internals\";\r\n"]}