@babylonjs/loaders 5.0.0-beta.9 → 5.0.0-rc.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. package/OBJ/index.d.ts +4 -4
  2. package/OBJ/index.js +4 -4
  3. package/OBJ/index.js.map +1 -1
  4. package/OBJ/mtlFileLoader.d.ts +41 -40
  5. package/OBJ/mtlFileLoader.js +232 -221
  6. package/OBJ/mtlFileLoader.js.map +1 -1
  7. package/OBJ/objFileLoader.d.ts +126 -133
  8. package/OBJ/objFileLoader.js +296 -300
  9. package/OBJ/objFileLoader.js.map +1 -1
  10. package/OBJ/objLoadingOptions.d.ts +43 -43
  11. package/OBJ/objLoadingOptions.js +1 -1
  12. package/OBJ/objLoadingOptions.js.map +1 -1
  13. package/OBJ/solidParser.d.ts +154 -153
  14. package/OBJ/solidParser.js +693 -699
  15. package/OBJ/solidParser.js.map +1 -1
  16. package/STL/index.d.ts +1 -1
  17. package/STL/index.js +1 -1
  18. package/STL/index.js.map +1 -1
  19. package/STL/stlFileLoader.d.ts +64 -71
  20. package/STL/stlFileLoader.js +233 -239
  21. package/STL/stlFileLoader.js.map +1 -1
  22. package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
  23. package/glTF/1.0/glTFBinaryExtension.js +60 -61
  24. package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
  25. package/glTF/1.0/glTFLoader.d.ts +136 -106
  26. package/glTF/1.0/glTFLoader.js +1814 -1696
  27. package/glTF/1.0/glTFLoader.js.map +1 -1
  28. package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
  29. package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
  30. package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
  31. package/glTF/1.0/glTFLoaderUtils.d.ts +63 -62
  32. package/glTF/1.0/glTFLoaderUtils.js +250 -232
  33. package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
  34. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
  35. package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -127
  36. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
  37. package/glTF/1.0/index.d.ts +5 -5
  38. package/glTF/1.0/index.js +5 -5
  39. package/glTF/1.0/index.js.map +1 -1
  40. package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -36
  41. package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -110
  42. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
  43. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -27
  44. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -79
  45. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  46. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -27
  47. package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -42
  48. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
  49. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -21
  50. package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -32
  51. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
  52. package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -32
  53. package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -55
  54. package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
  55. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -31
  56. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -101
  57. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
  58. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -28
  59. package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -81
  60. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  61. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -31
  62. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -86
  63. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  64. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -30
  65. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -45
  66. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
  67. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -34
  68. package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -54
  69. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  70. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -30
  71. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -72
  72. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
  73. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -31
  74. package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -76
  75. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  76. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -30
  77. package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -66
  78. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  79. package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -31
  80. package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -76
  81. package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
  82. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -30
  83. package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -277
  84. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  85. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -30
  86. package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -65
  87. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  88. package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -76
  89. package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -243
  90. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
  91. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -31
  92. package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -78
  93. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  94. package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -19
  95. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -21
  96. package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
  97. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -21
  98. package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -32
  99. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
  100. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -25
  101. package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -53
  102. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  103. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -29
  104. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -46
  105. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
  106. package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -38
  107. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -216
  108. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
  109. package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -75
  110. package/glTF/2.0/Extensions/MSFT_lod.js +369 -333
  111. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
  112. package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
  113. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
  114. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
  115. package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
  116. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
  117. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
  118. package/glTF/2.0/Extensions/index.d.ts +26 -26
  119. package/glTF/2.0/Extensions/index.js +26 -26
  120. package/glTF/2.0/Extensions/index.js.map +1 -1
  121. package/glTF/2.0/glTFLoader.d.ts +406 -357
  122. package/glTF/2.0/glTFLoader.js +2366 -2249
  123. package/glTF/2.0/glTFLoader.js.map +1 -1
  124. package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
  125. package/glTF/2.0/glTFLoaderExtension.js +1 -1
  126. package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
  127. package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -209
  128. package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
  129. package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
  130. package/glTF/2.0/index.d.ts +4 -4
  131. package/glTF/2.0/index.js +5 -4
  132. package/glTF/2.0/index.js.map +1 -1
  133. package/glTF/glTFFileLoader.d.ts +433 -368
  134. package/glTF/glTFFileLoader.js +927 -869
  135. package/glTF/glTFFileLoader.js.map +1 -1
  136. package/glTF/glTFValidation.d.ts +29 -29
  137. package/glTF/glTFValidation.js +123 -121
  138. package/glTF/glTFValidation.js.map +1 -1
  139. package/glTF/index.d.ts +5 -5
  140. package/glTF/index.js +6 -5
  141. package/glTF/index.js.map +1 -1
  142. package/index.d.ts +3 -3
  143. package/index.js +4 -3
  144. package/index.js.map +1 -1
  145. package/legacy/legacy-glTF.d.ts +2 -2
  146. package/legacy/legacy-glTF.js +18 -18
  147. package/legacy/legacy-glTF.js.map +1 -1
  148. package/legacy/legacy-glTF1.d.ts +2 -2
  149. package/legacy/legacy-glTF1.js +15 -14
  150. package/legacy/legacy-glTF1.js.map +1 -1
  151. package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
  152. package/legacy/legacy-glTF1FileLoader.js +3 -2
  153. package/legacy/legacy-glTF1FileLoader.js.map +1 -1
  154. package/legacy/legacy-glTF2.d.ts +2 -2
  155. package/legacy/legacy-glTF2.js +33 -32
  156. package/legacy/legacy-glTF2.js.map +1 -1
  157. package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
  158. package/legacy/legacy-glTF2FileLoader.js +3 -2
  159. package/legacy/legacy-glTF2FileLoader.js.map +1 -1
  160. package/legacy/legacy-glTFFileLoader.d.ts +3 -3
  161. package/legacy/legacy-glTFFileLoader.js +4 -3
  162. package/legacy/legacy-glTFFileLoader.js.map +1 -1
  163. package/legacy/legacy-objFileLoader.d.ts +1 -1
  164. package/legacy/legacy-objFileLoader.js +13 -12
  165. package/legacy/legacy-objFileLoader.js.map +1 -1
  166. package/legacy/legacy-stlFileLoader.d.ts +1 -1
  167. package/legacy/legacy-stlFileLoader.js +13 -12
  168. package/legacy/legacy-stlFileLoader.js.map +1 -1
  169. package/legacy/legacy.d.ts +6 -6
  170. package/legacy/legacy.js +8 -6
  171. package/legacy/legacy.js.map +1 -1
  172. package/package.json +23 -198
  173. package/readme.md +2 -2
