@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
@@ -0,0 +1,8 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./3mf.interfaces.js";
3
+ export * from "./3mf.opc.interfaces.js";
4
+ export * from "./3mf.opc.js";
5
+ export * from "./3mf.js";
6
+ export * from "./3mf.builder.js";
7
+ export * from "./3mf.types.js";
8
+ export * from "./3mf.serializer.js";
@@ -0,0 +1,9 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./3mf.interfaces.js";
3
+ export * from "./3mf.opc.interfaces.js";
4
+ export * from "./3mf.opc.js";
5
+ export * from "./3mf.js";
6
+ export * from "./3mf.builder.js";
7
+ export * from "./3mf.types.js";
8
+ export * from "./3mf.serializer.js";
9
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/3MF/core/model/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./3mf.interfaces\";\nexport * from \"./3mf.opc.interfaces\";\nexport * from \"./3mf.opc\";\nexport * from \"./3mf\";\nexport * from \"./3mf.builder\";\nexport * from \"./3mf.types\";\nexport * from \"./3mf.serializer\";\n"]}
@@ -0,0 +1,3 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./xml/pure.js";
3
+ export * from "./model/pure.js";
@@ -0,0 +1,5 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ /* eslint-disable @typescript-eslint/no-restricted-imports */
3
+ export * from "./xml/pure.js";
4
+ export * from "./model/pure.js";
5
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../dev/serializers/src/3MF/core/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,6DAA6D;AAC7D,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\n/* eslint-disable @typescript-eslint/no-restricted-imports */\nexport * from \"./xml/pure\";\nexport * from \"./model/pure\";\n"]}
@@ -0,0 +1,7 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./xml.interfaces.js";
3
+ export * from "./xml.serializer.js";
4
+ export * from "./xml.serializer.format.js";
5
+ export * from "./xml.builder.js";
6
+ export * from "./xml.builder.string.js";
7
+ export * from "./xml.builder.bytes.js";
@@ -0,0 +1,8 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./xml.interfaces.js";
3
+ export * from "./xml.serializer.js";
4
+ export * from "./xml.serializer.format.js";
5
+ export * from "./xml.builder.js";
6
+ export * from "./xml.builder.string.js";
7
+ export * from "./xml.builder.bytes.js";
8
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/3MF/core/xml/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./xml.interfaces\";\nexport * from \"./xml.serializer\";\nexport * from \"./xml.serializer.format\";\nexport * from \"./xml.builder\";\nexport * from \"./xml.builder.string\";\nexport * from \"./xml.builder.bytes\";\n"]}
package/3MF/pure.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./core/pure.js";
3
+ export * from "./3mfSerializer.js";
4
+ export * from "./3mfSerializer.configuration.js";
package/3MF/pure.js ADDED
@@ -0,0 +1,6 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ /* eslint-disable @typescript-eslint/no-restricted-imports */
3
+ export * from "./core/pure.js";
4
+ export * from "./3mfSerializer.js";
5
+ export * from "./3mfSerializer.configuration.js";
6
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../dev/serializers/src/3MF/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,6DAA6D;AAC7D,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\n/* eslint-disable @typescript-eslint/no-restricted-imports */\nexport * from \"./core/pure\";\nexport * from \"./3mfSerializer\";\nexport * from \"./3mfSerializer.configuration\";\n"]}
package/BVH/pure.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./bvhSerializer.js";
package/BVH/pure.js ADDED
@@ -0,0 +1,3 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./bvhSerializer.js";
3
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../dev/serializers/src/BVH/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,iBAAiB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./bvhSerializer\";\n"]}
package/OBJ/pure.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./objSerializer.js";
package/OBJ/pure.js ADDED
@@ -0,0 +1,3 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./objSerializer.js";
3
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../dev/serializers/src/OBJ/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,iBAAiB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./objSerializer\";\n"]}
package/USDZ/pure.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ export * from "./usdzExporter.js";
package/USDZ/pure.js ADDED
@@ -0,0 +1,4 @@
1
+ /** Pure barrel — re-exports only side-effect-free modules */
2
+ /* eslint-disable @typescript-eslint/no-restricted-imports */
3
+ export * from "./usdzExporter.js";
4
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../dev/serializers/src/USDZ/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,6DAA6D;AAC7D,cAAc,gBAAgB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\n/* eslint-disable @typescript-eslint/no-restricted-imports */\nexport * from \"./usdzExporter\";\n"]}
@@ -1,39 +1,5 @@
1
- import { type Nullable } from "@babylonjs/core/types.js";
2
- import { type Node } from "@babylonjs/core/node.js";
3
- import { type INode } from "babylonjs-gltf2interface";
4
- import { type IGLTFExporterExtensionV2 } from "../glTFExporterExtension.js";
5
- import { GLTFExporter } from "../glTFExporter.js";
6
1
  /**
7
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/EXT_lights_area/README.md)
2
+ * Re-exports the pure implementation and applies the runtime registration side effect.
3
+ * Import "./EXT_lights_area.pure" for tree-shakeable, side-effect-free usage.
8
4
  */
