@babylonjs/serializers 9.12.1 → 9.14.0

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 (187) hide show
  1. package/3MF/core/model/pure.d.ts +8 -0
  2. package/3MF/core/model/pure.js +9 -0
  3. package/3MF/core/model/pure.js.map +1 -0
  4. package/3MF/core/pure.d.ts +3 -0
  5. package/3MF/core/pure.js +5 -0
  6. package/3MF/core/pure.js.map +1 -0
  7. package/3MF/core/xml/pure.d.ts +7 -0
  8. package/3MF/core/xml/pure.js +8 -0
  9. package/3MF/core/xml/pure.js.map +1 -0
  10. package/3MF/pure.d.ts +4 -0
  11. package/3MF/pure.js +6 -0
  12. package/3MF/pure.js.map +1 -0
  13. package/BVH/pure.d.ts +2 -0
  14. package/BVH/pure.js +3 -0
  15. package/BVH/pure.js.map +1 -0
  16. package/OBJ/pure.d.ts +2 -0
  17. package/OBJ/pure.js +3 -0
  18. package/OBJ/pure.js.map +1 -0
  19. package/USDZ/pure.d.ts +2 -0
  20. package/USDZ/pure.js +4 -0
  21. package/USDZ/pure.js.map +1 -0
  22. package/glTF/2.0/Extensions/EXT_lights_area.d.ts +3 -37
  23. package/glTF/2.0/Extensions/EXT_lights_area.js +5 -130
  24. package/glTF/2.0/Extensions/EXT_lights_area.js.map +1 -1
  25. package/glTF/2.0/Extensions/EXT_lights_area.pure.d.ts +44 -0
  26. package/glTF/2.0/Extensions/EXT_lights_area.pure.js +145 -0
  27. package/glTF/2.0/Extensions/EXT_lights_area.pure.js.map +1 -0
  28. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +4 -38
  29. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +6 -138
  30. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  31. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.pure.d.ts +44 -0
  32. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.pure.js +151 -0
  33. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.pure.js.map +1 -0
  34. package/glTF/2.0/Extensions/EXT_texture_avif.d.ts +3 -15
  35. package/glTF/2.0/Extensions/EXT_texture_avif.js +5 -38
  36. package/glTF/2.0/Extensions/EXT_texture_avif.js.map +1 -1
  37. package/glTF/2.0/Extensions/EXT_texture_avif.pure.d.ts +27 -0
  38. package/glTF/2.0/Extensions/EXT_texture_avif.pure.js +58 -0
  39. package/glTF/2.0/Extensions/EXT_texture_avif.pure.js.map +1 -0
  40. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +3 -14
  41. package/glTF/2.0/Extensions/EXT_texture_webp.js +5 -37
  42. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
  43. package/glTF/2.0/Extensions/EXT_texture_webp.pure.d.ts +26 -0
  44. package/glTF/2.0/Extensions/EXT_texture_webp.pure.js +57 -0
  45. package/glTF/2.0/Extensions/EXT_texture_webp.pure.js.map +1 -0
  46. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +3 -30
  47. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +5 -128
  48. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
  49. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.pure.d.ts +37 -0
  50. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.pure.js +143 -0
  51. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.pure.js.map +1 -0
  52. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +3 -37
  53. package/glTF/2.0/Extensions/KHR_lights_punctual.js +5 -142
  54. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  55. package/glTF/2.0/Extensions/KHR_lights_punctual.pure.d.ts +44 -0
  56. package/glTF/2.0/Extensions/KHR_lights_punctual.pure.js +157 -0
  57. package/glTF/2.0/Extensions/KHR_lights_punctual.pure.js.map +1 -0
  58. package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +3 -30
  59. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +5 -177
  60. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
  61. package/glTF/2.0/Extensions/KHR_materials_anisotropy.pure.d.ts +37 -0
  62. package/glTF/2.0/Extensions/KHR_materials_anisotropy.pure.js +192 -0
  63. package/glTF/2.0/Extensions/KHR_materials_anisotropy.pure.js.map +1 -0
  64. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +3 -30
  65. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +5 -251
  66. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  67. package/glTF/2.0/Extensions/KHR_materials_clearcoat.pure.d.ts +37 -0
  68. package/glTF/2.0/Extensions/KHR_materials_clearcoat.pure.js +266 -0
  69. package/glTF/2.0/Extensions/KHR_materials_clearcoat.pure.js.map +1 -0
  70. package/glTF/2.0/Extensions/KHR_materials_coat.d.ts +3 -30
  71. package/glTF/2.0/Extensions/KHR_materials_coat.js +5 -380
  72. package/glTF/2.0/Extensions/KHR_materials_coat.js.map +1 -1
  73. package/glTF/2.0/Extensions/KHR_materials_coat.pure.d.ts +37 -0
  74. package/glTF/2.0/Extensions/KHR_materials_coat.pure.js +395 -0
  75. package/glTF/2.0/Extensions/KHR_materials_coat.pure.js.map +1 -0
  76. package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.d.ts +3 -22
  77. package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.js +5 -75
  78. package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.js.map +1 -1
  79. package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.pure.d.ts +29 -0
  80. package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.pure.js +90 -0
  81. package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.pure.js.map +1 -0
  82. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.d.ts +3 -38
  83. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +5 -115
  84. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
  85. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.pure.d.ts +45 -0
  86. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.pure.js +130 -0
  87. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.pure.js.map +1 -0
  88. package/glTF/2.0/Extensions/KHR_materials_dispersion.d.ts +3 -29
  89. package/glTF/2.0/Extensions/KHR_materials_dispersion.js +5 -60
  90. package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
  91. package/glTF/2.0/Extensions/KHR_materials_dispersion.pure.d.ts +36 -0
  92. package/glTF/2.0/Extensions/KHR_materials_dispersion.pure.js +75 -0
  93. package/glTF/2.0/Extensions/KHR_materials_dispersion.pure.js.map +1 -0
  94. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +3 -25
  95. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +5 -54
  96. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
  97. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.pure.d.ts +32 -0
  98. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.pure.js +69 -0
  99. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.pure.js.map +1 -0
  100. package/glTF/2.0/Extensions/KHR_materials_fuzz.d.ts +3 -30
  101. package/glTF/2.0/Extensions/KHR_materials_fuzz.js +5 -191
  102. package/glTF/2.0/Extensions/KHR_materials_fuzz.js.map +1 -1
  103. package/glTF/2.0/Extensions/KHR_materials_fuzz.pure.d.ts +37 -0
  104. package/glTF/2.0/Extensions/KHR_materials_fuzz.pure.js +206 -0
  105. package/glTF/2.0/Extensions/KHR_materials_fuzz.pure.js.map +1 -0
  106. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +3 -27
  107. package/glTF/2.0/Extensions/KHR_materials_ior.js +5 -67
  108. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  109. package/glTF/2.0/Extensions/KHR_materials_ior.pure.d.ts +34 -0
  110. package/glTF/2.0/Extensions/KHR_materials_ior.pure.js +81 -0
  111. package/glTF/2.0/Extensions/KHR_materials_ior.pure.js.map +1 -0
  112. package/glTF/2.0/Extensions/KHR_materials_iridescence.d.ts +3 -22
  113. package/glTF/2.0/Extensions/KHR_materials_iridescence.js +5 -100
  114. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
  115. package/glTF/2.0/Extensions/KHR_materials_iridescence.pure.d.ts +29 -0
  116. package/glTF/2.0/Extensions/KHR_materials_iridescence.pure.js +115 -0
  117. package/glTF/2.0/Extensions/KHR_materials_iridescence.pure.js.map +1 -0
  118. package/glTF/2.0/Extensions/KHR_materials_openpbr.d.ts +3 -25
  119. package/glTF/2.0/Extensions/KHR_materials_openpbr.js +5 -41
  120. package/glTF/2.0/Extensions/KHR_materials_openpbr.js.map +1 -1
  121. package/glTF/2.0/Extensions/KHR_materials_openpbr.pure.d.ts +32 -0
  122. package/glTF/2.0/Extensions/KHR_materials_openpbr.pure.js +56 -0
  123. package/glTF/2.0/Extensions/KHR_materials_openpbr.pure.js.map +1 -0
  124. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +3 -22
  125. package/glTF/2.0/Extensions/KHR_materials_sheen.js +5 -63
  126. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  127. package/glTF/2.0/Extensions/KHR_materials_sheen.pure.d.ts +29 -0
  128. package/glTF/2.0/Extensions/KHR_materials_sheen.pure.js +78 -0
  129. package/glTF/2.0/Extensions/KHR_materials_sheen.pure.js.map +1 -0
  130. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +3 -39
  131. package/glTF/2.0/Extensions/KHR_materials_specular.js +5 -123
  132. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  133. package/glTF/2.0/Extensions/KHR_materials_specular.pure.d.ts +46 -0
  134. package/glTF/2.0/Extensions/KHR_materials_specular.pure.js +138 -0
  135. package/glTF/2.0/Extensions/KHR_materials_specular.pure.js.map +1 -0
  136. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +3 -38
  137. package/glTF/2.0/Extensions/KHR_materials_transmission.js +5 -145
  138. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  139. package/glTF/2.0/Extensions/KHR_materials_transmission.pure.d.ts +45 -0
  140. package/glTF/2.0/Extensions/KHR_materials_transmission.pure.js +160 -0
  141. package/glTF/2.0/Extensions/KHR_materials_transmission.pure.js.map +1 -0
  142. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +3 -18
  143. package/glTF/2.0/Extensions/KHR_materials_unlit.js +5 -43
  144. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  145. package/glTF/2.0/Extensions/KHR_materials_unlit.pure.d.ts +25 -0
  146. package/glTF/2.0/Extensions/KHR_materials_unlit.pure.js +58 -0
  147. package/glTF/2.0/Extensions/KHR_materials_unlit.pure.js.map +1 -0
  148. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +3 -38
  149. package/glTF/2.0/Extensions/KHR_materials_volume.js +5 -169
  150. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  151. package/glTF/2.0/Extensions/KHR_materials_volume.pure.d.ts +45 -0
  152. package/glTF/2.0/Extensions/KHR_materials_volume.pure.js +184 -0
  153. package/glTF/2.0/Extensions/KHR_materials_volume.pure.js.map +1 -0
  154. package/glTF/2.0/Extensions/KHR_materials_volume_scatter.d.ts +3 -38
  155. package/glTF/2.0/Extensions/KHR_materials_volume_scatter.js +5 -130
  156. package/glTF/2.0/Extensions/KHR_materials_volume_scatter.js.map +1 -1
  157. package/glTF/2.0/Extensions/KHR_materials_volume_scatter.pure.d.ts +45 -0
  158. package/glTF/2.0/Extensions/KHR_materials_volume_scatter.pure.js +145 -0
  159. package/glTF/2.0/Extensions/KHR_materials_volume_scatter.pure.js.map +1 -0
  160. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +3 -14
  161. package/glTF/2.0/Extensions/KHR_texture_basisu.js +5 -37
  162. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
  163. package/glTF/2.0/Extensions/KHR_texture_basisu.pure.d.ts +26 -0
  164. package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js +57 -0
  165. package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js.map +1 -0
  166. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +3 -19
  167. package/glTF/2.0/Extensions/KHR_texture_transform.js +5 -90
  168. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  169. package/glTF/2.0/Extensions/KHR_texture_transform.pure.d.ts +26 -0
  170. package/glTF/2.0/Extensions/KHR_texture_transform.pure.js +105 -0
  171. package/glTF/2.0/Extensions/KHR_texture_transform.pure.js.map +1 -0
  172. package/glTF/2.0/Extensions/pure.d.ts +26 -0
  173. package/glTF/2.0/Extensions/pure.js +27 -0
  174. package/glTF/2.0/Extensions/pure.js.map +1 -0
  175. package/glTF/2.0/pure.d.ts +5 -0
  176. package/glTF/2.0/pure.js +7 -0
  177. package/glTF/2.0/pure.js.map +1 -0
  178. package/glTF/pure.d.ts +3 -0
  179. package/glTF/pure.js +5 -0
  180. package/glTF/pure.js.map +1 -0
  181. package/package.json +30 -4
  182. package/pure.d.ts +7 -0
  183. package/pure.js +9 -0
  184. package/pure.js.map +1 -0
  185. package/stl/pure.d.ts +2 -0
  186. package/stl/pure.js +3 -0
  187. package/stl/pure.js.map +1 -0