@@ -1,62 +1,61 @@
1
- import { __extends } from "tslib";
2
- import { GLTFLoaderExtension } from "./glTFLoader.js";
3
- import { GLTFUtils } from "./glTFLoaderUtils.js";
4
- import { EComponentType } from "./glTFLoaderInterfaces.js";
5
- import { GLTFLoader, GLTFLoaderBase } from "./glTFLoader.js";
6
- var BinaryExtensionBufferName = "binary_glTF";
7
- /** @hidden */
8
- var GLTFBinaryExtension = /** @class */ (function (_super) {
9
- __extends(GLTFBinaryExtension, _super);
10
- function GLTFBinaryExtension() {
11
- return _super.call(this, "KHR_binary_glTF") || this;
12
- }
13
- GLTFBinaryExtension.prototype.loadRuntimeAsync = function (scene, data, rootUrl, onSuccess, onError) {
14
- var extensionsUsed = data.json.extensionsUsed;
15
- if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {
16
- return false;
17
- }
18
- this._bin = data.bin;
19
- onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));
20
- return true;
21
- };
22
- GLTFBinaryExtension.prototype.loadBufferAsync = function (gltfRuntime, id, onSuccess, onError) {
23
- if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {
24
- return false;
25
- }
26
- if (id !== BinaryExtensionBufferName) {
27
- return false;
28
- }
29
- this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, function (error) { return onError(error.message); });
30
- return true;
31
- };
32
- GLTFBinaryExtension.prototype.loadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {
33
- var texture = gltfRuntime.textures[id];
34
- var source = gltfRuntime.images[texture.source];
35
- if (!source.extensions || !(this.name in source.extensions)) {
36
- return false;
37
- }
38
- var sourceExt = source.extensions[this.name];
39
- var bufferView = gltfRuntime.bufferViews[sourceExt.bufferView];
40
- var buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
41
- onSuccess(buffer);
42
- return true;
43
- };
44
- GLTFBinaryExtension.prototype.loadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {
45
- var shader = gltfRuntime.shaders[id];
46
- if (!shader.extensions || !(this.name in shader.extensions)) {
47
- return false;
48
- }
49
- var binaryExtensionShader = shader.extensions[this.name];
50
- var bufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];
51
- var shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
52
- setTimeout(function () {
53
- var shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);
54
- onSuccess(shaderString);
55
- });
56
- return true;
57
- };
58
- return GLTFBinaryExtension;
59
- }(GLTFLoaderExtension));
60
- export { GLTFBinaryExtension };
61
- GLTFLoader.RegisterExtension(new GLTFBinaryExtension());
1
+ import { __extends } from "tslib";
2
+ import { GLTFLoaderExtension, GLTFLoader, GLTFLoaderBase } from "./glTFLoader";
3
+ import { GLTFUtils } from "./glTFLoaderUtils";
4
+ import { EComponentType } from "./glTFLoaderInterfaces";
5
+ var BinaryExtensionBufferName = "binary_glTF";
6
+ /** @hidden */
7
+ var GLTFBinaryExtension = /** @class */ (function (_super) {
8
+ __extends(GLTFBinaryExtension, _super);
9
+ function GLTFBinaryExtension() {
10
+ return _super.call(this, "KHR_binary_glTF") || this;
11
+ }
12
+ GLTFBinaryExtension.prototype.loadRuntimeAsync = function (scene, data, rootUrl, onSuccess) {
13
+ var extensionsUsed = data.json.extensionsUsed;
14
+ if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {
15
+ return false;
16
+ }
17
+ this._bin = data.bin;
18
+ onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));
19
+ return true;
20
+ };
21
+ GLTFBinaryExtension.prototype.loadBufferAsync = function (gltfRuntime, id, onSuccess, onError) {
22
+ if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {
23
+ return false;
24
+ }
25
+ if (id !== BinaryExtensionBufferName) {
26
+ return false;
27
+ }
28
+ this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, function (error) { return onError(error.message); });
29
+ return true;
30
+ };
31
+ GLTFBinaryExtension.prototype.loadTextureBufferAsync = function (gltfRuntime, id, onSuccess) {
32
+ var texture = gltfRuntime.textures[id];
33
+ var source = gltfRuntime.images[texture.source];
34
+ if (!source.extensions || !(this.name in source.extensions)) {
35
+ return false;
36
+ }
37
+ var sourceExt = source.extensions[this.name];
38
+ var bufferView = gltfRuntime.bufferViews[sourceExt.bufferView];
39
+ var buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
40
+ onSuccess(buffer);
41
+ return true;
42
+ };
43
+ GLTFBinaryExtension.prototype.loadShaderStringAsync = function (gltfRuntime, id, onSuccess) {
44
+ var shader = gltfRuntime.shaders[id];
45
+ if (!shader.extensions || !(this.name in shader.extensions)) {
46
+ return false;
47
+ }
48
+ var binaryExtensionShader = shader.extensions[this.name];
49
+ var bufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];
50
+ var shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);
51
+ setTimeout(function () {
52
+ var shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);
53
+ onSuccess(shaderString);
54
+ });
55
+ return true;
56
+ };
57
+ return GLTFBinaryExtension;
58
+ }(GLTFLoaderExtension));
59
+ export { GLTFBinaryExtension };
60
+ GLTFLoader.RegisterExtension(new GLTFBinaryExtension());
62
61
  //# sourceMappingURL=glTFBinaryExtension.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"glTFBinaryExtension.js","sourceRoot":"","sources":["../../../../sourceES6/loaders/src/glTF/1.0/glTFBinaryExtension.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EAA2D,cAAc,EAAe,MAAM,wBAAwB,CAAC;AAC9H,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG1D,IAAM,yBAAyB,GAAG,aAAa,CAAC;AAahD,cAAc;AACd;IAAyC,uCAAmB;IAGxD;eACI,kBAAM,iBAAiB,CAAC;IAC5B,CAAC;IAEM,8CAAgB,GAAvB,UAAwB,KAAY,EAAE,IAAqB,EAAE,OAAe,EAAE,SAA8C,EAAE,OAAkC;QAC5J,IAAI,cAAc,GAAS,IAAI,CAAC,IAAK,CAAC,cAAc,CAAC;QACrD,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YAC1E,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,SAAS,CAAC,cAAc,CA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U,CAAC,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;QAChI,SAAS,CAAC,MAAM,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,mDAAqB,GAA5B,UAA6B,WAAyB,EAAE,EAAU,EAAE,SAAyC,EAAE,OAAkC;QAC7I,IAAI,MAAM,GAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE;YACzD,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,qBAAqB,GAA+B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrF,IAAI,UAAU,GAAoB,WAAW,CAAC,WAAW,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC5F,IAAI,WAAW,GAAG,SAAS,CAAC,uBAAuB,CAAC,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,CAAC,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;QAErI,UAAU,CAAC;YACP,IAAI,YAAY,GAAG,SAAS,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAC7D,SAAS,CAAC,YAAY,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,0BAAC;AAAD,CAAC,AA9DD,CAAyC,mBAAmB,GA8D3D;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC","sourcesContent":["import { GLTFLoaderExtension } from \"./glTFLoader\";\r\nimport { GLTFUtils } from \"./glTFLoaderUtils\";\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { IGLTFLoaderData } from \"../glTFFileLoader\";\r\nimport { IGLTFRuntime, IGLTFTexture, IGLTFImage, IGLTFBufferView, EComponentType, IGLTFShader } from \"./glTFLoaderInterfaces\";\r\nimport { GLTFLoader, GLTFLoaderBase } from \"./glTFLoader\";\r\nimport { IDataBuffer } from '@babylonjs/core/Misc/dataReader';\r\n\r\nconst BinaryExtensionBufferName = \"binary_glTF\";\r\n\r\ninterface IGLTFBinaryExtensionShader {\r\n bufferView: string;\r\n}\r\n\r\ninterface IGLTFBinaryExtensionImage {\r\n bufferView: string;\r\n mimeType: string;\r\n height: number;\r\n width: number;\r\n}\r\n\r\n/** @hidden */\r\nexport class GLTFBinaryExtension extends GLTFLoaderExtension {\r\n private _bin: IDataBuffer;\r\n\r\n public constructor() {\r\n super(\"KHR_binary_glTF\");\r\n }\r\n\r\n public loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void, onError: (message: string) => void): boolean {\r\n var extensionsUsed = (<any>data.json).extensionsUsed;\r\n if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {\r\n return false;\r\n }\r\n\r\n this._bin = data.bin;\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n return true;\r\n }\r\n\r\n public loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean {\r\n if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {\r\n return false;\r\n }\r\n\r\n if (id !== BinaryExtensionBufferName) {\r\n return false;\r\n }\r\n\r\n this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, (error) => onError(error.message));\r\n return true;\r\n }\r\n\r\n public loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean {\r\n var texture: IGLTFTexture = gltfRuntime.textures[id];\r\n var source: IGLTFImage = gltfRuntime.images[texture.source];\r\n if (!source.extensions || !(this.name in source.extensions)) {\r\n return false;\r\n }\r\n\r\n var sourceExt: IGLTFBinaryExtensionImage = source.extensions[this.name];\r\n var bufferView: IGLTFBufferView = gltfRuntime.bufferViews[sourceExt.bufferView];\r\n var buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n onSuccess(buffer);\r\n return true;\r\n }\r\n\r\n public loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean {\r\n var shader: IGLTFShader = gltfRuntime.shaders[id];\r\n if (!shader.extensions || !(this.name in shader.extensions)) {\r\n return false;\r\n }\r\n\r\n var binaryExtensionShader: IGLTFBinaryExtensionShader = shader.extensions[this.name];\r\n var bufferView: IGLTFBufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];\r\n var shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n\r\n setTimeout(() => {\r\n var shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);\r\n onSuccess(shaderString);\r\n });\r\n\r\n return true;\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(new GLTFBinaryExtension());"]}