9
- export declare class EXT_lights_area implements IGLTFExporterExtensionV2 {
10
- /** The name of this extension. */
11
- readonly name = "EXT_lights_area";
12
- /** Defines whether this extension is enabled. */
13
- enabled: boolean;
14
- /** Defines whether this extension is required */
15
- required: boolean;
16
- /** Reference to the glTF exporter */
17
- private _exporter;
18
- private _lights;
19
- /**
20
- * @internal
21
- */
22
- constructor(exporter: GLTFExporter);
23
- /** @internal */
24
- dispose(): void;
25
- /** @internal */
26
- get wasUsed(): boolean;
27
- /** @internal */
28
- onExporting(): void;
29
- /**
30
- * Define this method to modify the default behavior when exporting a node
31
- * @param context The context when exporting the node
32
- * @param node glTF node
33
- * @param babylonNode BabylonJS node
34
- * @param nodeMap Node mapping of babylon node to glTF node index
35
- * @param convertToRightHanded Flag to convert the values to right-handed
36
- * @returns nullable INode promise
37
- */
38
- postExportNodeAsync(context: string, node: INode, babylonNode: Node, nodeMap: Map<Node, number>, convertToRightHanded: boolean): Promise<Nullable<INode>>;
39
- }
5
+ export * from "./EXT_lights_area.pure.js";
@@ -1,133 +1,8 @@
1
- import { Vector3, Quaternion, TmpVectors } from "@babylonjs/core/Maths/math.vector.js";
2
- import { Light } from "@babylonjs/core/Lights/light.js";
3
- import { GLTFExporter } from "../glTFExporter.js";
4
- import { Logger } from "@babylonjs/core/Misc/logger.js";
5
- import { ConvertToRightHandedPosition, OmitDefaultValues, CollapseChildIntoParent, IsChildCollapsible } from "../glTFUtilities.js";
6
- const NAME = "EXT_lights_area";
7
- const DEFAULTS = {
8
- name: "",
9
- color: [1, 1, 1],
10
- intensity: 1,
11
- size: 1,
12
- };
13
- const RECTDEFAULTS = {
14
- aspect: 1,
15
- };
16
- const LIGHTDIRECTION = Vector3.Backward();
17
1
  /**
18
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/EXT_lights_area/README.md)
2
+ * Re-exports the pure implementation and applies the runtime registration side effect.
3
+ * Import "./EXT_lights_area.pure" for tree-shakeable, side-effect-free usage.
19
4
  */