@@ -1,141 +1,9 @@
1
- import { GLTFExporter } from "../glTFExporter.js";
2
- import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
3
- import "@babylonjs/core/Meshes/thinInstanceMesh.js";
4
- import { TmpVectors, Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.js";
5
- import { ConvertToRightHandedPosition, ConvertToRightHandedRotation } from "../glTFUtilities.js";
6
- import { Logger } from "@babylonjs/core/Misc/logger.js";
7
- const NAME = "EXT_mesh_gpu_instancing";
8
- function ColorBufferToRGBAToRGB(colorBuffer, instanceCount) {
9
- const colorBufferRgb = new Float32Array(instanceCount * 3);
10
- for (let i = 0; i < instanceCount; i++) {
11
- colorBufferRgb[i * 3 + 0] = colorBuffer[i * 4 + 0];
12
- colorBufferRgb[i * 3 + 1] = colorBuffer[i * 4 + 1];
13
- colorBufferRgb[i * 3 + 2] = colorBuffer[i * 4 + 2];
14
- }
15
- return colorBufferRgb;
16
- }
17
1
  /**
18
- * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md)
2
+ * Re-exports the pure implementation and applies the runtime registration side effect.
3
+ * Import "./EXT_mesh_gpu_instancing.pure" for tree-shakeable, side-effect-free usage.
19
4
  */
20
- // eslint-disable-next-line @typescript-eslint/naming-convention
21
- export class EXT_mesh_gpu_instancing {
22
- constructor(exporter) {
23
- /** Name of this extension */
24
- this.name = NAME;
25
- /** Defines whether this extension is enabled */
26
- this.enabled = true;
27
- /** Defines whether this extension is required */
28
- this.required = false;
29
- /**
30
- * Internal state to emit warning about instance color alpha once
31
- */
32
- this._instanceColorWarned = false;
33
- this._wasUsed = false;
34
- this._exporter = exporter;
35
- }
36
- dispose() { }
37
- /** @internal */
38
- get wasUsed() {
39
- return this._wasUsed;
40
- }
41
- /**
42
- * After node is exported
43
- * @param context the GLTF context when loading the asset
44
- * @param node the node exported
45
- * @param babylonNode the corresponding babylon node
46
- * @param nodeMap map from babylon node id to node index
47
- * @param convertToRightHanded true if we need to convert data from left hand to right hand system.
48
- * @param bufferManager buffer manager
49
- * @returns nullable promise, resolves with the node
50
- */
51
- async postExportNodeAsync(context, node, babylonNode, nodeMap, convertToRightHanded, bufferManager) {
52
- return await new Promise((resolve) => {
53
- if (node && babylonNode instanceof Mesh) {
54
- if (babylonNode.hasThinInstances && this._exporter) {
55
- this._wasUsed = true;
56
- const noTranslation = Vector3.Zero();
57
- const noRotation = Quaternion.Identity();
58
- const noScale = Vector3.One();
59
- // retrieve all the instance world matrix
60
- const matrix = babylonNode.thinInstanceGetWorldMatrices();
61
- const iwt = TmpVectors.Vector3[2];
62
- const iwr = TmpVectors.Quaternion[1];
63
- const iws = TmpVectors.Vector3[3];
64
- let hasAnyInstanceWorldTranslation = false;
65
- let hasAnyInstanceWorldRotation = false;
66
- let hasAnyInstanceWorldScale = false;
67
- // prepare temp buffers
68
- const translationBuffer = new Float32Array(babylonNode.thinInstanceCount * 3);
69
- const rotationBuffer = new Float32Array(babylonNode.thinInstanceCount * 4);
70
- const scaleBuffer = new Float32Array(babylonNode.thinInstanceCount * 3);
71
- let i = 0;
72
- for (const m of matrix) {
73
- m.decompose(iws, iwr, iwt);
74
- if (convertToRightHanded) {
75
- ConvertToRightHandedPosition(iwt);
76
- ConvertToRightHandedRotation(iwr);
77
- }
78
- // fill the temp buffer
79
- translationBuffer.set(iwt.asArray(), i * 3);
80
- rotationBuffer.set(iwr.normalize().asArray(), i * 4); // ensure the quaternion is normalized
81
- scaleBuffer.set(iws.asArray(), i * 3);
82
- // this is where we decide if there is any transformation
83
- hasAnyInstanceWorldTranslation = hasAnyInstanceWorldTranslation || !iwt.equalsWithEpsilon(noTranslation);
84
- hasAnyInstanceWorldRotation = hasAnyInstanceWorldRotation || !iwr.equalsWithEpsilon(noRotation);
85
- hasAnyInstanceWorldScale = hasAnyInstanceWorldScale || !iws.equalsWithEpsilon(noScale);
86
- i++;
87
- }
88
- const extension = {
89
- attributes: {},
90
- };
91
- // do we need to write TRANSLATION ?
92
- if (hasAnyInstanceWorldTranslation) {
93
- extension.attributes["TRANSLATION"] = this._buildAccessor(translationBuffer, "VEC3" /* AccessorType.VEC3 */, babylonNode.thinInstanceCount, bufferManager);
94
- }
95
- // do we need to write ROTATION ?
96
- if (hasAnyInstanceWorldRotation) {
97
- // we decided to stay on FLOAT for now see https://github.com/BabylonJS/Babylon.js/pull/12495
98
- extension.attributes["ROTATION"] = this._buildAccessor(rotationBuffer, "VEC4" /* AccessorType.VEC4 */, babylonNode.thinInstanceCount, bufferManager);
99
- }
100
- // do we need to write SCALE ?
101
- if (hasAnyInstanceWorldScale) {
102
- extension.attributes["SCALE"] = this._buildAccessor(scaleBuffer, "VEC3" /* AccessorType.VEC3 */, babylonNode.thinInstanceCount, bufferManager);
103
- }
104
- let colorBuffer = babylonNode._userThinInstanceBuffersStorage?.data?.instanceColor;
105
- if (colorBuffer) {
106
- const instanceCount = babylonNode.thinInstanceCount;
107
- const accessorType = "VEC3" /* AccessorType.VEC3 */;
108
- if (babylonNode.hasVertexAlpha && colorBuffer.length === instanceCount * 4) {
109
- if (!this._instanceColorWarned) {
110
- Logger.Warn("EXT_mesh_gpu_instancing: Exporting instance colors as RGB, alpha channel of instance color is not exported");
111
- this._instanceColorWarned = true;
112
- }
113
- colorBuffer = ColorBufferToRGBAToRGB(colorBuffer, instanceCount);
114
- }
115
- else if (colorBuffer.length === instanceCount * 4) {
116
- colorBuffer = ColorBufferToRGBAToRGB(colorBuffer, instanceCount);
117
- }
118
- if (colorBuffer.length === instanceCount * 3) {
119
- extension.attributes["_COLOR_0"] = this._buildAccessor(colorBuffer, accessorType, instanceCount, bufferManager);
120
- }
121
- }
122
- /* eslint-enable @typescript-eslint/naming-convention*/
123
- node.extensions = node.extensions || {};
124
- node.extensions[NAME] = extension;
125
- }
126
- }
127
- resolve(node);
128
- });
129
- }
130
- _buildAccessor(buffer, type, count, bufferManager) {
131
- // build the buffer view
132
- const bv = bufferManager.createBufferView(buffer);
133
- // finally build the accessor
134
- const accessor = bufferManager.createAccessor(bv, type, 5126 /* AccessorComponentType.FLOAT */, count);
135
- this._exporter._accessors.push(accessor);
136
- return this._exporter._accessors.length - 1;
137
- }
138
- }
139
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
140
- GLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_mesh_gpu_instancing(exporter));
5
+ export * from "./EXT_mesh_gpu_instancing.pure.js";
6
+ import "@babylonjs/core/Meshes/thinInstanceMesh.js";
7
+ import { RegisterEXT_mesh_gpu_instancing } from "./EXT_mesh_gpu_instancing.pure.js";
8
+ RegisterEXT_mesh_gpu_instancing();
141
9
  //# sourceMappingURL=EXT_mesh_gpu_instancing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EXT_mesh_gpu_instancing.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAE9F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAEvC,SAAS,sBAAsB,CAAC,WAAyB,EAAE,aAAqB;IAC5E,MAAM,cAAc,GAAG,IAAI,YAAY,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;IAE3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,cAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACnD,cAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACnD,cAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,OAA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BAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["import { type INode, type IEXTMeshGpuInstancing, AccessorType, AccessorComponentType } from \"babylonjs-gltf2interface\";\r\nimport { type IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\r\nimport { type BufferManager } from \"../bufferManager\";\r\nimport { GLTFExporter } from \"../glTFExporter\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type Node } from \"core/node\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport \"core/Meshes/thinInstanceMesh\";\r\nimport { TmpVectors, Quaternion, Vector3 } from \"core/Maths/math.vector\";\r\nimport { ConvertToRightHandedPosition, ConvertToRightHandedRotation } from \"../glTFUtilities\";\r\n\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\nconst NAME = \"EXT_mesh_gpu_instancing\";\r\n\r\nfunction ColorBufferToRGBAToRGB(colorBuffer: Float32Array, instanceCount: number) {\r\n const colorBufferRgb = new Float32Array(instanceCount * 3);\r\n\r\n for (let i = 0; i < instanceCount; i++) {\r\n colorBufferRgb[i * 3 + 0] = colorBuffer[i * 4 + 0];\r\n colorBufferRgb[i * 3 + 1] = colorBuffer[i * 4 + 1];\r\n colorBufferRgb[i * 3 + 2] = colorBuffer[i * 4 + 2];\r\n }\r\n return colorBufferRgb;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_mesh_gpu_instancing implements IGLTFExporterExtensionV2 {\r\n /** Name of this extension */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled */\r\n public enabled = true;\r\n\r\n /** Defines whether this extension is required */\r\n public required = false;\r\n\r\n /**\r\n * Internal state to emit warning about instance color alpha once\r\n */\r\n private _instanceColorWarned = false;\r\n\r\n private _exporter: GLTFExporter;\r\n\r\n private _wasUsed = false;\r\n\r\n constructor(exporter: GLTFExporter) {\r\n this._exporter = exporter;\r\n }\r\n\r\n public dispose() {}\r\n\r\n /** @internal */\r\n public get wasUsed() {\r\n return this._wasUsed;\r\n }\r\n\r\n /**\r\n * After node is exported\r\n * @param context the GLTF context when loading the asset\r\n * @param node the node exported\r\n * @param babylonNode the corresponding babylon node\r\n * @param nodeMap map from babylon node id to node index\r\n * @param convertToRightHanded true if we need to convert data from left hand to right hand system.\r\n * @param bufferManager buffer manager\r\n * @returns nullable promise, resolves with the node\r\n */\r\n public async postExportNodeAsync(\r\n context: string,\r\n node: Nullable<INode>,\r\n babylonNode: Node,\r\n nodeMap: Map<Node, number>,\r\n convertToRightHanded: boolean,\r\n bufferManager: BufferManager\r\n ): Promise<Nullable<INode>> {\r\n return await new Promise((resolve) => {\r\n if (node && babylonNode instanceof Mesh) {\r\n if (babylonNode.hasThinInstances && this._exporter) {\r\n this._wasUsed = true;\r\n\r\n const noTranslation = Vector3.Zero();\r\n const noRotation = Quaternion.Identity();\r\n const noScale = Vector3.One();\r\n\r\n // retrieve all the instance world matrix\r\n const matrix = babylonNode.thinInstanceGetWorldMatrices();\r\n\r\n const iwt = TmpVectors.Vector3[2];\r\n const iwr = TmpVectors.Quaternion[1];\r\n const iws = TmpVectors.Vector3[3];\r\n\r\n let hasAnyInstanceWorldTranslation = false;\r\n let hasAnyInstanceWorldRotation = false;\r\n let hasAnyInstanceWorldScale = false;\r\n\r\n // prepare temp buffers\r\n const translationBuffer = new Float32Array(babylonNode.thinInstanceCount * 3);\r\n const rotationBuffer = new Float32Array(babylonNode.thinInstanceCount * 4);\r\n const scaleBuffer = new Float32Array(babylonNode.thinInstanceCount * 3);\r\n\r\n let i = 0;\r\n for (const m of matrix) {\r\n m.decompose(iws, iwr, iwt);\r\n\r\n if (convertToRightHanded) {\r\n ConvertToRightHandedPosition(iwt);\r\n ConvertToRightHandedRotation(iwr);\r\n }\r\n\r\n // fill the temp buffer\r\n translationBuffer.set(iwt.asArray(), i * 3);\r\n rotationBuffer.set(iwr.normalize().asArray(), i * 4); // ensure the quaternion is normalized\r\n scaleBuffer.set(iws.asArray(), i * 3);\r\n\r\n // this is where we decide if there is any transformation\r\n hasAnyInstanceWorldTranslation = hasAnyInstanceWorldTranslation || !iwt.equalsWithEpsilon(noTranslation);\r\n hasAnyInstanceWorldRotation = hasAnyInstanceWorldRotation || !iwr.equalsWithEpsilon(noRotation);\r\n hasAnyInstanceWorldScale = hasAnyInstanceWorldScale || !iws.equalsWithEpsilon(noScale);\r\n\r\n i++;\r\n }\r\n\r\n const extension: IEXTMeshGpuInstancing = {\r\n attributes: {},\r\n };\r\n\r\n // do we need to write TRANSLATION ?\r\n if (hasAnyInstanceWorldTranslation) {\r\n extension.attributes[\"TRANSLATION\"] = this._buildAccessor(translationBuffer, AccessorType.VEC3, babylonNode.thinInstanceCount, bufferManager);\r\n }\r\n // do we need to write ROTATION ?\r\n if (hasAnyInstanceWorldRotation) {\r\n // we decided to stay on FLOAT for now see https://github.com/BabylonJS/Babylon.js/pull/12495\r\n extension.attributes[\"ROTATION\"] = this._buildAccessor(rotationBuffer, AccessorType.VEC4, babylonNode.thinInstanceCount, bufferManager);\r\n }\r\n // do we need to write SCALE ?\r\n if (hasAnyInstanceWorldScale) {\r\n extension.attributes[\"SCALE\"] = this._buildAccessor(scaleBuffer, AccessorType.VEC3, babylonNode.thinInstanceCount, bufferManager);\r\n }\r\n let colorBuffer = babylonNode._userThinInstanceBuffersStorage?.data?.instanceColor;\r\n if (colorBuffer) {\r\n const instanceCount = babylonNode.thinInstanceCount;\r\n const accessorType = AccessorType.VEC3;\r\n if (babylonNode.hasVertexAlpha && colorBuffer.length === instanceCount * 4) {\r\n if (!this._instanceColorWarned) {\r\n Logger.Warn(\"EXT_mesh_gpu_instancing: Exporting instance colors as RGB, alpha channel of instance color is not exported\");\r\n this._instanceColorWarned = true;\r\n }\r\n colorBuffer = ColorBufferToRGBAToRGB(colorBuffer, instanceCount);\r\n } else if (colorBuffer.length === instanceCount * 4) {\r\n colorBuffer = ColorBufferToRGBAToRGB(colorBuffer, instanceCount);\r\n }\r\n if (colorBuffer.length === instanceCount * 3) {\r\n extension.attributes[\"_COLOR_0\"] = this._buildAccessor(colorBuffer, accessorType, instanceCount, bufferManager);\r\n }\r\n }\r\n\r\n /* eslint-enable @typescript-eslint/naming-convention*/\r\n node.extensions = node.extensions || {};\r\n node.extensions[NAME] = extension;\r\n }\r\n }\r\n resolve(node);\r\n });\r\n }\r\n\r\n private _buildAccessor(buffer: Float32Array, type: AccessorType, count: number, bufferManager: BufferManager): number {\r\n // build the buffer view\r\n const bv = bufferManager.createBufferView(buffer);\r\n\r\n // finally build the accessor\r\n const accessor = bufferManager.createAccessor(bv, type, AccessorComponentType.FLOAT, count);\r\n this._exporter._accessors.push(accessor);\r\n return this._exporter._accessors.length - 1;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nGLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_mesh_gpu_instancing(exporter));\r\n"]}
