@babylonjs/loaders 5.0.0-rc.4 → 5.0.0-rc.5
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.js.map +1 -1
- package/OBJ/mtlFileLoader.d.ts +7 -6
- package/OBJ/mtlFileLoader.js +15 -14
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +11 -18
- package/OBJ/objFileLoader.js +19 -23
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +1 -1
- package/OBJ/objLoadingOptions.js.map +1 -1
- package/OBJ/solidParser.d.ts +6 -5
- package/OBJ/solidParser.js +15 -21
- package/OBJ/solidParser.js.map +1 -1
- package/STL/index.js.map +1 -1
- package/STL/stlFileLoader.d.ts +7 -14
- package/STL/stlFileLoader.js +15 -21
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.d.ts +4 -4
- package/glTF/1.0/glTFBinaryExtension.js +4 -5
- package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
- package/glTF/1.0/glTFLoader.d.ts +80 -50
- package/glTF/1.0/glTFLoader.js +265 -146
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +10 -10
- package/glTF/1.0/glTFLoaderInterfaces.js +3 -3
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.d.ts +25 -25
- package/glTF/1.0/glTFLoaderUtils.js +70 -52
- package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
- package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +2 -2
- package/glTF/1.0/glTFMaterialsCommonExtension.js +13 -11
- package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
- package/glTF/1.0/index.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +11 -4
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +9 -2
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +13 -5
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +12 -4
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +10 -3
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +10 -3
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +12 -4
- package/glTF/2.0/Extensions/EXT_texture_webp.js +11 -3
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +26 -8
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +22 -4
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +14 -6
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +17 -6
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +11 -3
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_ior.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +11 -3
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_specular.js +11 -3
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +11 -4
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +24 -13
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +10 -2
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +17 -6
- package/glTF/2.0/Extensions/KHR_materials_variants.js +19 -8
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_materials_volume.js +12 -5
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +4 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +5 -3
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +11 -3
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +12 -4
- package/glTF/2.0/Extensions/KHR_texture_transform.js +10 -2
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +4 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +4 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +23 -7
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +38 -14
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +45 -11
- package/glTF/2.0/Extensions/MSFT_lod.js +44 -8
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +2 -2
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +2 -2
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/glTF/2.0/glTFLoader.d.ts +70 -22
- package/glTF/2.0/glTFLoader.js +170 -85
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +11 -11
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +7 -7
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +79 -27
- package/glTF/glTFFileLoader.js +94 -45
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.d.ts +1 -1
- package/glTF/glTFValidation.js +12 -12
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/index.js.map +1 -1
- package/index.js.map +1 -1
- package/legacy/legacy-glTF.d.ts +2 -2
- package/legacy/legacy-glTF.js +5 -5
- package/legacy/legacy-glTF.js.map +1 -1
- package/legacy/legacy-glTF1.d.ts +1 -1
- package/legacy/legacy-glTF1.js +2 -2
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF1FileLoader.js +1 -0
- package/legacy/legacy-glTF1FileLoader.js.map +1 -1
- package/legacy/legacy-glTF2.d.ts +1 -1
- package/legacy/legacy-glTF2.js +11 -11
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-glTF2FileLoader.js +1 -0
- package/legacy/legacy-glTF2FileLoader.js.map +1 -1
- package/legacy/legacy-glTFFileLoader.js +1 -0
- package/legacy/legacy-glTFFileLoader.js.map +1 -1
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +3 -3
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +3 -3
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/legacy/legacy.d.ts +1 -1
- package/legacy/legacy.js +2 -1
- package/legacy/legacy.js.map +1 -1
- package/package.json +23 -198
- package/readme.md +2 -2
@@ -1,7 +1,7 @@
|
|
1
|
-
import { DracoCompression } from "@babylonjs/core/Meshes/Compression/dracoCompression";
|
2
|
-
import { Nullable } from "@babylonjs/core/types";
|
3
|
-
import { Geometry } from "@babylonjs/core/Meshes/geometry";
|
4
|
-
import { Mesh } from "@babylonjs/core/Meshes/mesh";
|
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
5
|
import { IMeshPrimitive } from "../glTFLoaderInterfaces";
|
6
6
|
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
7
7
|
import { GLTFLoader } from "../glTFLoader";
|
@@ -22,10 +22,18 @@ export declare class KHR_draco_mesh_compression implements IGLTFLoaderExtension
|
|
22
22
|
*/
|
23
23
|
enabled: boolean;
|
24
24
|
private _loader;
|
25
|
-
/**
|
25
|
+
/**
|
26
|
+
* @param loader
|
27
|
+
* @hidden
|
28
|
+
*/
|
26
29
|
constructor(loader: GLTFLoader);
|
27
30
|
/** @hidden */
|
28
31
|
dispose(): void;
|
29
|
-
/**
|
32
|
+
/**
|
33
|
+
* @param context
|
34
|
+
* @param primitive
|
35
|
+
* @param babylonMesh
|
36
|
+
* @hidden
|
37
|
+
*/
|
30
38
|
_loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>>;
|
31
39
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
1
2
|
import { DracoCompression } from "@babylonjs/core/Meshes/Compression/dracoCompression.js";
|
2
3
|
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
3
4
|
import { Geometry } from "@babylonjs/core/Meshes/geometry.js";
|
@@ -7,7 +8,10 @@ var NAME = "KHR_draco_mesh_compression";
|
|
7
8
|
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
|
8
9
|
*/
|
9
10
|
var KHR_draco_mesh_compression = /** @class */ (function () {
|
10
|
-
/**
|
11
|
+
/**
|
12
|
+
* @param loader
|
13
|
+
* @hidden
|
14
|
+
*/
|
11
15
|
function KHR_draco_mesh_compression(loader) {
|
12
16
|
/**
|
13
17
|
* The name of this extension.
|
@@ -21,13 +25,17 @@ var KHR_draco_mesh_compression = /** @class */ (function () {
|
|
21
25
|
delete this.dracoCompression;
|
22
26
|
this._loader = null;
|
23
27
|
};
|
24
|
-
/**
|
28
|
+
/**
|
29
|
+
* @param context
|
30
|
+
* @param primitive
|
31
|
+
* @param babylonMesh
|
32
|
+
* @hidden
|
33
|
+
*/
|
25
34
|
KHR_draco_mesh_compression.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {
|
26
35
|
var _this = this;
|
27
36
|
return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, function (extensionContext, extension) {
|
28
37
|
if (primitive.mode != undefined) {
|
29
|
-
if (primitive.mode !== 5 /* TRIANGLE_STRIP */ &&
|
30
|
-
primitive.mode !== 4 /* TRIANGLES */) {
|
38
|
+
if (primitive.mode !== 5 /* TRIANGLE_STRIP */ && primitive.mode !== 4 /* TRIANGLES */) {
|
31
39
|
throw new Error("".concat(context, ": Unsupported mode ").concat(primitive.mode));
|
32
40
|
}
|
33
41
|
// TODO: handle triangle strips
|
@@ -83,11 +91,14 @@ var KHR_draco_mesh_compression = /** @class */ (function () {
|
|
83
91
|
if (!bufferView._dracoBabylonGeometry) {
|
84
92
|
bufferView._dracoBabylonGeometry = _this._loader.loadBufferViewAsync("/bufferViews/".concat(bufferView.index), bufferView).then(function (data) {
|
85
93
|
var dracoCompression = _this.dracoCompression || DracoCompression.Default;
|
86
|
-
return dracoCompression
|
94
|
+
return dracoCompression
|
95
|
+
.decodeMeshAsync(data, attributes, dividers)
|
96
|
+
.then(function (babylonVertexData) {
|
87
97
|
var babylonGeometry = new Geometry(babylonMesh.name, _this._loader.babylonScene);
|
88
98
|
babylonVertexData.applyToGeometry(babylonGeometry);
|
89
99
|
return babylonGeometry;
|
90
|
-
})
|
100
|
+
})
|
101
|
+
.catch(function (error) {
|
91
102
|
throw new Error("".concat(context, ": ").concat(error.message));
|
92
103
|
});
|
93
104
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_draco_mesh_compression.js","sourceRoot":"","sources":["../../../../../sourceES6/loaders/src/glTF/2.0/Extensions/KHR_draco_mesh_compression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,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AAC,IAAI,EAAE,KAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;wBAClF,iBAAiB,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;wBACnD,OAAO,eAAe,CAAC;oBAC3B,CAAC,CAAC,CAAC,KAAK,CAAC,UAAC,KAAK;wBACX,MAAM,IAAI,KAAK,CAAC,UAAG,OAAO,eAAK,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC;oBACpD,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;aACN;YAED,OAAO,UAAU,CAAC,qBAAqB,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC;IACL,iCAAC;AAAD,CAAC,AAnHD,IAmHC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,0BAA0B,CAAC,MAAM,CAAC,EAAtC,CAAsC,CAAC,CAAC","sourcesContent":["import { DracoCompression } from \"@babylonjs/core/Meshes/Compression/dracoCompression\";\r\nimport { Nullable } from \"@babylonjs/core/types\";\r\nimport { VertexBuffer } from \"@babylonjs/core/Buffers/buffer\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\n\r\nimport { MeshPrimitiveMode, IKHRDracoMeshCompression, AccessorComponentType } from \"babylonjs-gltf2interface\";\r\nimport { IMeshPrimitive, IBufferView } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\n\r\nconst NAME = \"KHR_draco_mesh_compression\";\r\n\r\ninterface IBufferViewDraco extends IBufferView {\r\n _dracoBabylonGeometry?: Promise<Geometry>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)\r\n */\r\nexport class KHR_draco_mesh_compression implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * The draco compression used to decode vertex data or DracoCompression.Default if not defined\r\n */\r\n public dracoCompression?: DracoCompression;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /** @hidden */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose(): void {\r\n delete this.dracoCompression;\r\n (this._loader as any) = null;\r\n }\r\n\r\n /** @hidden */\r\n public _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRDracoMeshCompression, Geometry>(context, primitive, this.name, (extensionContext, extension) => {\r\n if (primitive.mode != undefined) {\r\n if (primitive.mode !== MeshPrimitiveMode.TRIANGLE_STRIP &&\r\n primitive.mode !== MeshPrimitiveMode.TRIANGLES) {\r\n throw new Error(`${context}: Unsupported mode ${primitive.mode}`);\r\n }\r\n\r\n // TODO: handle triangle strips\r\n if (primitive.mode === MeshPrimitiveMode.TRIANGLE_STRIP) {\r\n throw new Error(`${context}: Mode ${primitive.mode} is not currently supported`);\r\n }\r\n }\r\n\r\n const attributes: {\r\n [kind: string]: number\r\n } = {};\r\n const dividers: {\r\n [kind: string]: number\r\n } = {};\r\n const loadAttribute = (name: string, kind: string) => {\r\n const uniqueId = extension.attributes[name];\r\n if (uniqueId === undefined || primitive.attributes[name] === undefined) {\r\n return;\r\n }\r\n\r\n attributes[kind] = uniqueId;\r\n const accessor = ArrayItem.Get(`${context}/attributes/${name}`, this._loader.gltf.accessors, primitive.attributes[name]);\r\n if (accessor.normalized && accessor.componentType !== AccessorComponentType.FLOAT) {\r\n let divider = 1;\r\n switch (accessor.componentType) {\r\n case AccessorComponentType.BYTE:\r\n divider = 127.0;\r\n break;\r\n case AccessorComponentType.UNSIGNED_BYTE:\r\n divider = 255.0;\r\n break;\r\n case AccessorComponentType.SHORT:\r\n divider = 32767.0;\r\n break;\r\n case AccessorComponentType.UNSIGNED_SHORT:\r\n divider = 65535.0;\r\n break;\r\n }\r\n dividers[kind] = divider;\r\n }\r\n\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n\r\n };\r\n\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"TEXCOORD_2\", VertexBuffer.UV3Kind);\r\n loadAttribute(\"TEXCOORD_3\", VertexBuffer.UV4Kind);\r\n loadAttribute(\"TEXCOORD_4\", VertexBuffer.UV5Kind);\r\n loadAttribute(\"TEXCOORD_5\", VertexBuffer.UV6Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind);\r\n\r\n var bufferView = ArrayItem.Get(extensionContext, this._loader.gltf.bufferViews, extension.bufferView) as IBufferViewDraco;\r\n if (!bufferView._dracoBabylonGeometry) {\r\n bufferView._dracoBabylonGeometry = this._loader.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n const dracoCompression = this.dracoCompression || DracoCompression.Default;\r\n return dracoCompression.decodeMeshAsync(data, attributes, dividers).then((babylonVertexData) => {\r\n const babylonGeometry = new Geometry(babylonMesh.name, this._loader.babylonScene);\r\n babylonVertexData.applyToGeometry(babylonGeometry);\r\n return babylonGeometry;\r\n }).catch((error) => {\r\n throw new Error(`${context}: ${error.message}`);\r\n });\r\n });\r\n }\r\n\r\n return bufferView._dracoBabylonGeometry;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_draco_mesh_compression(loader));"]}
|
1
|
+
{"version":3,"file":"KHR_draco_mesh_compression.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_draco_mesh_compression.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,gBAAgB,EAAE,+DAAiD;AAE5E,OAAO,EAAE,YAAY,EAAE,0CAA4B;AACnD,OAAO,EAAE,QAAQ,EAAE,2CAA6B;AAMhD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEtD,IAAM,IAAI,GAAG,4BAA4B,CAAC;AAM1C;;GAEG;AACH;IAkBI;;;OAGG;IACH,oCAAY,MAAkB;QArB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAmBxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,gBAAgB,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3F,CAAC;IAED,cAAc;IACP,4CAAO,GAAd;QACI,OAAO,IAAI,CAAC,gBAAgB,CAAC;QAC5B,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,yDAAoB,GAA3B,UAA4B,OAAe,EAAE,SAAyB,EAAE,WAAiB;QAAzF,iBAoFC;QAnFG,OAAO,UAAU,CAAC,kBAAkB,CAAqC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YAChI,IAAI,SAAS,CAAC,IAAI,IAAI,SAAS,EAAE;gBAC7B,IAAI,SAAS,CAAC,IAA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AO,CAAC,mBAAmB,CAAC,uBAAgB,UAAU,CAAC,KAAK,CAAE,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;oBAC1H,IAAM,gBAAgB,GAAG,KAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,OAAO,CAAC;oBAC3E,OAAO,gBAAgB;yBAClB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC;yBAC3C,IAAI,CAAC,UAAC,iBAAiB;wBACpB,IAAM,eAAe,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;wBAClF,iBAAiB,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;wBACnD,OAAO,eAAe,CAAC;oBAC3B,CAAC,CAAC;yBACD,KAAK,CAAC,UAAC,KAAK;wBACT,MAAM,IAAI,KAAK,CAAC,UAAG,OAAO,eAAK,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC;oBACpD,CAAC,CAAC,CAAC;gBACX,CAAC,CAAC,CAAC;aACN;YAED,OAAO,UAAU,CAAC,qBAAqB,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC;IACL,iCAAC;AAAD,CAAC,AA5HD,IA4HC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,0BAA0B,CAAC,MAAM,CAAC,EAAtC,CAAsC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { DracoCompression } from \"core/Meshes/Compression/dracoCompression\";\r\nimport { Nullable } from \"core/types\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport { Geometry } from \"core/Meshes/geometry\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\n\r\nimport { MeshPrimitiveMode, IKHRDracoMeshCompression, AccessorComponentType } from \"babylonjs-gltf2interface\";\r\nimport { IMeshPrimitive, IBufferView } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\n\r\nconst NAME = \"KHR_draco_mesh_compression\";\r\n\r\ninterface IBufferViewDraco extends IBufferView {\r\n _dracoBabylonGeometry?: Promise<Geometry>;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)\r\n */\r\nexport class KHR_draco_mesh_compression implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * The draco compression used to decode vertex data or DracoCompression.Default if not defined\r\n */\r\n public dracoCompression?: DracoCompression;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose(): void {\r\n delete this.dracoCompression;\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param primitive\r\n * @param babylonMesh\r\n * @hidden\r\n */\r\n public _loadVertexDataAsync(context: string, primitive: IMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<Geometry>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRDracoMeshCompression, Geometry>(context, primitive, this.name, (extensionContext, extension) => {\r\n if (primitive.mode != undefined) {\r\n if (primitive.mode !== MeshPrimitiveMode.TRIANGLE_STRIP && primitive.mode !== MeshPrimitiveMode.TRIANGLES) {\r\n throw new Error(`${context}: Unsupported mode ${primitive.mode}`);\r\n }\r\n\r\n // TODO: handle triangle strips\r\n if (primitive.mode === MeshPrimitiveMode.TRIANGLE_STRIP) {\r\n throw new Error(`${context}: Mode ${primitive.mode} is not currently supported`);\r\n }\r\n }\r\n\r\n const attributes: {\r\n [kind: string]: number;\r\n } = {};\r\n const dividers: {\r\n [kind: string]: number;\r\n } = {};\r\n const loadAttribute = (name: string, kind: string) => {\r\n const uniqueId = extension.attributes[name];\r\n if (uniqueId === undefined || primitive.attributes[name] === undefined) {\r\n return;\r\n }\r\n\r\n attributes[kind] = uniqueId;\r\n const accessor = ArrayItem.Get(`${context}/attributes/${name}`, this._loader.gltf.accessors, primitive.attributes[name]);\r\n if (accessor.normalized && accessor.componentType !== AccessorComponentType.FLOAT) {\r\n let divider = 1;\r\n switch (accessor.componentType) {\r\n case AccessorComponentType.BYTE:\r\n divider = 127.0;\r\n break;\r\n case AccessorComponentType.UNSIGNED_BYTE:\r\n divider = 255.0;\r\n break;\r\n case AccessorComponentType.SHORT:\r\n divider = 32767.0;\r\n break;\r\n case AccessorComponentType.UNSIGNED_SHORT:\r\n divider = 65535.0;\r\n break;\r\n }\r\n dividers[kind] = divider;\r\n }\r\n\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n };\r\n\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"TEXCOORD_2\", VertexBuffer.UV3Kind);\r\n loadAttribute(\"TEXCOORD_3\", VertexBuffer.UV4Kind);\r\n loadAttribute(\"TEXCOORD_4\", VertexBuffer.UV5Kind);\r\n loadAttribute(\"TEXCOORD_5\", VertexBuffer.UV6Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind);\r\n\r\n const bufferView = ArrayItem.Get(extensionContext, this._loader.gltf.bufferViews, extension.bufferView) as IBufferViewDraco;\r\n if (!bufferView._dracoBabylonGeometry) {\r\n bufferView._dracoBabylonGeometry = this._loader.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\r\n const dracoCompression = this.dracoCompression || DracoCompression.Default;\r\n return dracoCompression\r\n .decodeMeshAsync(data, attributes, dividers)\r\n .then((babylonVertexData) => {\r\n const babylonGeometry = new Geometry(babylonMesh.name, this._loader.babylonScene);\r\n babylonVertexData.applyToGeometry(babylonGeometry);\r\n return babylonGeometry;\r\n })\r\n .catch((error) => {\r\n throw new Error(`${context}: ${error.message}`);\r\n });\r\n });\r\n }\r\n\r\n return bufferView._dracoBabylonGeometry;\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_draco_mesh_compression(loader));\r\n"]}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
2
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode";
|
1
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
3
3
|
import { INode } from "../glTFLoaderInterfaces";
|
4
4
|
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
5
|
import { GLTFLoader } from "../glTFLoader";
|
@@ -17,12 +17,20 @@ export declare class KHR_lights implements IGLTFLoaderExtension {
|
|
17
17
|
enabled: boolean;
|
18
18
|
private _loader;
|
19
19
|
private _lights?;
|
20
|
-
/**
|
20
|
+
/**
|
21
|
+
* @param loader
|
22
|
+
* @hidden
|
23
|
+
*/
|
21
24
|
constructor(loader: GLTFLoader);
|
22
25
|
/** @hidden */
|
23
26
|
dispose(): void;
|
24
27
|
/** @hidden */
|
25
28
|
onLoading(): void;
|
26
|
-
/**
|
29
|
+
/**
|
30
|
+
* @param context
|
31
|
+
* @param node
|
32
|
+
* @param assign
|
33
|
+
* @hidden
|
34
|
+
*/
|
27
35
|
loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>>;
|
28
36
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
2
|
-
import { Color3 } from
|
2
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
3
3
|
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
|
4
4
|
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
5
5
|
import { SpotLight } from "@babylonjs/core/Lights/spotLight.js";
|
@@ -10,7 +10,10 @@ var NAME = "KHR_lights_punctual";
|
|
10
10
|
* [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)
|
11
11
|
*/
|
12
12
|
var KHR_lights = /** @class */ (function () {
|
13
|
-
/**
|
13
|
+
/**
|
14
|
+
* @param loader
|
15
|
+
* @hidden
|
16
|
+
*/
|
14
17
|
function KHR_lights(loader) {
|
15
18
|
/**
|
16
19
|
* The name of this extension.
|
@@ -32,7 +35,12 @@ var KHR_lights = /** @class */ (function () {
|
|
32
35
|
this._lights = extension.lights;
|
33
36
|
}
|
34
37
|
};
|
35
|
-
/**
|
38
|
+
/**
|
39
|
+
* @param context
|
40
|
+
* @param node
|
41
|
+
* @param assign
|
42
|
+
* @hidden
|
43
|
+
*/
|
36
44
|
KHR_lights.prototype.loadNodeAsync = function (context, node, assign) {
|
37
45
|
var _this = this;
|
38
46
|
return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_lights_punctual.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"KHR_lights_punctual.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glT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AC,CAAC;IACP,CAAC;IACL,iBAAC;AAAD,CAAC,AA5FD,IA4FC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,UAAU,CAAC,MAAM,CAAC,EAAtB,CAAsB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Nullable } from \"core/types\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { PointLight } from \"core/Lights/pointLight\";\r\nimport { SpotLight } from \"core/Lights/spotLight\";\r\nimport { Light } from \"core/Lights/light\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\n\r\nimport { IKHRLightsPunctual_LightType, IKHRLightsPunctual_LightReference, IKHRLightsPunctual_Light, IKHRLightsPunctual } from \"babylonjs-gltf2interface\";\r\nimport { INode } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\n\r\nconst NAME = \"KHR_lights_punctual\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)\r\n */\r\nexport class KHR_lights implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n private _lights?: IKHRLightsPunctual_Light[];\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n delete this._lights;\r\n }\r\n\r\n /** @hidden */\r\n public onLoading(): void {\r\n const extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n const extension = extensions[this.name] as IKHRLightsPunctual;\r\n this._lights = extension.lights;\r\n }\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param node\r\n * @param assign\r\n * @hidden\r\n */\r\n public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRLightsPunctual_LightReference, TransformNode>(context, node, this.name, (extensionContext, extension) => {\r\n return this._loader.loadNodeAsync(context, node, (babylonMesh) => {\r\n let babylonLight: Light;\r\n\r\n const light = ArrayItem.Get(extensionContext, this._lights, extension.light);\r\n const name = light.name || babylonMesh.name;\r\n\r\n this._loader.babylonScene._blockEntityCollection = !!this._loader._assetContainer;\r\n\r\n switch (light.type) {\r\n case IKHRLightsPunctual_LightType.DIRECTIONAL: {\r\n babylonLight = new DirectionalLight(name, Vector3.Backward(), this._loader.babylonScene);\r\n break;\r\n }\r\n case IKHRLightsPunctual_LightType.POINT: {\r\n babylonLight = new PointLight(name, Vector3.Zero(), this._loader.babylonScene);\r\n break;\r\n }\r\n case IKHRLightsPunctual_LightType.SPOT: {\r\n const babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, this._loader.babylonScene);\r\n babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2;\r\n babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2;\r\n babylonLight = babylonSpotLight;\r\n break;\r\n }\r\n default: {\r\n this._loader.babylonScene._blockEntityCollection = false;\r\n throw new Error(`${extensionContext}: Invalid light type (${light.type})`);\r\n }\r\n }\r\n\r\n babylonLight._parentContainer = this._loader._assetContainer;\r\n this._loader.babylonScene._blockEntityCollection = false;\r\n babylonLight.falloffType = Light.FALLOFF_GLTF;\r\n babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();\r\n babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;\r\n babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;\r\n babylonLight.parent = babylonMesh;\r\n\r\n this._loader._babylonLights.push(babylonLight);\r\n\r\n GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);\r\n\r\n assign(babylonMesh);\r\n });\r\n });\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_lights(loader));\r\n"]}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
2
|
-
import { Material } from "@babylonjs/core/Materials/material";
|
1
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
3
3
|
import { IMaterial } from "../glTFLoaderInterfaces";
|
4
4
|
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
5
|
import { GLTFLoader } from "../glTFLoader";
|
@@ -21,11 +21,19 @@ export declare class KHR_materials_clearcoat implements IGLTFLoaderExtension {
|
|
21
21
|
*/
|
22
22
|
order: number;
|
23
23
|
private _loader;
|
24
|
-
/**
|
24
|
+
/**
|
25
|
+
* @param loader
|
26
|
+
* @hidden
|
27
|
+
*/
|
25
28
|
constructor(loader: GLTFLoader);
|
26
29
|
/** @hidden */
|
27
30
|
dispose(): void;
|
28
|
-
/**
|
31
|
+
/**
|
32
|
+
* @param context
|
33
|
+
* @param material
|
34
|
+
* @param babylonMaterial
|
35
|
+
* @hidden
|
36
|
+
*/
|
29
37
|
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
30
38
|
private _loadClearCoatPropertiesAsync;
|
31
39
|
}
|
@@ -6,7 +6,10 @@ var NAME = "KHR_materials_clearcoat";
|
|
6
6
|
* [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)
|
7
7
|
*/
|
8
8
|
var KHR_materials_clearcoat = /** @class */ (function () {
|
9
|
-
/**
|
9
|
+
/**
|
10
|
+
* @param loader
|
11
|
+
* @hidden
|
12
|
+
*/
|
10
13
|
function KHR_materials_clearcoat(loader) {
|
11
14
|
/**
|
12
15
|
* The name of this extension.
|
@@ -23,7 +26,12 @@ var KHR_materials_clearcoat = /** @class */ (function () {
|
|
23
26
|
KHR_materials_clearcoat.prototype.dispose = function () {
|
24
27
|
this._loader = null;
|
25
28
|
};
|
26
|
-
/**
|
29
|
+
/**
|
30
|
+
* @param context
|
31
|
+
* @param material
|
32
|
+
* @param babylonMaterial
|
33
|
+
* @hidden
|
34
|
+
*/
|
27
35
|
KHR_materials_clearcoat.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
28
36
|
var _this = this;
|
29
37
|
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_clearcoat.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"KHR_materials_clearcoat.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_materials_clearcoat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,yBAAyB,CAAC;AAEvC;;;GAGG;AACH;IAkBI;;;OAGG;IACH,iCAAY,MAAkB;QArB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QASf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,cAAc;IACP,yCAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,6DAA2B,GAAlC,UAAmC,OA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AAe,CAAC,gBAAgB,GAAG,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,oBAAoB,CAAC;YACpF,eAAe,CAAC,gBAAgB,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC,oBAAoB,CAAC;YACnF,IAAI,UAAU,CAAC,sBAAsB,CAAC,KAAK,IAAI,SAAS,EAAE;gBACtD,eAAe,CAAC,SAAS,CAAC,WAAY,CAAC,KAAK,GAAG,UAAU,CAAC,sBAAsB,CAAC,KAAK,CAAC;aAC1F;SACJ;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,cAAO,CAAC,CAAC,CAAC;IAChD,CAAC;IACL,8BAAC;AAAD,CAAC,AA3GD,IA2GC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAnC,CAAmC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport { Material } from \"core/Materials/material\";\r\n\r\nimport { IMaterial, ITextureInfo } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { IKHRMaterialsClearcoat } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_materials_clearcoat\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)\r\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)\r\n */\r\nexport class KHR_materials_clearcoat implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 190;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param material\r\n * @param babylonMaterial\r\n * @hidden\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsClearcoat>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadClearCoatPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadClearCoatPropertiesAsync(context: string, properties: IKHRMaterialsClearcoat, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n const promises = new Array<Promise<any>>();\r\n\r\n babylonMaterial.clearCoat.isEnabled = true;\r\n babylonMaterial.clearCoat.useRoughnessFromMainTexture = false;\r\n babylonMaterial.clearCoat.remapF0OnInterfaceChange = false;\r\n\r\n if (properties.clearcoatFactor != undefined) {\r\n babylonMaterial.clearCoat.intensity = properties.clearcoatFactor;\r\n } else {\r\n babylonMaterial.clearCoat.intensity = 0;\r\n }\r\n\r\n if (properties.clearcoatTexture) {\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/clearcoatTexture`, properties.clearcoatTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (ClearCoat Intensity)`;\r\n babylonMaterial.clearCoat.texture = texture;\r\n })\r\n );\r\n }\r\n\r\n if (properties.clearcoatRoughnessFactor != undefined) {\r\n babylonMaterial.clearCoat.roughness = properties.clearcoatRoughnessFactor;\r\n } else {\r\n babylonMaterial.clearCoat.roughness = 0;\r\n }\r\n\r\n if (properties.clearcoatRoughnessTexture) {\r\n (properties.clearcoatRoughnessTexture as ITextureInfo).nonColorData = true;\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/clearcoatRoughnessTexture`, properties.clearcoatRoughnessTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (ClearCoat Roughness)`;\r\n babylonMaterial.clearCoat.textureRoughness = texture;\r\n })\r\n );\r\n }\r\n\r\n if (properties.clearcoatNormalTexture) {\r\n (properties.clearcoatNormalTexture as ITextureInfo).nonColorData = true;\r\n promises.push(\r\n this._loader.loadTextureInfoAsync(`${context}/clearcoatNormalTexture`, properties.clearcoatNormalTexture, (texture) => {\r\n texture.name = `${babylonMaterial.name} (ClearCoat Normal)`;\r\n babylonMaterial.clearCoat.bumpTexture = texture;\r\n })\r\n );\r\n\r\n babylonMaterial.invertNormalMapX = !babylonMaterial.getScene().useRightHandedSystem;\r\n babylonMaterial.invertNormalMapY = babylonMaterial.getScene().useRightHandedSystem;\r\n if (properties.clearcoatNormalTexture.scale != undefined) {\r\n babylonMaterial.clearCoat.bumpTexture!.level = properties.clearcoatNormalTexture.scale;\r\n }\r\n }\r\n\r\n return Promise.all(promises).then(() => {});\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_clearcoat(loader));\r\n"]}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
2
|
-
import { Material } from "@babylonjs/core/Materials/material";
|
1
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
3
3
|
import { IMaterial } from "../glTFLoaderInterfaces";
|
4
4
|
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
5
|
import { GLTFLoader } from "../glTFLoader";
|
@@ -20,11 +20,19 @@ export declare class KHR_materials_emissive_strength implements IGLTFLoaderExten
|
|
20
20
|
*/
|
21
21
|
order: number;
|
22
22
|
private _loader;
|
23
|
-
/**
|
23
|
+
/**
|
24
|
+
* @param loader
|
25
|
+
* @hidden
|
26
|
+
*/
|
24
27
|
constructor(loader: GLTFLoader);
|
25
28
|
/** @hidden */
|
26
29
|
dispose(): void;
|
27
|
-
/**
|
30
|
+
/**
|
31
|
+
* @param context
|
32
|
+
* @param material
|
33
|
+
* @param babylonMaterial
|
34
|
+
* @hidden
|
35
|
+
*/
|
28
36
|
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
29
37
|
private _loadEmissiveProperties;
|
30
38
|
}
|
@@ -5,7 +5,10 @@ var NAME = "KHR_materials_emissive_strength";
|
|
5
5
|
* [Experimental Spec](https://github.com/KhronosGroup/glTF/pull/1994)
|
6
6
|
*/
|
7
7
|
var KHR_materials_emissive_strength = /** @class */ (function () {
|
8
|
-
/**
|
8
|
+
/**
|
9
|
+
* @param loader
|
10
|
+
* @hidden
|
11
|
+
*/
|
9
12
|
function KHR_materials_emissive_strength(loader) {
|
10
13
|
/**
|
11
14
|
* The name of this extension.
|
@@ -22,7 +25,12 @@ var KHR_materials_emissive_strength = /** @class */ (function () {
|
|
22
25
|
KHR_materials_emissive_strength.prototype.dispose = function () {
|
23
26
|
this._loader = null;
|
24
27
|
};
|
25
|
-
/**
|
28
|
+
/**
|
29
|
+
* @param context
|
30
|
+
* @param material
|
31
|
+
* @param babylonMaterial
|
32
|
+
* @hidden
|
33
|
+
*/
|
26
34
|
KHR_materials_emissive_strength.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
27
35
|
var _this = this;
|
28
36
|
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_emissive_strength.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"KHR_materials_emissive_strength.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_materials_emissive_strength.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,iCAAiC,CAAC;AAE/C;;GAEG;AACH;IAkBI;;;OAGG;IACH,yCAAY,MAAkB;QArB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QASf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,cAAc;IACP,iDAAO,GAAd;QACK,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,qEAA2B,GAAlC,UAAmC,OAAe,EAAE,QAAmB,EAAE,eAAyB;QAAlG,iBAMC;QALG,OAAO,UAAU,CAAC,kBAAkB,CAAgC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,UAAC,gBAAgB,EAAE,SAAS;YAC1H,OAAO,KAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC;gBACrF,KAAI,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;YAC/E,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,iEAAuB,GAA/B,UAAgC,OAAe,EAAE,UAAyC,EAAE,eAAyB;QACjH,IAAI,CAAC,CAAC,eAAe,YAAY,WAAW,CAAC,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,UAAG,OAAO,kCAA+B,CAAC,CAAC;SAC9D;QAED,IAAI,UAAU,CAAC,gBAAgB,KAAK,SAAS,EAAE;YAC3C,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;SACxG;IACL,CAAC;IACL,sCAAC;AAAD,CAAC,AAvDD,IAuDC;;AAED,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,+BAA+B,CAAC,MAAM,CAAC,EAA3C,CAA2C,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport { Material } from \"core/Materials/material\";\r\n\r\nimport { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { IKHRMaterialsEmissiveStrength } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_materials_emissive_strength\";\r\n\r\n/**\r\n * [Experimental Spec](https://github.com/KhronosGroup/glTF/pull/1994)\r\n */\r\nexport class KHR_materials_emissive_strength implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 170;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param material\r\n * @param babylonMaterial\r\n * @hidden\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsEmissiveStrength>(context, material, this.name, (extensionContext, extension) => {\r\n return this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial).then(() => {\r\n this._loadEmissiveProperties(extensionContext, extension, babylonMaterial);\r\n });\r\n });\r\n }\r\n\r\n private _loadEmissiveProperties(context: string, properties: IKHRMaterialsEmissiveStrength, babylonMaterial: Material): void {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n if (properties.emissiveStrength !== undefined) {\r\n babylonMaterial.emissiveColor.scaleToRef(properties.emissiveStrength, babylonMaterial.emissiveColor);\r\n }\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_emissive_strength(loader));\r\n"]}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
2
|
-
import { Material } from "@babylonjs/core/Materials/material";
|
1
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
3
3
|
import { IMaterial } from "../glTFLoaderInterfaces";
|
4
4
|
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
5
|
import { GLTFLoader } from "../glTFLoader";
|
@@ -24,11 +24,19 @@ export declare class KHR_materials_ior implements IGLTFLoaderExtension {
|
|
24
24
|
*/
|
25
25
|
order: number;
|
26
26
|
private _loader;
|
27
|
-
/**
|
27
|
+
/**
|
28
|
+
* @param loader
|
29
|
+
* @hidden
|
30
|
+
*/
|
28
31
|
constructor(loader: GLTFLoader);
|
29
32
|
/** @hidden */
|
30
33
|
dispose(): void;
|
31
|
-
/**
|
34
|
+
/**
|
35
|
+
* @param context
|
36
|
+
* @param material
|
37
|
+
* @param babylonMaterial
|
38
|
+
* @hidden
|
39
|
+
*/
|
32
40
|
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
33
41
|
private _loadIorPropertiesAsync;
|
34
42
|
}
|
@@ -5,7 +5,10 @@ var NAME = "KHR_materials_ior";
|
|
5
5
|
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior)
|
6
6
|
*/
|
7
7
|
var KHR_materials_ior = /** @class */ (function () {
|
8
|
-
/**
|
8
|
+
/**
|
9
|
+
* @param loader
|
10
|
+
* @hidden
|
11
|
+
*/
|
9
12
|
function KHR_materials_ior(loader) {
|
10
13
|
/**
|
11
14
|
* The name of this extension.
|
@@ -22,7 +25,12 @@ var KHR_materials_ior = /** @class */ (function () {
|
|
22
25
|
KHR_materials_ior.prototype.dispose = function () {
|
23
26
|
this._loader = null;
|
24
27
|
};
|
25
|
-
/**
|
28
|
+
/**
|
29
|
+
* @param context
|
30
|
+
* @param material
|
31
|
+
* @param babylonMaterial
|
32
|
+
* @hidden
|
33
|
+
*/
|
26
34
|
KHR_materials_ior.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
27
35
|
var _this = this;
|
28
36
|
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KHR_materials_ior.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"KHR_materials_ior.js","sourceRoot":"","sources":["../../../../../../../lts/loaders/generated/glTF/2.0/Extensions/KHR_materials_ior.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,IAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC;;GAEG;AACH;IAuBI;;;OAGG;IACH,2BAAY,MAAkB;QArB9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAO5B;;WAEG;QACI,UAAK,GAAG,GAAG,CAAC;QASf,IAAI,CAA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,CAAC;IA/DD;;OAEG;IACqB,8BAAY,GAAG,GAAG,CAAC;IA6D/C,wBAAC;CAAA,AAjED,IAiEC;SAjEY,iBAAiB;AAmE9B,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAC,MAAM,IAAK,OAAA,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAA7B,CAA6B,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Nullable } from \"core/types\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport { Material } from \"core/Materials/material\";\r\n\r\nimport { IMaterial } from \"../glTFLoaderInterfaces\";\r\nimport { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { IKHRMaterialsIor } from \"babylonjs-gltf2interface\";\r\n\r\nconst NAME = \"KHR_materials_ior\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior)\r\n */\r\nexport class KHR_materials_ior implements IGLTFLoaderExtension {\r\n /**\r\n * Default ior Value from the spec.\r\n */\r\n private static readonly _DEFAULT_IOR = 1.5;\r\n\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n public order = 180;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @param loader\r\n * @hidden\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @hidden */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @param context\r\n * @param material\r\n * @param babylonMaterial\r\n * @hidden\r\n */\r\n public loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRMaterialsIor>(context, material, this.name, (extensionContext, extension) => {\r\n const promises = new Array<Promise<any>>();\r\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(this._loadIorPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(() => {});\r\n });\r\n }\r\n\r\n private _loadIorPropertiesAsync(context: string, properties: IKHRMaterialsIor, babylonMaterial: Material): Promise<void> {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(`${context}: Material type not supported`);\r\n }\r\n\r\n if (properties.ior !== undefined) {\r\n babylonMaterial.indexOfRefraction = properties.ior;\r\n } else {\r\n babylonMaterial.indexOfRefraction = KHR_materials_ior._DEFAULT_IOR;\r\n }\r\n\r\n return Promise.resolve();\r\n }\r\n}\r\n\r\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_ior(loader));\r\n"]}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types";
|
2
|
-
import { Material } from "@babylonjs/core/Materials/material";
|
1
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
3
3
|
import { IMaterial } from "../glTFLoaderInterfaces";
|
4
4
|
import { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
5
5
|
import { GLTFLoader } from "../glTFLoader";
|
@@ -20,11 +20,19 @@ export declare class KHR_materials_pbrSpecularGlossiness implements IGLTFLoaderE
|
|
20
20
|
*/
|
21
21
|
order: number;
|
22
22
|
private _loader;
|
23
|
-
/**
|
23
|
+
/**
|
24
|
+
* @param loader
|
25
|
+
* @hidden
|
26
|
+
*/
|
24
27
|
constructor(loader: GLTFLoader);
|
25
28
|
/** @hidden */
|
26
29
|
dispose(): void;
|
27
|
-
/**
|
30
|
+
/**
|
31
|
+
* @param context
|
32
|
+
* @param material
|
33
|
+
* @param babylonMaterial
|
34
|
+
* @hidden
|
35
|
+
*/
|
28
36
|
loadMaterialPropertiesAsync(context: string, material: IMaterial, babylonMaterial: Material): Nullable<Promise<void>>;
|
29
37
|
private _loadSpecularGlossinessPropertiesAsync;
|
30
38
|
}
|
@@ -6,7 +6,10 @@ var NAME = "KHR_materials_pbrSpecularGlossiness";
|
|
6
6
|
* [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
|
7
7
|
*/
|
8
8
|
var KHR_materials_pbrSpecularGlossiness = /** @class */ (function () {
|
9
|
-
/**
|
9
|
+
/**
|
10
|
+
* @param loader
|
11
|
+
* @hidden
|
12
|
+
*/
|
10
13
|
function KHR_materials_pbrSpecularGlossiness(loader) {
|
11
14
|
/**
|
12
15
|
* The name of this extension.
|
@@ -23,7 +26,12 @@ var KHR_materials_pbrSpecularGlossiness = /** @class */ (function () {
|
|
23
26
|
KHR_materials_pbrSpecularGlossiness.prototype.dispose = function () {
|
24
27
|
this._loader = null;
|
25
28
|
};
|
26
|
-
/**
|
29
|
+
/**
|
30
|
+
* @param context
|
31
|
+
* @param material
|
32
|
+
* @param babylonMaterial
|
33
|
+
* @hidden
|
34
|
+
*/
|
27
35
|
KHR_materials_pbrSpecularGlossiness.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {
|
28
36
|
var _this = this;
|
29
37
|
return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {
|