@babylonjs/serializers 6.5.0 → 6.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +24 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +61 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -0
- package/glTF/2.0/Extensions/index.d.ts +1 -0
- package/glTF/2.0/Extensions/index.js +1 -0
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/package.json +3 -3
@@ -0,0 +1,24 @@
|
|
1
|
+
import type { IMaterial } from "babylonjs-gltf2interface";
|
2
|
+
import type { IGLTFExporterExtensionV2 } from "../glTFExporterExtension";
|
3
|
+
import { _Exporter } from "../glTFExporter";
|
4
|
+
import type { Material } from "@babylonjs/core/Materials/material.js";
|
5
|
+
import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
6
|
+
/**
|
7
|
+
* @internal
|
8
|
+
*/
|
9
|
+
export declare class KHR_materials_anisotropy implements IGLTFExporterExtensionV2 {
|
10
|
+
/** Name of this extension */
|
11
|
+
readonly name = "KHR_materials_anisotropy";
|
12
|
+
/** Defines whether this extension is enabled */
|
13
|
+
enabled: boolean;
|
14
|
+
/** Defines whether this extension is required */
|
15
|
+
required: boolean;
|
16
|
+
private _exporter;
|
17
|
+
private _wasUsed;
|
18
|
+
constructor(exporter: _Exporter);
|
19
|
+
dispose(): void;
|
20
|
+
/** @internal */
|
21
|
+
get wasUsed(): boolean;
|
22
|
+
postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];
|
23
|
+
postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial>;
|
24
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { _Exporter } from "../glTFExporter.js";
|
2
|
+
import { PBRBaseMaterial } from "@babylonjs/core/Materials/PBR/pbrBaseMaterial.js";
|
3
|
+
const NAME = "KHR_materials_anisotropy";
|
4
|
+
/**
|
5
|
+
* @internal
|
6
|
+
*/
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
8
|
+
export class KHR_materials_anisotropy {
|
9
|
+
constructor(exporter) {
|
10
|
+
/** Name of this extension */
|
11
|
+
this.name = NAME;
|
12
|
+
/** Defines whether this extension is enabled */
|
13
|
+
this.enabled = true;
|
14
|
+
/** Defines whether this extension is required */
|
15
|
+
this.required = false;
|
16
|
+
this._wasUsed = false;
|
17
|
+
this._exporter = exporter;
|
18
|
+
}
|
19
|
+
dispose() { }
|
20
|
+
/** @internal */
|
21
|
+
get wasUsed() {
|
22
|
+
return this._wasUsed;
|
23
|
+
}
|
24
|
+
postExportMaterialAdditionalTextures(context, node, babylonMaterial) {
|
25
|
+
const additionalTextures = [];
|
26
|
+
if (babylonMaterial instanceof PBRBaseMaterial) {
|
27
|
+
if (babylonMaterial.anisotropy.isEnabled && !babylonMaterial.anisotropy.legacy) {
|
28
|
+
if (babylonMaterial.anisotropy.texture) {
|
29
|
+
additionalTextures.push(babylonMaterial.anisotropy.texture);
|
30
|
+
}
|
31
|
+
return additionalTextures;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return [];
|
35
|
+
}
|
36
|
+
postExportMaterialAsync(context, node, babylonMaterial) {
|
37
|
+
return new Promise((resolve) => {
|
38
|
+
if (babylonMaterial instanceof PBRBaseMaterial) {
|
39
|
+
if (!babylonMaterial.anisotropy.isEnabled || babylonMaterial.anisotropy.legacy) {
|
40
|
+
resolve(node);
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
this._wasUsed = true;
|
44
|
+
node.extensions = node.extensions || {};
|
45
|
+
const anisotropyTextureInfo = this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.anisotropy.texture);
|
46
|
+
const anisotropyInfo = {
|
47
|
+
anisotropyStrength: babylonMaterial.anisotropy.intensity,
|
48
|
+
anisotropyRotation: babylonMaterial.anisotropy.angle,
|
49
|
+
anisotropyTexture: anisotropyTextureInfo !== null && anisotropyTextureInfo !== void 0 ? anisotropyTextureInfo : undefined,
|
50
|
+
hasTextures: () => {
|
51
|
+
return anisotropyInfo.anisotropyTexture !== null;
|
52
|
+
},
|
53
|
+
};
|
54
|
+
node.extensions[NAME] = anisotropyInfo;
|
55
|
+
}
|
56
|
+
resolve(node);
|
57
|
+
});
|
58
|
+
}
|
59
|
+
}
|
60
|
+
_Exporter.RegisterExtension(NAME, (exporter) => new KHR_materials_anisotropy(exporter));
|
61
|
+
//# sourceMappingURL=KHR_materials_anisotropy.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"KHR_materials_anisotropy.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/Extensions/KHR_materials_anisotropy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,yDAA2C;AAGrE,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAExC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,wBAAwB;IAcjC,YAAY,QAAmB;QAb/B,6BAA6B;QACb,SAAI,GAAG,IAAI,CAAC;QAE5B,gDAAgD;QACzC,YAAO,GAAG,IAAI,CAAC;QAEtB,iDAAiD;QAC1C,aAAQ,GAAG,KAAK,CAAC;QAIhB,aAAQ,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAEM,OAAO,KAAI,CAAC;IAEnB,gBAAgB;IAChB,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAEM,oCAAoC,CAAE,OAAe,EAAE,IAAe,EAAE,eAAyB;QACpG,MAAM,kBAAkB,GAAkB,EAAE,CAAC;QAC7C,IAAI,eAAe,YAAY,eAAe,EAAE;YAC5C,IAAI,eAAe,CAAC,UAAU,CAAC,SAAS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ACJ;AAED,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["import type { IMaterial, IKHRMaterialsAnisotropy } from \"babylonjs-gltf2interface\";\r\nimport type { IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\r\nimport { _Exporter } from \"../glTFExporter\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { PBRBaseMaterial } from \"core/Materials/PBR/pbrBaseMaterial\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\n\r\nconst NAME = \"KHR_materials_anisotropy\";\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_anisotropy implements IGLTFExporterExtensionV2 {\r\n /** Name of this extension */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled */\r\n public enabled = true;\r\n\r\n /** Defines whether this extension is required */\r\n public required = false;\r\n\r\n private _exporter: _Exporter;\r\n\r\n private _wasUsed = false;\r\n\r\n constructor(exporter: _Exporter) {\r\n this._exporter = exporter;\r\n }\r\n\r\n public dispose() {}\r\n\r\n /** @internal */\r\n public get wasUsed() {\r\n return this._wasUsed;\r\n }\r\n\r\n public postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[] {\r\n const additionalTextures: BaseTexture[] = [];\r\n if (babylonMaterial instanceof PBRBaseMaterial) {\r\n if (babylonMaterial.anisotropy.isEnabled && !babylonMaterial.anisotropy.legacy) {\r\n if (babylonMaterial.anisotropy.texture) {\r\n additionalTextures.push(babylonMaterial.anisotropy.texture);\r\n }\r\n return additionalTextures;\r\n }\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial> {\r\n return new Promise((resolve) => {\r\n if (babylonMaterial instanceof PBRBaseMaterial) {\r\n if (!babylonMaterial.anisotropy.isEnabled || babylonMaterial.anisotropy.legacy) {\r\n resolve(node);\r\n return;\r\n }\r\n\r\n this._wasUsed = true;\r\n\r\n node.extensions = node.extensions || {};\r\n\r\n const anisotropyTextureInfo = this._exporter._glTFMaterialExporter._getTextureInfo(babylonMaterial.anisotropy.texture);\r\n\r\n const anisotropyInfo: IKHRMaterialsAnisotropy = {\r\n anisotropyStrength: babylonMaterial.anisotropy.intensity,\r\n anisotropyRotation: babylonMaterial.anisotropy.angle,\r\n anisotropyTexture: anisotropyTextureInfo ?? undefined,\r\n hasTextures: () => {\r\n return anisotropyInfo.anisotropyTexture !== null;\r\n },\r\n };\r\n\r\n node.extensions[NAME] = anisotropyInfo;\r\n }\r\n resolve(node);\r\n });\r\n }\r\n}\r\n\r\n_Exporter.RegisterExtension(NAME, (exporter) => new KHR_materials_anisotropy(exporter));\r\n"]}
|
@@ -2,6 +2,7 @@ export * from "./KHR_texture_transform";
|
|
2
2
|
export * from "./KHR_lights_punctual";
|
3
3
|
export * from "./KHR_materials_clearcoat";
|
4
4
|
export * from "./KHR_materials_iridescence";
|
5
|
+
export * from "./KHR_materials_anisotropy";
|
5
6
|
export * from "./KHR_materials_sheen";
|
6
7
|
export * from "./KHR_materials_unlit";
|
7
8
|
export * from "./KHR_materials_ior";
|
@@ -2,6 +2,7 @@ export * from "./KHR_texture_transform.js";
|
|
2
2
|
export * from "./KHR_lights_punctual.js";
|
3
3
|
export * from "./KHR_materials_clearcoat.js";
|
4
4
|
export * from "./KHR_materials_iridescence.js";
|
5
|
+
export * from "./KHR_materials_anisotropy.js";
|
5
6
|
export * from "./KHR_materials_sheen.js";
|
6
7
|
export * from "./KHR_materials_unlit.js";
|
7
8
|
export * from "./KHR_materials_ior.js";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC","sourcesContent":["export * from \"./KHR_texture_transform\";\r\nexport * from \"./KHR_lights_punctual\";\r\nexport * from \"./KHR_materials_clearcoat\";\r\nexport * from \"./KHR_materials_iridescence\";\r\nexport * from \"./KHR_materials_sheen\";\r\nexport * from \"./KHR_materials_unlit\";\r\nexport * from \"./KHR_materials_ior\";\r\nexport * from \"./KHR_materials_specular\";\r\nexport * from \"./KHR_materials_volume\";\r\nexport * from \"./KHR_materials_transmission\";\r\nexport * from \"./EXT_mesh_gpu_instancing\";\r\nexport * from \"./KHR_materials_emissive_strength\";\r\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/serializers/generated/glTF/2.0/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC","sourcesContent":["export * from \"./KHR_texture_transform\";\r\nexport * from \"./KHR_lights_punctual\";\r\nexport * from \"./KHR_materials_clearcoat\";\r\nexport * from \"./KHR_materials_iridescence\";\r\nexport * from \"./KHR_materials_anisotropy\";\r\nexport * from \"./KHR_materials_sheen\";\r\nexport * from \"./KHR_materials_unlit\";\r\nexport * from \"./KHR_materials_ior\";\r\nexport * from \"./KHR_materials_specular\";\r\nexport * from \"./KHR_materials_volume\";\r\nexport * from \"./KHR_materials_transmission\";\r\nexport * from \"./EXT_mesh_gpu_instancing\";\r\nexport * from \"./KHR_materials_emissive_strength\";\r\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/serializers",
|
3
|
-
"version": "6.5.
|
3
|
+
"version": "6.5.1",
|
4
4
|
"main": "index.js",
|
5
5
|
"module": "index.js",
|
6
6
|
"types": "index.d.ts",
|
@@ -18,10 +18,10 @@
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
|
-
"@babylonjs/core": "^6.5.
|
21
|
+
"@babylonjs/core": "^6.5.1",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/serializers": "^1.0.0",
|
24
|
-
"babylonjs-gltf2interface": "^6.5.
|
24
|
+
"babylonjs-gltf2interface": "^6.5.1",
|
25
25
|
"rimraf": "^3.0.2",
|
26
26
|
"typescript": "^4.4.4"
|
27
27
|
},
|