1
+ {"version":3,"file":"EXT_mesh_gpu_instancing.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,gCAAgC,CAAC;AAE/C,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AACjF,+BAA+B,EAAE,CAAC","sourcesContent":["/**\r\n * Re-exports the pure implementation and applies the runtime registration side effect.\r\n * Import \"./EXT_mesh_gpu_instancing.pure\" for tree-shakeable, side-effect-free usage.\r\n */\r\nexport * from \"./EXT_mesh_gpu_instancing.pure\";\r\n\r\nimport \"core/Meshes/thinInstanceMesh\";\r\n\r\nimport { RegisterEXT_mesh_gpu_instancing } from \"./EXT_mesh_gpu_instancing.pure\";\r\nRegisterEXT_mesh_gpu_instancing();\r\n"]}
@@ -0,0 +1,44 @@
1
+ import { type INode } from "babylonjs-gltf2interface";
2
+ import { type IGLTFExporterExtensionV2 } from "../glTFExporterExtension.js";
3
+ import { type BufferManager } from "../bufferManager.js";
4
+ import { GLTFExporter } from "../glTFExporter.js";
5
+ import { type Nullable } from "@babylonjs/core/types.js";
6
+ import { type Node } from "@babylonjs/core/node.js";
7
+ /**
8
+ * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md)
9
+ */
10
+ export declare class EXT_mesh_gpu_instancing implements IGLTFExporterExtensionV2 {
11
+ /** Name of this extension */
12
+ readonly name = "EXT_mesh_gpu_instancing";
13
+ /** Defines whether this extension is enabled */
14
+ enabled: boolean;
15
+ /** Defines whether this extension is required */
16
+ required: boolean;
17
+ /**
18
+ * Internal state to emit warning about instance color alpha once
19
+ */
20
+ private _instanceColorWarned;
21
+ private _exporter;
22
+ private _wasUsed;
23
+ constructor(exporter: GLTFExporter);
24
+ dispose(): void;
25
+ /** @internal */
26
+ get wasUsed(): boolean;
27
+ /**
28
+ * After node is exported
29
+ * @param context the GLTF context when loading the asset
30
+ * @param node the node exported
31
+ * @param babylonNode the corresponding babylon node
32
+ * @param nodeMap map from babylon node id to node index
33
+ * @param convertToRightHanded true if we need to convert data from left hand to right hand system.
34
+ * @param bufferManager buffer manager
35
+ * @returns nullable promise, resolves with the node
36
+ */
37
+ postExportNodeAsync(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap: Map<Node, number>, convertToRightHanded: boolean, bufferManager: BufferManager): Promise<Nullable<INode>>;
38
+ private _buildAccessor;
39
+ }
40
+ /**
41
+ * Registers the EXT_mesh_gpu_instancing glTF serializer extension with the {@link GLTFExporter}.
42
+ * Safe to call multiple times; only the first call has an effect.
43
+ */
44
+ export declare function RegisterEXT_mesh_gpu_instancing(): void;
@@ -0,0 +1,151 @@
1
+ import { GLTFExporter } from "../glTFExporter.js";
2
+ import { Mesh } from "@babylonjs/core/Meshes/mesh.pure.js";
3
+ import { TmpVectors, Quaternion, Vector3 } from "@babylonjs/core/Maths/math.vector.pure.js";
4
+ import { ConvertToRightHandedPosition, ConvertToRightHandedRotation } from "../glTFUtilities.js";
5
+ import { Logger } from "@babylonjs/core/Misc/logger.js";
6
+ const NAME = "EXT_mesh_gpu_instancing";
7
+ function ColorBufferToRGBAToRGB(colorBuffer, instanceCount) {
8
+ const colorBufferRgb = new Float32Array(instanceCount * 3);
9
+ for (let i = 0; i < instanceCount; i++) {
10
+ colorBufferRgb[i * 3 + 0] = colorBuffer[i * 4 + 0];
11
+ colorBufferRgb[i * 3 + 1] = colorBuffer[i * 4 + 1];
12
+ colorBufferRgb[i * 3 + 2] = colorBuffer[i * 4 + 2];
13
+ }
14
+ return colorBufferRgb;
15
+ }
16
+ /**
17
+ * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md)
18
+ */
19
+ // eslint-disable-next-line @typescript-eslint/naming-convention
20
+ export class EXT_mesh_gpu_instancing {
21
+ constructor(exporter) {
22
+ /** Name of this extension */
23
+ this.name = NAME;
24
+ /** Defines whether this extension is enabled */
25
+ this.enabled = true;
26
+ /** Defines whether this extension is required */
27
+ this.required = false;
28
+ /**
29
+ * Internal state to emit warning about instance color alpha once
30
+ */
31
+ this._instanceColorWarned = false;
32
+ this._wasUsed = false;
33
+ this._exporter = exporter;
34
+ }
35
+ dispose() { }
36
+ /** @internal */
37
+ get wasUsed() {
38
+ return this._wasUsed;
39
+ }
40
+ /**
41
+ * After node is exported
42
+ * @param context the GLTF context when loading the asset
43
+ * @param node the node exported
44
+ * @param babylonNode the corresponding babylon node
45
+ * @param nodeMap map from babylon node id to node index
46
+ * @param convertToRightHanded true if we need to convert data from left hand to right hand system.
47
+ * @param bufferManager buffer manager
48
+ * @returns nullable promise, resolves with the node
49
+ */
50
+ async postExportNodeAsync(context, node, babylonNode, nodeMap, convertToRightHanded, bufferManager) {
51
+ return await new Promise((resolve) => {
52
+ if (node && babylonNode instanceof Mesh) {
53
+ if (babylonNode.hasThinInstances && this._exporter) {
54
+ this._wasUsed = true;
55
+ const noTranslation = Vector3.Zero();
56
+ const noRotation = Quaternion.Identity();
57
+ const noScale = Vector3.One();
58
+ // retrieve all the instance world matrix
59
+ const matrix = babylonNode.thinInstanceGetWorldMatrices();
60
+ const iwt = TmpVectors.Vector3[2];
61
+ const iwr = TmpVectors.Quaternion[1];
62
+ const iws = TmpVectors.Vector3[3];
63
+ let hasAnyInstanceWorldTranslation = false;
64
+ let hasAnyInstanceWorldRotation = false;
65
+ let hasAnyInstanceWorldScale = false;
66
+ // prepare temp buffers
67
+ const translationBuffer = new Float32Array(babylonNode.thinInstanceCount * 3);
68
+ const rotationBuffer = new Float32Array(babylonNode.thinInstanceCount * 4);
69
+ const scaleBuffer = new Float32Array(babylonNode.thinInstanceCount * 3);
70
+ let i = 0;
71
+ for (const m of matrix) {
72
+ m.decompose(iws, iwr, iwt);
73
+ if (convertToRightHanded) {
74
+ ConvertToRightHandedPosition(iwt);
75
+ ConvertToRightHandedRotation(iwr);
76
+ }
77
+ // fill the temp buffer
78
+ translationBuffer.set(iwt.asArray(), i * 3);
79
+ rotationBuffer.set(iwr.normalize().asArray(), i * 4); // ensure the quaternion is normalized
80
+ scaleBuffer.set(iws.asArray(), i * 3);
81
+ // this is where we decide if there is any transformation
82
+ hasAnyInstanceWorldTranslation = hasAnyInstanceWorldTranslation || !iwt.equalsWithEpsilon(noTranslation);
83
+ hasAnyInstanceWorldRotation = hasAnyInstanceWorldRotation || !iwr.equalsWithEpsilon(noRotation);
84
+ hasAnyInstanceWorldScale = hasAnyInstanceWorldScale || !iws.equalsWithEpsilon(noScale);
85
+ i++;
86
+ }
87
+ const extension = {
88
+ attributes: {},
89
+ };
90
+ // do we need to write TRANSLATION ?
91
+ if (hasAnyInstanceWorldTranslation) {
92
+ extension.attributes["TRANSLATION"] = this._buildAccessor(translationBuffer, "VEC3" /* AccessorType.VEC3 */, babylonNode.thinInstanceCount, bufferManager);
93
+ }
94
+ // do we need to write ROTATION ?
95
+ if (hasAnyInstanceWorldRotation) {
96
+ // we decided to stay on FLOAT for now see https://github.com/BabylonJS/Babylon.js/pull/12495
97
+ extension.attributes["ROTATION"] = this._buildAccessor(rotationBuffer, "VEC4" /* AccessorType.VEC4 */, babylonNode.thinInstanceCount, bufferManager);
98
+ }
99
+ // do we need to write SCALE ?
100
+ if (hasAnyInstanceWorldScale) {
101
+ extension.attributes["SCALE"] = this._buildAccessor(scaleBuffer, "VEC3" /* AccessorType.VEC3 */, babylonNode.thinInstanceCount, bufferManager);
102
+ }
103
+ let colorBuffer = babylonNode._userThinInstanceBuffersStorage?.data?.instanceColor;
104
+ if (colorBuffer) {
105
+ const instanceCount = babylonNode.thinInstanceCount;
106
+ const accessorType = "VEC3" /* AccessorType.VEC3 */;
107
+ if (babylonNode.hasVertexAlpha && colorBuffer.length === instanceCount * 4) {
108
+ if (!this._instanceColorWarned) {
109
+ Logger.Warn("EXT_mesh_gpu_instancing: Exporting instance colors as RGB, alpha channel of instance color is not exported");
110
+ this._instanceColorWarned = true;
111
+ }
112
+ colorBuffer = ColorBufferToRGBAToRGB(colorBuffer, instanceCount);
113
+ }
114
+ else if (colorBuffer.length === instanceCount * 4) {
115
+ colorBuffer = ColorBufferToRGBAToRGB(colorBuffer, instanceCount);
116
+ }
117
+ if (colorBuffer.length === instanceCount * 3) {
118
+ extension.attributes["_COLOR_0"] = this._buildAccessor(colorBuffer, accessorType, instanceCount, bufferManager);
119
+ }
120
+ }
121
+ /* eslint-enable @typescript-eslint/naming-convention*/
122
+ node.extensions = node.extensions || {};
123
+ node.extensions[NAME] = extension;
124
+ }
125
+ }
126
+ resolve(node);
127
+ });
128
+ }
129
+ _buildAccessor(buffer, type, count, bufferManager) {
130
+ // build the buffer view
131
+ const bv = bufferManager.createBufferView(buffer);
132
+ // finally build the accessor
133
+ const accessor = bufferManager.createAccessor(bv, type, 5126 /* AccessorComponentType.FLOAT */, count);
134
+ this._exporter._accessors.push(accessor);
135
+ return this._exporter._accessors.length - 1;
136
+ }
137
+ }
138
+ let _Registered = false;
139
+ /**
140
+ * Registers the EXT_mesh_gpu_instancing glTF serializer extension with the {@link GLTFExporter}.
141
+ * Safe to call multiple times; only the first call has an effect.
142
+ */
143
+ // eslint-disable-next-line @typescript-eslint/naming-convention
144
+ export function RegisterEXT_mesh_gpu_instancing() {
145
+ if (_Registered) {
146
+ return;
147
+ }
148
+ _Registered = true;
149
+ GLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_mesh_gpu_instancing(exporter));
150
+ }
151
+ //# sourceMappingURL=EXT_mesh_gpu_instancing.pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EXT_mesh_gpu_instancing.pure.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.pure.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAE9F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAEvC,SAAS,sBAAsB,CAAC,WAAyB,EAAE,aAAqB;IAC5E,MAAM,cAAc,GAAG,IAAI,YAAY,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;IAE3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,cAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACnD,cAAc,CAAC,CAAC,GAAG,CAA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I,CAAC,QAAQ,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAChD,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,gEAAgE;AAChE,MAAM,UAAU,+BAA+B;IAC3C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["import { type INode, type IEXTMeshGpuInstancing, AccessorType, AccessorComponentType } from \"babylonjs-gltf2interface\";\r\nimport { type IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\r\nimport { type BufferManager } from \"../bufferManager\";\r\nimport { GLTFExporter } from \"../glTFExporter\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type Node } from \"core/node\";\r\nimport { Mesh } from \"core/Meshes/mesh.pure\";\r\nimport { TmpVectors, Quaternion, Vector3 } from \"core/Maths/math.vector.pure\";\r\nimport { ConvertToRightHandedPosition, ConvertToRightHandedRotation } from \"../glTFUtilities\";\r\n\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\nconst NAME = \"EXT_mesh_gpu_instancing\";\r\n\r\nfunction ColorBufferToRGBAToRGB(colorBuffer: Float32Array, instanceCount: number) {\r\n const colorBufferRgb = new Float32Array(instanceCount * 3);\r\n\r\n for (let i = 0; i < instanceCount; i++) {\r\n colorBufferRgb[i * 3 + 0] = colorBuffer[i * 4 + 0];\r\n colorBufferRgb[i * 3 + 1] = colorBuffer[i * 4 + 1];\r\n colorBufferRgb[i * 3 + 2] = colorBuffer[i * 4 + 2];\r\n }\r\n return colorBufferRgb;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_mesh_gpu_instancing implements IGLTFExporterExtensionV2 {\r\n /** Name of this extension */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled */\r\n public enabled = true;\r\n\r\n /** Defines whether this extension is required */\r\n public required = false;\r\n\r\n /**\r\n * Internal state to emit warning about instance color alpha once\r\n */\r\n private _instanceColorWarned = false;\r\n\r\n private _exporter: GLTFExporter;\r\n\r\n private _wasUsed = false;\r\n\r\n constructor(exporter: GLTFExporter) {\r\n this._exporter = exporter;\r\n }\r\n\r\n public dispose() {}\r\n\r\n /** @internal */\r\n public get wasUsed() {\r\n return this._wasUsed;\r\n }\r\n\r\n /**\r\n * After node is exported\r\n * @param context the GLTF context when loading the asset\r\n * @param node the node exported\r\n * @param babylonNode the corresponding babylon node\r\n * @param nodeMap map from babylon node id to node index\r\n * @param convertToRightHanded true if we need to convert data from left hand to right hand system.\r\n * @param bufferManager buffer manager\r\n * @returns nullable promise, resolves with the node\r\n */\r\n public async postExportNodeAsync(\r\n context: string,\r\n node: Nullable<INode>,\r\n babylonNode: Node,\r\n nodeMap: Map<Node, number>,\r\n convertToRightHanded: boolean,\r\n bufferManager: BufferManager\r\n ): Promise<Nullable<INode>> {\r\n return await new Promise((resolve) => {\r\n if (node && babylonNode instanceof Mesh) {\r\n if (babylonNode.hasThinInstances && this._exporter) {\r\n this._wasUsed = true;\r\n\r\n const noTranslation = Vector3.Zero();\r\n const noRotation = Quaternion.Identity();\r\n const noScale = Vector3.One();\r\n\r\n // retrieve all the instance world matrix\r\n const matrix = babylonNode.thinInstanceGetWorldMatrices();\r\n\r\n const iwt = TmpVectors.Vector3[2];\r\n const iwr = TmpVectors.Quaternion[1];\r\n const iws = TmpVectors.Vector3[3];\r\n\r\n let hasAnyInstanceWorldTranslation = false;\r\n let hasAnyInstanceWorldRotation = false;\r\n let hasAnyInstanceWorldScale = false;\r\n\r\n // prepare temp buffers\r\n const translationBuffer = new Float32Array(babylonNode.thinInstanceCount * 3);\r\n const rotationBuffer = new Float32Array(babylonNode.thinInstanceCount * 4);\r\n const scaleBuffer = new Float32Array(babylonNode.thinInstanceCount * 3);\r\n\r\n let i = 0;\r\n for (const m of matrix) {\r\n m.decompose(iws, iwr, iwt);\r\n\r\n if (convertToRightHanded) {\r\n ConvertToRightHandedPosition(iwt);\r\n ConvertToRightHandedRotation(iwr);\r\n }\r\n\r\n // fill the temp buffer\r\n translationBuffer.set(iwt.asArray(), i * 3);\r\n rotationBuffer.set(iwr.normalize().asArray(), i * 4); // ensure the quaternion is normalized\r\n scaleBuffer.set(iws.asArray(), i * 3);\r\n\r\n // this is where we decide if there is any transformation\r\n hasAnyInstanceWorldTranslation = hasAnyInstanceWorldTranslation || !iwt.equalsWithEpsilon(noTranslation);\r\n hasAnyInstanceWorldRotation = hasAnyInstanceWorldRotation || !iwr.equalsWithEpsilon(noRotation);\r\n hasAnyInstanceWorldScale = hasAnyInstanceWorldScale || !iws.equalsWithEpsilon(noScale);\r\n\r\n i++;\r\n }\r\n\r\n const extension: IEXTMeshGpuInstancing = {\r\n attributes: {},\r\n };\r\n\r\n // do we need to write TRANSLATION ?\r\n if (hasAnyInstanceWorldTranslation) {\r\n extension.attributes[\"TRANSLATION\"] = this._buildAccessor(translationBuffer, AccessorType.VEC3, babylonNode.thinInstanceCount, bufferManager);\r\n }\r\n // do we need to write ROTATION ?\r\n if (hasAnyInstanceWorldRotation) {\r\n // we decided to stay on FLOAT for now see https://github.com/BabylonJS/Babylon.js/pull/12495\r\n extension.attributes[\"ROTATION\"] = this._buildAccessor(rotationBuffer, AccessorType.VEC4, babylonNode.thinInstanceCount, bufferManager);\r\n }\r\n // do we need to write SCALE ?\r\n if (hasAnyInstanceWorldScale) {\r\n extension.attributes[\"SCALE\"] = this._buildAccessor(scaleBuffer, AccessorType.VEC3, babylonNode.thinInstanceCount, bufferManager);\r\n }\r\n let colorBuffer = babylonNode._userThinInstanceBuffersStorage?.data?.instanceColor;\r\n if (colorBuffer) {\r\n const instanceCount = babylonNode.thinInstanceCount;\r\n const accessorType = AccessorType.VEC3;\r\n if (babylonNode.hasVertexAlpha && colorBuffer.length === instanceCount * 4) {\r\n if (!this._instanceColorWarned) {\r\n Logger.Warn(\"EXT_mesh_gpu_instancing: Exporting instance colors as RGB, alpha channel of instance color is not exported\");\r\n this._instanceColorWarned = true;\r\n }\r\n colorBuffer = ColorBufferToRGBAToRGB(colorBuffer, instanceCount);\r\n } else if (colorBuffer.length === instanceCount * 4) {\r\n colorBuffer = ColorBufferToRGBAToRGB(colorBuffer, instanceCount);\r\n }\r\n if (colorBuffer.length === instanceCount * 3) {\r\n extension.attributes[\"_COLOR_0\"] = this._buildAccessor(colorBuffer, accessorType, instanceCount, bufferManager);\r\n }\r\n }\r\n\r\n /* eslint-enable @typescript-eslint/naming-convention*/\r\n node.extensions = node.extensions || {};\r\n node.extensions[NAME] = extension;\r\n }\r\n }\r\n resolve(node);\r\n });\r\n }\r\n\r\n private _buildAccessor(buffer: Float32Array, type: AccessorType, count: number, bufferManager: BufferManager): number {\r\n // build the buffer view\r\n const bv = bufferManager.createBufferView(buffer);\r\n\r\n // finally build the accessor\r\n const accessor = bufferManager.createAccessor(bv, type, AccessorComponentType.FLOAT, count);\r\n this._exporter._accessors.push(accessor);\r\n return this._exporter._accessors.length - 1;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Registers the EXT_mesh_gpu_instancing glTF serializer extension with the {@link GLTFExporter}.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function RegisterEXT_mesh_gpu_instancing(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n GLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_mesh_gpu_instancing(exporter));\r\n}\r\n"]}
@@ -1,17 +1,5 @@
1
- import { type IGLTFExporterExtensionV2 } from "../glTFExporterExtension.js";
2
- import { GLTFExporter } from "../glTFExporter.js";
3
1
  /**
4
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/blob/5cb7518cf9a1bfb8268320026961b21caf5a4aac/extensions/2.0/Vendor/EXT_texture_avif/README.md)
5
- * @experimental
2
+ * Re-exports the pure implementation and applies the runtime registration side effect.
3
+ * Import "./EXT_texture_avif.pure" for tree-shakeable, side-effect-free usage.
6
4
  */
