@babylonjs/loaders 5.0.0-rc.5 → 5.0.0-rc.9
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.d.ts +4 -4
- package/OBJ/index.js +4 -4
- package/OBJ/mtlFileLoader.d.ts +41 -41
- package/OBJ/mtlFileLoader.js +232 -232
- package/OBJ/objFileLoader.d.ts +126 -126
- package/OBJ/objFileLoader.js +296 -296
- package/OBJ/objLoadingOptions.d.ts +43 -43
- package/OBJ/objLoadingOptions.js +1 -1
- package/OBJ/solidParser.d.ts +154 -154
- package/OBJ/solidParser.js +693 -693
- package/STL/index.d.ts +1 -1
- package/STL/index.js +1 -1
- package/STL/stlFileLoader.d.ts +64 -64
- package/STL/stlFileLoader.js +233 -233
- package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
- package/glTF/1.0/glTFBinaryExtension.js +60 -60
- package/glTF/1.0/glTFLoader.d.ts +136 -136
- package/glTF/1.0/glTFLoader.js +1815 -1815
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
- package/glTF/1.0/glTFLoaderUtils.d.ts +62 -62
- package/glTF/1.0/glTFLoaderUtils.js +250 -250
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
- package/glTF/1.0/index.d.ts +5 -5
- package/glTF/1.0/index.js +5 -5
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +43 -43
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +117 -117
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +36 -36
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +88 -88
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +34 -34
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +49 -49
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +29 -29
- package/glTF/2.0/Extensions/EXT_texture_webp.js +40 -40
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -50
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +112 -112
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +36 -36
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +89 -89
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -94
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +53 -53
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +42 -42
- package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -62
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +80 -80
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +84 -84
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_specular.js +74 -74
- package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +83 -83
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +288 -288
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +38 -38
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -73
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +87 -87
- package/glTF/2.0/Extensions/KHR_materials_variants.js +254 -254
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +39 -39
- package/glTF/2.0/Extensions/KHR_materials_volume.js +85 -85
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +22 -22
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -23
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +29 -29
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +40 -40
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +33 -33
- package/glTF/2.0/Extensions/KHR_texture_transform.js +61 -61
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +32 -32
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +49 -49
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +54 -54
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +240 -240
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +109 -109
- package/glTF/2.0/Extensions/MSFT_lod.js +369 -369
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +36 -36
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +14 -14
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +36 -36
- package/glTF/2.0/Extensions/index.d.ts +26 -26
- package/glTF/2.0/Extensions/index.js +26 -26
- package/glTF/2.0/glTFLoader.d.ts +405 -405
- package/glTF/2.0/glTFLoader.js +2366 -2366
- package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
- package/glTF/2.0/glTFLoaderExtension.js +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
- package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
- package/glTF/2.0/index.d.ts +4 -4
- package/glTF/2.0/index.js +4 -4
- package/glTF/glTFFileLoader.d.ts +433 -433
- package/glTF/glTFFileLoader.js +927 -927
- package/glTF/glTFValidation.d.ts +29 -29
- package/glTF/glTFValidation.js +123 -123
- package/glTF/index.d.ts +5 -5
- package/glTF/index.js +5 -5
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +18 -18
- package/legacy/legacy-glTF1.d.ts +2 -2
- package/legacy/legacy-glTF1.js +14 -14
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF1FileLoader.js +3 -3
- package/legacy/legacy-glTF2.d.ts +2 -2
- package/legacy/legacy-glTF2.js +32 -32
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF2FileLoader.js +3 -3
- package/legacy/legacy-glTFFileLoader.d.ts +3 -3
- package/legacy/legacy-glTFFileLoader.js +4 -4
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +12 -12
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +12 -12
- package/legacy/legacy.d.ts +6 -6
- package/legacy/legacy.js +7 -7
- package/package.json +3 -3
@@ -1,50 +1,50 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
3
|
-
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
4
|
-
import { INode, ICamera, IMaterial } from "../glTFLoaderInterfaces";
|
5
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
6
|
-
import { GLTFLoader } from "../glTFLoader";
|
7
|
-
import { Material } from "@babylonjs/core/Materials/material.js";
|
8
|
-
/**
|
9
|
-
* Store glTF extras (if present) in BJS objects' metadata
|
10
|
-
*/
|
11
|
-
export declare class ExtrasAsMetadata implements IGLTFLoaderExtension {
|
12
|
-
/**
|
13
|
-
* The name of this extension.
|
14
|
-
*/
|
15
|
-
readonly name = "ExtrasAsMetadata";
|
16
|
-
/**
|
17
|
-
* Defines whether this extension is enabled.
|
18
|
-
*/
|
19
|
-
enabled: boolean;
|
20
|
-
private _loader;
|
21
|
-
private _assignExtras;
|
22
|
-
/**
|
23
|
-
* @param loader
|
24
|
-
* @hidden
|
25
|
-
*/
|
26
|
-
constructor(loader: GLTFLoader);
|
27
|
-
/** @hidden */
|
28
|
-
dispose(): void;
|
29
|
-
/**
|
30
|
-
* @param context
|
31
|
-
* @param node
|
32
|
-
* @param assign
|
33
|
-
* @hidden
|
34
|
-
*/
|
35
|
-
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
36
|
-
/**
|
37
|
-
* @param context
|
38
|
-
* @param camera
|
39
|
-
* @param assign
|
40
|
-
* @hidden
|
41
|
-
*/
|
42
|
-
loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
|
43
|
-
/**
|
44
|
-
* @param context
|
45
|
-
* @param material
|
46
|
-
* @param babylonDrawMode
|
47
|
-
* @hidden
|
48
|
-
*/
|
49
|
-
createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
|
50
|
-
}
|
1
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
3
|
+
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
4
|
+
import { INode, ICamera, IMaterial } from "../glTFLoaderInterfaces";
|
5
|
+
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
6
|
+
import { GLTFLoader } from "../glTFLoader";
|
7
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
8
|
+
/**
|
9
|
+
* Store glTF extras (if present) in BJS objects' metadata
|
10
|
+
*/
|
11
|
+
export declare class ExtrasAsMetadata implements IGLTFLoaderExtension {
|
12
|
+
/**
|
13
|
+
* The name of this extension.
|
14
|
+
*/
|
15
|
+
readonly name = "ExtrasAsMetadata";
|
16
|
+
/**
|
17
|
+
* Defines whether this extension is enabled.
|
18
|
+
*/
|
19
|
+
enabled: boolean;
|
20
|
+
private _loader;
|
21
|
+
private _assignExtras;
|
22
|
+
/**
|
23
|
+
* @param loader
|
24
|
+
* @hidden
|
25
|
+
*/
|
26
|
+
constructor(loader: GLTFLoader);
|
27
|
+
/** @hidden */
|
28
|
+
dispose(): void;
|
29
|
+
/**
|
30
|
+
* @param context
|
31
|
+
* @param node
|
32
|
+
* @param assign
|
33
|
+
* @hidden
|
34
|
+
*/
|
35
|
+
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
36
|
+
/**
|
37
|
+
* @param context
|
38
|
+
* @param camera
|
39
|
+
* @param assign
|
40
|
+
* @hidden
|
41
|
+
*/
|
42
|
+
loadCameraAsync(context: string, camera: ICamera, assign: (babylonCamera: Camera) => void): Nullable<Promise<Camera>>;
|
43
|
+
/**
|
44
|
+
* @param context
|
45
|
+
* @param material
|
46
|
+
* @param babylonDrawMode
|
47
|
+
* @hidden
|
48
|
+
*/
|
49
|
+
createMaterial(context: string, material: IMaterial, babylonDrawMode: number): Nullable<Material>;
|
50
|
+
}
|
@@ -1,74 +1,74 @@
|
|
1
|
-
import { GLTFLoader } from "../glTFLoader
|
2
|
-
var NAME = "ExtrasAsMetadata";
|
3
|
-
/**
|
4
|
-
* Store glTF extras (if present) in BJS objects' metadata
|
5
|
-
*/
|
6
|
-
var ExtrasAsMetadata = /** @class */ (function () {
|
7
|
-
/**
|
8
|
-
* @param loader
|
9
|
-
* @hidden
|
10
|
-
*/
|
11
|
-
function ExtrasAsMetadata(loader) {
|
12
|
-
/**
|
13
|
-
* The name of this extension.
|
14
|
-
*/
|
15
|
-
this.name = NAME;
|
16
|
-
/**
|
17
|
-
* Defines whether this extension is enabled.
|
18
|
-
*/
|
19
|
-
this.enabled = true;
|
20
|
-
this._loader = loader;
|
21
|
-
}
|
22
|
-
ExtrasAsMetadata.prototype._assignExtras = function (babylonObject, gltfProp) {
|
23
|
-
if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {
|
24
|
-
var metadata = (babylonObject.metadata = babylonObject.metadata || {});
|
25
|
-
var gltf = (metadata.gltf = metadata.gltf || {});
|
26
|
-
gltf.extras = gltfProp.extras;
|
27
|
-
}
|
28
|
-
};
|
29
|
-
/** @hidden */
|
30
|
-
ExtrasAsMetadata.prototype.dispose = function () {
|
31
|
-
this._loader = null;
|
32
|
-
};
|
33
|
-
/**
|
34
|
-
* @param context
|
35
|
-
* @param node
|
36
|
-
* @param assign
|
37
|
-
* @hidden
|
38
|
-
*/
|
39
|
-
ExtrasAsMetadata.prototype.loadNodeAsync = function (context, node, assign) {
|
40
|
-
var _this = this;
|
41
|
-
return this._loader.loadNodeAsync(context, node, function (babylonTransformNode) {
|
42
|
-
_this._assignExtras(babylonTransformNode, node);
|
43
|
-
assign(babylonTransformNode);
|
44
|
-
});
|
45
|
-
};
|
46
|
-
/**
|
47
|
-
* @param context
|
48
|
-
* @param camera
|
49
|
-
* @param assign
|
50
|
-
* @hidden
|
51
|
-
*/
|
52
|
-
ExtrasAsMetadata.prototype.loadCameraAsync = function (context, camera, assign) {
|
53
|
-
var _this = this;
|
54
|
-
return this._loader.loadCameraAsync(context, camera, function (babylonCamera) {
|
55
|
-
_this._assignExtras(babylonCamera, camera);
|
56
|
-
assign(babylonCamera);
|
57
|
-
});
|
58
|
-
};
|
59
|
-
/**
|
60
|
-
* @param context
|
61
|
-
* @param material
|
62
|
-
* @param babylonDrawMode
|
63
|
-
* @hidden
|
64
|
-
*/
|
65
|
-
ExtrasAsMetadata.prototype.createMaterial = function (context, material, babylonDrawMode) {
|
66
|
-
var babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);
|
67
|
-
this._assignExtras(babylonMaterial, material);
|
68
|
-
return babylonMaterial;
|
69
|
-
};
|
70
|
-
return ExtrasAsMetadata;
|
71
|
-
}());
|
72
|
-
export { ExtrasAsMetadata };
|
73
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new ExtrasAsMetadata(loader); });
|
1
|
+
import { GLTFLoader } from "../glTFLoader";
|
2
|
+
var NAME = "ExtrasAsMetadata";
|
3
|
+
/**
|
4
|
+
* Store glTF extras (if present) in BJS objects' metadata
|
5
|
+
*/
|
6
|
+
var ExtrasAsMetadata = /** @class */ (function () {
|
7
|
+
/**
|
8
|
+
* @param loader
|
9
|
+
* @hidden
|
10
|
+
*/
|
11
|
+
function ExtrasAsMetadata(loader) {
|
12
|
+
/**
|
13
|
+
* The name of this extension.
|
14
|
+
*/
|
15
|
+
this.name = NAME;
|
16
|
+
/**
|
17
|
+
* Defines whether this extension is enabled.
|
18
|
+
*/
|
19
|
+
this.enabled = true;
|
20
|
+
this._loader = loader;
|
21
|
+
}
|
22
|
+
ExtrasAsMetadata.prototype._assignExtras = function (babylonObject, gltfProp) {
|
23
|
+
if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {
|
24
|
+
var metadata = (babylonObject.metadata = babylonObject.metadata || {});
|
25
|
+
var gltf = (metadata.gltf = metadata.gltf || {});
|
26
|
+
gltf.extras = gltfProp.extras;
|
27
|
+
}
|
28
|
+
};
|
29
|
+
/** @hidden */
|
30
|
+
ExtrasAsMetadata.prototype.dispose = function () {
|
31
|
+
this._loader = null;
|
32
|
+
};
|
33
|
+
/**
|
34
|
+
* @param context
|
35
|
+
* @param node
|
36
|
+
* @param assign
|
37
|
+
* @hidden
|
38
|
+
*/
|
39
|
+
ExtrasAsMetadata.prototype.loadNodeAsync = function (context, node, assign) {
|
40
|
+
var _this = this;
|
41
|
+
return this._loader.loadNodeAsync(context, node, function (babylonTransformNode) {
|
42
|
+
_this._assignExtras(babylonTransformNode, node);
|
43
|
+
assign(babylonTransformNode);
|
44
|
+
});
|
45
|
+
};
|
46
|
+
/**
|
47
|
+
* @param context
|
48
|
+
* @param camera
|
49
|
+
* @param assign
|
50
|
+
* @hidden
|
51
|
+
*/
|
52
|
+
ExtrasAsMetadata.prototype.loadCameraAsync = function (context, camera, assign) {
|
53
|
+
var _this = this;
|
54
|
+
return this._loader.loadCameraAsync(context, camera, function (babylonCamera) {
|
55
|
+
_this._assignExtras(babylonCamera, camera);
|
56
|
+
assign(babylonCamera);
|
57
|
+
});
|
58
|
+
};
|
59
|
+
/**
|
60
|
+
* @param context
|
61
|
+
* @param material
|
62
|
+
* @param babylonDrawMode
|
63
|
+
* @hidden
|
64
|
+
*/
|
65
|
+
ExtrasAsMetadata.prototype.createMaterial = function (context, material, babylonDrawMode) {
|
66
|
+
var babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);
|
67
|
+
this._assignExtras(babylonMaterial, material);
|
68
|
+
return babylonMaterial;
|
69
|
+
};
|
70
|
+
return ExtrasAsMetadata;
|
71
|
+
}());
|
72
|
+
export { ExtrasAsMetadata };
|
73
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new ExtrasAsMetadata(loader); });
|
74
74
|
//# sourceMappingURL=ExtrasAsMetadata.js.map
|
@@ -1,39 +1,39 @@
|
|
1
|
-
import { DracoCompression } from "@babylonjs/core/Meshes/Compression/dracoCompression.js";
|
2
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
3
|
-
import { Geometry } from "@babylonjs/core/Meshes/geometry.js";
|
4
|
-
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
5
|
-
import { IMeshPrimitive } from "../glTFLoaderInterfaces";
|
6
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
7
|
-
import { GLTFLoader } from "../glTFLoader";
|
8
|
-
/**
|
9
|
-
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
|
10
|
-
*/
|
11
|
-
export declare class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
|
12
|
-
/**
|
13
|
-
* The name of this extension.
|
14
|
-
*/
|
15
|
-
readonly name = "KHR_draco_mesh_compression";
|
16
|
-
/**
|
17
|
-
* The draco compression used to decode vertex data or DracoCompression.Default if not defined
|
18
|
-
*/
|
19
|
-
dracoCompression?: DracoCompression;
|
20
|
-
/**
|
21
|
-
* Defines whether this extension is enabled.
|
22
|
-
*/
|
23
|
-
enabled: boolean;
|
24
|
-
private _loader;
|
25
|
-
/**
|
26
|
-
* @param loader
|
27
|
-
* @hidden
|
28
|
-
*/
|
29
|
-
constructor(loader: GLTFLoader);
|
30
|
-
/** @hidden */
|
31
|
-
dispose(): void;
|
32
|
-
/**
|
33
|
-
* @param context
|
34
|
-
* @param primitive
|
35
|
-
* @param babylonMesh
|
36
|
-
* @hidden
|
37
|
-
*/
|
38
|
-
_loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
|
39
|
-
}
|
1
|
+
import { DracoCompression } from "@babylonjs/core/Meshes/Compression/dracoCompression.js";
|
2
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
3
|
+
import { Geometry } from "@babylonjs/core/Meshes/geometry.js";
|
4
|
+
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
5
|
+
import { IMeshPrimitive } from "../glTFLoaderInterfaces";
|
6
|
+
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
7
|
+
import { GLTFLoader } from "../glTFLoader";
|
8
|
+
/**
|
9
|
+
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
|
10
|
+
*/
|
11
|
+
export declare class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
|
12
|
+
/**
|
13
|
+
* The name of this extension.
|
14
|
+
*/
|
15
|
+
readonly name = "KHR_draco_mesh_compression";
|
16
|
+
/**
|
17
|
+
* The draco compression used to decode vertex data or DracoCompression.Default if not defined
|
18
|
+
*/
|
19
|
+
dracoCompression?: DracoCompression;
|
20
|
+
/**
|
21
|
+
* Defines whether this extension is enabled.
|
22
|
+
*/
|
23
|
+
enabled: boolean;
|
24
|
+
private _loader;
|
25
|
+
/**
|
26
|
+
* @param loader
|
27
|
+
* @hidden
|
28
|
+
*/
|
29
|
+
constructor(loader: GLTFLoader);
|
30
|
+
/** @hidden */
|
31
|
+
dispose(): void;
|
32
|
+
/**
|
33
|
+
* @param context
|
34
|
+
* @param primitive
|
35
|
+
* @param babylonMesh
|
36
|
+
* @hidden
|
37
|
+
*/
|
38
|
+
_loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
|
39
|
+
}
|
@@ -1,113 +1,113 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
2
|
-
import { DracoCompression } from "@babylonjs/core/Meshes/Compression/dracoCompression.js";
|
3
|
-
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
4
|
-
import { Geometry } from "@babylonjs/core/Meshes/geometry.js";
|
5
|
-
import { GLTFLoader, ArrayItem } from "../glTFLoader
|
6
|
-
var NAME = "KHR_draco_mesh_compression";
|
7
|
-
/**
|
8
|
-
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
|
9
|
-
*/
|
10
|
-
var KHR_draco_mesh_compression = /** @class */ (function () {
|
11
|
-
/**
|
12
|
-
* @param loader
|
13
|
-
* @hidden
|
14
|
-
*/
|
15
|
-
function KHR_draco_mesh_compression(loader) {
|
16
|
-
/**
|
17
|
-
* The name of this extension.
|
18
|
-
*/
|
19
|
-
this.name = NAME;
|
20
|
-
this._loader = loader;
|
21
|
-
this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);
|
22
|
-
}
|
23
|
-
/** @hidden */
|
24
|
-
KHR_draco_mesh_compression.prototype.dispose = function () {
|
25
|
-
delete this.dracoCompression;
|
26
|
-
this._loader = null;
|
27
|
-
};
|
28
|
-
/**
|
29
|
-
* @param context
|
30
|
-
* @param primitive
|
31
|
-
* @param babylonMesh
|
32
|
-
* @hidden
|
33
|
-
*/
|
34
|
-
KHR_draco_mesh_compression.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {
|
35
|
-
var _this = this;
|
36
|
-
return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, function (extensionContext, extension) {
|
37
|
-
if (primitive.mode != undefined) {
|
38
|
-
if (primitive.mode !== 5 /* TRIANGLE_STRIP */ && primitive.mode !== 4 /* TRIANGLES */) {
|
39
|
-
throw new Error("".concat(context, ": Unsupported mode ").concat(primitive.mode));
|
40
|
-
}
|
41
|
-
// TODO: handle triangle strips
|
42
|
-
if (primitive.mode === 5 /* TRIANGLE_STRIP */) {
|
43
|
-
throw new Error("".concat(context, ": Mode ").concat(primitive.mode, " is not currently supported"));
|
44
|
-
}
|
45
|
-
}
|
46
|
-
var attributes = {};
|
47
|
-
var dividers = {};
|
48
|
-
var loadAttribute = function (name, kind) {
|
49
|
-
var uniqueId = extension.attributes[name];
|
50
|
-
if (uniqueId === undefined || primitive.attributes[name] === undefined) {
|
51
|
-
return;
|
52
|
-
}
|
53
|
-
attributes[kind] = uniqueId;
|
54
|
-
var accessor = ArrayItem.Get("".concat(context, "/attributes/").concat(name), _this._loader.gltf.accessors, primitive.attributes[name]);
|
55
|
-
if (accessor.normalized && accessor.componentType !== 5126 /* FLOAT */) {
|
56
|
-
var divider = 1;
|
57
|
-
switch (accessor.componentType) {
|
58
|
-
case 5120 /* BYTE */:
|
59
|
-
divider = 127.0;
|
60
|
-
break;
|
61
|
-
case 5121 /* UNSIGNED_BYTE */:
|
62
|
-
divider = 255.0;
|
63
|
-
break;
|
64
|
-
case 5122 /* SHORT */:
|
65
|
-
divider = 32767.0;
|
66
|
-
break;
|
67
|
-
case 5123 /* UNSIGNED_SHORT */:
|
68
|
-
divider = 65535.0;
|
69
|
-
break;
|
70
|
-
}
|
71
|
-
dividers[kind] = divider;
|
72
|
-
}
|
73
|
-
babylonMesh._delayInfo = babylonMesh._delayInfo || [];
|
74
|
-
if (babylonMesh._delayInfo.indexOf(kind) === -1) {
|
75
|
-
babylonMesh._delayInfo.push(kind);
|
76
|
-
}
|
77
|
-
};
|
78
|
-
loadAttribute("POSITION", VertexBuffer.PositionKind);
|
79
|
-
loadAttribute("NORMAL", VertexBuffer.NormalKind);
|
80
|
-
loadAttribute("TANGENT", VertexBuffer.TangentKind);
|
81
|
-
loadAttribute("TEXCOORD_0", VertexBuffer.UVKind);
|
82
|
-
loadAttribute("TEXCOORD_1", VertexBuffer.UV2Kind);
|
83
|
-
loadAttribute("TEXCOORD_2", VertexBuffer.UV3Kind);
|
84
|
-
loadAttribute("TEXCOORD_3", VertexBuffer.UV4Kind);
|
85
|
-
loadAttribute("TEXCOORD_4", VertexBuffer.UV5Kind);
|
86
|
-
loadAttribute("TEXCOORD_5", VertexBuffer.UV6Kind);
|
87
|
-
loadAttribute("JOINTS_0", VertexBuffer.MatricesIndicesKind);
|
88
|
-
loadAttribute("WEIGHTS_0", VertexBuffer.MatricesWeightsKind);
|
89
|
-
loadAttribute("COLOR_0", VertexBuffer.ColorKind);
|
90
|
-
var bufferView = ArrayItem.Get(extensionContext, _this._loader.gltf.bufferViews, extension.bufferView);
|
91
|
-
if (!bufferView._dracoBabylonGeometry) {
|
92
|
-
bufferView._dracoBabylonGeometry = _this._loader.loadBufferViewAsync("/bufferViews/".concat(bufferView.index), bufferView).then(function (data) {
|
93
|
-
var dracoCompression = _this.dracoCompression || DracoCompression.Default;
|
94
|
-
return dracoCompression
|
95
|
-
.decodeMeshAsync(data, attributes, dividers)
|
96
|
-
.then(function (babylonVertexData) {
|
97
|
-
var babylonGeometry = new Geometry(babylonMesh.name, _this._loader.babylonScene);
|
98
|
-
babylonVertexData.applyToGeometry(babylonGeometry);
|
99
|
-
return babylonGeometry;
|
100
|
-
})
|
101
|
-
.catch(function (error) {
|
102
|
-
throw new Error("".concat(context, ": ").concat(error.message));
|
103
|
-
});
|
104
|
-
});
|
105
|
-
}
|
106
|
-
return bufferView._dracoBabylonGeometry;
|
107
|
-
});
|
108
|
-
};
|
109
|
-
return KHR_draco_mesh_compression;
|
110
|
-
}());
|
111
|
-
export { KHR_draco_mesh_compression };
|
112
|
-
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_draco_mesh_compression(loader); });
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
2
|
+
import { DracoCompression } from "@babylonjs/core/Meshes/Compression/dracoCompression.js";
|
3
|
+
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
4
|
+
import { Geometry } from "@babylonjs/core/Meshes/geometry.js";
|
5
|
+
import { GLTFLoader, ArrayItem } from "../glTFLoader";
|
6
|
+
var NAME = "KHR_draco_mesh_compression";
|
7
|
+
/**
|
8
|
+
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
|
9
|
+
*/
|
10
|
+
var KHR_draco_mesh_compression = /** @class */ (function () {
|
11
|
+
/**
|
12
|
+
* @param loader
|
13
|
+
* @hidden
|
14
|
+
*/
|
15
|
+
function KHR_draco_mesh_compression(loader) {
|
16
|
+
/**
|
17
|
+
* The name of this extension.
|
18
|
+
*/
|
19
|
+
this.name = NAME;
|
20
|
+
this._loader = loader;
|
21
|
+
this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);
|
22
|
+
}
|
23
|
+
/** @hidden */
|
24
|
+
KHR_draco_mesh_compression.prototype.dispose = function () {
|
25
|
+
delete this.dracoCompression;
|
26
|
+
this._loader = null;
|
27
|
+
};
|
28
|
+
/**
|
29
|
+
* @param context
|
30
|
+
* @param primitive
|
31
|
+
* @param babylonMesh
|
32
|
+
* @hidden
|
33
|
+
*/
|
34
|
+
KHR_draco_mesh_compression.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {
|
35
|
+
var _this = this;
|
36
|
+
return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, function (extensionContext, extension) {
|
37
|
+
if (primitive.mode != undefined) {
|
38
|
+
if (primitive.mode !== 5 /* TRIANGLE_STRIP */ && primitive.mode !== 4 /* TRIANGLES */) {
|
39
|
+
throw new Error("".concat(context, ": Unsupported mode ").concat(primitive.mode));
|
40
|
+
}
|
41
|
+
// TODO: handle triangle strips
|
42
|
+
if (primitive.mode === 5 /* TRIANGLE_STRIP */) {
|
43
|
+
throw new Error("".concat(context, ": Mode ").concat(primitive.mode, " is not currently supported"));
|
44
|
+
}
|
45
|
+
}
|
46
|
+
var attributes = {};
|
47
|
+
var dividers = {};
|
48
|
+
var loadAttribute = function (name, kind) {
|
49
|
+
var uniqueId = extension.attributes[name];
|
50
|
+
if (uniqueId === undefined || primitive.attributes[name] === undefined) {
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
attributes[kind] = uniqueId;
|
54
|
+
var accessor = ArrayItem.Get("".concat(context, "/attributes/").concat(name), _this._loader.gltf.accessors, primitive.attributes[name]);
|
55
|
+
if (accessor.normalized && accessor.componentType !== 5126 /* FLOAT */) {
|
56
|
+
var divider = 1;
|
57
|
+
switch (accessor.componentType) {
|
58
|
+
case 5120 /* BYTE */:
|
59
|
+
divider = 127.0;
|
60
|
+
break;
|
61
|
+
case 5121 /* UNSIGNED_BYTE */:
|
62
|
+
divider = 255.0;
|
63
|
+
break;
|
64
|
+
case 5122 /* SHORT */:
|
65
|
+
divider = 32767.0;
|
66
|
+
break;
|
67
|
+
case 5123 /* UNSIGNED_SHORT */:
|
68
|
+
divider = 65535.0;
|
69
|
+
break;
|
70
|
+
}
|
71
|
+
dividers[kind] = divider;
|
72
|
+
}
|
73
|
+
babylonMesh._delayInfo = babylonMesh._delayInfo || [];
|
74
|
+
if (babylonMesh._delayInfo.indexOf(kind) === -1) {
|
75
|
+
babylonMesh._delayInfo.push(kind);
|
76
|
+
}
|
77
|
+
};
|
78
|
+
loadAttribute("POSITION", VertexBuffer.PositionKind);
|
79
|
+
loadAttribute("NORMAL", VertexBuffer.NormalKind);
|
80
|
+
loadAttribute("TANGENT", VertexBuffer.TangentKind);
|
81
|
+
loadAttribute("TEXCOORD_0", VertexBuffer.UVKind);
|
82
|
+
loadAttribute("TEXCOORD_1", VertexBuffer.UV2Kind);
|
83
|
+
loadAttribute("TEXCOORD_2", VertexBuffer.UV3Kind);
|
84
|
+
loadAttribute("TEXCOORD_3", VertexBuffer.UV4Kind);
|
85
|
+
loadAttribute("TEXCOORD_4", VertexBuffer.UV5Kind);
|
86
|
+
loadAttribute("TEXCOORD_5", VertexBuffer.UV6Kind);
|
87
|
+
loadAttribute("JOINTS_0", VertexBuffer.MatricesIndicesKind);
|
88
|
+
loadAttribute("WEIGHTS_0", VertexBuffer.MatricesWeightsKind);
|
89
|
+
loadAttribute("COLOR_0", VertexBuffer.ColorKind);
|
90
|
+
var bufferView = ArrayItem.Get(extensionContext, _this._loader.gltf.bufferViews, extension.bufferView);
|
91
|
+
if (!bufferView._dracoBabylonGeometry) {
|
92
|
+
bufferView._dracoBabylonGeometry = _this._loader.loadBufferViewAsync("/bufferViews/".concat(bufferView.index), bufferView).then(function (data) {
|
93
|
+
var dracoCompression = _this.dracoCompression || DracoCompression.Default;
|
94
|
+
return dracoCompression
|
95
|
+
.decodeMeshAsync(data, attributes, dividers)
|
96
|
+
.then(function (babylonVertexData) {
|
97
|
+
var babylonGeometry = new Geometry(babylonMesh.name, _this._loader.babylonScene);
|
98
|
+
babylonVertexData.applyToGeometry(babylonGeometry);
|
99
|
+
return babylonGeometry;
|
100
|
+
})
|
101
|
+
.catch(function (error) {
|
102
|
+
throw new Error("".concat(context, ": ").concat(error.message));
|
103
|
+
});
|
104
|
+
});
|
105
|
+
}
|
106
|
+
return bufferView._dracoBabylonGeometry;
|
107
|
+
});
|
108
|
+
};
|
109
|
+
return KHR_draco_mesh_compression;
|
110
|
+
}());
|
111
|
+
export { KHR_draco_mesh_compression };
|
112
|
+
GLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_draco_mesh_compression(loader); });
|
113
113
|
//# sourceMappingURL=KHR_draco_mesh_compression.js.map
|
@@ -1,36 +1,36 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
3
|
-
import { INode } from "../glTFLoaderInterfaces";
|
4
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
-
import { GLTFLoader } from "../glTFLoader";
|
6
|
-
/**
|
7
|
-
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)
|
8
|
-
*/
|
9
|
-
export declare class KHR_lights implements IGLTFLoaderExtension {
|
10
|
-
/**
|
11
|
-
* The name of this extension.
|
12
|
-
*/
|
13
|
-
readonly name = "KHR_lights_punctual";
|
14
|
-
/**
|
15
|
-
* Defines whether this extension is enabled.
|
16
|
-
*/
|
17
|
-
enabled: boolean;
|
18
|
-
private _loader;
|
19
|
-
private _lights?;
|
20
|
-
/**
|
21
|
-
* @param loader
|
22
|
-
* @hidden
|
23
|
-
*/
|
24
|
-
constructor(loader: GLTFLoader);
|
25
|
-
/** @hidden */
|
26
|
-
dispose(): void;
|
27
|
-
/** @hidden */
|
28
|
-
onLoading(): void;
|
29
|
-
/**
|
30
|
-
* @param context
|
31
|
-
* @param node
|
32
|
-
* @param assign
|
33
|
-
* @hidden
|
34
|
-
*/
|
35
|
-
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
36
|
-
}
|
1
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
3
|
+
import { INode } from "../glTFLoaderInterfaces";
|
4
|
+
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
+
import { GLTFLoader } from "../glTFLoader";
|
6
|
+
/**
|
7
|
+
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)
|
8
|
+
*/
|
9
|
+
export declare class KHR_lights implements IGLTFLoaderExtension {
|
10
|
+
/**
|
11
|
+
* The name of this extension.
|
12
|
+
*/
|
13
|
+
readonly name = "KHR_lights_punctual";
|
14
|
+
/**
|
15
|
+
* Defines whether this extension is enabled.
|
16
|
+
*/
|
17
|
+
enabled: boolean;
|
18
|
+
private _loader;
|
19
|
+
private _lights?;
|
20
|
+
/**
|
21
|
+
* @param loader
|
22
|
+
* @hidden
|
23
|
+
*/
|
24
|
+
constructor(loader: GLTFLoader);
|
25
|
+
/** @hidden */
|
26
|
+
dispose(): void;
|
27
|
+
/** @hidden */
|
28
|
+
onLoading(): void;
|
29
|
+
/**
|
30
|
+
* @param context
|
31
|
+
* @param node
|
32
|
+
* @param assign
|
33
|
+
* @hidden
|
34
|
+
*/
|
35
|
+
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
36
|
+
}
|