1
+ {"version":3,"file":"glTFBinaryExtension.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/1.0/glTFBinaryExtension.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI9C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAIxD,IAAM,yBAAyB,GAAG,aAAa,CAAC;AAahD,cAAc;AACd;IAAyC,uCAAmB;IAGxD;eACI,kBAAM,iBAAiB,CAAC;IAC5B,CAAC;IAEM,8CAAgB,GAAvB,UAAwB,KAAY,EAAE,IAAqB,EAAE,OAAe,EAAE,SAA8C;QACxH,IAAM,cAAc,GAAS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AC,IAAI,mBAAmB,EAAE,CAAC,CAAC","sourcesContent":["import { GLTFLoaderExtension, GLTFLoader, GLTFLoaderBase } from \"./glTFLoader\";\r\nimport { GLTFUtils } from \"./glTFLoaderUtils\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { IGLTFLoaderData } from \"../glTFFileLoader\";\r\nimport type { IGLTFRuntime, IGLTFTexture, IGLTFImage, IGLTFBufferView, IGLTFShader } from \"./glTFLoaderInterfaces\";\r\nimport { EComponentType } from \"./glTFLoaderInterfaces\";\r\n\r\nimport type { IDataBuffer } from \"core/Misc/dataReader\";\r\n\r\nconst BinaryExtensionBufferName = \"binary_glTF\";\r\n\r\ninterface IGLTFBinaryExtensionShader {\r\n bufferView: string;\r\n}\r\n\r\ninterface IGLTFBinaryExtensionImage {\r\n bufferView: string;\r\n mimeType: string;\r\n height: number;\r\n width: number;\r\n}\r\n\r\n/** @hidden */\r\nexport class GLTFBinaryExtension extends GLTFLoaderExtension {\r\n private _bin: IDataBuffer;\r\n\r\n public constructor() {\r\n super(\"KHR_binary_glTF\");\r\n }\r\n\r\n public loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (gltfRuntime: IGLTFRuntime) => void): boolean {\r\n const extensionsUsed = (<any>data.json).extensionsUsed;\r\n if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {\r\n return false;\r\n }\r\n\r\n this._bin = data.bin;\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n return true;\r\n }\r\n\r\n public loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean {\r\n if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {\r\n return false;\r\n }\r\n\r\n if (id !== BinaryExtensionBufferName) {\r\n return false;\r\n }\r\n\r\n this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, (error) => onError(error.message));\r\n return true;\r\n }\r\n\r\n public loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void): boolean {\r\n const texture: IGLTFTexture = gltfRuntime.textures[id];\r\n const source: IGLTFImage = gltfRuntime.images[texture.source];\r\n if (!source.extensions || !(this.name in source.extensions)) {\r\n return false;\r\n }\r\n\r\n const sourceExt: IGLTFBinaryExtensionImage = source.extensions[this.name];\r\n const bufferView: IGLTFBufferView = gltfRuntime.bufferViews[sourceExt.bufferView];\r\n const buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n onSuccess(buffer);\r\n return true;\r\n }\r\n\r\n public loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void): boolean {\r\n const shader: IGLTFShader = gltfRuntime.shaders[id];\r\n if (!shader.extensions || !(this.name in shader.extensions)) {\r\n return false;\r\n }\r\n\r\n const binaryExtensionShader: IGLTFBinaryExtensionShader = shader.extensions[this.name];\r\n const bufferView: IGLTFBufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];\r\n const shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n\r\n setTimeout(() => {\r\n const shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);\r\n onSuccess(shaderString);\r\n });\r\n\r\n return true;\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(new GLTFBinaryExtension());\r\n"]}
@@ -1,106 +1,136 @@
1
- import { IGLTFRuntime } from "./glTFLoaderInterfaces";
2
- import { Nullable } from "@babylonjs/core/types";
3
- import { Material } from "@babylonjs/core/Materials/material";
4
- import { Texture } from "@babylonjs/core/Materials/Textures/texture";
5
- import { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader";
6
- import { Scene } from "@babylonjs/core/scene";
7
- import { IGLTFLoader, IGLTFLoaderData } from "../glTFFileLoader";
8
- import { AssetContainer } from "@babylonjs/core/assetContainer";
9
- /**
10
- * Implementation of the base glTF spec
11
- * @hidden
12
- */
13
- export declare class GLTFLoaderBase {
14
- static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
15
- static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
16
- static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
17
- static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
18
- static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void;
19
- static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
20
- }
21
- /**
22
- * glTF V1 Loader
23
- * @hidden
24
- */
25
- export declare class GLTFLoader implements IGLTFLoader {
26
- static Extensions: {
27
- [name: string]: GLTFLoaderExtension;
28
- };
29
- static RegisterExtension(extension: GLTFLoaderExtension): void;
30
- dispose(): void;
31
- private _importMeshAsync;
32
- /**
33
- * Imports one or more meshes from a loaded gltf file and adds them to the scene
34
- * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
35
- * @param scene the scene the meshes should be added to
36
- * @param assetContainer defines the asset container to use (can be null)
37
- * @param data gltf data containing information of the meshes in a loaded file
38
- * @param rootUrl root url to load from
39
- * @param onProgress event that fires when loading progress has occured
40
- * @returns a promise containg the loaded meshes, particles, skeletons and animations
41
- */
42
- importMeshAsync(meshesNames: any, scene: Scene, assetContainer: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<ISceneLoaderAsyncResult>;
43
- private _loadAsync;
44
- /**
45
- * Imports all objects from a loaded gltf file and adds them to the scene
46
- * @param scene the scene the objects should be added to
47
- * @param data gltf data containing information of the meshes in a loaded file
48
- * @param rootUrl root url to load from
49
- * @param onProgress event that fires when loading progress has occured
50
- * @returns a promise which completes when objects have been loaded to the scene
51
- */
52
- loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<void>;
53
- private _loadShadersAsync;
54
- private _loadBuffersAsync;
55
- private _createNodes;
56
- }
57
- /** @hidden */
58
- export declare abstract class GLTFLoaderExtension {
59
- private _name;
60
- constructor(name: string);
61
- get name(): string;
62
- /**
63
- * Defines an override for loading the runtime
64
- * Return true to stop further extensions from loading the runtime
65
- */
66
- loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
67
- /**
68
- * Defines an onverride for creating gltf runtime
69
- * Return true to stop further extensions from creating the runtime
70
- */
71
- loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
72
- /**
73
- * Defines an override for loading buffers
74
- * Return true to stop further extensions from loading this buffer
75
- */
76
- loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
77
- /**
78
- * Defines an override for loading texture buffers
79
- * Return true to stop further extensions from loading this texture data
80
- */
81
- loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
82
- /**
83
- * Defines an override for creating textures
84
- * Return true to stop further extensions from loading this texture
85
- */
86
- createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
87
- /**
88
- * Defines an override for loading shader strings
89
- * Return true to stop further extensions from loading this shader data
90
- */
91
- loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
92
- /**
93
- * Defines an override for loading materials
94
- * Return true to stop further extensions from loading this material
95
- */
96
- loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
97
- static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
98
- static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void;
99
- static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
100
- static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
101
- static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void;
102
- static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
103
- private static LoadTextureBufferAsync;
104
- private static CreateTextureAsync;
105
- private static ApplyExtensions;
106
- }
1
+ import type { IGLTFRuntime } from "./glTFLoaderInterfaces";
2
+ import type { Nullable } from "@babylonjs/core/types.js";
3
+ import { Material } from "@babylonjs/core/Materials/material.js";
4
+ import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
5
+ import type { ISceneLoaderAsyncResult, ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader.js";
6
+ import type { Scene } from "@babylonjs/core/scene.js";
7
+ import type { IGLTFLoader, IGLTFLoaderData } from "../glTFFileLoader";
8
+ import type { AssetContainer } from "@babylonjs/core/assetContainer.js";
9
+ /**
10
+ * Implementation of the base glTF spec
11
+ * @hidden
12
+ */
13
+ export declare class GLTFLoaderBase {
14
+ static CreateRuntime(parsedData: any, scene: Scene, rootUrl: string): IGLTFRuntime;
15
+ static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
16
+ static LoadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: Nullable<ArrayBufferView>) => void, onError: (message: string) => void): void;
17
+ static CreateTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: Nullable<ArrayBufferView>, onSuccess: (texture: Texture) => void): void;
18
+ static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string | ArrayBuffer) => void, onError?: (message: string) => void): void;
19
+ static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
20
+ }
21
+ /**
22
+ * glTF V1 Loader
23
+ * @hidden
24
+ */
25
+ export declare class GLTFLoader implements IGLTFLoader {
26
+ static Extensions: {
27
+ [name: string]: GLTFLoaderExtension;
28
+ };
29
+ static RegisterExtension(extension: GLTFLoaderExtension): void;
30
+ dispose(): void;
31
+ private _importMeshAsync;
32
+ /**
33
+ * Imports one or more meshes from a loaded gltf file and adds them to the scene
34
+ * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
35
+ * @param scene the scene the meshes should be added to
36
+ * @param assetContainer defines the asset container to use (can be null)
37
+ * @param data gltf data containing information of the meshes in a loaded file
38
+ * @param rootUrl root url to load from
39
+ * @param onProgress event that fires when loading progress has occured
40
+ * @returns a promise containg the loaded meshes, particles, skeletons and animations
41
+ */
42
+ importMeshAsync(meshesNames: any, scene: Scene, assetContainer: Nullable<AssetContainer>, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<ISceneLoaderAsyncResult>;
43
+ private _loadAsync;
44
+ /**
45
+ * Imports all objects from a loaded gltf file and adds them to the scene
46
+ * @param scene the scene the objects should be added to
47
+ * @param data gltf data containing information of the meshes in a loaded file
48
+ * @param rootUrl root url to load from
49
+ * @param onProgress event that fires when loading progress has occured
50
+ * @returns a promise which completes when objects have been loaded to the scene
51
+ */
52
+ loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void): Promise<void>;
53
+ private _loadShadersAsync;
54
+ private _loadBuffersAsync;
55
+ private _createNodes;
56
+ }
57
+ /** @hidden */
58
+ export declare abstract class GLTFLoaderExtension {
59
+ private _name;
60
+ constructor(name: string);
61
+ get name(): string;
62
+ /**
63
+ * Defines an override for loading the runtime
64
+ * Return true to stop further extensions from loading the runtime
65
+ * @param scene
66
+ * @param data
67
+ * @param rootUrl
68
+ * @param onSuccess
69
+ * @param onError
70
+ */
71
+ loadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): boolean;
72
+ /**
73
+ * Defines an onverride for creating gltf runtime
74
+ * Return true to stop further extensions from creating the runtime
75
+ * @param gltfRuntime
76
+ * @param onSuccess
77
+ * @param onError
78
+ */
79
+ loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): boolean;
80
+ /**
81
+ * Defines an override for loading buffers
82
+ * Return true to stop further extensions from loading this buffer
83
+ * @param gltfRuntime
84
+ * @param id
85
+ * @param onSuccess
86
+ * @param onError
87
+ * @param onProgress
88
+ */
89
+ loadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): boolean;
90
+ /**
91
+ * Defines an override for loading texture buffers
92
+ * Return true to stop further extensions from loading this texture data
93
+ * @param gltfRuntime
94
+ * @param id
95
+ * @param onSuccess
96
+ * @param onError
97
+ */
98
+ loadTextureBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void, onError: (message: string) => void): boolean;
99
+ /**
100
+ * Defines an override for creating textures
101
+ * Return true to stop further extensions from loading this texture
102
+ * @param gltfRuntime
103
+ * @param id
104
+ * @param buffer
105
+ * @param onSuccess
106
+ * @param onError
107
+ */
108
+ createTextureAsync(gltfRuntime: IGLTFRuntime, id: string, buffer: ArrayBufferView, onSuccess: (texture: Texture) => void, onError: (message: string) => void): boolean;
109
+ /**
110
+ * Defines an override for loading shader strings
111
+ * Return true to stop further extensions from loading this shader data
112
+ * @param gltfRuntime
113
+ * @param id
114
+ * @param onSuccess
115
+ * @param onError
116
+ */
117
+ loadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void, onError: (message: string) => void): boolean;
118
+ /**
119
+ * Defines an override for loading materials
120
+ * Return true to stop further extensions from loading this material
121
+ * @param gltfRuntime
122
+ * @param id
123
+ * @param onSuccess
124
+ * @param onError
125
+ */
126
+ loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
127
+ static LoadRuntimeAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (gltfRuntime: IGLTFRuntime) => void, onError?: (message: string) => void): void;
128
+ static LoadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime, onSuccess: () => void, onError?: (message: string) => void): void;
129
+ static LoadBufferAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (bufferView: ArrayBufferView) => void, onError: (message: string) => void, onProgress?: () => void): void;
130
+ static LoadTextureAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (texture: Texture) => void, onError: (message: string) => void): void;
131
+ static LoadShaderStringAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (shaderData: string | ArrayBuffer) => void, onError: (message: string) => void): void;
132
+ static LoadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): void;
133
+ private static _LoadTextureBufferAsync;
134
+ private static _CreateTextureAsync;
135
+ private static _ApplyExtensions;
136
+ }