7
- export declare class EXT_texture_avif implements IGLTFExporterExtensionV2 {
8
- readonly name = "EXT_texture_avif";
9
- enabled: boolean;
10
- required: boolean;
11
- private _wasUsed;
12
- get wasUsed(): boolean;
13
- private _exporter;
14
- constructor(exporter: GLTFExporter);
15
- dispose(): void;
16
- postExportTexture(_: string, textureInfo: BABYLON.GLTF2.ITextureInfo): void;
17
- }
5
+ export * from "./EXT_texture_avif.pure.js";
@@ -1,41 +1,8 @@
1
- import { GLTFExporter } from "../glTFExporter.js";
2
- import { GetMimeType } from "@babylonjs/core/Misc/fileTools.js";
3
- const NAME = "EXT_texture_avif";
4
1
  /**
5
- * [Proposed Specification](https://github.com/KhronosGroup/glTF/blob/5cb7518cf9a1bfb8268320026961b21caf5a4aac/extensions/2.0/Vendor/EXT_texture_avif/README.md)
6
- * @experimental
2
+ * Re-exports the pure implementation and applies the runtime registration side effect.
3
+ * Import "./EXT_texture_avif.pure" for tree-shakeable, side-effect-free usage.
7
4
  */
8
- // eslint-disable-next-line @typescript-eslint/naming-convention
9
- export class EXT_texture_avif {
10
- get wasUsed() {
11
- return this._wasUsed;
12
- }
13
- constructor(exporter) {
14
- this.name = NAME;
15
- this.enabled = true;
16
- this.required = true;
17
- this._wasUsed = false;
18
- this._exporter = exporter;
19
- }
20
- dispose() { }
21
- postExportTexture(_, textureInfo) {
22
- const texture = this._exporter._textures[textureInfo.index];
23
- const imageIndex = texture.source;
24
- if (imageIndex === undefined) {
25
- return;
26
- }
27
- const image = this._exporter._images[imageIndex];
28
- const sourceMimeType = image.mimeType || GetMimeType(image.uri);
29
- if (sourceMimeType !== "image/avif" /* ImageMimeType.AVIF */) {
30
- return;
31
- }
32
- texture.source = undefined;
33
- texture.extensions || (texture.extensions = {});
34
- texture.extensions[NAME] = {
35
- source: imageIndex,
36
- };
37
- this._wasUsed = true;
38
- }
39
- }
40
- GLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_texture_avif(exporter));
5
+ export * from "./EXT_texture_avif.pure.js";
6
+ import { RegisterEXT_texture_avif } from "./EXT_texture_avif.pure.js";
7
+ RegisterEXT_texture_avif();
41
8
  //# sourceMappingURL=EXT_texture_avif.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EXT_texture_avif.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/EXT_texture_avif.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAEhC;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,gBAAgB;IASzB,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAID,YAAY,QAAsB;QAdlB,SAAI,GAAG,IAAI,CAAC;QAErB,YAAO,GAAG,IAAI,CAAC;QAEf,aAAQ,GAAG,IAAI,CAAC;QAEf,aAAQ,GAAG,KAAK,CAAC;QASrB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAEM,OAAO,KAAI,CAAC;IAEZ,iBAAiB,CAAC,CAAS,EAAE,WAAuC;QACvE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5D,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;QAClC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACjD,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,IAAI,WAAW,CAAC,KAAK,CAAC,GAAI,CAAC,CAAC;QACjE,IAAI,cAAc,0CAAuB,EAAE,CAAC;YACxC,OAAO;QACX,CAAC;QAED,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;QAC3B,OAAO,CAAC,UAAU,KAAlB,OAAO,CAAC,UAAU,GAAK,EAAE,EAAC;QAC1B,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG;YACvB,MAAM,EAAE,UAAU;SACrB,CAAC;QAEF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC;CACJ;AAED,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n/* eslint-disable babylonjs/available */\nimport { type IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\nimport { GLTFExporter } from \"../glTFExporter\";\nimport { GetMimeType } from \"core/Misc/fileTools\";\nimport { ImageMimeType } from \"babylonjs-gltf2interface\";\n\nconst NAME = \"EXT_texture_avif\";\n\n/**\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/blob/5cb7518cf9a1bfb8268320026961b21caf5a4aac/extensions/2.0/Vendor/EXT_texture_avif/README.md)\n * @experimental\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class EXT_texture_avif implements IGLTFExporterExtensionV2 {\n public readonly name = NAME;\n\n public enabled = true;\n\n public required = true;\n\n private _wasUsed = false;\n\n public get wasUsed() {\n return this._wasUsed;\n }\n\n private _exporter: GLTFExporter;\n\n constructor(exporter: GLTFExporter) {\n this._exporter = exporter;\n }\n\n public dispose() {}\n\n public postExportTexture(_: string, textureInfo: BABYLON.GLTF2.ITextureInfo): void {\n const texture = this._exporter._textures[textureInfo.index];\n const imageIndex = texture.source;\n if (imageIndex === undefined) {\n return;\n }\n\n const image = this._exporter._images[imageIndex];\n const sourceMimeType = image.mimeType || GetMimeType(image.uri!);\n if (sourceMimeType !== ImageMimeType.AVIF) {\n return;\n }\n\n texture.source = undefined;\n texture.extensions ||= {};\n texture.extensions[NAME] = {\n source: imageIndex,\n };\n\n this._wasUsed = true;\n }\n}\n\nGLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_texture_avif(exporter));\n"]}