20
- // eslint-disable-next-line @typescript-eslint/naming-convention
21
- export class EXT_lights_area {
22
- /**
23
- * @internal
24
- */
25
- constructor(exporter) {
26
- /** The name of this extension. */
27
- this.name = NAME;
28
- /** Defines whether this extension is enabled. */
29
- this.enabled = true;
30
- /** Defines whether this extension is required */
31
- this.required = false;
32
- this._exporter = exporter;
33
- }
34
- /** @internal */
35
- dispose() {
36
- this._lights = null;
37
- }
38
- /** @internal */
39
- get wasUsed() {
40
- return !!this._lights;
41
- }
42
- /** @internal */
43
- onExporting() {
44
- this._exporter._glTF.extensions[NAME] = this._lights;
45
- }
46
- /**
47
- * Define this method to modify the default behavior when exporting a node
48
- * @param context The context when exporting the node
49
- * @param node glTF node
50
- * @param babylonNode BabylonJS node
51
- * @param nodeMap Node mapping of babylon node to glTF node index
52
- * @param convertToRightHanded Flag to convert the values to right-handed
53
- * @returns nullable INode promise
54
- */
55
- async postExportNodeAsync(context, node, babylonNode, nodeMap, convertToRightHanded) {
56
- return await new Promise((resolve) => {
57
- if (!(babylonNode instanceof Light)) {
58
- resolve(node);
59
- return;
60
- }
61
- const lightType = babylonNode.getTypeID() == Light.LIGHTTYPEID_RECT_AREALIGHT ? "rect" /* EXTLightsArea_LightType.RECT */ : null;
62
- if (!lightType) {
63
- Logger.Warn(`${context}: Light ${babylonNode.name} is not supported in ${NAME}`);
64
- resolve(node);
65
- return;
66
- }
67
- const areaLight = babylonNode;
68
- if (areaLight.falloffType !== Light.FALLOFF_GLTF) {
69
- Logger.Warn(`${context}: Light falloff for ${babylonNode.name} does not match the ${NAME} specification!`);
70
- }
71
- // Set the node's translation and rotation here, since lights are not handled in exportNodeAsync
72
- if (!areaLight.position.equalsToFloats(0, 0, 0)) {
73
- const translation = TmpVectors.Vector3[0].copyFrom(areaLight.position);
74
- if (convertToRightHanded) {
75
- ConvertToRightHandedPosition(translation);
76
- }
77
- node.translation = translation.asArray();
78
- }
79
- // Represent the Babylon light's direction as a quaternion
80
- // relative to glTF lights' forward direction, (0, 0, -1).
81
- const direction = Vector3.Forward();
82
- if (convertToRightHanded) {
83
- ConvertToRightHandedPosition(direction);
84
- }
85
- const lightRotationQuaternion = Quaternion.FromUnitVectorsToRef(LIGHTDIRECTION, direction, TmpVectors.Quaternion[0]);
86
- if (!Quaternion.IsIdentity(lightRotationQuaternion)) {
87
- node.rotation = lightRotationQuaternion.asArray();
88
- }
89
- const light = {
90
- type: lightType,
91
- name: areaLight.name,
92
- color: areaLight.diffuse.asArray(),
93
- intensity: areaLight.intensity,
94
- size: areaLight.height,
95
- rect: {
96
- aspect: areaLight.width / areaLight.height,
97
- },
98
- };
99
- OmitDefaultValues(light, DEFAULTS);
100
- if (light.rect) {
101
- OmitDefaultValues(light.rect, RECTDEFAULTS);
102
- }
103
- this._lights || (this._lights = {
104
- lights: [],
105
- });
106
- this._lights.lights.push(light);
107
- const lightReference = {
108
- light: this._lights.lights.length - 1,
109
- };
110
- // Assign the light to its parent node, if possible, to condense the glTF
111
- // Why and when: the glTF loader generates a new parent TransformNode for each light node, which we should undo on export
112
- const parentBabylonNode = babylonNode.parent;
113
- if (parentBabylonNode && IsChildCollapsible(areaLight, parentBabylonNode)) {
114
- const parentNodeIndex = nodeMap.get(parentBabylonNode);
115
- if (parentNodeIndex) {
116
- // Combine the light's transformation with the parent's
117
- const parentNode = this._exporter._nodes[parentNodeIndex];
118
- CollapseChildIntoParent(node, parentNode);
119
- parentNode.extensions || (parentNode.extensions = {});
120
- parentNode.extensions[NAME] = lightReference;
121
- // Do not export the original node
122
- resolve(null);
123
- return;
124
- }
125
- }
126
- node.extensions || (node.extensions = {});
127
- node.extensions[NAME] = lightReference;
128
- resolve(node);
129
- });
130
- }
131
- }
132
- GLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_lights_area(exporter));
5
+ export * from "./EXT_lights_area.pure.js";
6
+ import { RegisterEXT_lights_area } from "./EXT_lights_area.pure.js";
7
+ RegisterEXT_lights_area();
133
8
  //# sourceMappingURL=EXT_lights_area.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EXT_lights_area.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/EXT_lights_area.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,uBAAuB,E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C,eAAe,CAAC,CAAC;oBAC1D,uBAAuB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;oBAC1C,UAAU,CAAC,UAAU,KAArB,UAAU,CAAC,UAAU,GAAK,EAAE,EAAC;oBAC7B,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC;oBAE7C,kCAAkC;oBAClC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACd,OAAO;gBACX,CAAC;YACL,CAAC;YAED,IAAI,CAAC,UAAU,KAAf,IAAI,CAAC,UAAU,GAAK,EAAE,EAAC;YACvB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["import { type Nullable } from \"core/types\";\r\nimport { Vector3, Quaternion, TmpVectors } from \"core/Maths/math.vector\";\r\nimport { Light } from \"core/Lights/light\";\r\nimport { type Node } from \"core/node\";\r\nimport { type INode, type IEXTLightsArea_LightReference, type IEXTLightsArea_Light, type IEXTLightsArea, EXTLightsArea_LightType } from \"babylonjs-gltf2interface\";\r\nimport { type IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\r\nimport { GLTFExporter } from \"../glTFExporter\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { ConvertToRightHandedPosition, OmitDefaultValues, CollapseChildIntoParent, IsChildCollapsible } from \"../glTFUtilities\";\r\nimport { type RectAreaLight } from \"core/Lights/rectAreaLight\";\r\n\r\nconst NAME = \"EXT_lights_area\";\r\nconst DEFAULTS: Omit<IEXTLightsArea_Light, \"type\"> = {\r\n name: \"\",\r\n color: [1, 1, 1],\r\n intensity: 1,\r\n size: 1,\r\n};\r\nconst RECTDEFAULTS: NonNullable<IEXTLightsArea_Light[\"rect\"]> = {\r\n aspect: 1,\r\n};\r\nconst LIGHTDIRECTION = Vector3.Backward();\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/EXT_lights_area/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_lights_area implements IGLTFExporterExtensionV2 {\r\n /** The 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 /** Reference to the glTF exporter */\r\n private _exporter: GLTFExporter;\r\n\r\n private _lights: IEXTLightsArea;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(exporter: GLTFExporter) {\r\n this._exporter = exporter;\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._lights as any) = null;\r\n }\r\n\r\n /** @internal */\r\n public get wasUsed() {\r\n return !!this._lights;\r\n }\r\n\r\n /** @internal */\r\n public onExporting(): void {\r\n this._exporter._glTF.extensions![NAME] = this._lights;\r\n }\r\n /**\r\n * Define this method to modify the default behavior when exporting a node\r\n * @param context The context when exporting the node\r\n * @param node glTF node\r\n * @param babylonNode BabylonJS node\r\n * @param nodeMap Node mapping of babylon node to glTF node index\r\n * @param convertToRightHanded Flag to convert the values to right-handed\r\n * @returns nullable INode promise\r\n */\r\n public async postExportNodeAsync(context: string, node: INode, babylonNode: Node, nodeMap: Map<Node, number>, convertToRightHanded: boolean): Promise<Nullable<INode>> {\r\n return await new Promise((resolve) => {\r\n if (!(babylonNode instanceof Light)) {\r\n resolve(node);\r\n return;\r\n }\r\n\r\n const lightType = babylonNode.getTypeID() == Light.LIGHTTYPEID_RECT_AREALIGHT ? EXTLightsArea_LightType.RECT : null;\r\n if (!lightType) {\r\n Logger.Warn(`${context}: Light ${babylonNode.name} is not supported in ${NAME}`);\r\n resolve(node);\r\n return;\r\n }\r\n\r\n const areaLight = babylonNode as RectAreaLight;\r\n\r\n if (areaLight.falloffType !== Light.FALLOFF_GLTF) {\r\n Logger.Warn(`${context}: Light falloff for ${babylonNode.name} does not match the ${NAME} specification!`);\r\n }\r\n\r\n // Set the node's translation and rotation here, since lights are not handled in exportNodeAsync\r\n if (!areaLight.position.equalsToFloats(0, 0, 0)) {\r\n const translation = TmpVectors.Vector3[0].copyFrom(areaLight.position);\r\n if (convertToRightHanded) {\r\n ConvertToRightHandedPosition(translation);\r\n }\r\n node.translation = translation.asArray();\r\n }\r\n\r\n // Represent the Babylon light's direction as a quaternion\r\n // relative to glTF lights' forward direction, (0, 0, -1).\r\n const direction = Vector3.Forward();\r\n if (convertToRightHanded) {\r\n ConvertToRightHandedPosition(direction);\r\n }\r\n\r\n const lightRotationQuaternion = Quaternion.FromUnitVectorsToRef(LIGHTDIRECTION, direction, TmpVectors.Quaternion[0]);\r\n if (!Quaternion.IsIdentity(lightRotationQuaternion)) {\r\n node.rotation = lightRotationQuaternion.asArray();\r\n }\r\n\r\n const light: IEXTLightsArea_Light = {\r\n type: lightType,\r\n name: areaLight.name,\r\n color: areaLight.diffuse.asArray(),\r\n intensity: areaLight.intensity,\r\n size: areaLight.height,\r\n rect: {\r\n aspect: areaLight.width / areaLight.height,\r\n },\r\n };\r\n OmitDefaultValues(light, DEFAULTS);\r\n\r\n if (light.rect) {\r\n OmitDefaultValues(light.rect, RECTDEFAULTS);\r\n }\r\n\r\n this._lights ||= {\r\n lights: [],\r\n };\r\n this._lights.lights.push(light);\r\n\r\n const lightReference: IEXTLightsArea_LightReference = {\r\n light: this._lights.lights.length - 1,\r\n };\r\n\r\n // Assign the light to its parent node, if possible, to condense the glTF\r\n // Why and when: the glTF loader generates a new parent TransformNode for each light node, which we should undo on export\r\n const parentBabylonNode = babylonNode.parent;\r\n\r\n if (parentBabylonNode && IsChildCollapsible(areaLight, parentBabylonNode)) {\r\n const parentNodeIndex = nodeMap.get(parentBabylonNode);\r\n if (parentNodeIndex) {\r\n // Combine the light's transformation with the parent's\r\n const parentNode = this._exporter._nodes[parentNodeIndex];\r\n CollapseChildIntoParent(node, parentNode);\r\n parentNode.extensions ||= {};\r\n parentNode.extensions[NAME] = lightReference;\r\n\r\n // Do not export the original node\r\n resolve(null);\r\n return;\r\n }\r\n }\r\n\r\n node.extensions ||= {};\r\n node.extensions[NAME] = lightReference;\r\n resolve(node);\r\n });\r\n }\r\n}\r\n\r\nGLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_lights_area(exporter));\r\n"]}
