@babylonjs/loaders 5.0.0-rc.7 → 5.0.1
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/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +126 -126
- package/OBJ/objFileLoader.js +296 -296
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +43 -43
- package/OBJ/objLoadingOptions.js +1 -1
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/OBJ/solidParser.d.ts +154 -154
- package/OBJ/solidParser.js +693 -693
- package/OBJ/solidParser.js.map +1 -1
- 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/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.d.ts +13 -13
- package/glTF/1.0/glTFBinaryExtension.js +60 -60
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.d.ts +136 -136
- package/glTF/1.0/glTFLoader.js +1814 -1815
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -412
- package/glTF/1.0/glTFLoaderInterfaces.js +95 -95
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.d.ts +63 -62
- package/glTF/1.0/glTFLoaderUtils.js +250 -250
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +10 -10
- package/glTF/1.0/glTFMaterialsCommonExtension.js +129 -129
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- 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_lights_image_based.js.map +1 -1
- 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_mesh_gpu_instancing.js.map +1 -1
- 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_meshopt_compression.js.map +1 -1
- 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/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +50 -50
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +73 -73
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- 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_draco_mesh_compression.js.map +1 -1
- 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_lights_punctual.js.map +1 -1
- 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_clearcoat.js.map +1 -1
- 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_emissive_strength.js.map +1 -1
- 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_ior.js.map +1 -1
- 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_pbrSpecularGlossiness.js.map +1 -1
- 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_sheen.js.map +1 -1
- 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_specular.js.map +1 -1
- 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_translucency.js.map +1 -1
- 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_transmission.js.map +1 -1
- 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_unlit.js.map +1 -1
- 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_variants.js.map +1 -1
- 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_materials_volume.js.map +1 -1
- 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_mesh_quantization.js.map +1 -1
- 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_basisu.js.map +1 -1
- 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_texture_transform.js.map +1 -1
- 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/KHR_xmp_json_ld.js.map +1 -1
- 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_audio_emitter.js.map +1 -1
- 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_lod.js.map +1 -1
- 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_minecraftMesh.js.map +1 -1
- 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/MSFT_sRGBFactors.js.map +1 -1
- 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 +406 -405
- package/glTF/2.0/glTFLoader.js +2366 -2366
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +152 -152
- package/glTF/2.0/glTFLoaderExtension.js +1 -1
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +211 -211
- package/glTF/2.0/glTFLoaderInterfaces.js +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/2.0/index.d.ts +4 -4
- package/glTF/2.0/index.js +5 -4
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +433 -433
- package/glTF/glTFFileLoader.js +927 -927
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.d.ts +29 -29
- package/glTF/glTFValidation.js +123 -123
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/index.d.ts +5 -5
- package/glTF/index.js +6 -5
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +18 -18
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.d.ts +2 -2
- package/legacy/legacy-glTF1.js +15 -14
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF1FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF1FileLoader.js +3 -3
- package/legacy/legacy-glTF1FileLoader.js.map +1 -1
- package/legacy/legacy-glTF2.d.ts +2 -2
- package/legacy/legacy-glTF2.js +33 -32
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-glTF2FileLoader.d.ts +2 -2
- package/legacy/legacy-glTF2FileLoader.js +3 -3
- package/legacy/legacy-glTF2FileLoader.js.map +1 -1
- package/legacy/legacy-glTFFileLoader.d.ts +3 -3
- package/legacy/legacy-glTFFileLoader.js +4 -4
- package/legacy/legacy-glTFFileLoader.js.map +1 -1
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +13 -12
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +13 -12
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/legacy/legacy.d.ts +6 -6
- package/legacy/legacy.js +8 -7
- package/legacy/legacy.js.map +1 -1
- package/license.md +71 -0
- package/package.json +25 -6
@@ -1,130 +1,130 @@
|
|
1
|
-
import { __extends } from "tslib";
|
2
|
-
import { GLTFLoaderExtension, GLTFLoaderBase, GLTFLoader } from "./glTFLoader.js";
|
3
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
4
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
5
|
-
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
6
|
-
import { Material } from "@babylonjs/core/Materials/material.js";
|
7
|
-
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
|
8
|
-
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
9
|
-
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
|
10
|
-
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
11
|
-
import { SpotLight } from "@babylonjs/core/Lights/spotLight.js";
|
12
|
-
/** @hidden */
|
13
|
-
var GLTFMaterialsCommonExtension = /** @class */ (function (_super) {
|
14
|
-
__extends(GLTFMaterialsCommonExtension, _super);
|
15
|
-
function GLTFMaterialsCommonExtension() {
|
16
|
-
return _super.call(this, "KHR_materials_common") || this;
|
17
|
-
}
|
18
|
-
GLTFMaterialsCommonExtension.prototype.loadRuntimeExtensionsAsync = function (gltfRuntime) {
|
19
|
-
if (!gltfRuntime.extensions) {
|
20
|
-
return false;
|
21
|
-
}
|
22
|
-
var extension = gltfRuntime.extensions[this.name];
|
23
|
-
if (!extension) {
|
24
|
-
return false;
|
25
|
-
}
|
26
|
-
// Create lights
|
27
|
-
var lights = extension.lights;
|
28
|
-
if (lights) {
|
29
|
-
for (var thing in lights) {
|
30
|
-
var light = lights[thing];
|
31
|
-
switch (light.type) {
|
32
|
-
case "ambient": {
|
33
|
-
var ambientLight = new HemisphericLight(light.name, new Vector3(0, 1, 0), gltfRuntime.scene);
|
34
|
-
var ambient = light.ambient;
|
35
|
-
if (ambient) {
|
36
|
-
ambientLight.diffuse = Color3.FromArray(ambient.color || [1, 1, 1]);
|
37
|
-
}
|
38
|
-
break;
|
39
|
-
}
|
40
|
-
case "point": {
|
41
|
-
var pointLight = new PointLight(light.name, new Vector3(10, 10, 10), gltfRuntime.scene);
|
42
|
-
var point = light.point;
|
43
|
-
if (point) {
|
44
|
-
pointLight.diffuse = Color3.FromArray(point.color || [1, 1, 1]);
|
45
|
-
}
|
46
|
-
break;
|
47
|
-
}
|
48
|
-
case "directional": {
|
49
|
-
var dirLight = new DirectionalLight(light.name, new Vector3(0, -1, 0), gltfRuntime.scene);
|
50
|
-
var directional = light.directional;
|
51
|
-
if (directional) {
|
52
|
-
dirLight.diffuse = Color3.FromArray(directional.color || [1, 1, 1]);
|
53
|
-
}
|
54
|
-
break;
|
55
|
-
}
|
56
|
-
case "spot": {
|
57
|
-
var spot = light.spot;
|
58
|
-
if (spot) {
|
59
|
-
var spotLight = new SpotLight(light.name, new Vector3(0, 10, 0), new Vector3(0, -1, 0), spot.fallOffAngle || Math.PI, spot.fallOffExponent || 0.0, gltfRuntime.scene);
|
60
|
-
spotLight.diffuse = Color3.FromArray(spot.color || [1, 1, 1]);
|
61
|
-
}
|
62
|
-
break;
|
63
|
-
}
|
64
|
-
default:
|
65
|
-
Tools.Warn('GLTF Material Common extension: light type "' + light.type + "” not supported");
|
66
|
-
break;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
return false;
|
71
|
-
};
|
72
|
-
GLTFMaterialsCommonExtension.prototype.loadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {
|
73
|
-
var material = gltfRuntime.materials[id];
|
74
|
-
if (!material || !material.extensions) {
|
75
|
-
return false;
|
76
|
-
}
|
77
|
-
var extension = material.extensions[this.name];
|
78
|
-
if (!extension) {
|
79
|
-
return false;
|
80
|
-
}
|
81
|
-
var standardMaterial = new StandardMaterial(id, gltfRuntime.scene);
|
82
|
-
standardMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;
|
83
|
-
if (extension.technique === "CONSTANT") {
|
84
|
-
standardMaterial.disableLighting = true;
|
85
|
-
}
|
86
|
-
standardMaterial.backFaceCulling = extension.doubleSided === undefined ? false : !extension.doubleSided;
|
87
|
-
standardMaterial.alpha = extension.values.transparency === undefined ? 1.0 : extension.values.transparency;
|
88
|
-
standardMaterial.specularPower = extension.values.shininess === undefined ? 0.0 : extension.values.shininess;
|
89
|
-
// Ambient
|
90
|
-
if (typeof extension.values.ambient === "string") {
|
91
|
-
this._loadTexture(gltfRuntime, extension.values.ambient, standardMaterial, "ambientTexture", onError);
|
92
|
-
}
|
93
|
-
else {
|
94
|
-
standardMaterial.ambientColor = Color3.FromArray(extension.values.ambient || [0, 0, 0]);
|
95
|
-
}
|
96
|
-
// Diffuse
|
97
|
-
if (typeof extension.values.diffuse === "string") {
|
98
|
-
this._loadTexture(gltfRuntime, extension.values.diffuse, standardMaterial, "diffuseTexture", onError);
|
99
|
-
}
|
100
|
-
else {
|
101
|
-
standardMaterial.diffuseColor = Color3.FromArray(extension.values.diffuse || [0, 0, 0]);
|
102
|
-
}
|
103
|
-
// Emission
|
104
|
-
if (typeof extension.values.emission === "string") {
|
105
|
-
this._loadTexture(gltfRuntime, extension.values.emission, standardMaterial, "emissiveTexture", onError);
|
106
|
-
}
|
107
|
-
else {
|
108
|
-
standardMaterial.emissiveColor = Color3.FromArray(extension.values.emission || [0, 0, 0]);
|
109
|
-
}
|
110
|
-
// Specular
|
111
|
-
if (typeof extension.values.specular === "string") {
|
112
|
-
this._loadTexture(gltfRuntime, extension.values.specular, standardMaterial, "specularTexture", onError);
|
113
|
-
}
|
114
|
-
else {
|
115
|
-
standardMaterial.specularColor = Color3.FromArray(extension.values.specular || [0, 0, 0]);
|
116
|
-
}
|
117
|
-
return true;
|
118
|
-
};
|
119
|
-
GLTFMaterialsCommonExtension.prototype._loadTexture = function (gltfRuntime, id, material, propertyPath, onError) {
|
120
|
-
// Create buffer from texture url
|
121
|
-
GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, function (buffer) {
|
122
|
-
// Create texture from buffer
|
123
|
-
GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, function (texture) { return (material[propertyPath] = texture); });
|
124
|
-
}, onError);
|
125
|
-
};
|
126
|
-
return GLTFMaterialsCommonExtension;
|
127
|
-
}(GLTFLoaderExtension));
|
128
|
-
export { GLTFMaterialsCommonExtension };
|
129
|
-
GLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());
|
1
|
+
import { __extends } from "tslib";
|
2
|
+
import { GLTFLoaderExtension, GLTFLoaderBase, GLTFLoader } from "./glTFLoader.js";
|
3
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
4
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
5
|
+
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
6
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
7
|
+
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
|
8
|
+
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
9
|
+
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
|
10
|
+
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
11
|
+
import { SpotLight } from "@babylonjs/core/Lights/spotLight.js";
|
12
|
+
/** @hidden */
|
13
|
+
var GLTFMaterialsCommonExtension = /** @class */ (function (_super) {
|
14
|
+
__extends(GLTFMaterialsCommonExtension, _super);
|
15
|
+
function GLTFMaterialsCommonExtension() {
|
16
|
+
return _super.call(this, "KHR_materials_common") || this;
|
17
|
+
}
|
18
|
+
GLTFMaterialsCommonExtension.prototype.loadRuntimeExtensionsAsync = function (gltfRuntime) {
|
19
|
+
if (!gltfRuntime.extensions) {
|
20
|
+
return false;
|
21
|
+
}
|
22
|
+
var extension = gltfRuntime.extensions[this.name];
|
23
|
+
if (!extension) {
|
24
|
+
return false;
|
25
|
+
}
|
26
|
+
// Create lights
|
27
|
+
var lights = extension.lights;
|
28
|
+
if (lights) {
|
29
|
+
for (var thing in lights) {
|
30
|
+
var light = lights[thing];
|
31
|
+
switch (light.type) {
|
32
|
+
case "ambient": {
|
33
|
+
var ambientLight = new HemisphericLight(light.name, new Vector3(0, 1, 0), gltfRuntime.scene);
|
34
|
+
var ambient = light.ambient;
|
35
|
+
if (ambient) {
|
36
|
+
ambientLight.diffuse = Color3.FromArray(ambient.color || [1, 1, 1]);
|
37
|
+
}
|
38
|
+
break;
|
39
|
+
}
|
40
|
+
case "point": {
|
41
|
+
var pointLight = new PointLight(light.name, new Vector3(10, 10, 10), gltfRuntime.scene);
|
42
|
+
var point = light.point;
|
43
|
+
if (point) {
|
44
|
+
pointLight.diffuse = Color3.FromArray(point.color || [1, 1, 1]);
|
45
|
+
}
|
46
|
+
break;
|
47
|
+
}
|
48
|
+
case "directional": {
|
49
|
+
var dirLight = new DirectionalLight(light.name, new Vector3(0, -1, 0), gltfRuntime.scene);
|
50
|
+
var directional = light.directional;
|
51
|
+
if (directional) {
|
52
|
+
dirLight.diffuse = Color3.FromArray(directional.color || [1, 1, 1]);
|
53
|
+
}
|
54
|
+
break;
|
55
|
+
}
|
56
|
+
case "spot": {
|
57
|
+
var spot = light.spot;
|
58
|
+
if (spot) {
|
59
|
+
var spotLight = new SpotLight(light.name, new Vector3(0, 10, 0), new Vector3(0, -1, 0), spot.fallOffAngle || Math.PI, spot.fallOffExponent || 0.0, gltfRuntime.scene);
|
60
|
+
spotLight.diffuse = Color3.FromArray(spot.color || [1, 1, 1]);
|
61
|
+
}
|
62
|
+
break;
|
63
|
+
}
|
64
|
+
default:
|
65
|
+
Tools.Warn('GLTF Material Common extension: light type "' + light.type + "” not supported");
|
66
|
+
break;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return false;
|
71
|
+
};
|
72
|
+
GLTFMaterialsCommonExtension.prototype.loadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {
|
73
|
+
var material = gltfRuntime.materials[id];
|
74
|
+
if (!material || !material.extensions) {
|
75
|
+
return false;
|
76
|
+
}
|
77
|
+
var extension = material.extensions[this.name];
|
78
|
+
if (!extension) {
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
var standardMaterial = new StandardMaterial(id, gltfRuntime.scene);
|
82
|
+
standardMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;
|
83
|
+
if (extension.technique === "CONSTANT") {
|
84
|
+
standardMaterial.disableLighting = true;
|
85
|
+
}
|
86
|
+
standardMaterial.backFaceCulling = extension.doubleSided === undefined ? false : !extension.doubleSided;
|
87
|
+
standardMaterial.alpha = extension.values.transparency === undefined ? 1.0 : extension.values.transparency;
|
88
|
+
standardMaterial.specularPower = extension.values.shininess === undefined ? 0.0 : extension.values.shininess;
|
89
|
+
// Ambient
|
90
|
+
if (typeof extension.values.ambient === "string") {
|
91
|
+
this._loadTexture(gltfRuntime, extension.values.ambient, standardMaterial, "ambientTexture", onError);
|
92
|
+
}
|
93
|
+
else {
|
94
|
+
standardMaterial.ambientColor = Color3.FromArray(extension.values.ambient || [0, 0, 0]);
|
95
|
+
}
|
96
|
+
// Diffuse
|
97
|
+
if (typeof extension.values.diffuse === "string") {
|
98
|
+
this._loadTexture(gltfRuntime, extension.values.diffuse, standardMaterial, "diffuseTexture", onError);
|
99
|
+
}
|
100
|
+
else {
|
101
|
+
standardMaterial.diffuseColor = Color3.FromArray(extension.values.diffuse || [0, 0, 0]);
|
102
|
+
}
|
103
|
+
// Emission
|
104
|
+
if (typeof extension.values.emission === "string") {
|
105
|
+
this._loadTexture(gltfRuntime, extension.values.emission, standardMaterial, "emissiveTexture", onError);
|
106
|
+
}
|
107
|
+
else {
|
108
|
+
standardMaterial.emissiveColor = Color3.FromArray(extension.values.emission || [0, 0, 0]);
|
109
|
+
}
|
110
|
+
// Specular
|
111
|
+
if (typeof extension.values.specular === "string") {
|
112
|
+
this._loadTexture(gltfRuntime, extension.values.specular, standardMaterial, "specularTexture", onError);
|
113
|
+
}
|
114
|
+
else {
|
115
|
+
standardMaterial.specularColor = Color3.FromArray(extension.values.specular || [0, 0, 0]);
|
116
|
+
}
|
117
|
+
return true;
|
118
|
+
};
|
119
|
+
GLTFMaterialsCommonExtension.prototype._loadTexture = function (gltfRuntime, id, material, propertyPath, onError) {
|
120
|
+
// Create buffer from texture url
|
121
|
+
GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, function (buffer) {
|
122
|
+
// Create texture from buffer
|
123
|
+
GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, function (texture) { return (material[propertyPath] = texture); });
|
124
|
+
}, onError);
|
125
|
+
};
|
126
|
+
return GLTFMaterialsCommonExtension;
|
127
|
+
}(GLTFLoaderExtension));
|
128
|
+
export { GLTFMaterialsCommonExtension };
|
129
|
+
GLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());
|
130
130
|
//# sourceMappingURL=glTFMaterialsCommonExtension.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"glTFMaterialsCommonExtension.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/1.0/glTFMaterialsCommonExtension.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/E,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,QAAQ,EAAE,8CAAgC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AACnE,OAAO,EAAE,gBAAgB,EAAE,mDAAqC;AAChE,OAAO,EAAE,gBAAgB,EAAE,mDAAqC;AAChE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AACpD,OAAO,EAAE,SAAS,EAAE,4CAA8B;AAwDlD,cAAc;AACd;IAAkD,gDAAmB;IACjE;e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CAAC,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAC7F;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,mDAAY,GAApB,UAAqB,WAAyB,EAAE,EAAU,EAAE,QAA0B,EAAE,YAAoB,EAAE,OAAkC;QAC5I,iCAAiC;QACjC,cAAc,CAAC,sBAAsB,CACjC,WAAW,EACX,EAAE,EACF,UAAC,MAAM;YACH,6BAA6B;YAC7B,cAAc,CAAC,kBAAkB,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,UAAC,OAAO,IAAK,OAAA,CAAO,QAAS,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,EAAzC,CAAyC,CAAC,CAAC;QACvH,CAAC,EACD,OAAO,CACV,CAAC;IACN,CAAC;IACL,mCAAC;AAAD,CAAC,AAxID,CAAkD,mBAAmB,GAwIpE;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,4BAA4B,EAAE,CAAC,CAAC","sourcesContent":["import { GLTFLoaderExtension, GLTFLoaderBase, GLTFLoader } from \"./glTFLoader\";\r\n\r\nimport { IGLTFRuntime, IGLTFMaterial } from \"./glTFLoaderInterfaces\";\r\n\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { HemisphericLight } from \"core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\n\r\ninterface IGLTFMaterialsCommonExtensionValues {\r\n ambient?: number[] | string;\r\n diffuse?: number[] | string;\r\n emission?: number[] | string;\r\n specular?: number[] | string;\r\n shininess?: number;\r\n transparency?: number;\r\n}\r\n\r\ninterface IGLTFMaterialsCommonExtension {\r\n technique: string;\r\n transparent?: number;\r\n doubleSided?: boolean;\r\n values: IGLTFMaterialsCommonExtensionValues;\r\n}\r\n\r\ninterface IGLTFRuntimeCommonExtension {\r\n lights: { [key: string]: IGLTFLightCommonExtension };\r\n}\r\n\r\ninterface IGLTFLightCommonExtension {\r\n name: string;\r\n type: string;\r\n\r\n ambient?: IGLTFAmbientLightCommonExtension;\r\n point?: IGLTFPointLightCommonExtension;\r\n directional?: IGLTFDirectionalLightCommonExtension;\r\n spot?: IGLTFSpotLightCommonExtension;\r\n}\r\n\r\ninterface IGLTFPointLightCommonExtension {\r\n color: number[];\r\n constantAttenuation: number;\r\n linearAttenuation: number;\r\n quadraticAttenuation: number;\r\n}\r\n\r\ninterface IGLTFAmbientLightCommonExtension {\r\n color: number[];\r\n}\r\n\r\ninterface IGLTFDirectionalLightCommonExtension {\r\n color: number[];\r\n}\r\n\r\ninterface IGLTFSpotLightCommonExtension {\r\n color: number[];\r\n constantAttenuation: number;\r\n fallOffAngle: number;\r\n fallOffExponent: number;\r\n linearAttenuation: number;\r\n quadraticAttenuation: number;\r\n}\r\n\r\n/** @hidden */\r\nexport class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {\r\n constructor() {\r\n super(\"KHR_materials_common\");\r\n }\r\n\r\n public loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime): boolean {\r\n if (!gltfRuntime.extensions) {\r\n return false;\r\n }\r\n\r\n const extension: IGLTFRuntimeCommonExtension = gltfRuntime.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n\r\n // Create lights\r\n const lights = extension.lights;\r\n if (lights) {\r\n for (const thing in lights) {\r\n const light: IGLTFLightCommonExtension = lights[thing];\r\n\r\n switch (light.type) {\r\n case \"ambient\": {\r\n const ambientLight = new HemisphericLight(light.name, new Vector3(0, 1, 0), gltfRuntime.scene);\r\n const ambient = light.ambient;\r\n if (ambient) {\r\n ambientLight.diffuse = Color3.FromArray(ambient.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"point\": {\r\n const pointLight = new PointLight(light.name, new Vector3(10, 10, 10), gltfRuntime.scene);\r\n const point = light.point;\r\n if (point) {\r\n pointLight.diffuse = Color3.FromArray(point.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"directional\": {\r\n const dirLight = new DirectionalLight(light.name, new Vector3(0, -1, 0), gltfRuntime.scene);\r\n const directional = light.directional;\r\n if (directional) {\r\n dirLight.diffuse = Color3.FromArray(directional.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"spot\": {\r\n const spot = light.spot;\r\n if (spot) {\r\n const spotLight = new SpotLight(\r\n light.name,\r\n new Vector3(0, 10, 0),\r\n new Vector3(0, -1, 0),\r\n spot.fallOffAngle || Math.PI,\r\n spot.fallOffExponent || 0.0,\r\n gltfRuntime.scene\r\n );\r\n spotLight.diffuse = Color3.FromArray(spot.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n default:\r\n Tools.Warn('GLTF Material Common extension: light type \"' + light.type + \"” not supported\");\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean {\r\n const material: IGLTFMaterial = gltfRuntime.materials[id];\r\n if (!material || !material.extensions) {\r\n return false;\r\n }\r\n\r\n const extension: IGLTFMaterialsCommonExtension = material.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n\r\n const standardMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n standardMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n\r\n if (extension.technique === \"CONSTANT\") {\r\n standardMaterial.disableLighting = true;\r\n }\r\n\r\n standardMaterial.backFaceCulling = extension.doubleSided === undefined ? false : !extension.doubleSided;\r\n standardMaterial.alpha = extension.values.transparency === undefined ? 1.0 : extension.values.transparency;\r\n standardMaterial.specularPower = extension.values.shininess === undefined ? 0.0 : extension.values.shininess;\r\n\r\n // Ambient\r\n if (typeof extension.values.ambient === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.ambient, standardMaterial, \"ambientTexture\", onError);\r\n } else {\r\n standardMaterial.ambientColor = Color3.FromArray(extension.values.ambient || [0, 0, 0]);\r\n }\r\n\r\n // Diffuse\r\n if (typeof extension.values.diffuse === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.diffuse, standardMaterial, \"diffuseTexture\", onError);\r\n } else {\r\n standardMaterial.diffuseColor = Color3.FromArray(extension.values.diffuse || [0, 0, 0]);\r\n }\r\n\r\n // Emission\r\n if (typeof extension.values.emission === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.emission, standardMaterial, \"emissiveTexture\", onError);\r\n } else {\r\n standardMaterial.emissiveColor = Color3.FromArray(extension.values.emission || [0, 0, 0]);\r\n }\r\n\r\n // Specular\r\n if (typeof extension.values.specular === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.specular, standardMaterial, \"specularTexture\", onError);\r\n } else {\r\n standardMaterial.specularColor = Color3.FromArray(extension.values.specular || [0, 0, 0]);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _loadTexture(gltfRuntime: IGLTFRuntime, id: string, material: StandardMaterial, propertyPath: string, onError: (message: string) => void): void {\r\n // Create buffer from texture url\r\n GLTFLoaderBase.LoadTextureBufferAsync(\r\n gltfRuntime,\r\n id,\r\n (buffer) => {\r\n // Create texture from buffer\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, (texture) => ((<any>material)[propertyPath] = texture));\r\n },\r\n onError\r\n );\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());\r\n"]}
|
1
|
+
{"version":3,"file":"glTFMaterialsCommonExtension.js","sourceRoot":"","sources":["../../../../../../lts/loaders/generated/glTF/1.0/glTFMaterialsCommonExtension.ts"],"names":[],"m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r\n\r\nimport type { IGLTFRuntime, IGLTFMaterial } from \"./glTFLoaderInterfaces\";\r\n\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { HemisphericLight } from \"core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\n\r\ninterface IGLTFMaterialsCommonExtensionValues {\r\n ambient?: number[] | string;\r\n diffuse?: number[] | string;\r\n emission?: number[] | string;\r\n specular?: number[] | string;\r\n shininess?: number;\r\n transparency?: number;\r\n}\r\n\r\ninterface IGLTFMaterialsCommonExtension {\r\n technique: string;\r\n transparent?: number;\r\n doubleSided?: boolean;\r\n values: IGLTFMaterialsCommonExtensionValues;\r\n}\r\n\r\ninterface IGLTFRuntimeCommonExtension {\r\n lights: { [key: string]: IGLTFLightCommonExtension };\r\n}\r\n\r\ninterface IGLTFLightCommonExtension {\r\n name: string;\r\n type: string;\r\n\r\n ambient?: IGLTFAmbientLightCommonExtension;\r\n point?: IGLTFPointLightCommonExtension;\r\n directional?: IGLTFDirectionalLightCommonExtension;\r\n spot?: IGLTFSpotLightCommonExtension;\r\n}\r\n\r\ninterface IGLTFPointLightCommonExtension {\r\n color: number[];\r\n constantAttenuation: number;\r\n linearAttenuation: number;\r\n quadraticAttenuation: number;\r\n}\r\n\r\ninterface IGLTFAmbientLightCommonExtension {\r\n color: number[];\r\n}\r\n\r\ninterface IGLTFDirectionalLightCommonExtension {\r\n color: number[];\r\n}\r\n\r\ninterface IGLTFSpotLightCommonExtension {\r\n color: number[];\r\n constantAttenuation: number;\r\n fallOffAngle: number;\r\n fallOffExponent: number;\r\n linearAttenuation: number;\r\n quadraticAttenuation: number;\r\n}\r\n\r\n/** @hidden */\r\nexport class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {\r\n constructor() {\r\n super(\"KHR_materials_common\");\r\n }\r\n\r\n public loadRuntimeExtensionsAsync(gltfRuntime: IGLTFRuntime): boolean {\r\n if (!gltfRuntime.extensions) {\r\n return false;\r\n }\r\n\r\n const extension: IGLTFRuntimeCommonExtension = gltfRuntime.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n\r\n // Create lights\r\n const lights = extension.lights;\r\n if (lights) {\r\n for (const thing in lights) {\r\n const light: IGLTFLightCommonExtension = lights[thing];\r\n\r\n switch (light.type) {\r\n case \"ambient\": {\r\n const ambientLight = new HemisphericLight(light.name, new Vector3(0, 1, 0), gltfRuntime.scene);\r\n const ambient = light.ambient;\r\n if (ambient) {\r\n ambientLight.diffuse = Color3.FromArray(ambient.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"point\": {\r\n const pointLight = new PointLight(light.name, new Vector3(10, 10, 10), gltfRuntime.scene);\r\n const point = light.point;\r\n if (point) {\r\n pointLight.diffuse = Color3.FromArray(point.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"directional\": {\r\n const dirLight = new DirectionalLight(light.name, new Vector3(0, -1, 0), gltfRuntime.scene);\r\n const directional = light.directional;\r\n if (directional) {\r\n dirLight.diffuse = Color3.FromArray(directional.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n case \"spot\": {\r\n const spot = light.spot;\r\n if (spot) {\r\n const spotLight = new SpotLight(\r\n light.name,\r\n new Vector3(0, 10, 0),\r\n new Vector3(0, -1, 0),\r\n spot.fallOffAngle || Math.PI,\r\n spot.fallOffExponent || 0.0,\r\n gltfRuntime.scene\r\n );\r\n spotLight.diffuse = Color3.FromArray(spot.color || [1, 1, 1]);\r\n }\r\n break;\r\n }\r\n default:\r\n Tools.Warn('GLTF Material Common extension: light type \"' + light.type + \"” not supported\");\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public loadMaterialAsync(gltfRuntime: IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean {\r\n const material: IGLTFMaterial = gltfRuntime.materials[id];\r\n if (!material || !material.extensions) {\r\n return false;\r\n }\r\n\r\n const extension: IGLTFMaterialsCommonExtension = material.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n\r\n const standardMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n standardMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n\r\n if (extension.technique === \"CONSTANT\") {\r\n standardMaterial.disableLighting = true;\r\n }\r\n\r\n standardMaterial.backFaceCulling = extension.doubleSided === undefined ? false : !extension.doubleSided;\r\n standardMaterial.alpha = extension.values.transparency === undefined ? 1.0 : extension.values.transparency;\r\n standardMaterial.specularPower = extension.values.shininess === undefined ? 0.0 : extension.values.shininess;\r\n\r\n // Ambient\r\n if (typeof extension.values.ambient === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.ambient, standardMaterial, \"ambientTexture\", onError);\r\n } else {\r\n standardMaterial.ambientColor = Color3.FromArray(extension.values.ambient || [0, 0, 0]);\r\n }\r\n\r\n // Diffuse\r\n if (typeof extension.values.diffuse === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.diffuse, standardMaterial, \"diffuseTexture\", onError);\r\n } else {\r\n standardMaterial.diffuseColor = Color3.FromArray(extension.values.diffuse || [0, 0, 0]);\r\n }\r\n\r\n // Emission\r\n if (typeof extension.values.emission === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.emission, standardMaterial, \"emissiveTexture\", onError);\r\n } else {\r\n standardMaterial.emissiveColor = Color3.FromArray(extension.values.emission || [0, 0, 0]);\r\n }\r\n\r\n // Specular\r\n if (typeof extension.values.specular === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.specular, standardMaterial, \"specularTexture\", onError);\r\n } else {\r\n standardMaterial.specularColor = Color3.FromArray(extension.values.specular || [0, 0, 0]);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _loadTexture(gltfRuntime: IGLTFRuntime, id: string, material: StandardMaterial, propertyPath: string, onError: (message: string) => void): void {\r\n // Create buffer from texture url\r\n GLTFLoaderBase.LoadTextureBufferAsync(\r\n gltfRuntime,\r\n id,\r\n (buffer) => {\r\n // Create texture from buffer\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, (texture) => ((<any>material)[propertyPath] = texture));\r\n },\r\n onError\r\n );\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());\r\n"]}
|
package/glTF/1.0/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export * from "./glTFBinaryExtension";
|
2
|
-
export * from "./glTFLoader";
|
3
|
-
export * from "./glTFLoaderInterfaces";
|
4
|
-
export * from "./glTFLoaderUtils";
|
5
|
-
export * from "./glTFMaterialsCommonExtension";
|
1
|
+
export * from "./glTFBinaryExtension";
|
2
|
+
export * from "./glTFLoader";
|
3
|
+
export * from "./glTFLoaderInterfaces";
|
4
|
+
export * from "./glTFLoaderUtils";
|
5
|
+
export * from "./glTFMaterialsCommonExtension";
|
package/glTF/1.0/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
export * from "./glTFBinaryExtension.js";
|
2
|
-
export * from "./glTFLoader.js";
|
3
|
-
export * from "./glTFLoaderInterfaces.js";
|
4
|
-
export * from "./glTFLoaderUtils.js";
|
5
|
-
export * from "./glTFMaterialsCommonExtension.js";
|
1
|
+
export * from "./glTFBinaryExtension.js";
|
2
|
+
export * from "./glTFLoader.js";
|
3
|
+
export * from "./glTFLoaderInterfaces.js";
|
4
|
+
export * from "./glTFLoaderUtils.js";
|
5
|
+
export * from "./glTFMaterialsCommonExtension.js";
|
6
6
|
//# sourceMappingURL=index.js.map
|
@@ -1,43 +1,43 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
3
|
-
import { IScene } from "../glTFLoaderInterfaces";
|
4
|
-
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
-
import { GLTFLoader } from "../glTFLoader";
|
6
|
-
declare module "babylonjs-gltf2interface" {
|
7
|
-
/** @hidden */
|
8
|
-
interface IEXTLightsImageBased_LightImageBased {
|
9
|
-
_babylonTexture?: BaseTexture;
|
10
|
-
_loaded?: Promise<void>;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
/**
|
14
|
-
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md)
|
15
|
-
*/
|
16
|
-
export declare class EXT_lights_image_based implements IGLTFLoaderExtension {
|
17
|
-
/**
|
18
|
-
* The name of this extension.
|
19
|
-
*/
|
20
|
-
readonly name = "EXT_lights_image_based";
|
21
|
-
/**
|
22
|
-
* Defines whether this extension is enabled.
|
23
|
-
*/
|
24
|
-
enabled: boolean;
|
25
|
-
private _loader;
|
26
|
-
private _lights?;
|
27
|
-
/**
|
28
|
-
* @param loader
|
29
|
-
* @hidden
|
30
|
-
*/
|
31
|
-
constructor(loader: GLTFLoader);
|
32
|
-
/** @hidden */
|
33
|
-
dispose(): void;
|
34
|
-
/** @hidden */
|
35
|
-
onLoading(): void;
|
36
|
-
/**
|
37
|
-
* @param context
|
38
|
-
* @param scene
|
39
|
-
* @hidden
|
40
|
-
*/
|
41
|
-
loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
|
42
|
-
private _loadLightAsync;
|
43
|
-
}
|
1
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
3
|
+
import type { IScene } from "../glTFLoaderInterfaces";
|
4
|
+
import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
|
+
import { GLTFLoader } from "../glTFLoader";
|
6
|
+
declare module "babylonjs-gltf2interface" {
|
7
|
+
/** @hidden */
|
8
|
+
interface IEXTLightsImageBased_LightImageBased {
|
9
|
+
_babylonTexture?: BaseTexture;
|
10
|
+
_loaded?: Promise<void>;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md)
|
15
|
+
*/
|
16
|
+
export declare class EXT_lights_image_based implements IGLTFLoaderExtension {
|
17
|
+
/**
|
18
|
+
* The name of this extension.
|
19
|
+
*/
|
20
|
+
readonly name = "EXT_lights_image_based";
|
21
|
+
/**
|
22
|
+
* Defines whether this extension is enabled.
|
23
|
+
*/
|
24
|
+
enabled: boolean;
|
25
|
+
private _loader;
|
26
|
+
private _lights?;
|
27
|
+
/**
|
28
|
+
* @param loader
|
29
|
+
* @hidden
|
30
|
+
*/
|
31
|
+
constructor(loader: GLTFLoader);
|
32
|
+
/** @hidden */
|
33
|
+
dispose(): void;
|
34
|
+
/** @hidden */
|
35
|
+
onLoading(): void;
|
36
|
+
/**
|
37
|
+
* @param context
|
38
|
+
* @param scene
|
39
|
+
* @hidden
|
40
|
+
*/
|
41
|
+
loadSceneAsync(context: string, scene: IScene): Nullable<Promise<void>>;
|
42
|
+
private _loadLightAsync;
|
43
|
+
}
|