1
+ {"version":3,"file":"EXT_texture_avif.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/EXT_texture_avif.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,yBAAyB,CAAC;AAExC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,wBAAwB,EAAE,CAAC","sourcesContent":["/**\n * Re-exports the pure implementation and applies the runtime registration side effect.\n * Import \"./EXT_texture_avif.pure\" for tree-shakeable, side-effect-free usage.\n */\nexport * from \"./EXT_texture_avif.pure\";\n\nimport { RegisterEXT_texture_avif } from \"./EXT_texture_avif.pure\";\nRegisterEXT_texture_avif();\n"]}
@@ -0,0 +1,27 @@
1
+ import { type IGLTFExporterExtensionV2 } from "../glTFExporterExtension.js";
2
+ import { GLTFExporter } from "../glTFExporter.js";
3
+ /**
4
+ * [Proposed Specification](https://github.com/KhronosGroup/glTF/blob/5cb7518cf9a1bfb8268320026961b21caf5a4aac/extensions/2.0/Vendor/EXT_texture_avif/README.md)
5
+ * @experimental
6
+ */
7
+ export declare class EXT_texture_avif implements IGLTFExporterExtensionV2 {
8
+ readonly name = "EXT_texture_avif";
9
+ enabled: boolean;
10
+ required: boolean;
11
+ private _wasUsed;
12
+ get wasUsed(): boolean;
13
+ private _exporter;
14
+ constructor(exporter: GLTFExporter);
15
+ dispose(): void;
16
+ /**
17
+ * Called after a texture is exported to register the encoded image MIME type.
18
+ * @param _ - the name of the exported babylon texture (unused)
19
+ * @param textureInfo - the glTF texture info for the exported texture
20
+ */
21
+ postExportTexture(_: string, textureInfo: BABYLON.GLTF2.ITextureInfo): void;
22
+ }
23
+ /**
24
+ * Registers the EXT_texture_avif glTF serializer extension with the {@link GLTFExporter}.
25
+ * Safe to call multiple times; only the first call has an effect.
26
+ */
27
+ export declare function RegisterEXT_texture_avif(): void;
@@ -0,0 +1,58 @@
1
+ import { GLTFExporter } from "../glTFExporter.js";
2
+ import { GetMimeType } from "@babylonjs/core/Misc/fileTools.pure.js";
3
+ const NAME = "EXT_texture_avif";
4
+ /**
5
+ * [Proposed Specification](https://github.com/KhronosGroup/glTF/blob/5cb7518cf9a1bfb8268320026961b21caf5a4aac/extensions/2.0/Vendor/EXT_texture_avif/README.md)
6
+ * @experimental
7
+ */
8
+ // eslint-disable-next-line @typescript-eslint/naming-convention
9
+ export class EXT_texture_avif {
10
+ get wasUsed() {
11
+ return this._wasUsed;
12
+ }
13
+ constructor(exporter) {
14
+ this.name = NAME;
15
+ this.enabled = true;
16
+ this.required = true;
17
+ this._wasUsed = false;
18
+ this._exporter = exporter;
19
+ }
20
+ dispose() { }
21
+ /**
22
+ * Called after a texture is exported to register the encoded image MIME type.
23
+ * @param _ - the name of the exported babylon texture (unused)
24
+ * @param textureInfo - the glTF texture info for the exported texture
25
+ */
26
+ postExportTexture(_, textureInfo) {
27
+ const texture = this._exporter._textures[textureInfo.index];
28
+ const imageIndex = texture.source;
29
+ if (imageIndex === undefined) {
30
+ return;
31
+ }
32
+ const image = this._exporter._images[imageIndex];
33
+ const sourceMimeType = image.mimeType || GetMimeType(image.uri);
34
+ if (sourceMimeType !== "image/avif" /* ImageMimeType.AVIF */) {
35
+ return;
36
+ }
37
+ texture.source = undefined;
38
+ texture.extensions || (texture.extensions = {});
39
+ texture.extensions[NAME] = {
40
+ source: imageIndex,
41
+ };
42
+ this._wasUsed = true;
43
+ }
44
+ }
45
+ let _Registered = false;
46
+ /**
47
+ * Registers the EXT_texture_avif glTF serializer extension with the {@link GLTFExporter}.
48
+ * Safe to call multiple times; only the first call has an effect.
49
+ */
50
+ // eslint-disable-next-line @typescript-eslint/naming-convention
51
+ export function RegisterEXT_texture_avif() {
52
+ if (_Registered) {
53
+ return;
54
+ }
55
+ _Registered = true;
56
+ GLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_texture_avif(exporter));
57
+ }
58
+ //# sourceMappingURL=EXT_texture_avif.pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EXT_texture_avif.pure.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/EXT_texture_avif.pure.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAEhC;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,gBAAgB;IASzB,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAID,YAAY,QAAsB;QAdlB,SAAI,GAAG,IAAI,CAAC;QAErB,YAAO,GAAG,IAAI,CAAC;QAEf,aAAQ,GAAG,IAAI,CAAC;QAEf,aAAQ,GAAG,KAAK,CAAC;QASrB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAEM,OAAO,KAAI,CAAC;IAEnB;;;;OAIG;IACI,iBAAiB,CAAC,CAAS,EAAE,WAAuC;QACvE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5D,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;QAClC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACjD,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,IAAI,WAAW,CAAC,KAAK,CAAC,GAAI,CAAC,CAAC;QACjE,IAAI,cAAc,0CAAuB,EAAE,CAAC;YACxC,OAAO;QACX,CAAC;QAED,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;QAC3B,OAAO,CAAC,UAAU,KAAlB,OAAO,CAAC,UAAU,GAAK,EAAE,EAAC;QAC1B,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG;YACvB,MAAM,EAAE,UAAU;SACrB,CAAC;QAEF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,gEAAgE;AAChE,MAAM,UAAU,wBAAwB;IACpC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;AACvF,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n/* eslint-disable babylonjs/available */\nimport { type IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\nimport { GLTFExporter } from \"../glTFExporter\";\nimport { GetMimeType } from \"core/Misc/fileTools.pure\";\nimport { ImageMimeType } from \"babylonjs-gltf2interface\";\n\nconst NAME = \"EXT_texture_avif\";\n\n/**\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/blob/5cb7518cf9a1bfb8268320026961b21caf5a4aac/extensions/2.0/Vendor/EXT_texture_avif/README.md)\n * @experimental\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class EXT_texture_avif implements IGLTFExporterExtensionV2 {\n public readonly name = NAME;\n\n public enabled = true;\n\n public required = true;\n\n private _wasUsed = false;\n\n public get wasUsed() {\n return this._wasUsed;\n }\n\n private _exporter: GLTFExporter;\n\n constructor(exporter: GLTFExporter) {\n this._exporter = exporter;\n }\n\n public dispose() {}\n\n /**\n * Called after a texture is exported to register the encoded image MIME type.\n * @param _ - the name of the exported babylon texture (unused)\n * @param textureInfo - the glTF texture info for the exported texture\n */\n public postExportTexture(_: string, textureInfo: BABYLON.GLTF2.ITextureInfo): void {\n const texture = this._exporter._textures[textureInfo.index];\n const imageIndex = texture.source;\n if (imageIndex === undefined) {\n return;\n }\n\n const image = this._exporter._images[imageIndex];\n const sourceMimeType = image.mimeType || GetMimeType(image.uri!);\n if (sourceMimeType !== ImageMimeType.AVIF) {\n return;\n }\n\n texture.source = undefined;\n texture.extensions ||= {};\n texture.extensions[NAME] = {\n source: imageIndex,\n };\n\n this._wasUsed = true;\n }\n}\n\nlet _Registered = false;\n/**\n * Registers the EXT_texture_avif glTF serializer extension with the {@link GLTFExporter}.\n * Safe to call multiple times; only the first call has an effect.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function RegisterEXT_texture_avif(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n GLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_texture_avif(exporter));\n}\n"]}
@@ -1,16 +1,5 @@
1
- import { type IGLTFExporterExtensionV2 } from "../glTFExporterExtension.js";
2
- import { GLTFExporter } from "../glTFExporter.js";
3
1
  /**
4
- * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_texture_webp/README.md)
2
+ * Re-exports the pure implementation and applies the runtime registration side effect.
3
+ * Import "./EXT_texture_webp.pure" for tree-shakeable, side-effect-free usage.
5
4
  */
6
- export declare class EXT_texture_webp implements IGLTFExporterExtensionV2 {
7
- readonly name = "EXT_texture_webp";
8
- enabled: boolean;
9
- required: boolean;
10
- private _wasUsed;
11
- get wasUsed(): boolean;
12
- private _exporter;
13
- constructor(exporter: GLTFExporter);
14
- dispose(): void;
15
- postExportTexture(_: string, textureInfo: BABYLON.GLTF2.ITextureInfo): void;
16
- }
5
+ export * from "./EXT_texture_webp.pure.js";