1
+ {"version":3,"file":"EXT_lights_area.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/EXT_lights_area.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,uBAAuB,EAAE,CAAC","sourcesContent":["/**\r\n * Re-exports the pure implementation and applies the runtime registration side effect.\r\n * Import \"./EXT_lights_area.pure\" for tree-shakeable, side-effect-free usage.\r\n */\r\nexport * from \"./EXT_lights_area.pure\";\r\n\r\nimport { RegisterEXT_lights_area } from \"./EXT_lights_area.pure\";\r\nRegisterEXT_lights_area();\r\n"]}
@@ -0,0 +1,44 @@
1
+ import { type Nullable } from "@babylonjs/core/types.js";
2
+ import { type Node } from "@babylonjs/core/node.js";
3
+ import { type INode } from "babylonjs-gltf2interface";
4
+ import { type IGLTFExporterExtensionV2 } from "../glTFExporterExtension.js";
5
+ import { GLTFExporter } from "../glTFExporter.js";
6
+ /**
7
+ * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/EXT_lights_area/README.md)
8
+ */
9
+ export declare class EXT_lights_area implements IGLTFExporterExtensionV2 {
10
+ /** The name of this extension. */
11
+ readonly name = "EXT_lights_area";
12
+ /** Defines whether this extension is enabled. */
13
+ enabled: boolean;
14
+ /** Defines whether this extension is required */
15
+ required: boolean;
16
+ /** Reference to the glTF exporter */
17
+ private _exporter;
18
+ private _lights;
19
+ /**
20
+ * @internal
21
+ */
22
+ constructor(exporter: GLTFExporter);
23
+ /** @internal */
24
+ dispose(): void;
25
+ /** @internal */
26
+ get wasUsed(): boolean;
27
+ /** @internal */
28
+ onExporting(): void;
29
+ /**
30
+ * Define this method to modify the default behavior when exporting a node
31
+ * @param context The context when exporting the node
32
+ * @param node glTF node
33
+ * @param babylonNode BabylonJS node
34
+ * @param nodeMap Node mapping of babylon node to glTF node index
35
+ * @param convertToRightHanded Flag to convert the values to right-handed
36
+ * @returns nullable INode promise
37
+ */
38
+ postExportNodeAsync(context: string, node: INode, babylonNode: Node, nodeMap: Map<Node, number>, convertToRightHanded: boolean): Promise<Nullable<INode>>;
39
+ }
40
+ /**
41
+ * Registers the EXT_lights_area 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_lights_area(): void;
@@ -0,0 +1,145 @@
1
+ import { Vector3, Quaternion, TmpVectors } from "@babylonjs/core/Maths/math.vector.pure.js";
2
+ import { Light } from "@babylonjs/core/Lights/light.js";
3
+ import { GLTFExporter } from "../glTFExporter.js";
4
+ import { Logger } from "@babylonjs/core/Misc/logger.js";
5
+ import { ConvertToRightHandedPosition, OmitDefaultValues, CollapseChildIntoParent, IsChildCollapsible } from "../glTFUtilities.js";
6
+ const NAME = "EXT_lights_area";
7
+ const DEFAULTS = {
8
+ name: "",
9
+ color: [1, 1, 1],
10
+ intensity: 1,
11
+ size: 1,
12
+ };
13
+ const RECTDEFAULTS = {
14
+ aspect: 1,
15
+ };
16
+ const LIGHTDIRECTION = /*#__PURE__*/ Vector3.Backward();
17
+ /**
18
+ * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/EXT_lights_area/README.md)
19
+ */
20
+ // eslint-disable-next-line @typescript-eslint/naming-convention
21
+ export class EXT_lights_area {
22
+ /**
23
+ * @internal
24
+ */
25
+ constructor(exporter) {
26
+ /** The name of this extension. */
27
+ this.name = NAME;
28
+ /** Defines whether this extension is enabled. */
29
+ this.enabled = true;
30
+ /** Defines whether this extension is required */
31
+ this.required = false;
32
+ this._exporter = exporter;
33
+ }
34
+ /** @internal */
35
+ dispose() {
36
+ this._lights = null;
37
+ }
38
+ /** @internal */
39
+ get wasUsed() {
40
+ return !!this._lights;
41
+ }
42
+ /** @internal */
43
+ onExporting() {
44
+ this._exporter._glTF.extensions[NAME] = this._lights;
45
+ }
46
+ /**
47
+ * Define this method to modify the default behavior when exporting a node
48
+ * @param context The context when exporting the node
49
+ * @param node glTF node
50
+ * @param babylonNode BabylonJS node
51
+ * @param nodeMap Node mapping of babylon node to glTF node index
52
+ * @param convertToRightHanded Flag to convert the values to right-handed
53
+ * @returns nullable INode promise
54
+ */
55
+ async postExportNodeAsync(context, node, babylonNode, nodeMap, convertToRightHanded) {
56
+ return await new Promise((resolve) => {
57
+ if (!(babylonNode instanceof Light)) {
58
+ resolve(node);
59
+ return;
60
+ }
61
+ const lightType = babylonNode.getTypeID() == Light.LIGHTTYPEID_RECT_AREALIGHT ? "rect" /* EXTLightsArea_LightType.RECT */ : null;
62
+ if (!lightType) {
63
+ Logger.Warn(`${context}: Light ${babylonNode.name} is not supported in ${NAME}`);
64
+ resolve(node);
65
+ return;
66
+ }
67
+ const areaLight = babylonNode;
68
+ if (areaLight.falloffType !== Light.FALLOFF_GLTF) {
69
+ Logger.Warn(`${context}: Light falloff for ${babylonNode.name} does not match the ${NAME} specification!`);
70
+ }
71
+ // Set the node's translation and rotation here, since lights are not handled in exportNodeAsync
72
+ if (!areaLight.position.equalsToFloats(0, 0, 0)) {
73
+ const translation = TmpVectors.Vector3[0].copyFrom(areaLight.position);
74
+ if (convertToRightHanded) {
75
+ ConvertToRightHandedPosition(translation);
76
+ }
77
+ node.translation = translation.asArray();
78
+ }
79
+ // Represent the Babylon light's direction as a quaternion
80
+ // relative to glTF lights' forward direction, (0, 0, -1).
81
+ const direction = Vector3.Forward();
82
+ if (convertToRightHanded) {
83
+ ConvertToRightHandedPosition(direction);
84
+ }
85
+ const lightRotationQuaternion = Quaternion.FromUnitVectorsToRef(LIGHTDIRECTION, direction, TmpVectors.Quaternion[0]);
86
+ if (!Quaternion.IsIdentity(lightRotationQuaternion)) {
87
+ node.rotation = lightRotationQuaternion.asArray();
88
+ }
89
+ const light = {
90
+ type: lightType,
91
+ name: areaLight.name,
92
+ color: areaLight.diffuse.asArray(),
93
+ intensity: areaLight.intensity,
94
+ size: areaLight.height,
95
+ rect: {
96
+ aspect: areaLight.width / areaLight.height,
97
+ },
98
+ };
99
+ OmitDefaultValues(light, DEFAULTS);
100
+ if (light.rect) {
101
+ OmitDefaultValues(light.rect, RECTDEFAULTS);
102
+ }
103
+ this._lights || (this._lights = {
104
+ lights: [],
105
+ });
106
+ this._lights.lights.push(light);
107
+ const lightReference = {
108
+ light: this._lights.lights.length - 1,
109
+ };
110
+ // Assign the light to its parent node, if possible, to condense the glTF
111
+ // Why and when: the glTF loader generates a new parent TransformNode for each light node, which we should undo on export
112
+ const parentBabylonNode = babylonNode.parent;
113
+ if (parentBabylonNode && IsChildCollapsible(areaLight, parentBabylonNode)) {
114
+ const parentNodeIndex = nodeMap.get(parentBabylonNode);
115
+ if (parentNodeIndex) {
116
+ // Combine the light's transformation with the parent's
117
+ const parentNode = this._exporter._nodes[parentNodeIndex];
118
+ CollapseChildIntoParent(node, parentNode);
119
+ parentNode.extensions || (parentNode.extensions = {});
120
+ parentNode.extensions[NAME] = lightReference;
121
+ // Do not export the original node
122
+ resolve(null);
123
+ return;
124
+ }
125
+ }
126
+ node.extensions || (node.extensions = {});
127
+ node.extensions[NAME] = lightReference;
128
+ resolve(node);
129
+ });
130
+ }
131
+ }
132
+ let _Registered = false;
133
+ /**
134
+ * Registers the EXT_lights_area glTF serializer extension with the {@link GLTFExporter}.
135
+ * Safe to call multiple times; only the first call has an effect.
136
+ */
137
+ // eslint-disable-next-line @typescript-eslint/naming-convention
138
+ export function RegisterEXT_lights_area() {
139
+ if (_Registered) {
140
+ return;
141
+ }
142
+ _Registered = true;
143
+ GLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_lights_area(exporter));
144
+ }
145
+ //# sourceMappingURL=EXT_lights_area.pure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EXT_lights_area.pure.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/EXT_lights_area.pure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGhI,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,QAAQ,GAAuC;IACjD,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAChB,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,CAAC;CACV,CAAC;AACF,MAAM,YAAY,GAA8C;IAC5D,MAAM,EAAE,CAAC;CACZ,CAAC;AACF,MAAM,cAAc,GAAG,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;AAExD;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,eAAe;IAexB;;OAEG;IACH,YAAY,QAAsB;QAjBlC,kCAAkC;QAClB,SAAI,GAAG,IAAI,CAAC;QAE5B,iDAAiD;QAC1C,YAAO,GAAG,IAAI,CAAC;QAEtB,iDAAiD;QAC1C,aAAQ,GAAG,KAAK,CAAC;QAWpB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED,gBAAgB;I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AC;IAEnB,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import { type Nullable } from \"core/types\";\r\nimport { Vector3, Quaternion, TmpVectors } from \"core/Maths/math.vector.pure\";\r\nimport { Light } from \"core/Lights/light\";\r\nimport { type Node } from \"core/node\";\r\nimport { type INode, type IEXTLightsArea_LightReference, type IEXTLightsArea_Light, type IEXTLightsArea, EXTLightsArea_LightType } from \"babylonjs-gltf2interface\";\r\nimport { type IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\r\nimport { GLTFExporter } from \"../glTFExporter\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { ConvertToRightHandedPosition, OmitDefaultValues, CollapseChildIntoParent, IsChildCollapsible } from \"../glTFUtilities\";\r\nimport { type RectAreaLight } from \"core/Lights/rectAreaLight\";\r\n\r\nconst NAME = \"EXT_lights_area\";\r\nconst DEFAULTS: Omit<IEXTLightsArea_Light, \"type\"> = {\r\n name: \"\",\r\n color: [1, 1, 1],\r\n intensity: 1,\r\n size: 1,\r\n};\r\nconst RECTDEFAULTS: NonNullable<IEXTLightsArea_Light[\"rect\"]> = {\r\n aspect: 1,\r\n};\r\nconst LIGHTDIRECTION = /*#__PURE__*/ Vector3.Backward();\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/EXT_lights_area/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class EXT_lights_area implements IGLTFExporterExtensionV2 {\r\n /** The 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 /** Reference to the glTF exporter */\r\n private _exporter: GLTFExporter;\r\n\r\n private _lights: IEXTLightsArea;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(exporter: GLTFExporter) {\r\n this._exporter = exporter;\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._lights as any) = null;\r\n }\r\n\r\n /** @internal */\r\n public get wasUsed() {\r\n return !!this._lights;\r\n }\r\n\r\n /** @internal */\r\n public onExporting(): void {\r\n this._exporter._glTF.extensions![NAME] = this._lights;\r\n }\r\n /**\r\n * Define this method to modify the default behavior when exporting a node\r\n * @param context The context when exporting the node\r\n * @param node glTF node\r\n * @param babylonNode BabylonJS node\r\n * @param nodeMap Node mapping of babylon node to glTF node index\r\n * @param convertToRightHanded Flag to convert the values to right-handed\r\n * @returns nullable INode promise\r\n */\r\n public async postExportNodeAsync(context: string, node: INode, babylonNode: Node, nodeMap: Map<Node, number>, convertToRightHanded: boolean): Promise<Nullable<INode>> {\r\n return await new Promise((resolve) => {\r\n if (!(babylonNode instanceof Light)) {\r\n resolve(node);\r\n return;\r\n }\r\n\r\n const lightType = babylonNode.getTypeID() == Light.LIGHTTYPEID_RECT_AREALIGHT ? EXTLightsArea_LightType.RECT : null;\r\n if (!lightType) {\r\n Logger.Warn(`${context}: Light ${babylonNode.name} is not supported in ${NAME}`);\r\n resolve(node);\r\n return;\r\n }\r\n\r\n const areaLight = babylonNode as RectAreaLight;\r\n\r\n if (areaLight.falloffType !== Light.FALLOFF_GLTF) {\r\n Logger.Warn(`${context}: Light falloff for ${babylonNode.name} does not match the ${NAME} specification!`);\r\n }\r\n\r\n // Set the node's translation and rotation here, since lights are not handled in exportNodeAsync\r\n if (!areaLight.position.equalsToFloats(0, 0, 0)) {\r\n const translation = TmpVectors.Vector3[0].copyFrom(areaLight.position);\r\n if (convertToRightHanded) {\r\n ConvertToRightHandedPosition(translation);\r\n }\r\n node.translation = translation.asArray();\r\n }\r\n\r\n // Represent the Babylon light's direction as a quaternion\r\n // relative to glTF lights' forward direction, (0, 0, -1).\r\n const direction = Vector3.Forward();\r\n if (convertToRightHanded) {\r\n ConvertToRightHandedPosition(direction);\r\n }\r\n\r\n const lightRotationQuaternion = Quaternion.FromUnitVectorsToRef(LIGHTDIRECTION, direction, TmpVectors.Quaternion[0]);\r\n if (!Quaternion.IsIdentity(lightRotationQuaternion)) {\r\n node.rotation = lightRotationQuaternion.asArray();\r\n }\r\n\r\n const light: IEXTLightsArea_Light = {\r\n type: lightType,\r\n name: areaLight.name,\r\n color: areaLight.diffuse.asArray(),\r\n intensity: areaLight.intensity,\r\n size: areaLight.height,\r\n rect: {\r\n aspect: areaLight.width / areaLight.height,\r\n },\r\n };\r\n OmitDefaultValues(light, DEFAULTS);\r\n\r\n if (light.rect) {\r\n OmitDefaultValues(light.rect, RECTDEFAULTS);\r\n }\r\n\r\n this._lights ||= {\r\n lights: [],\r\n };\r\n this._lights.lights.push(light);\r\n\r\n const lightReference: IEXTLightsArea_LightReference = {\r\n light: this._lights.lights.length - 1,\r\n };\r\n\r\n // Assign the light to its parent node, if possible, to condense the glTF\r\n // Why and when: the glTF loader generates a new parent TransformNode for each light node, which we should undo on export\r\n const parentBabylonNode = babylonNode.parent;\r\n\r\n if (parentBabylonNode && IsChildCollapsible(areaLight, parentBabylonNode)) {\r\n const parentNodeIndex = nodeMap.get(parentBabylonNode);\r\n if (parentNodeIndex) {\r\n // Combine the light's transformation with the parent's\r\n const parentNode = this._exporter._nodes[parentNodeIndex];\r\n CollapseChildIntoParent(node, parentNode);\r\n parentNode.extensions ||= {};\r\n parentNode.extensions[NAME] = lightReference;\r\n\r\n // Do not export the original node\r\n resolve(null);\r\n return;\r\n }\r\n }\r\n\r\n node.extensions ||= {};\r\n node.extensions[NAME] = lightReference;\r\n resolve(node);\r\n });\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Registers the EXT_lights_area 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_lights_area(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n GLTFExporter.RegisterExtension(NAME, (exporter) => new EXT_lights_area(exporter));\r\n}\r\n"]}
@@ -1,40 +1,6 @@
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
- import "@babylonjs/core/Meshes/thinInstanceMesh.js";
8
1
  /**
9
- * [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.
10
4
  */
