@babylonjs/loaders 7.31.1 → 7.32.0
Sign up to get free protection for your applications and to get access to all the features.
- package/SPLAT/splatFileLoader.js +85 -75
- package/SPLAT/splatFileLoader.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_visibility.d.ts +30 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.js +43 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -0
- package/glTF/2.0/Extensions/dynamic.js +4 -0
- package/glTF/2.0/Extensions/dynamic.js.map +1 -1
- 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
package/SPLAT/splatFileLoader.js
CHANGED
@@ -123,45 +123,48 @@ export class SPLATFileLoader {
|
|
123
123
|
return mesh;
|
124
124
|
}
|
125
125
|
_parse(meshesNames, scene, data, rootUrl) {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
}
|
136
|
-
break;
|
137
|
-
case 1 /* Mode.PointCloud */:
|
138
|
-
{
|
139
|
-
const pointcloud = new PointsCloudSystem("PointCloud", 1, scene);
|
140
|
-
if (SPLATFileLoader._BuildPointCloud(pointcloud, parsedPLY.data)) {
|
141
|
-
return Promise.all([pointcloud.buildMeshAsync()]).then((mesh) => {
|
142
|
-
babylonMeshesArray.push(mesh[0]);
|
143
|
-
return babylonMeshesArray;
|
144
|
-
});
|
145
|
-
}
|
146
|
-
else {
|
147
|
-
pointcloud.dispose();
|
126
|
+
return SPLATFileLoader._ConvertPLYToSplat(data).then(async (parsedPLY) => {
|
127
|
+
const babylonMeshesArray = []; //The mesh for babylon
|
128
|
+
switch (parsedPLY.mode) {
|
129
|
+
case 0 /* Mode.Splat */:
|
130
|
+
{
|
131
|
+
const gaussianSplatting = new GaussianSplattingMesh("GaussianSplatting", null, scene, this._loadingOptions.keepInRam);
|
132
|
+
gaussianSplatting._parentContainer = this._assetContainer;
|
133
|
+
babylonMeshesArray.push(gaussianSplatting);
|
134
|
+
await gaussianSplatting.updateDataAsync(parsedPLY.data);
|
148
135
|
}
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
136
|
+
break;
|
137
|
+
case 1 /* Mode.PointCloud */:
|
138
|
+
{
|
139
|
+
const pointcloud = new PointsCloudSystem("PointCloud", 1, scene);
|
140
|
+
if (SPLATFileLoader._BuildPointCloud(pointcloud, parsedPLY.data)) {
|
141
|
+
return Promise.all([pointcloud.buildMeshAsync()]).then((mesh) => {
|
142
|
+
babylonMeshesArray.push(mesh[0]);
|
143
|
+
return babylonMeshesArray;
|
144
|
+
});
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
pointcloud.dispose();
|
148
|
+
}
|
155
149
|
}
|
156
|
-
|
157
|
-
|
150
|
+
break;
|
151
|
+
case 2 /* Mode.Mesh */:
|
152
|
+
{
|
153
|
+
if (parsedPLY.faces) {
|
154
|
+
babylonMeshesArray.push(SPLATFileLoader._BuildMesh(scene, parsedPLY));
|
155
|
+
}
|
156
|
+
else {
|
157
|
+
throw new Error("PLY mesh doesn't contain face informations.");
|
158
|
+
}
|
158
159
|
}
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
160
|
+
break;
|
161
|
+
default:
|
162
|
+
throw new Error("Unsupported Splat mode");
|
163
|
+
}
|
164
|
+
return new Promise((resolve) => {
|
165
|
+
resolve(babylonMeshesArray);
|
166
|
+
});
|
167
|
+
});
|
165
168
|
}
|
166
169
|
/**
|
167
170
|
* Load into an asset container.
|
@@ -212,7 +215,9 @@ export class SPLATFileLoader {
|
|
212
215
|
const headerEndIndex = header.indexOf(headerEnd);
|
213
216
|
if (headerEndIndex < 0 || !header) {
|
214
217
|
// standard splat
|
215
|
-
return
|
218
|
+
return new Promise((resolve) => {
|
219
|
+
resolve({ mode: 0 /* Mode.Splat */, data: data });
|
220
|
+
});
|
216
221
|
}
|
217
222
|
const vertexCount = parseInt(/element vertex (\d+)\n/.exec(header)[1]);
|
218
223
|
const faceElement = /element face (\d+)\n/.exec(header);
|
@@ -273,48 +278,53 @@ export class SPLATFileLoader {
|
|
273
278
|
}
|
274
279
|
const rowVertexLength = rowVertexOffset;
|
275
280
|
const rowChunkLength = rowChunkOffset;
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
281
|
+
return GaussianSplattingMesh.ConvertPLYToSplatAsync(data).then((buffer) => {
|
282
|
+
const dataView = new DataView(data, headerEndIndex + headerEnd.length);
|
283
|
+
let offset = rowChunkLength * chunkCount + rowVertexLength * vertexCount;
|
284
|
+
// faces
|
285
|
+
const faces = [];
|
286
|
+
if (faceCount) {
|
287
|
+
for (let i = 0; i < faceCount; i++) {
|
288
|
+
const faceVertexCount = dataView.getUint8(offset);
|
289
|
+
if (faceVertexCount != 3) {
|
290
|
+
continue; // only support triangles
|
291
|
+
}
|
292
|
+
offset += 1;
|
293
|
+
for (let j = 0; j < faceVertexCount; j++) {
|
294
|
+
const vertexIndex = dataView.getUint32(offset + (2 - j) * 4, true); // change face winding
|
295
|
+
faces.push(vertexIndex);
|
296
|
+
}
|
297
|
+
offset += 12;
|
291
298
|
}
|
292
|
-
offset += 12;
|
293
299
|
}
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
// count available properties. if all necessary are present then it's a splat. Otherwise, it's a point cloud
|
300
|
-
// if faces are found, then it's a standard mesh
|
301
|
-
let propertyCount = 0;
|
302
|
-
let propertyColorCount = 0;
|
303
|
-
const splatProperties = ["x", "y", "z", "scale_0", "scale_1", "scale_2", "opacity", "rot_0", "rot_1", "rot_2", "rot_3"];
|
304
|
-
const splatColorProperties = ["red", "green", "blue", "f_dc_0", "f_dc_1", "f_dc_2"];
|
305
|
-
for (let propertyIndex = 0; propertyIndex < vertexProperties.length; propertyIndex++) {
|
306
|
-
const property = vertexProperties[propertyIndex];
|
307
|
-
if (splatProperties.includes(property.name)) {
|
308
|
-
propertyCount++;
|
300
|
+
// early exit for chunked/quantized ply
|
301
|
+
if (chunkCount) {
|
302
|
+
return new Promise((resolve) => {
|
303
|
+
resolve({ mode: 0 /* Mode.Splat */, data: buffer, faces: faces, hasVertexColors: false });
|
304
|
+
});
|
309
305
|
}
|
310
|
-
if
|
311
|
-
|
306
|
+
// count available properties. if all necessary are present then it's a splat. Otherwise, it's a point cloud
|
307
|
+
// if faces are found, then it's a standard mesh
|
308
|
+
let propertyCount = 0;
|
309
|
+
let propertyColorCount = 0;
|
310
|
+
const splatProperties = ["x", "y", "z", "scale_0", "scale_1", "scale_2", "opacity", "rot_0", "rot_1", "rot_2", "rot_3"];
|
311
|
+
const splatColorProperties = ["red", "green", "blue", "f_dc_0", "f_dc_1", "f_dc_2"];
|
312
|
+
for (let propertyIndex = 0; propertyIndex < vertexProperties.length; propertyIndex++) {
|
313
|
+
const property = vertexProperties[propertyIndex];
|
314
|
+
if (splatProperties.includes(property.name)) {
|
315
|
+
propertyCount++;
|
316
|
+
}
|
317
|
+
if (splatColorProperties.includes(property.name)) {
|
318
|
+
propertyColorCount++;
|
319
|
+
}
|
312
320
|
}
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
321
|
+
const hasMandatoryProperties = propertyCount == splatProperties.length && propertyColorCount == 3;
|
322
|
+
const currentMode = faceCount ? 2 /* Mode.Mesh */ : hasMandatoryProperties ? 0 /* Mode.Splat */ : 1 /* Mode.PointCloud */;
|
323
|
+
// parsed ready ready to be used as a splat
|
324
|
+
return new Promise((resolve) => {
|
325
|
+
resolve({ mode: currentMode, data: buffer, faces: faces, hasVertexColors: !!propertyColorCount });
|
326
|
+
});
|
327
|
+
});
|
318
328
|
}
|
319
329
|
}
|
320
330
|
SPLATFileLoader._DefaultLoadingOptions = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"splatFileLoader.js","sourceRoot":"","sources":["../../../../dev/loaders/src/SPLAT/splatFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,+CAAiC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,0EAA4D;AAC5F,OAAO,EAAE,cAAc,EAAE,0CAA4B;AAIrD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAC1C,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,iBAAiB,EAAE,uDAAyC;AACrE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,UAAU,EAAE,kDAAoC;AAazD;;GAEG;AACH,IAAW,IAIV;AAJD,WAAW,IAAI;IACX,iCAAS,CAAA;IACT,2CAAc,CAAA;IACd,+BAAQ,CAAA;AACZ,CAAC,EAJU,IAAI,KAAJ,IAAI,QAId;AAYD;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAexB;;;OAGG;IACH,YAAY,iBAAyD,eAAe,CAAC,sBAAsB;QAlB3G;;WAEG;QACa,SAAI,GAAG,uBAAuB,CAAC,IAAI,CAAC;QAE5C,oBAAe,GAA6B,IAAI,CAAC;QAGzD;;;WAGG;QACa,eAAU,GAAG,uBAAuB,CAAC,UAAU,CAAC;QAO5D,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IAC1C,CAAC;IAMD,gBAAgB;IAChB,YAAY,CAAC,OAAiC;QAC1C,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,eAAe,CACxB,WAAgB,EAChB,KAAY,EACZ,IAAS,EACT,OAAe,EACf,UAAuD,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ceneLoaderProgressEvent, SceneLoaderPluginOptions } from \"core/Loading/sceneLoader\";\r\nimport { registerSceneLoaderPlugin } from \"core/Loading/sceneLoader\";\r\nimport { SPLATFileLoaderMetadata } from \"./splatFileLoader.metadata\";\r\nimport { GaussianSplattingMesh } from \"core/Meshes/GaussianSplatting/gaussianSplattingMesh\";\r\nimport { AssetContainer } from \"core/assetContainer\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { PointsCloudSystem } from \"core/Particles/pointsCloudSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { SPLATLoadingOptions } from \"./splatLoadingOptions\";\r\n\r\ndeclare module \"core/Loading/sceneLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface SceneLoaderPluginOptions {\r\n /**\r\n * Defines options for the splat loader.\r\n */\r\n [SPLATFileLoaderMetadata.name]: Partial<SPLATLoadingOptions>;\r\n }\r\n}\r\n\r\n/**\r\n * Indicator of the parsed ply buffer. A standard ready to use splat or an array of positions for a point cloud\r\n */\r\nconst enum Mode {\r\n Splat = 0,\r\n PointCloud = 1,\r\n Mesh = 2,\r\n}\r\n\r\n/**\r\n * A parsed buffer and how to use it\r\n */\r\ninterface ParsedPLY {\r\n data: ArrayBuffer;\r\n mode: Mode;\r\n faces?: number[];\r\n hasVertexColors?: boolean;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * SPLAT file type loader.\r\n * This is a babylon scene loader plugin.\r\n */\r\nexport class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\r\n /**\r\n * Defines the name of the plugin.\r\n */\r\n public readonly name = SPLATFileLoaderMetadata.name;\r\n\r\n private _assetContainer: Nullable<AssetContainer> = null;\r\n\r\n private readonly _loadingOptions: Readonly<SPLATLoadingOptions>;\r\n /**\r\n * Defines the extensions the splat loader is able to load.\r\n * force data to come in as an ArrayBuffer\r\n */\r\n public readonly extensions = SPLATFileLoaderMetadata.extensions;\r\n\r\n /**\r\n * Creates loader for gaussian splatting files\r\n * @param loadingOptions options for loading and parsing splat and PLY files.\r\n */\r\n constructor(loadingOptions: Partial<Readonly<SPLATLoadingOptions>> = SPLATFileLoader._DefaultLoadingOptions) {\r\n this._loadingOptions = loadingOptions;\r\n }\r\n\r\n private static readonly _DefaultLoadingOptions = {\r\n keepInRam: false,\r\n } as const satisfies SPLATLoadingOptions;\r\n\r\n /** @internal */\r\n createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync {\r\n return new SPLATFileLoader(options[SPLATFileLoaderMetadata.name]);\r\n }\r\n\r\n /**\r\n * Imports from the loaded gaussian splatting data and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param data the gaussian splatting data to load\r\n * @param rootUrl root url to load from\r\n * @param onProgress callback called while file is loading\r\n * @param fileName Defines the name of the file to load\r\n * @returns a promise containing the loaded meshes, particles, skeletons and animations\r\n */\r\n public async importMeshAsync(\r\n meshesNames: any,\r\n scene: Scene,\r\n data: any,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n fileName?: string\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return this._parse(meshesNames, scene, data, rootUrl).then((meshes) => {\r\n return {\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: [],\r\n animationGroups: [],\r\n transformNodes: [],\r\n geometries: [],\r\n lights: [],\r\n spriteManagers: [],\r\n };\r\n });\r\n }\r\n\r\n private static _BuildPointCloud(pointcloud: PointsCloudSystem, data: ArrayBuffer): boolean {\r\n if (!data.byteLength) {\r\n return false;\r\n }\r\n const uBuffer = new Uint8Array(data);\r\n const fBuffer = new Float32Array(data);\r\n\r\n // parsed array contains room for position(3floats), normal(3floats), color (4b), quantized quaternion (4b)\r\n const rowLength = 3 * 4 + 3 * 4 + 4 + 4;\r\n const vertexCount = uBuffer.length / rowLength;\r\n\r\n const pointcloudfunc = function (particle: any, i: number) {\r\n const x = fBuffer[8 * i + 0];\r\n const y = fBuffer[8 * i + 1];\r\n const z = fBuffer[8 * i + 2];\r\n particle.position = new Vector3(x, y, z);\r\n\r\n const r = uBuffer[rowLength * i + 24 + 0] / 255;\r\n const g = uBuffer[rowLength * i + 24 + 1] / 255;\r\n const b = uBuffer[rowLength * i + 24 + 2] / 255;\r\n particle.color = new Color4(r, g, b, 1);\r\n };\r\n\r\n pointcloud.addPoints(vertexCount, pointcloudfunc);\r\n return true;\r\n }\r\n\r\n private static _BuildMesh(scene: Scene, parsedPLY: ParsedPLY): Mesh {\r\n const mesh = new Mesh(\"PLYMesh\", scene);\r\n\r\n const uBuffer = new Uint8Array(parsedPLY.data);\r\n const fBuffer = new Float32Array(parsedPLY.data);\r\n\r\n const rowLength = 3 * 4 + 3 * 4 + 4 + 4;\r\n const vertexCount = uBuffer.length / rowLength;\r\n\r\n const positions = [];\r\n\r\n const vertexData = new VertexData();\r\n for (let i = 0; i < vertexCount; i++) {\r\n const x = fBuffer[8 * i + 0];\r\n const y = fBuffer[8 * i + 1];\r\n const z = fBuffer[8 * i + 2];\r\n positions.push(x, y, z);\r\n }\r\n\r\n if (parsedPLY.hasVertexColors) {\r\n const colors = new Float32Array(vertexCount * 4);\r\n for (let i = 0; i < vertexCount; i++) {\r\n const r = uBuffer[rowLength * i + 24 + 0] / 255;\r\n const g = uBuffer[rowLength * i + 24 + 1] / 255;\r\n const b = uBuffer[rowLength * i + 24 + 2] / 255;\r\n colors[i * 4 + 0] = r;\r\n colors[i * 4 + 1] = g;\r\n colors[i * 4 + 2] = b;\r\n colors[i * 4 + 3] = 1;\r\n }\r\n vertexData.colors = colors;\r\n }\r\n\r\n vertexData.positions = positions;\r\n vertexData.indices = parsedPLY.faces!;\r\n\r\n vertexData.applyToMesh(mesh);\r\n return mesh;\r\n }\r\n\r\n private _parse(meshesNames: any, scene: Scene, data: any, rootUrl: string): Promise<Array<AbstractMesh>> {\r\n const babylonMeshesArray: Array<Mesh> = []; //The mesh for babylon\r\n const parsedPLY = SPLATFileLoader._ConvertPLYToSplat(data as ArrayBuffer);\r\n switch (parsedPLY.mode) {\r\n case Mode.Splat:\r\n {\r\n const gaussianSplatting = new GaussianSplattingMesh(\"GaussianSplatting\", null, scene, this._loadingOptions.keepInRam);\r\n gaussianSplatting._parentContainer = this._assetContainer;\r\n babylonMeshesArray.push(gaussianSplatting);\r\n gaussianSplatting.loadDataAsync(parsedPLY.data);\r\n }\r\n break;\r\n case Mode.PointCloud:\r\n {\r\n const pointcloud = new PointsCloudSystem(\"PointCloud\", 1, scene);\r\n if (SPLATFileLoader._BuildPointCloud(pointcloud, parsedPLY.data)) {\r\n return Promise.all([pointcloud.buildMeshAsync()]).then((mesh) => {\r\n babylonMeshesArray.push(mesh[0]);\r\n return babylonMeshesArray;\r\n });\r\n } else {\r\n pointcloud.dispose();\r\n }\r\n }\r\n break;\r\n case Mode.Mesh:\r\n {\r\n if (parsedPLY.faces) {\r\n babylonMeshesArray.push(SPLATFileLoader._BuildMesh(scene, parsedPLY));\r\n } else {\r\n throw new Error(\"PLY mesh doesn't contain face informations.\");\r\n }\r\n }\r\n break;\r\n default:\r\n throw new Error(\"Unsupported Splat mode\");\r\n }\r\n return Promise.resolve(babylonMeshesArray);\r\n }\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @returns The loaded asset container\r\n */\r\n public loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string): Promise<AssetContainer> {\r\n const container = new AssetContainer(scene);\r\n this._assetContainer = container;\r\n\r\n return this.importMeshAsync(null, scene, data, rootUrl)\r\n .then((result) => {\r\n result.meshes.forEach((mesh) => container.meshes.push(mesh));\r\n // mesh material will be null before 1st rendered frame.\r\n this._assetContainer = null;\r\n return container;\r\n })\r\n .catch((ex) => {\r\n this._assetContainer = null;\r\n throw ex;\r\n });\r\n }\r\n\r\n /**\r\n * Imports all objects from the loaded OBJ data and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data the OBJ data to load\r\n * @param rootUrl root url to load from\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n public loadAsync(scene: Scene, data: string, rootUrl: string): Promise<void> {\r\n //Get the 3D model\r\n return this.importMeshAsync(null, scene, data, rootUrl).then(() => {\r\n // return void\r\n });\r\n }\r\n\r\n /**\r\n * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license\r\n * Converts a .ply data array buffer to splat\r\n * if data array buffer is not ply, returns the original buffer\r\n * @param data the .ply data to load\r\n * @returns the loaded splat buffer\r\n */\r\n private static _ConvertPLYToSplat(data: ArrayBuffer): ParsedPLY {\r\n const ubuf = new Uint8Array(data);\r\n const header = new TextDecoder().decode(ubuf.slice(0, 1024 * 10));\r\n const headerEnd = \"end_header\\n\";\r\n const headerEndIndex = header.indexOf(headerEnd);\r\n if (headerEndIndex < 0 || !header) {\r\n // standard splat\r\n return { mode: Mode.Splat, data: data };\r\n }\r\n\r\n const vertexCount = parseInt(/element vertex (\\d+)\\n/.exec(header)![1]);\r\n const faceElement = /element face (\\d+)\\n/.exec(header);\r\n let faceCount = 0;\r\n if (faceElement) {\r\n faceCount = parseInt(faceElement[1]);\r\n }\r\n const chunkElement = /element chunk (\\d+)\\n/.exec(header);\r\n let chunkCount = 0;\r\n if (chunkElement) {\r\n chunkCount = parseInt(chunkElement[1]);\r\n }\r\n\r\n let rowVertexOffset = 0;\r\n let rowChunkOffset = 0;\r\n const offsets: Record<string, number> = {\r\n double: 8,\r\n int: 4,\r\n uint: 4,\r\n float: 4,\r\n short: 2,\r\n ushort: 2,\r\n uchar: 1,\r\n list: 0,\r\n };\r\n\r\n type PlyProperty = {\r\n name: string;\r\n type: string;\r\n offset: number;\r\n };\r\n\r\n const enum ElementMode {\r\n Vertex = 0,\r\n Chunk = 1,\r\n }\r\n\r\n let chunkMode = ElementMode.Chunk;\r\n const vertexProperties: PlyProperty[] = [];\r\n const chunkProperties: PlyProperty[] = [];\r\n const filtered = header.slice(0, headerEndIndex).split(\"\\n\");\r\n for (const prop of filtered) {\r\n if (prop.startsWith(\"property \")) {\r\n const [, type, name] = prop.split(\" \");\r\n\r\n if (chunkMode == ElementMode.Chunk) {\r\n chunkProperties.push({ name, type, offset: rowChunkOffset });\r\n rowChunkOffset += offsets[type];\r\n } else if (chunkMode == ElementMode.Vertex) {\r\n vertexProperties.push({ name, type, offset: rowVertexOffset });\r\n rowVertexOffset += offsets[type];\r\n }\r\n\r\n if (!offsets[type]) {\r\n Logger.Warn(`Unsupported property type: ${type}.`);\r\n }\r\n } else if (prop.startsWith(\"element \")) {\r\n const [, type] = prop.split(\" \");\r\n if (type == \"chunk\") {\r\n chunkMode = ElementMode.Chunk;\r\n } else if (type == \"vertex\") {\r\n chunkMode = ElementMode.Vertex;\r\n }\r\n }\r\n }\r\n\r\n const rowVertexLength = rowVertexOffset;\r\n const rowChunkLength = rowChunkOffset;\r\n\r\n const buffer = GaussianSplattingMesh.ConvertPLYToSplat(data);\r\n const dataView = new DataView(data, headerEndIndex + headerEnd.length);\r\n let offset = rowChunkLength * chunkCount + rowVertexLength * vertexCount;\r\n // faces\r\n const faces = [];\r\n if (faceCount) {\r\n for (let i = 0; i < faceCount; i++) {\r\n const faceVertexCount = dataView.getUint8(offset);\r\n if (faceVertexCount != 3) {\r\n continue; // only support triangles\r\n }\r\n offset += 1;\r\n\r\n for (let j = 0; j < faceVertexCount; j++) {\r\n const vertexIndex = dataView.getUint32(offset + (2 - j) * 4, true); // change face winding\r\n faces.push(vertexIndex);\r\n }\r\n offset += 12;\r\n }\r\n }\r\n\r\n // early exit for chunked/quantized ply\r\n if (chunkCount) {\r\n return { mode: Mode.Splat, data: buffer, faces: faces, hasVertexColors: false };\r\n }\r\n // count available properties. if all necessary are present then it's a splat. Otherwise, it's a point cloud\r\n // if faces are found, then it's a standard mesh\r\n let propertyCount = 0;\r\n let propertyColorCount = 0;\r\n const splatProperties = [\"x\", \"y\", \"z\", \"scale_0\", \"scale_1\", \"scale_2\", \"opacity\", \"rot_0\", \"rot_1\", \"rot_2\", \"rot_3\"];\r\n const splatColorProperties = [\"red\", \"green\", \"blue\", \"f_dc_0\", \"f_dc_1\", \"f_dc_2\"];\r\n for (let propertyIndex = 0; propertyIndex < vertexProperties.length; propertyIndex++) {\r\n const property = vertexProperties[propertyIndex];\r\n if (splatProperties.includes(property.name)) {\r\n propertyCount++;\r\n }\r\n if (splatColorProperties.includes(property.name)) {\r\n propertyColorCount++;\r\n }\r\n }\r\n const hasMandatoryProperties = propertyCount == splatProperties.length && propertyColorCount == 3;\r\n const currentMode = faceCount ? Mode.Mesh : hasMandatoryProperties ? Mode.Splat : Mode.PointCloud;\r\n // parsed ready ready to be used as a splat\r\n return { mode: currentMode, data: buffer, faces: faces, hasVertexColors: !!propertyColorCount };\r\n }\r\n}\r\n\r\n// Add this loader into the register plugin\r\nregisterSceneLoaderPlugin(new SPLATFileLoader());\r\n"]}
|
1
|
+
{"version":3,"file":"splatFileLoader.js","sourceRoot":"","sources":["../../../../dev/loaders/src/SPLAT/splatFileLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,+CAAiC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,0EAA4D;AAC5F,OAAO,EAAE,cAAc,EAAE,0CAA4B;AAIrD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAC1C,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,iBAAiB,EAAE,uDAAyC;AACrE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aderPluginOptions } from \"core/Loading/sceneLoader\";\r\nimport { registerSceneLoaderPlugin } from \"core/Loading/sceneLoader\";\r\nimport { SPLATFileLoaderMetadata } from \"./splatFileLoader.metadata\";\r\nimport { GaussianSplattingMesh } from \"core/Meshes/GaussianSplatting/gaussianSplattingMesh\";\r\nimport { AssetContainer } from \"core/assetContainer\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { PointsCloudSystem } from \"core/Particles/pointsCloudSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { SPLATLoadingOptions } from \"./splatLoadingOptions\";\r\n\r\ndeclare module \"core/Loading/sceneLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n export interface SceneLoaderPluginOptions {\r\n /**\r\n * Defines options for the splat loader.\r\n */\r\n [SPLATFileLoaderMetadata.name]: Partial<SPLATLoadingOptions>;\r\n }\r\n}\r\n\r\n/**\r\n * Indicator of the parsed ply buffer. A standard ready to use splat or an array of positions for a point cloud\r\n */\r\nconst enum Mode {\r\n Splat = 0,\r\n PointCloud = 1,\r\n Mesh = 2,\r\n}\r\n\r\n/**\r\n * A parsed buffer and how to use it\r\n */\r\ninterface ParsedPLY {\r\n data: ArrayBuffer;\r\n mode: Mode;\r\n faces?: number[];\r\n hasVertexColors?: boolean;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * SPLAT file type loader.\r\n * This is a babylon scene loader plugin.\r\n */\r\nexport class SPLATFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\r\n /**\r\n * Defines the name of the plugin.\r\n */\r\n public readonly name = SPLATFileLoaderMetadata.name;\r\n\r\n private _assetContainer: Nullable<AssetContainer> = null;\r\n\r\n private readonly _loadingOptions: Readonly<SPLATLoadingOptions>;\r\n /**\r\n * Defines the extensions the splat loader is able to load.\r\n * force data to come in as an ArrayBuffer\r\n */\r\n public readonly extensions = SPLATFileLoaderMetadata.extensions;\r\n\r\n /**\r\n * Creates loader for gaussian splatting files\r\n * @param loadingOptions options for loading and parsing splat and PLY files.\r\n */\r\n constructor(loadingOptions: Partial<Readonly<SPLATLoadingOptions>> = SPLATFileLoader._DefaultLoadingOptions) {\r\n this._loadingOptions = loadingOptions;\r\n }\r\n\r\n private static readonly _DefaultLoadingOptions = {\r\n keepInRam: false,\r\n } as const satisfies SPLATLoadingOptions;\r\n\r\n /** @internal */\r\n createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync {\r\n return new SPLATFileLoader(options[SPLATFileLoaderMetadata.name]);\r\n }\r\n\r\n /**\r\n * Imports from the loaded gaussian splatting data and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param data the gaussian splatting data to load\r\n * @param rootUrl root url to load from\r\n * @param onProgress callback called while file is loading\r\n * @param fileName Defines the name of the file to load\r\n * @returns a promise containing the loaded meshes, particles, skeletons and animations\r\n */\r\n public async importMeshAsync(\r\n meshesNames: any,\r\n scene: Scene,\r\n data: any,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n fileName?: string\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return this._parse(meshesNames, scene, data, rootUrl).then((meshes) => {\r\n return {\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: [],\r\n animationGroups: [],\r\n transformNodes: [],\r\n geometries: [],\r\n lights: [],\r\n spriteManagers: [],\r\n };\r\n });\r\n }\r\n\r\n private static _BuildPointCloud(pointcloud: PointsCloudSystem, data: ArrayBuffer): boolean {\r\n if (!data.byteLength) {\r\n return false;\r\n }\r\n const uBuffer = new Uint8Array(data);\r\n const fBuffer = new Float32Array(data);\r\n\r\n // parsed array contains room for position(3floats), normal(3floats), color (4b), quantized quaternion (4b)\r\n const rowLength = 3 * 4 + 3 * 4 + 4 + 4;\r\n const vertexCount = uBuffer.length / rowLength;\r\n\r\n const pointcloudfunc = function (particle: any, i: number) {\r\n const x = fBuffer[8 * i + 0];\r\n const y = fBuffer[8 * i + 1];\r\n const z = fBuffer[8 * i + 2];\r\n particle.position = new Vector3(x, y, z);\r\n\r\n const r = uBuffer[rowLength * i + 24 + 0] / 255;\r\n const g = uBuffer[rowLength * i + 24 + 1] / 255;\r\n const b = uBuffer[rowLength * i + 24 + 2] / 255;\r\n particle.color = new Color4(r, g, b, 1);\r\n };\r\n\r\n pointcloud.addPoints(vertexCount, pointcloudfunc);\r\n return true;\r\n }\r\n\r\n private static _BuildMesh(scene: Scene, parsedPLY: ParsedPLY): Mesh {\r\n const mesh = new Mesh(\"PLYMesh\", scene);\r\n\r\n const uBuffer = new Uint8Array(parsedPLY.data);\r\n const fBuffer = new Float32Array(parsedPLY.data);\r\n\r\n const rowLength = 3 * 4 + 3 * 4 + 4 + 4;\r\n const vertexCount = uBuffer.length / rowLength;\r\n\r\n const positions = [];\r\n\r\n const vertexData = new VertexData();\r\n for (let i = 0; i < vertexCount; i++) {\r\n const x = fBuffer[8 * i + 0];\r\n const y = fBuffer[8 * i + 1];\r\n const z = fBuffer[8 * i + 2];\r\n positions.push(x, y, z);\r\n }\r\n\r\n if (parsedPLY.hasVertexColors) {\r\n const colors = new Float32Array(vertexCount * 4);\r\n for (let i = 0; i < vertexCount; i++) {\r\n const r = uBuffer[rowLength * i + 24 + 0] / 255;\r\n const g = uBuffer[rowLength * i + 24 + 1] / 255;\r\n const b = uBuffer[rowLength * i + 24 + 2] / 255;\r\n colors[i * 4 + 0] = r;\r\n colors[i * 4 + 1] = g;\r\n colors[i * 4 + 2] = b;\r\n colors[i * 4 + 3] = 1;\r\n }\r\n vertexData.colors = colors;\r\n }\r\n\r\n vertexData.positions = positions;\r\n vertexData.indices = parsedPLY.faces!;\r\n\r\n vertexData.applyToMesh(mesh);\r\n return mesh;\r\n }\r\n\r\n private _parse(meshesNames: any, scene: Scene, data: any, rootUrl: string): Promise<Array<AbstractMesh>> {\r\n return SPLATFileLoader._ConvertPLYToSplat(data as ArrayBuffer).then(async (parsedPLY) => {\r\n const babylonMeshesArray: Array<Mesh> = []; //The mesh for babylon\r\n switch (parsedPLY.mode) {\r\n case Mode.Splat:\r\n {\r\n const gaussianSplatting = new GaussianSplattingMesh(\"GaussianSplatting\", null, scene, this._loadingOptions.keepInRam);\r\n gaussianSplatting._parentContainer = this._assetContainer;\r\n babylonMeshesArray.push(gaussianSplatting);\r\n await gaussianSplatting.updateDataAsync(parsedPLY.data);\r\n }\r\n break;\r\n case Mode.PointCloud:\r\n {\r\n const pointcloud = new PointsCloudSystem(\"PointCloud\", 1, scene);\r\n if (SPLATFileLoader._BuildPointCloud(pointcloud, parsedPLY.data)) {\r\n return Promise.all([pointcloud.buildMeshAsync()]).then((mesh) => {\r\n babylonMeshesArray.push(mesh[0]);\r\n return babylonMeshesArray;\r\n });\r\n } else {\r\n pointcloud.dispose();\r\n }\r\n }\r\n break;\r\n case Mode.Mesh:\r\n {\r\n if (parsedPLY.faces) {\r\n babylonMeshesArray.push(SPLATFileLoader._BuildMesh(scene, parsedPLY));\r\n } else {\r\n throw new Error(\"PLY mesh doesn't contain face informations.\");\r\n }\r\n }\r\n break;\r\n default:\r\n throw new Error(\"Unsupported Splat mode\");\r\n }\r\n return new Promise((resolve) => {\r\n resolve(babylonMeshesArray);\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @returns The loaded asset container\r\n */\r\n public loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string): Promise<AssetContainer> {\r\n const container = new AssetContainer(scene);\r\n this._assetContainer = container;\r\n\r\n return this.importMeshAsync(null, scene, data, rootUrl)\r\n .then((result) => {\r\n result.meshes.forEach((mesh) => container.meshes.push(mesh));\r\n // mesh material will be null before 1st rendered frame.\r\n this._assetContainer = null;\r\n return container;\r\n })\r\n .catch((ex) => {\r\n this._assetContainer = null;\r\n throw ex;\r\n });\r\n }\r\n\r\n /**\r\n * Imports all objects from the loaded OBJ data and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data the OBJ data to load\r\n * @param rootUrl root url to load from\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n public loadAsync(scene: Scene, data: string, rootUrl: string): Promise<void> {\r\n //Get the 3D model\r\n return this.importMeshAsync(null, scene, data, rootUrl).then(() => {\r\n // return void\r\n });\r\n }\r\n\r\n /**\r\n * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license\r\n * Converts a .ply data array buffer to splat\r\n * if data array buffer is not ply, returns the original buffer\r\n * @param data the .ply data to load\r\n * @returns the loaded splat buffer\r\n */\r\n private static _ConvertPLYToSplat(data: ArrayBuffer): Promise<ParsedPLY> {\r\n const ubuf = new Uint8Array(data);\r\n const header = new TextDecoder().decode(ubuf.slice(0, 1024 * 10));\r\n const headerEnd = \"end_header\\n\";\r\n const headerEndIndex = header.indexOf(headerEnd);\r\n if (headerEndIndex < 0 || !header) {\r\n // standard splat\r\n return new Promise((resolve) => {\r\n resolve({ mode: Mode.Splat, data: data });\r\n });\r\n }\r\n\r\n const vertexCount = parseInt(/element vertex (\\d+)\\n/.exec(header)![1]);\r\n const faceElement = /element face (\\d+)\\n/.exec(header);\r\n let faceCount = 0;\r\n if (faceElement) {\r\n faceCount = parseInt(faceElement[1]);\r\n }\r\n const chunkElement = /element chunk (\\d+)\\n/.exec(header);\r\n let chunkCount = 0;\r\n if (chunkElement) {\r\n chunkCount = parseInt(chunkElement[1]);\r\n }\r\n\r\n let rowVertexOffset = 0;\r\n let rowChunkOffset = 0;\r\n const offsets: Record<string, number> = {\r\n double: 8,\r\n int: 4,\r\n uint: 4,\r\n float: 4,\r\n short: 2,\r\n ushort: 2,\r\n uchar: 1,\r\n list: 0,\r\n };\r\n\r\n type PlyProperty = {\r\n name: string;\r\n type: string;\r\n offset: number;\r\n };\r\n\r\n const enum ElementMode {\r\n Vertex = 0,\r\n Chunk = 1,\r\n }\r\n\r\n let chunkMode = ElementMode.Chunk;\r\n const vertexProperties: PlyProperty[] = [];\r\n const chunkProperties: PlyProperty[] = [];\r\n const filtered = header.slice(0, headerEndIndex).split(\"\\n\");\r\n for (const prop of filtered) {\r\n if (prop.startsWith(\"property \")) {\r\n const [, type, name] = prop.split(\" \");\r\n\r\n if (chunkMode == ElementMode.Chunk) {\r\n chunkProperties.push({ name, type, offset: rowChunkOffset });\r\n rowChunkOffset += offsets[type];\r\n } else if (chunkMode == ElementMode.Vertex) {\r\n vertexProperties.push({ name, type, offset: rowVertexOffset });\r\n rowVertexOffset += offsets[type];\r\n }\r\n\r\n if (!offsets[type]) {\r\n Logger.Warn(`Unsupported property type: ${type}.`);\r\n }\r\n } else if (prop.startsWith(\"element \")) {\r\n const [, type] = prop.split(\" \");\r\n if (type == \"chunk\") {\r\n chunkMode = ElementMode.Chunk;\r\n } else if (type == \"vertex\") {\r\n chunkMode = ElementMode.Vertex;\r\n }\r\n }\r\n }\r\n\r\n const rowVertexLength = rowVertexOffset;\r\n const rowChunkLength = rowChunkOffset;\r\n\r\n return GaussianSplattingMesh.ConvertPLYToSplatAsync(data).then((buffer) => {\r\n const dataView = new DataView(data, headerEndIndex + headerEnd.length);\r\n let offset = rowChunkLength * chunkCount + rowVertexLength * vertexCount;\r\n // faces\r\n const faces: number[] = [];\r\n if (faceCount) {\r\n for (let i = 0; i < faceCount; i++) {\r\n const faceVertexCount = dataView.getUint8(offset);\r\n if (faceVertexCount != 3) {\r\n continue; // only support triangles\r\n }\r\n offset += 1;\r\n\r\n for (let j = 0; j < faceVertexCount; j++) {\r\n const vertexIndex = dataView.getUint32(offset + (2 - j) * 4, true); // change face winding\r\n faces.push(vertexIndex);\r\n }\r\n offset += 12;\r\n }\r\n }\r\n\r\n // early exit for chunked/quantized ply\r\n if (chunkCount) {\r\n return new Promise((resolve) => {\r\n resolve({ mode: Mode.Splat, data: buffer, faces: faces, hasVertexColors: false });\r\n });\r\n }\r\n // count available properties. if all necessary are present then it's a splat. Otherwise, it's a point cloud\r\n // if faces are found, then it's a standard mesh\r\n let propertyCount = 0;\r\n let propertyColorCount = 0;\r\n const splatProperties = [\"x\", \"y\", \"z\", \"scale_0\", \"scale_1\", \"scale_2\", \"opacity\", \"rot_0\", \"rot_1\", \"rot_2\", \"rot_3\"];\r\n const splatColorProperties = [\"red\", \"green\", \"blue\", \"f_dc_0\", \"f_dc_1\", \"f_dc_2\"];\r\n for (let propertyIndex = 0; propertyIndex < vertexProperties.length; propertyIndex++) {\r\n const property = vertexProperties[propertyIndex];\r\n if (splatProperties.includes(property.name)) {\r\n propertyCount++;\r\n }\r\n if (splatColorProperties.includes(property.name)) {\r\n propertyColorCount++;\r\n }\r\n }\r\n const hasMandatoryProperties = propertyCount == splatProperties.length && propertyColorCount == 3;\r\n const currentMode = faceCount ? Mode.Mesh : hasMandatoryProperties ? Mode.Splat : Mode.PointCloud;\r\n // parsed ready ready to be used as a splat\r\n return new Promise((resolve) => {\r\n resolve({ mode: currentMode, data: buffer, faces: faces, hasVertexColors: !!propertyColorCount });\r\n });\r\n });\r\n }\r\n}\r\n\r\n// Add this loader into the register plugin\r\nregisterSceneLoaderPlugin(new SPLATFileLoader());\r\n"]}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import type { GLTFLoader } from "../glTFLoader";
|
2
|
+
import type { IGLTFLoaderExtension } from "../glTFLoaderExtension";
|
3
|
+
declare module "../../glTFFileLoader" {
|
4
|
+
interface GLTFLoaderExtensionOptions {
|
5
|
+
/**
|
6
|
+
* Defines options for the KHR_node_visibility extension.
|
7
|
+
*/
|
8
|
+
["KHR_node_visibility"]: {};
|
9
|
+
}
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* Loader extension for KHR_node_visibility
|
13
|
+
*/
|
14
|
+
export declare class KHR_node_visibility implements IGLTFLoaderExtension {
|
15
|
+
/**
|
16
|
+
* The name of this extension.
|
17
|
+
*/
|
18
|
+
readonly name = "KHR_node_visibility";
|
19
|
+
/**
|
20
|
+
* Defines whether this extension is enabled.
|
21
|
+
*/
|
22
|
+
enabled: boolean;
|
23
|
+
private _loader;
|
24
|
+
/**
|
25
|
+
* @internal
|
26
|
+
*/
|
27
|
+
constructor(loader: GLTFLoader);
|
28
|
+
onReady(): Promise<void>;
|
29
|
+
dispose(): void;
|
30
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
2
|
+
const NAME = "KHR_node_visibility";
|
3
|
+
/**
|
4
|
+
* Loader extension for KHR_node_visibility
|
5
|
+
*/
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
7
|
+
export class KHR_node_visibility {
|
8
|
+
/**
|
9
|
+
* @internal
|
10
|
+
*/
|
11
|
+
constructor(loader) {
|
12
|
+
/**
|
13
|
+
* The name of this extension.
|
14
|
+
*/
|
15
|
+
this.name = NAME;
|
16
|
+
this._loader = loader;
|
17
|
+
this.enabled = loader.isExtensionUsed(NAME);
|
18
|
+
}
|
19
|
+
async onReady() {
|
20
|
+
this._loader.gltf.nodes?.forEach((node) => {
|
21
|
+
node._primitiveBabylonMeshes?.forEach((mesh) => {
|
22
|
+
mesh.inheritVisibility = true;
|
23
|
+
});
|
24
|
+
// When the JSON Pointer is used we need to change both the transform node and the primitive meshes to the new value.
|
25
|
+
if (node.extensions?.KHR_node_visibility) {
|
26
|
+
if (node.extensions?.KHR_node_visibility.visible === false) {
|
27
|
+
if (node._babylonTransformNode) {
|
28
|
+
node._babylonTransformNode.isVisible = false;
|
29
|
+
}
|
30
|
+
node._primitiveBabylonMeshes?.forEach((mesh) => {
|
31
|
+
mesh.isVisible = false;
|
32
|
+
});
|
33
|
+
}
|
34
|
+
}
|
35
|
+
});
|
36
|
+
}
|
37
|
+
dispose() {
|
38
|
+
this._loader = null;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
unregisterGLTFExtension(NAME);
|
42
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_node_visibility(loader));
|
43
|
+
//# sourceMappingURL=KHR_node_visibility.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"KHR_node_visibility.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_node_visibility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,qBAAqB,CAAC;AAanC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,mBAAmB;IAY5B;;OAEG;IACH,YAAY,MAAkB;QAd9B;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAYxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,OAAO;QAChB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACtC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC3C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;YAClC,CAAC,CAAC,CAAC;YACH,qHAAqH;YACrH,IAAI,IAAI,CAAC,UAAU,EAAE,mBAAmB,EAAE;gBACtC,IAAI,IAAI,CAAC,UAAU,EAAE,mBAAmB,CAAC,OAAO,KAAK,KAAK,EAAE;oBACxD,IAAI,IAAI,CAAC,qBAAqB,EAAE;wBAC3B,IAAI,CAAC,qBAAsC,CAAC,SAAS,GAAG,KAAK,CAAC;qBAClE;oBACD,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;wBAC3C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;oBAC3B,CAAC,CAAC,CAAC;iBACN;aACJ;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;CACJ;AAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import type { AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport type { GLTFLoader } from \"../glTFLoader\";\nimport type { IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\n\nconst NAME = \"KHR_node_visibility\";\n\ndeclare module \"../../glTFFileLoader\" {\n // eslint-disable-next-line jsdoc/require-jsdoc\n export interface GLTFLoaderExtensionOptions {\n /**\n * Defines options for the KHR_node_visibility extension.\n */\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\n [\"KHR_node_visibility\"]: {};\n }\n}\n\n/**\n * Loader extension for KHR_node_visibility\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_node_visibility implements IGLTFLoaderExtension {\n /**\n * The name of this extension.\n */\n public readonly name = NAME;\n /**\n * Defines whether this extension is enabled.\n */\n public enabled: boolean;\n\n private _loader: GLTFLoader;\n\n /**\n * @internal\n */\n constructor(loader: GLTFLoader) {\n this._loader = loader;\n this.enabled = loader.isExtensionUsed(NAME);\n }\n\n public async onReady(): Promise<void> {\n this._loader.gltf.nodes?.forEach((node) => {\n node._primitiveBabylonMeshes?.forEach((mesh) => {\n mesh.inheritVisibility = true;\n });\n // When the JSON Pointer is used we need to change both the transform node and the primitive meshes to the new value.\n if (node.extensions?.KHR_node_visibility) {\n if (node.extensions?.KHR_node_visibility.visible === false) {\n if (node._babylonTransformNode) {\n (node._babylonTransformNode as AbstractMesh).isVisible = false;\n }\n node._primitiveBabylonMeshes?.forEach((mesh) => {\n mesh.isVisible = false;\n });\n }\n }\n });\n }\n\n public dispose() {\n (this._loader as any) = null;\n }\n}\n\nunregisterGLTFExtension(NAME);\nregisterGLTFExtension(NAME, true, (loader) => new KHR_node_visibility(loader));\n"]}
|
@@ -132,5 +132,9 @@ export function registerBuiltInGLTFExtensions() {
|
|
132
132
|
const { MSFT_sRGBFactors } = await import("./MSFT_sRGBFactors.js");
|
133
133
|
return new MSFT_sRGBFactors(loader);
|
134
134
|
});
|
135
|
+
registerGLTFExtension("KHR_node_visibility", true, async (loader) => {
|
136
|
+
const { KHR_node_visibility } = await import("./KHR_node_visibility.js");
|
137
|
+
return new KHR_node_visibility(loader);
|
138
|
+
});
|
135
139
|
}
|
136
140
|
//# sourceMappingURL=dynamic.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dynamic.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/dynamic.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE;;GAEG;AACH,MAAM,UAAU,6BAA6B;IACzC,qBAAqB,CAAC,wBAAwB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACnE,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;QAC5E,OAAO,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,yBAAyB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACpE,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;QAC9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,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;QACpE,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QAChD,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC/D,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;QACpE,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC7D,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAChE,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\nimport { registerGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\n/**\r\n * Registers the built-in glTF 2.0 extension async factories, which dynamically imports and loads each glTF extension on demand (e.g. only when a glTF model uses the extension).\r\n */\r\nexport function registerBuiltInGLTFExtensions() {\r\n registerGLTFExtension(\"EXT_lights_image_based\", true, async (loader) => {\r\n const { EXT_lights_image_based } = await import(\"./EXT_lights_image_based\");\r\n return new EXT_lights_image_based(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_mesh_gpu_instancing\", true, async (loader) => {\r\n const { EXT_mesh_gpu_instancing } = await import(\"./EXT_mesh_gpu_instancing\");\r\n return new EXT_mesh_gpu_instancing(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_meshopt_compression\", true, async (loader) => {\r\n const { EXT_meshopt_compression } = await import(\"./EXT_meshopt_compression\");\r\n return new EXT_meshopt_compression(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_texture_avif\", true, async (loader) => {\r\n const { EXT_texture_avif } = await import(\"./EXT_texture_avif\");\r\n return new EXT_texture_avif(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_texture_webp\", true, async (loader) => {\r\n const { EXT_texture_webp } = await import(\"./EXT_texture_webp\");\r\n return new EXT_texture_webp(loader);\r\n });\r\n\r\n registerGLTFExtension(\"ExtrasAsMetadata\", false, async (loader) => {\r\n const { ExtrasAsMetadata } = await import(\"./ExtrasAsMetadata\");\r\n return new ExtrasAsMetadata(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_animation_pointer\", true, async (loader) => {\r\n const { KHR_animation_pointer } = await import(\"./KHR_animation_pointer\");\r\n return new KHR_animation_pointer(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_draco_mesh_compression\", true, async (loader) => {\r\n const { KHR_draco_mesh_compression } = await import(\"./KHR_draco_mesh_compression\");\r\n return new KHR_draco_mesh_compression(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_interactivity\", true, async (loader) => {\r\n const { KHR_interactivity } = await import(\"./KHR_interactivity\");\r\n return new KHR_interactivity(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_lights_punctual\", true, async (loader) => {\r\n const { KHR_lights } = await import(\"./KHR_lights_punctual\");\r\n return new KHR_lights(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_anisotropy\", true, async (loader) => {\r\n const { KHR_materials_anisotropy } = await import(\"./KHR_materials_anisotropy\");\r\n return new KHR_materials_anisotropy(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_clearcoat\", true, async (loader) => {\r\n const { KHR_materials_clearcoat } = await import(\"./KHR_materials_clearcoat\");\r\n return new KHR_materials_clearcoat(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_diffuse_transmission\", true, async (loader) => {\r\n const { KHR_materials_diffuse_transmission } = await import(\"./KHR_materials_diffuse_transmission\");\r\n return new KHR_materials_diffuse_transmission(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_dispersion\", true, async (loader) => {\r\n const { KHR_materials_dispersion } = await import(\"./KHR_materials_dispersion\");\r\n return new KHR_materials_dispersion(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_emissive_strength\", true, async (loader) => {\r\n const { KHR_materials_emissive_strength } = await import(\"./KHR_materials_emissive_strength\");\r\n return new KHR_materials_emissive_strength(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_ior\", true, async (loader) => {\r\n const { KHR_materials_ior } = await import(\"./KHR_materials_ior\");\r\n return new KHR_materials_ior(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_iridescence\", true, async (loader) => {\r\n const { KHR_materials_iridescence } = await import(\"./KHR_materials_iridescence\");\r\n return new KHR_materials_iridescence(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_pbrSpecularGlossiness\", true, async (loader) => {\r\n const { KHR_materials_pbrSpecularGlossiness } = await import(\"./KHR_materials_pbrSpecularGlossiness\");\r\n return new KHR_materials_pbrSpecularGlossiness(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_sheen\", true, async (loader) => {\r\n const { KHR_materials_sheen } = await import(\"./KHR_materials_sheen\");\r\n return new KHR_materials_sheen(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_specular\", true, async (loader) => {\r\n const { KHR_materials_specular } = await import(\"./KHR_materials_specular\");\r\n return new KHR_materials_specular(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_transmission\", true, async (loader) => {\r\n const { KHR_materials_transmission } = await import(\"./KHR_materials_transmission\");\r\n return new KHR_materials_transmission(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_unlit\", true, async (loader) => {\r\n const { KHR_materials_unlit } = await import(\"./KHR_materials_unlit\");\r\n return new KHR_materials_unlit(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_variants\", true, async (loader) => {\r\n const { KHR_materials_variants } = await import(\"./KHR_materials_variants\");\r\n return new KHR_materials_variants(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_volume\", true, async (loader) => {\r\n const { KHR_materials_volume } = await import(\"./KHR_materials_volume\");\r\n return new KHR_materials_volume(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_mesh_quantization\", true, async (loader) => {\r\n const { KHR_mesh_quantization } = await import(\"./KHR_mesh_quantization\");\r\n return new KHR_mesh_quantization(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_texture_basisu\", true, async (loader) => {\r\n const { KHR_texture_basisu } = await import(\"./KHR_texture_basisu\");\r\n return new KHR_texture_basisu(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_texture_transform\", true, async (loader) => {\r\n const { KHR_texture_transform } = await import(\"./KHR_texture_transform\");\r\n return new KHR_texture_transform(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_xmp_json_ld\", true, async (loader) => {\r\n const { KHR_xmp_json_ld } = await import(\"./KHR_xmp_json_ld\");\r\n return new KHR_xmp_json_ld(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_audio_emitter\", true, async (loader) => {\r\n const { MSFT_audio_emitter } = await import(\"./MSFT_audio_emitter\");\r\n return new MSFT_audio_emitter(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_lod\", true, async (loader) => {\r\n const { MSFT_lod } = await import(\"./MSFT_lod\");\r\n return new MSFT_lod(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_minecraftMesh\", true, async (loader) => {\r\n const { MSFT_minecraftMesh } = await import(\"./MSFT_minecraftMesh\");\r\n return new MSFT_minecraftMesh(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_sRGBFactors\", true, async (loader) => {\r\n const { MSFT_sRGBFactors } = await import(\"./MSFT_sRGBFactors\");\r\n return new MSFT_sRGBFactors(loader);\r\n });\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"dynamic.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/dynamic.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE;;GAEG;AACH,MAAM,UAAU,6BAA6B;IACzC,qBAAqB,CAAC,wBAAwB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACnE,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;QAC5E,OAAO,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,yBAAyB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACpE,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;QAC9E,OAAO,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,yBAAyB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACpE,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;QAC9E,OAAO,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC7D,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAChE,OAAO,I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sBAAsB,CAAC,CAAC;QACpE,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC7D,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAChE,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,qBAAqB,CAAC,qBAAqB,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAChE,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACtE,OAAO,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\nimport { registerGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\n/**\r\n * Registers the built-in glTF 2.0 extension async factories, which dynamically imports and loads each glTF extension on demand (e.g. only when a glTF model uses the extension).\r\n */\r\nexport function registerBuiltInGLTFExtensions() {\r\n registerGLTFExtension(\"EXT_lights_image_based\", true, async (loader) => {\r\n const { EXT_lights_image_based } = await import(\"./EXT_lights_image_based\");\r\n return new EXT_lights_image_based(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_mesh_gpu_instancing\", true, async (loader) => {\r\n const { EXT_mesh_gpu_instancing } = await import(\"./EXT_mesh_gpu_instancing\");\r\n return new EXT_mesh_gpu_instancing(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_meshopt_compression\", true, async (loader) => {\r\n const { EXT_meshopt_compression } = await import(\"./EXT_meshopt_compression\");\r\n return new EXT_meshopt_compression(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_texture_avif\", true, async (loader) => {\r\n const { EXT_texture_avif } = await import(\"./EXT_texture_avif\");\r\n return new EXT_texture_avif(loader);\r\n });\r\n\r\n registerGLTFExtension(\"EXT_texture_webp\", true, async (loader) => {\r\n const { EXT_texture_webp } = await import(\"./EXT_texture_webp\");\r\n return new EXT_texture_webp(loader);\r\n });\r\n\r\n registerGLTFExtension(\"ExtrasAsMetadata\", false, async (loader) => {\r\n const { ExtrasAsMetadata } = await import(\"./ExtrasAsMetadata\");\r\n return new ExtrasAsMetadata(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_animation_pointer\", true, async (loader) => {\r\n const { KHR_animation_pointer } = await import(\"./KHR_animation_pointer\");\r\n return new KHR_animation_pointer(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_draco_mesh_compression\", true, async (loader) => {\r\n const { KHR_draco_mesh_compression } = await import(\"./KHR_draco_mesh_compression\");\r\n return new KHR_draco_mesh_compression(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_interactivity\", true, async (loader) => {\r\n const { KHR_interactivity } = await import(\"./KHR_interactivity\");\r\n return new KHR_interactivity(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_lights_punctual\", true, async (loader) => {\r\n const { KHR_lights } = await import(\"./KHR_lights_punctual\");\r\n return new KHR_lights(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_anisotropy\", true, async (loader) => {\r\n const { KHR_materials_anisotropy } = await import(\"./KHR_materials_anisotropy\");\r\n return new KHR_materials_anisotropy(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_clearcoat\", true, async (loader) => {\r\n const { KHR_materials_clearcoat } = await import(\"./KHR_materials_clearcoat\");\r\n return new KHR_materials_clearcoat(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_diffuse_transmission\", true, async (loader) => {\r\n const { KHR_materials_diffuse_transmission } = await import(\"./KHR_materials_diffuse_transmission\");\r\n return new KHR_materials_diffuse_transmission(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_dispersion\", true, async (loader) => {\r\n const { KHR_materials_dispersion } = await import(\"./KHR_materials_dispersion\");\r\n return new KHR_materials_dispersion(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_emissive_strength\", true, async (loader) => {\r\n const { KHR_materials_emissive_strength } = await import(\"./KHR_materials_emissive_strength\");\r\n return new KHR_materials_emissive_strength(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_ior\", true, async (loader) => {\r\n const { KHR_materials_ior } = await import(\"./KHR_materials_ior\");\r\n return new KHR_materials_ior(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_iridescence\", true, async (loader) => {\r\n const { KHR_materials_iridescence } = await import(\"./KHR_materials_iridescence\");\r\n return new KHR_materials_iridescence(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_pbrSpecularGlossiness\", true, async (loader) => {\r\n const { KHR_materials_pbrSpecularGlossiness } = await import(\"./KHR_materials_pbrSpecularGlossiness\");\r\n return new KHR_materials_pbrSpecularGlossiness(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_sheen\", true, async (loader) => {\r\n const { KHR_materials_sheen } = await import(\"./KHR_materials_sheen\");\r\n return new KHR_materials_sheen(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_specular\", true, async (loader) => {\r\n const { KHR_materials_specular } = await import(\"./KHR_materials_specular\");\r\n return new KHR_materials_specular(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_transmission\", true, async (loader) => {\r\n const { KHR_materials_transmission } = await import(\"./KHR_materials_transmission\");\r\n return new KHR_materials_transmission(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_unlit\", true, async (loader) => {\r\n const { KHR_materials_unlit } = await import(\"./KHR_materials_unlit\");\r\n return new KHR_materials_unlit(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_variants\", true, async (loader) => {\r\n const { KHR_materials_variants } = await import(\"./KHR_materials_variants\");\r\n return new KHR_materials_variants(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_materials_volume\", true, async (loader) => {\r\n const { KHR_materials_volume } = await import(\"./KHR_materials_volume\");\r\n return new KHR_materials_volume(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_mesh_quantization\", true, async (loader) => {\r\n const { KHR_mesh_quantization } = await import(\"./KHR_mesh_quantization\");\r\n return new KHR_mesh_quantization(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_texture_basisu\", true, async (loader) => {\r\n const { KHR_texture_basisu } = await import(\"./KHR_texture_basisu\");\r\n return new KHR_texture_basisu(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_texture_transform\", true, async (loader) => {\r\n const { KHR_texture_transform } = await import(\"./KHR_texture_transform\");\r\n return new KHR_texture_transform(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_xmp_json_ld\", true, async (loader) => {\r\n const { KHR_xmp_json_ld } = await import(\"./KHR_xmp_json_ld\");\r\n return new KHR_xmp_json_ld(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_audio_emitter\", true, async (loader) => {\r\n const { MSFT_audio_emitter } = await import(\"./MSFT_audio_emitter\");\r\n return new MSFT_audio_emitter(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_lod\", true, async (loader) => {\r\n const { MSFT_lod } = await import(\"./MSFT_lod\");\r\n return new MSFT_lod(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_minecraftMesh\", true, async (loader) => {\r\n const { MSFT_minecraftMesh } = await import(\"./MSFT_minecraftMesh\");\r\n return new MSFT_minecraftMesh(loader);\r\n });\r\n\r\n registerGLTFExtension(\"MSFT_sRGBFactors\", true, async (loader) => {\r\n const { MSFT_sRGBFactors } = await import(\"./MSFT_sRGBFactors\");\r\n return new MSFT_sRGBFactors(loader);\r\n });\r\n\r\n registerGLTFExtension(\"KHR_node_visibility\", true, async (loader) => {\r\n const { KHR_node_visibility } = await import(\"./KHR_node_visibility\");\r\n return new KHR_node_visibility(loader);\r\n });\r\n}\r\n"]}
|
@@ -29,5 +29,6 @@ export * from "./MSFT_lod.js";
|
|
29
29
|
export * from "./MSFT_minecraftMesh.js";
|
30
30
|
export * from "./MSFT_sRGBFactors.js";
|
31
31
|
export * from "./KHR_interactivity.js";
|
32
|
+
export * from "./KHR_node_visibility.js";
|
32
33
|
export * from "./ExtrasAsMetadata.js";
|
33
34
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./EXT_lights_image_based\";\r\nexport * from \"./EXT_mesh_gpu_instancing\";\r\nexport * from \"./EXT_meshopt_compression\";\r\nexport * from \"./EXT_texture_webp\";\r\nexport * from \"./EXT_texture_avif\";\r\nexport * from \"./KHR_draco_mesh_compression\";\r\nexport * from \"./KHR_lights_punctual\";\r\nexport * from \"./KHR_materials_pbrSpecularGlossiness\";\r\nexport * from \"./KHR_materials_unlit\";\r\nexport * from \"./KHR_materials_clearcoat\";\r\nexport * from \"./KHR_materials_iridescence\";\r\nexport * from \"./KHR_materials_anisotropy\";\r\nexport * from \"./KHR_materials_emissive_strength\";\r\nexport * from \"./KHR_materials_sheen\";\r\nexport * from \"./KHR_materials_specular\";\r\nexport * from \"./KHR_materials_ior\";\r\nexport * from \"./KHR_materials_variants\";\r\nexport * from \"./KHR_materials_transmission\";\r\nexport * from \"./KHR_materials_diffuse_transmission\";\r\nexport * from \"./KHR_materials_volume\";\r\nexport * from \"./KHR_materials_dispersion\";\r\nexport * from \"./KHR_mesh_quantization\";\r\nexport * from \"./KHR_texture_basisu\";\r\nexport * from \"./KHR_texture_transform\";\r\nexport * from \"./KHR_xmp_json_ld\";\r\nexport * from \"./KHR_animation_pointer\";\r\nexport * from \"./MSFT_audio_emitter\";\r\nexport * from \"./MSFT_lod\";\r\nexport * from \"./MSFT_minecraftMesh\";\r\nexport * from \"./MSFT_sRGBFactors\";\r\nexport * from \"./KHR_interactivity\";\r\nexport * from \"./ExtrasAsMetadata\";\r\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./EXT_lights_image_based\";\r\nexport * from \"./EXT_mesh_gpu_instancing\";\r\nexport * from \"./EXT_meshopt_compression\";\r\nexport * from \"./EXT_texture_webp\";\r\nexport * from \"./EXT_texture_avif\";\r\nexport * from \"./KHR_draco_mesh_compression\";\r\nexport * from \"./KHR_lights_punctual\";\r\nexport * from \"./KHR_materials_pbrSpecularGlossiness\";\r\nexport * from \"./KHR_materials_unlit\";\r\nexport * from \"./KHR_materials_clearcoat\";\r\nexport * from \"./KHR_materials_iridescence\";\r\nexport * from \"./KHR_materials_anisotropy\";\r\nexport * from \"./KHR_materials_emissive_strength\";\r\nexport * from \"./KHR_materials_sheen\";\r\nexport * from \"./KHR_materials_specular\";\r\nexport * from \"./KHR_materials_ior\";\r\nexport * from \"./KHR_materials_variants\";\r\nexport * from \"./KHR_materials_transmission\";\r\nexport * from \"./KHR_materials_diffuse_transmission\";\r\nexport * from \"./KHR_materials_volume\";\r\nexport * from \"./KHR_materials_dispersion\";\r\nexport * from \"./KHR_mesh_quantization\";\r\nexport * from \"./KHR_texture_basisu\";\r\nexport * from \"./KHR_texture_transform\";\r\nexport * from \"./KHR_xmp_json_ld\";\r\nexport * from \"./KHR_animation_pointer\";\r\nexport * from \"./MSFT_audio_emitter\";\r\nexport * from \"./MSFT_lod\";\r\nexport * from \"./MSFT_minecraftMesh\";\r\nexport * from \"./MSFT_sRGBFactors\";\r\nexport * from \"./KHR_interactivity\";\r\nexport * from \"./KHR_node_visibility\";\r\nexport * from \"./ExtrasAsMetadata\";\r\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/loaders",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.32.0",
|
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": "^7.
|
21
|
+
"@babylonjs/core": "^7.32.0",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/loaders": "^1.0.0",
|
24
|
-
"babylonjs-gltf2interface": "^7.
|
24
|
+
"babylonjs-gltf2interface": "^7.32.0"
|
25
25
|
},
|
26
26
|
"peerDependencies": {
|
27
27
|
"@babylonjs/core": "^7.0.0",
|