@babylonjs/serializers 8.33.4 → 8.34.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/EXT_lights_area.d.ts +39 -0
- package/glTF/2.0/Extensions/EXT_lights_area.js +133 -0
- package/glTF/2.0/Extensions/EXT_lights_area.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +32 -105
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +8 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +136 -13
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/{KHR_materials_clearcoat_darkening.d.ts → KHR_materials_coat.d.ts} +10 -2
- package/glTF/2.0/Extensions/KHR_materials_coat.js +383 -0
- package/glTF/2.0/Extensions/KHR_materials_coat.js.map +1 -0
- package/glTF/2.0/Extensions/{KHR_materials_clearcoat_color.d.ts → KHR_materials_fuzz.d.ts} +13 -5
- package/glTF/2.0/Extensions/KHR_materials_fuzz.js +194 -0
- package/glTF/2.0/Extensions/KHR_materials_fuzz.js.map +1 -0
- package/glTF/2.0/Extensions/index.d.ts +3 -4
- package/glTF/2.0/Extensions/index.js +3 -4
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/glTF/2.0/glTFAnimation.js +2 -2
- package/glTF/2.0/glTFAnimation.js.map +1 -1
- package/glTF/2.0/glTFMaterialExporter.d.ts +2 -2
- package/glTF/2.0/glTFMaterialExporter.js +85 -14
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
- package/glTF/2.0/glTFUtilities.d.ts +2 -1
- package/glTF/2.0/glTFUtilities.js.map +1 -1
- package/package.json +3 -3
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.d.ts +0 -32
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.js +0 -231
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_color.js +0 -101
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_color.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_darkening.js +0 -70
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_darkening.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_ior.d.ts +0 -26
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_ior.js +0 -60
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_ior.js.map +0 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { GLTFExporter } from "../glTFExporter.js";
|
|
2
|
+
import { OpenPBRMaterial } from "@babylonjs/core/Materials/PBR/openpbrMaterial.js";
|
|
3
|
+
import { MergeTexturesAsync, CreateRGBAConfiguration, CreateTextureInput, CreateConstantInput } from "@babylonjs/core/Materials/Textures/textureMerger.js";
|
|
4
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
5
|
+
const NAME = "KHR_materials_fuzz";
|
|
6
|
+
/**
|
|
7
|
+
* Generate a unique ID for the merged coat textures based on the internal texture data.
|
|
8
|
+
* This is used for caching merged textures.
|
|
9
|
+
* @param babylonMaterial Source OpenPBR material
|
|
10
|
+
* @returns A unique ID string for the merged coat textures
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
function GetFuzzColorTextureId(babylonMaterial) {
|
|
14
|
+
const fuzzColorTexture = babylonMaterial.fuzzColorTexture;
|
|
15
|
+
const fuzzColorId = fuzzColorTexture && fuzzColorTexture.getInternalTexture() ? fuzzColorTexture.getInternalTexture().uniqueId : "NoFuzzColor";
|
|
16
|
+
const fuzzRoughnessTexture = babylonMaterial.fuzzRoughnessTexture;
|
|
17
|
+
const fuzzRoughnessId = fuzzRoughnessTexture && fuzzRoughnessTexture.getInternalTexture() ? fuzzRoughnessTexture.getInternalTexture().uniqueId : "NoFuzzRoughness";
|
|
18
|
+
return `FuzzColor_${fuzzColorId}_FuzzRoughness_${fuzzRoughnessId}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Using the coat weight and coat roughness textures, create a merged internal texture that can be used
|
|
22
|
+
* for multiple textures (with potentially different transforms) on export.
|
|
23
|
+
* @param babylonMaterial The source OpenPBR material
|
|
24
|
+
* @returns A new, internal texture with the coat weight in the red channel and coat roughness in the green channel
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
async function CreateMergedFuzzInternalTexture(babylonMaterial) {
|
|
28
|
+
const scene = babylonMaterial.getScene();
|
|
29
|
+
const fuzzColorTexture = babylonMaterial.fuzzColorTexture;
|
|
30
|
+
const fuzzRoughnessTexture = babylonMaterial.fuzzRoughnessTexture;
|
|
31
|
+
// If we don't have any textures, we don't need to generate anything.
|
|
32
|
+
if (!(fuzzColorTexture || fuzzRoughnessTexture)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const texture = await MergeTexturesAsync("FuzzTexture", CreateRGBAConfiguration(fuzzColorTexture ? CreateTextureInput(fuzzColorTexture, 0) : CreateConstantInput(1.0), // fuzz color from red channel
|
|
36
|
+
fuzzColorTexture ? CreateTextureInput(fuzzColorTexture, 1) : CreateConstantInput(1.0), // fuzz color from green channel
|
|
37
|
+
fuzzColorTexture ? CreateTextureInput(fuzzColorTexture, 2) : CreateConstantInput(1.0), // fuzz color from blue channel
|
|
38
|
+
// fuzz roughness goes in the alpha channel but may come from red or alpha channels in the source
|
|
39
|
+
fuzzRoughnessTexture ? CreateTextureInput(fuzzRoughnessTexture, babylonMaterial._useFuzzRoughnessFromTextureAlpha ? 3 : 0) : CreateConstantInput(1.0)), scene);
|
|
40
|
+
return texture.getInternalTexture();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates a temporary texture based on the source texture.
|
|
44
|
+
* @param internalTexture The source internal texture
|
|
45
|
+
* @param sourceTexture The source of the new texture's name, and sampler info
|
|
46
|
+
* @returns The new texture
|
|
47
|
+
*/
|
|
48
|
+
function CreateTempTexture(internalTexture, sourceTexture) {
|
|
49
|
+
const tempTexture = new Texture(sourceTexture.name, sourceTexture.getScene());
|
|
50
|
+
tempTexture._texture = internalTexture;
|
|
51
|
+
tempTexture.coordinatesIndex = sourceTexture.coordinatesIndex;
|
|
52
|
+
if (sourceTexture instanceof Texture) {
|
|
53
|
+
tempTexture.uOffset = sourceTexture.uOffset;
|
|
54
|
+
tempTexture.vOffset = sourceTexture.vOffset;
|
|
55
|
+
tempTexture.uScale = sourceTexture.uScale;
|
|
56
|
+
tempTexture.vScale = sourceTexture.vScale;
|
|
57
|
+
tempTexture.wAng = sourceTexture.wAng;
|
|
58
|
+
}
|
|
59
|
+
tempTexture.wrapU = sourceTexture.wrapU;
|
|
60
|
+
tempTexture.wrapV = sourceTexture.wrapV;
|
|
61
|
+
return tempTexture;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
67
|
+
export class KHR_materials_fuzz {
|
|
68
|
+
constructor(exporter) {
|
|
69
|
+
/** Name of this extension */
|
|
70
|
+
this.name = NAME;
|
|
71
|
+
/** Defines whether this extension is enabled */
|
|
72
|
+
this.enabled = true;
|
|
73
|
+
/** Defines whether this extension is required */
|
|
74
|
+
this.required = false;
|
|
75
|
+
this._wasUsed = false;
|
|
76
|
+
/**
|
|
77
|
+
* Cache that holds temporary merged textures created during export
|
|
78
|
+
*/
|
|
79
|
+
this._mergedTexturesMap = {};
|
|
80
|
+
/**
|
|
81
|
+
* Cache that holds internal textures of merged textures created during export
|
|
82
|
+
*/
|
|
83
|
+
this._cachedInternalTexturesMap = {};
|
|
84
|
+
this._exporter = exporter;
|
|
85
|
+
}
|
|
86
|
+
dispose() {
|
|
87
|
+
for (const key of Object.keys(this._mergedTexturesMap)) {
|
|
88
|
+
const texture = this._mergedTexturesMap[key];
|
|
89
|
+
texture.dispose();
|
|
90
|
+
}
|
|
91
|
+
this._mergedTexturesMap = {};
|
|
92
|
+
for (const key of Object.keys(this._cachedInternalTexturesMap)) {
|
|
93
|
+
const internalTexture = this._cachedInternalTexturesMap[key];
|
|
94
|
+
internalTexture.dispose();
|
|
95
|
+
}
|
|
96
|
+
this._cachedInternalTexturesMap = {};
|
|
97
|
+
}
|
|
98
|
+
/** @internal */
|
|
99
|
+
get wasUsed() {
|
|
100
|
+
return this._wasUsed;
|
|
101
|
+
}
|
|
102
|
+
async postExportMaterialAdditionalTexturesAsync(context, node, babylonMaterial) {
|
|
103
|
+
if (babylonMaterial instanceof OpenPBRMaterial) {
|
|
104
|
+
const additionalTextures = [];
|
|
105
|
+
if (babylonMaterial.fuzzWeight > 0.0) {
|
|
106
|
+
if (babylonMaterial.fuzzWeightTexture) {
|
|
107
|
+
additionalTextures.push(babylonMaterial.fuzzWeightTexture);
|
|
108
|
+
}
|
|
109
|
+
let fuzzTexturesNeedMerge = false;
|
|
110
|
+
if (babylonMaterial.fuzzRoughnessTexture) {
|
|
111
|
+
if (babylonMaterial._useFuzzRoughnessFromTextureAlpha) {
|
|
112
|
+
additionalTextures.push(babylonMaterial.fuzzRoughnessTexture);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
fuzzTexturesNeedMerge = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (babylonMaterial.fuzzColorTexture && !fuzzTexturesNeedMerge) {
|
|
119
|
+
additionalTextures.push(babylonMaterial.fuzzColorTexture);
|
|
120
|
+
}
|
|
121
|
+
if (fuzzTexturesNeedMerge) {
|
|
122
|
+
const texId = GetFuzzColorTextureId(babylonMaterial);
|
|
123
|
+
if (!this._cachedInternalTexturesMap[texId]) {
|
|
124
|
+
const mergedInternalTexture = await CreateMergedFuzzInternalTexture(babylonMaterial);
|
|
125
|
+
if (mergedInternalTexture) {
|
|
126
|
+
this._cachedInternalTexturesMap[texId] = mergedInternalTexture;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (this._cachedInternalTexturesMap[texId]) {
|
|
130
|
+
if (babylonMaterial.fuzzColorTexture) {
|
|
131
|
+
this._mergedTexturesMap[babylonMaterial.fuzzColorTexture.uniqueId] = CreateTempTexture(this._cachedInternalTexturesMap[texId], babylonMaterial.fuzzColorTexture);
|
|
132
|
+
additionalTextures.push(this._mergedTexturesMap[babylonMaterial.fuzzColorTexture.uniqueId]);
|
|
133
|
+
}
|
|
134
|
+
if (babylonMaterial.fuzzRoughnessTexture) {
|
|
135
|
+
this._mergedTexturesMap[babylonMaterial.fuzzRoughnessTexture.uniqueId] = CreateTempTexture(this._cachedInternalTexturesMap[texId], babylonMaterial.fuzzRoughnessTexture);
|
|
136
|
+
additionalTextures.push(this._mergedTexturesMap[babylonMaterial.fuzzRoughnessTexture.uniqueId]);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return additionalTextures;
|
|
142
|
+
}
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
async postExportMaterialAsync(context, node, babylonMaterial) {
|
|
146
|
+
return await new Promise((resolve) => {
|
|
147
|
+
if (babylonMaterial instanceof OpenPBRMaterial) {
|
|
148
|
+
if (babylonMaterial.fuzzWeight == 0.0) {
|
|
149
|
+
resolve(node);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
this._wasUsed = true;
|
|
153
|
+
if (node.extensions == null) {
|
|
154
|
+
node.extensions = {};
|
|
155
|
+
}
|
|
156
|
+
const fuzzInfo = {
|
|
157
|
+
fuzzFactor: babylonMaterial.fuzzWeight,
|
|
158
|
+
fuzzColorFactor: babylonMaterial.fuzzColor.asArray(),
|
|
159
|
+
fuzzRoughnessFactor: babylonMaterial.fuzzRoughness,
|
|
160
|
+
};
|
|
161
|
+
if (babylonMaterial.fuzzWeightTexture) {
|
|
162
|
+
fuzzInfo.fuzzTexture = this._exporter._materialExporter.getTextureInfo(babylonMaterial.fuzzWeightTexture) ?? undefined;
|
|
163
|
+
}
|
|
164
|
+
let fuzzColorTexture = null;
|
|
165
|
+
if (babylonMaterial.fuzzColorTexture) {
|
|
166
|
+
if (this._mergedTexturesMap[babylonMaterial.fuzzColorTexture.uniqueId]) {
|
|
167
|
+
fuzzColorTexture = this._mergedTexturesMap[babylonMaterial.fuzzColorTexture.uniqueId];
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
fuzzColorTexture = babylonMaterial.fuzzColorTexture;
|
|
171
|
+
}
|
|
172
|
+
fuzzInfo.fuzzColorTexture = this._exporter._materialExporter.getTextureInfo(fuzzColorTexture) ?? undefined;
|
|
173
|
+
}
|
|
174
|
+
let fuzzRoughnessTexture = null;
|
|
175
|
+
if (babylonMaterial.fuzzRoughnessTexture) {
|
|
176
|
+
if (this._mergedTexturesMap[babylonMaterial.fuzzRoughnessTexture.uniqueId]) {
|
|
177
|
+
fuzzRoughnessTexture = this._mergedTexturesMap[babylonMaterial.fuzzRoughnessTexture.uniqueId];
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
fuzzRoughnessTexture = babylonMaterial.fuzzRoughnessTexture;
|
|
181
|
+
}
|
|
182
|
+
fuzzInfo.fuzzRoughnessTexture = this._exporter._materialExporter.getTextureInfo(fuzzRoughnessTexture) ?? undefined;
|
|
183
|
+
}
|
|
184
|
+
if (fuzzInfo.fuzzColorTexture !== null || fuzzInfo.fuzzRoughnessTexture !== null) {
|
|
185
|
+
this._exporter._materialNeedsUVsSet.add(babylonMaterial);
|
|
186
|
+
}
|
|
187
|
+
node.extensions[NAME] = fuzzInfo;
|
|
188
|
+
}
|
|
189
|
+
resolve(node);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
GLTFExporter.RegisterExtension(NAME, (exporter) => new KHR_materials_fuzz(exporter));
|
|
194
|
+
//# sourceMappingURL=KHR_materials_fuzz.js.map
|
|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AC,oBAAoB,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,cAAc,CAAC,oBAAoB,CAAC,IAAI,SAAS,CAAC;gBACvH,CAAC;gBAED,IAAI,QAAQ,CAAC,gBAAgB,KAAK,IAAI,IAAI,QAAQ,CAAC,oBAAoB,KAAK,IAAI,EAAE,CAAC;oBAC/E,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;gBAC7D,CAAC;gBAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;YACrC,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["import type { IMaterial, IKHRMaterialsFuzz } from \"babylonjs-gltf2interface\";\r\nimport type { IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\r\nimport { GLTFExporter } from \"../glTFExporter\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { OpenPBRMaterial } from \"core/Materials/PBR/openpbrMaterial\";\r\nimport { MergeTexturesAsync, CreateRGBAConfiguration, CreateTextureInput, CreateConstantInput } from \"core/Materials/Textures/textureMerger\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { InternalTexture } from \"core/Materials/Textures/internalTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\n\r\nconst NAME = \"KHR_materials_fuzz\";\r\n\r\n/**\r\n * Generate a unique ID for the merged coat textures based on the internal texture data.\r\n * This is used for caching merged textures.\r\n * @param babylonMaterial Source OpenPBR material\r\n * @returns A unique ID string for the merged coat textures\r\n * @internal\r\n */\r\nfunction GetFuzzColorTextureId(babylonMaterial: OpenPBRMaterial): string {\r\n const fuzzColorTexture: Nullable<BaseTexture> = babylonMaterial.fuzzColorTexture;\r\n const fuzzColorId = fuzzColorTexture && fuzzColorTexture.getInternalTexture() ? fuzzColorTexture!.getInternalTexture()!.uniqueId : \"NoFuzzColor\";\r\n const fuzzRoughnessTexture: Nullable<BaseTexture> = babylonMaterial.fuzzRoughnessTexture;\r\n const fuzzRoughnessId = fuzzRoughnessTexture && fuzzRoughnessTexture.getInternalTexture() ? fuzzRoughnessTexture!.getInternalTexture()!.uniqueId : \"NoFuzzRoughness\";\r\n return `FuzzColor_${fuzzColorId}_FuzzRoughness_${fuzzRoughnessId}`;\r\n}\r\n\r\n/**\r\n * Using the coat weight and coat roughness textures, create a merged internal texture that can be used\r\n * for multiple textures (with potentially different transforms) on export.\r\n * @param babylonMaterial The source OpenPBR material\r\n * @returns A new, internal texture with the coat weight in the red channel and coat roughness in the green channel\r\n * @internal\r\n */\r\nasync function CreateMergedFuzzInternalTexture(babylonMaterial: OpenPBRMaterial): Promise<Nullable<InternalTexture>> {\r\n const scene = babylonMaterial.getScene();\r\n const fuzzColorTexture: Nullable<BaseTexture> = babylonMaterial.fuzzColorTexture;\r\n const fuzzRoughnessTexture: Nullable<BaseTexture> = babylonMaterial.fuzzRoughnessTexture;\r\n // If we don't have any textures, we don't need to generate anything.\r\n if (!(fuzzColorTexture || fuzzRoughnessTexture)) {\r\n return null;\r\n }\r\n\r\n const texture = await MergeTexturesAsync(\r\n \"FuzzTexture\",\r\n CreateRGBAConfiguration(\r\n fuzzColorTexture ? CreateTextureInput(fuzzColorTexture, 0) : CreateConstantInput(1.0), // fuzz color from red channel\r\n fuzzColorTexture ? CreateTextureInput(fuzzColorTexture, 1) : CreateConstantInput(1.0), // fuzz color from green channel\r\n fuzzColorTexture ? CreateTextureInput(fuzzColorTexture, 2) : CreateConstantInput(1.0), // fuzz color from blue channel\r\n // fuzz roughness goes in the alpha channel but may come from red or alpha channels in the source\r\n fuzzRoughnessTexture ? CreateTextureInput(fuzzRoughnessTexture, babylonMaterial._useFuzzRoughnessFromTextureAlpha ? 3 : 0) : CreateConstantInput(1.0)\r\n ),\r\n scene\r\n );\r\n\r\n return texture.getInternalTexture();\r\n}\r\n\r\n/**\r\n * Creates a temporary texture based on the source texture.\r\n * @param internalTexture The source internal texture\r\n * @param sourceTexture The source of the new texture's name, and sampler info\r\n * @returns The new texture\r\n */\r\nfunction CreateTempTexture(internalTexture: InternalTexture, sourceTexture: BaseTexture): Texture {\r\n const tempTexture = new Texture(sourceTexture.name, sourceTexture.getScene());\r\n tempTexture._texture = internalTexture;\r\n tempTexture.coordinatesIndex = sourceTexture.coordinatesIndex;\r\n if (sourceTexture instanceof Texture) {\r\n tempTexture.uOffset = sourceTexture.uOffset;\r\n tempTexture.vOffset = sourceTexture.vOffset;\r\n tempTexture.uScale = sourceTexture.uScale;\r\n tempTexture.vScale = sourceTexture.vScale;\r\n tempTexture.wAng = sourceTexture.wAng;\r\n }\r\n tempTexture.wrapU = sourceTexture.wrapU;\r\n tempTexture.wrapV = sourceTexture.wrapV;\r\n return tempTexture;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_fuzz 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 _wasUsed = false;\r\n\r\n private _exporter: GLTFExporter;\r\n\r\n constructor(exporter: GLTFExporter) {\r\n this._exporter = exporter;\r\n }\r\n\r\n /**\r\n * Cache that holds temporary merged textures created during export\r\n */\r\n private _mergedTexturesMap: Record<string, BaseTexture> = {};\r\n\r\n /**\r\n * Cache that holds internal textures of merged textures created during export\r\n */\r\n private _cachedInternalTexturesMap: Record<string, InternalTexture> = {};\r\n\r\n public dispose() {\r\n for (const key of Object.keys(this._mergedTexturesMap)) {\r\n const texture = this._mergedTexturesMap[key];\r\n texture.dispose();\r\n }\r\n this._mergedTexturesMap = {};\r\n for (const key of Object.keys(this._cachedInternalTexturesMap)) {\r\n const internalTexture = this._cachedInternalTexturesMap[key];\r\n internalTexture.dispose();\r\n }\r\n this._cachedInternalTexturesMap = {};\r\n }\r\n\r\n /** @internal */\r\n public get wasUsed() {\r\n return this._wasUsed;\r\n }\r\n\r\n public async postExportMaterialAdditionalTexturesAsync(context: string, node: IMaterial, babylonMaterial: Material): Promise<BaseTexture[]> {\r\n if (babylonMaterial instanceof OpenPBRMaterial) {\r\n const additionalTextures: BaseTexture[] = [];\r\n if (babylonMaterial.fuzzWeight > 0.0) {\r\n if (babylonMaterial.fuzzWeightTexture) {\r\n additionalTextures.push(babylonMaterial.fuzzWeightTexture);\r\n }\r\n let fuzzTexturesNeedMerge = false;\r\n if (babylonMaterial.fuzzRoughnessTexture) {\r\n if (babylonMaterial._useFuzzRoughnessFromTextureAlpha) {\r\n additionalTextures.push(babylonMaterial.fuzzRoughnessTexture);\r\n } else {\r\n fuzzTexturesNeedMerge = true;\r\n }\r\n }\r\n if (babylonMaterial.fuzzColorTexture && !fuzzTexturesNeedMerge) {\r\n additionalTextures.push(babylonMaterial.fuzzColorTexture);\r\n }\r\n if (fuzzTexturesNeedMerge) {\r\n const texId = GetFuzzColorTextureId(babylonMaterial);\r\n if (!this._cachedInternalTexturesMap[texId]) {\r\n const mergedInternalTexture = await CreateMergedFuzzInternalTexture(babylonMaterial);\r\n if (mergedInternalTexture) {\r\n this._cachedInternalTexturesMap[texId] = mergedInternalTexture;\r\n }\r\n }\r\n if (this._cachedInternalTexturesMap[texId]) {\r\n if (babylonMaterial.fuzzColorTexture) {\r\n this._mergedTexturesMap[babylonMaterial.fuzzColorTexture.uniqueId] = CreateTempTexture(\r\n this._cachedInternalTexturesMap[texId],\r\n babylonMaterial.fuzzColorTexture\r\n );\r\n additionalTextures.push(this._mergedTexturesMap[babylonMaterial.fuzzColorTexture.uniqueId]);\r\n }\r\n if (babylonMaterial.fuzzRoughnessTexture) {\r\n this._mergedTexturesMap[babylonMaterial.fuzzRoughnessTexture.uniqueId] = CreateTempTexture(\r\n this._cachedInternalTexturesMap[texId],\r\n babylonMaterial.fuzzRoughnessTexture\r\n );\r\n additionalTextures.push(this._mergedTexturesMap[babylonMaterial.fuzzRoughnessTexture.uniqueId]);\r\n }\r\n }\r\n }\r\n }\r\n return additionalTextures;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n public async postExportMaterialAsync(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial> {\r\n return await new Promise((resolve) => {\r\n if (babylonMaterial instanceof OpenPBRMaterial) {\r\n if (babylonMaterial.fuzzWeight == 0.0) {\r\n resolve(node);\r\n return;\r\n }\r\n\r\n this._wasUsed = true;\r\n\r\n if (node.extensions == null) {\r\n node.extensions = {};\r\n }\r\n const fuzzInfo: IKHRMaterialsFuzz = {\r\n fuzzFactor: babylonMaterial.fuzzWeight,\r\n fuzzColorFactor: babylonMaterial.fuzzColor.asArray(),\r\n fuzzRoughnessFactor: babylonMaterial.fuzzRoughness,\r\n };\r\n\r\n if (babylonMaterial.fuzzWeightTexture) {\r\n fuzzInfo.fuzzTexture = this._exporter._materialExporter.getTextureInfo(babylonMaterial.fuzzWeightTexture) ?? undefined;\r\n }\r\n\r\n let fuzzColorTexture: Nullable<BaseTexture> = null;\r\n if (babylonMaterial.fuzzColorTexture) {\r\n if (this._mergedTexturesMap[babylonMaterial.fuzzColorTexture.uniqueId]) {\r\n fuzzColorTexture = this._mergedTexturesMap[babylonMaterial.fuzzColorTexture.uniqueId];\r\n } else {\r\n fuzzColorTexture = babylonMaterial.fuzzColorTexture;\r\n }\r\n fuzzInfo.fuzzColorTexture = this._exporter._materialExporter.getTextureInfo(fuzzColorTexture) ?? undefined;\r\n }\r\n\r\n let fuzzRoughnessTexture: Nullable<BaseTexture> = null;\r\n if (babylonMaterial.fuzzRoughnessTexture) {\r\n if (this._mergedTexturesMap[babylonMaterial.fuzzRoughnessTexture.uniqueId]) {\r\n fuzzRoughnessTexture = this._mergedTexturesMap[babylonMaterial.fuzzRoughnessTexture.uniqueId];\r\n } else {\r\n fuzzRoughnessTexture = babylonMaterial.fuzzRoughnessTexture;\r\n }\r\n fuzzInfo.fuzzRoughnessTexture = this._exporter._materialExporter.getTextureInfo(fuzzRoughnessTexture) ?? undefined;\r\n }\r\n\r\n if (fuzzInfo.fuzzColorTexture !== null || fuzzInfo.fuzzRoughnessTexture !== null) {\r\n this._exporter._materialNeedsUVsSet.add(babylonMaterial);\r\n }\r\n\r\n node.extensions[NAME] = fuzzInfo;\r\n }\r\n resolve(node);\r\n });\r\n }\r\n}\r\n\r\nGLTFExporter.RegisterExtension(NAME, (exporter) => new KHR_materials_fuzz(exporter));\r\n"]}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
export * from "./EXT_mesh_gpu_instancing.js";
|
|
2
2
|
export * from "./KHR_draco_mesh_compression.js";
|
|
3
3
|
export * from "./KHR_lights_punctual.js";
|
|
4
|
+
export * from "./EXT_lights_area.js";
|
|
4
5
|
export * from "./KHR_materials_anisotropy.js";
|
|
5
6
|
export * from "./KHR_materials_clearcoat.js";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./KHR_materials_clearcoat_ior.js";
|
|
8
|
-
export * from "./KHR_materials_clearcoat_color.js";
|
|
9
|
-
export * from "./KHR_materials_clearcoat_anisotropy.js";
|
|
7
|
+
export * from "./KHR_materials_coat.js";
|
|
10
8
|
export * from "./KHR_materials_diffuse_transmission.js";
|
|
11
9
|
export * from "./KHR_materials_dispersion.js";
|
|
12
10
|
export * from "./KHR_materials_emissive_strength.js";
|
|
13
11
|
export * from "./KHR_materials_ior.js";
|
|
14
12
|
export * from "./KHR_materials_iridescence.js";
|
|
15
13
|
export * from "./KHR_materials_sheen.js";
|
|
14
|
+
export * from "./KHR_materials_fuzz.js";
|
|
16
15
|
export * from "./KHR_materials_specular.js";
|
|
17
16
|
export * from "./KHR_materials_transmission.js";
|
|
18
17
|
export * from "./KHR_materials_unlit.js";
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
export * from "./EXT_mesh_gpu_instancing.js";
|
|
2
2
|
export * from "./KHR_draco_mesh_compression.js";
|
|
3
3
|
export * from "./KHR_lights_punctual.js";
|
|
4
|
+
export * from "./EXT_lights_area.js";
|
|
4
5
|
export * from "./KHR_materials_anisotropy.js";
|
|
5
6
|
export * from "./KHR_materials_clearcoat.js";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./KHR_materials_clearcoat_ior.js";
|
|
8
|
-
export * from "./KHR_materials_clearcoat_color.js";
|
|
9
|
-
export * from "./KHR_materials_clearcoat_anisotropy.js";
|
|
7
|
+
export * from "./KHR_materials_coat.js";
|
|
10
8
|
export * from "./KHR_materials_diffuse_transmission.js";
|
|
11
9
|
export * from "./KHR_materials_dispersion.js";
|
|
12
10
|
export * from "./KHR_materials_emissive_strength.js";
|
|
13
11
|
export * from "./KHR_materials_ior.js";
|
|
14
12
|
export * from "./KHR_materials_iridescence.js";
|
|
15
13
|
export * from "./KHR_materials_sheen.js";
|
|
14
|
+
export * from "./KHR_materials_fuzz.js";
|
|
16
15
|
export * from "./KHR_materials_specular.js";
|
|
17
16
|
export * from "./KHR_materials_transmission.js";
|
|
18
17
|
export * from "./KHR_materials_unlit.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./EXT_mesh_gpu_instancing\";\r\nexport * from \"./KHR_draco_mesh_compression\";\r\nexport * from \"./KHR_lights_punctual\";\r\nexport * from \"./EXT_lights_area\";\r\nexport * from \"./KHR_materials_anisotropy\";\r\nexport * from \"./KHR_materials_clearcoat\";\r\nexport * from \"./KHR_materials_coat\";\r\nexport * from \"./KHR_materials_diffuse_transmission\";\r\nexport * from \"./KHR_materials_dispersion\";\r\nexport * from \"./KHR_materials_emissive_strength\";\r\nexport * from \"./KHR_materials_ior\";\r\nexport * from \"./KHR_materials_iridescence\";\r\nexport * from \"./KHR_materials_sheen\";\r\nexport * from \"./KHR_materials_fuzz\";\r\nexport * from \"./KHR_materials_specular\";\r\nexport * from \"./KHR_materials_transmission\";\r\nexport * from \"./KHR_materials_unlit\";\r\nexport * from \"./KHR_materials_volume\";\r\nexport * from \"./KHR_materials_diffuse_roughness\";\r\nexport * from \"./KHR_texture_transform\";\r\nexport * from \"./KHR_texture_basisu\";\r\nexport * from \"./EXT_texture_webp\";\r\nexport * from \"./EXT_texture_avif\";\r\n"]}
|
|
@@ -199,7 +199,7 @@ export class _GLTFAnimation {
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
combinedAnimation.setKeys(combinedAnimationKeys);
|
|
202
|
+
combinedAnimation.setKeys(combinedAnimationKeys, true);
|
|
203
203
|
const animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimation);
|
|
204
204
|
if (animationInfo) {
|
|
205
205
|
glTFAnimation = {
|
|
@@ -332,7 +332,7 @@ export class _GLTFAnimation {
|
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
combinedAnimationGroup.setKeys(animationKeys);
|
|
335
|
+
combinedAnimationGroup.setKeys(animationKeys, true);
|
|
336
336
|
const animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimationGroup);
|
|
337
337
|
if (animationInfo) {
|
|
338
338
|
_GLTFAnimation._AddAnimation(`${animationGroup.name}_${mesh.name}_MorphWeightAnimation`, glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, bufferManager, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, false, morphTargetManager?.numTargets);
|