11
- export declare class EXT_mesh_gpu_instancing implements IGLTFExporterExtensionV2 {
12
- /** Name of this extension */
13
- readonly name = "EXT_mesh_gpu_instancing";
14
- /** Defines whether this extension is enabled */
15
- enabled: boolean;
16
- /** Defines whether this extension is required */
17
- required: boolean;
18
- /**
19
- * Internal state to emit warning about instance color alpha once
20
- */
21
- private _instanceColorWarned;
22
- private _exporter;
23
- private _wasUsed;
24
- constructor(exporter: GLTFExporter);
25
- dispose(): void;
26
- /** @internal */
27
- get wasUsed(): boolean;
28
- /**
29
- * After node is exported
30
- * @param context the GLTF context when loading the asset
31
- * @param node the node exported
32
- * @param babylonNode the corresponding babylon node
33
- * @param nodeMap map from babylon node id to node index
34
- * @param convertToRightHanded true if we need to convert data from left hand to right hand system.
35
- * @param bufferManager buffer manager
36
- * @returns nullable promise, resolves with the node
37
- */
38
- postExportNodeAsync(context: string, node: Nullable<INode>, babylonNode: Node, nodeMap: Map<Node, number>, convertToRightHanded: boolean, bufferManager: BufferManager): Promise<Nullable<INode>>;
39
- private _buildAccessor;
40
- }
5
+ export * from "./EXT_mesh_gpu_instancing.pure.js";
6
+ import "@babylonjs/core/Meshes/thinInstanceMesh.js";