three-usd-robot 0.10.0 → 0.12.0
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/README.md +108 -8
- package/dist/MeshBinding-DQKXuYNr.d.ts +288 -0
- package/dist/ThreeUsdRobot-C3N6-XBJ.d.ts +347 -0
- package/dist/{ThreeUsdRobotLoader-NdFAVN96.d.ts → ThreeUsdRobotLoader-D2fEo9_p.d.ts} +17 -3
- package/dist/{buildKinematicTree-BCySuZZn.d.ts → buildKinematicTree-iFqaw0Jl.d.ts} +1 -1
- package/dist/bytes-CxGRGry_.d.ts +14 -0
- package/dist/{chunk-NFKK5LJK.js → chunk-6W4LQVEQ.js} +33 -307
- package/dist/chunk-6W4LQVEQ.js.map +1 -0
- package/dist/{chunk-CDQPWWMQ.js → chunk-7GGSIA6M.js} +50 -28
- package/dist/chunk-7GGSIA6M.js.map +1 -0
- package/dist/{chunk-SSSDVLUK.js → chunk-CK5MTMYR.js} +6 -4
- package/dist/chunk-CK5MTMYR.js.map +1 -0
- package/dist/chunk-JGIVJXBU.js +54 -0
- package/dist/chunk-JGIVJXBU.js.map +1 -0
- package/dist/chunk-KYBHWDX5.js +701 -0
- package/dist/chunk-KYBHWDX5.js.map +1 -0
- package/dist/chunk-PPPRB6KE.js +963 -0
- package/dist/chunk-PPPRB6KE.js.map +1 -0
- package/dist/{chunk-IYKPVUZ2.js → chunk-YGJ23CG3.js} +40 -53
- package/dist/chunk-YGJ23CG3.js.map +1 -0
- package/dist/core.d.ts +74 -5
- package/dist/core.js +5 -3
- package/dist/extras.d.ts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.js +3 -2
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +10 -237
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/nodes.d.ts +49 -0
- package/dist/nodes.js +439 -0
- package/dist/nodes.js.map +1 -0
- package/dist/parseMdl-vfzBGoMr.d.ts +87 -0
- package/dist/react.d.ts +6 -4
- package/dist/react.js +6 -4
- package/dist/react.js.map +1 -1
- package/package.json +6 -2
- package/dist/ThreeUsdRobot-B7Z4oORO.d.ts +0 -185
- package/dist/bytes-MOJ2oN-u.d.ts +0 -42
- package/dist/chunk-CDQPWWMQ.js.map +0 -1
- package/dist/chunk-IYKPVUZ2.js.map +0 -1
- package/dist/chunk-NFKK5LJK.js.map +0 -1
- package/dist/chunk-SSSDVLUK.js.map +0 -1
- package/dist/chunk-WROYLUSS.js +0 -393
- package/dist/chunk-WROYLUSS.js.map +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { multiply, makeTranslation, makeRotationFromQuat, identity4, invert, makeEuler, DEG2RAD, makeRotationZ, makeRotationY, makeRotationX, fromUsdMatrix, makeScale, RAD2DEG } from './chunk-YGJ23CG3.js';
|
|
2
|
+
import { parseMdl, joinPosix } from './chunk-PPPRB6KE.js';
|
|
3
|
+
import { Quat, AssetPath, UsdMatrix } from './chunk-JGIVJXBU.js';
|
|
2
4
|
import { unzipSync } from 'fflate';
|
|
3
5
|
|
|
4
6
|
// src/schemas/usdGeom.ts
|
|
@@ -282,254 +284,6 @@ function asMatrix(v, where) {
|
|
|
282
284
|
throw new Error(`${where}: expected a matrix`);
|
|
283
285
|
}
|
|
284
286
|
|
|
285
|
-
// src/three/MaterialBinding.ts
|
|
286
|
-
var DIFFUSE_INPUTS = [
|
|
287
|
-
"inputs:diffuseColor",
|
|
288
|
-
// UsdPreviewSurface
|
|
289
|
-
"inputs:diffuse_color_constant",
|
|
290
|
-
// OmniPBR
|
|
291
|
-
"inputs:diffuse_tint",
|
|
292
|
-
"inputs:base_color",
|
|
293
|
-
"inputs:baseColor"
|
|
294
|
-
];
|
|
295
|
-
var OPACITY_INPUTS = ["inputs:opacity", "inputs:opacity_constant"];
|
|
296
|
-
var OPACITY_THRESHOLD_INPUTS = ["inputs:opacityThreshold", "inputs:opacity_threshold"];
|
|
297
|
-
var METALLIC_INPUTS = ["inputs:metallic", "inputs:metallic_constant"];
|
|
298
|
-
var ROUGHNESS_INPUTS = ["inputs:roughness", "inputs:reflection_roughness_constant"];
|
|
299
|
-
var EMISSIVE_INPUTS = ["inputs:emissiveColor", "inputs:emissive_color"];
|
|
300
|
-
var SURFACE_OUTPUTS = ["outputs:surface", "outputs:mdl:surface"];
|
|
301
|
-
var TEXTURE_LOOKUPS = {
|
|
302
|
-
color: {
|
|
303
|
-
surface: ["inputs:diffuseColor"],
|
|
304
|
-
direct: ["inputs:diffuse_texture", "inputs:diffuse_color_texture"]
|
|
305
|
-
},
|
|
306
|
-
opacity: {
|
|
307
|
-
surface: ["inputs:opacity"],
|
|
308
|
-
direct: ["inputs:opacity_texture", "inputs:opacity_color_texture"]
|
|
309
|
-
},
|
|
310
|
-
normal: {
|
|
311
|
-
surface: ["inputs:normal"],
|
|
312
|
-
direct: ["inputs:normalmap_texture", "inputs:normal_texture"]
|
|
313
|
-
},
|
|
314
|
-
roughness: {
|
|
315
|
-
surface: ["inputs:roughness"],
|
|
316
|
-
direct: ["inputs:reflectionroughness_texture", "inputs:roughness_texture"]
|
|
317
|
-
},
|
|
318
|
-
metalness: {
|
|
319
|
-
surface: ["inputs:metallic"],
|
|
320
|
-
direct: ["inputs:metallic_texture"]
|
|
321
|
-
},
|
|
322
|
-
occlusion: {
|
|
323
|
-
surface: ["inputs:occlusion"],
|
|
324
|
-
direct: ["inputs:ao_texture", "inputs:occlusion_texture"]
|
|
325
|
-
},
|
|
326
|
-
emissive: {
|
|
327
|
-
surface: ["inputs:emissiveColor"],
|
|
328
|
-
direct: ["inputs:emissive_color_texture", "inputs:emissive_mask_texture"]
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
function resolveBoundMaterial(stage, prim) {
|
|
332
|
-
const materialPath = findBinding(prim);
|
|
333
|
-
if (!materialPath) return void 0;
|
|
334
|
-
const material = stage.GetPrimAtPath(materialPath);
|
|
335
|
-
if (!material) return void 0;
|
|
336
|
-
const shader = findSurfaceShader(material);
|
|
337
|
-
if (!shader) return void 0;
|
|
338
|
-
const result = { name: material.GetName() };
|
|
339
|
-
const color = firstColor(shader, DIFFUSE_INPUTS);
|
|
340
|
-
if (color) result.color = color;
|
|
341
|
-
const opacity = firstNumber(shader, OPACITY_INPUTS);
|
|
342
|
-
if (opacity !== void 0) result.opacity = opacity;
|
|
343
|
-
const opacityThreshold = firstNumber(shader, OPACITY_THRESHOLD_INPUTS);
|
|
344
|
-
if (opacityThreshold !== void 0) result.opacityThreshold = opacityThreshold;
|
|
345
|
-
const metalness = firstNumber(shader, METALLIC_INPUTS);
|
|
346
|
-
if (metalness !== void 0) result.metalness = metalness;
|
|
347
|
-
const roughness = firstNumber(shader, ROUGHNESS_INPUTS);
|
|
348
|
-
if (roughness !== void 0) result.roughness = roughness;
|
|
349
|
-
const emissive = firstColor(shader, EMISSIVE_INPUTS);
|
|
350
|
-
if (emissive && shader.GetAttribute("inputs:enable_emission").Get() !== false) {
|
|
351
|
-
result.emissiveColor = emissive;
|
|
352
|
-
const intensity = firstNumber(shader, ["inputs:emissive_intensity"]);
|
|
353
|
-
if (intensity !== void 0) result.emissiveIntensity = intensity;
|
|
354
|
-
}
|
|
355
|
-
const ior = firstNumber(shader, ["inputs:ior"]);
|
|
356
|
-
if (ior !== void 0) result.ior = ior;
|
|
357
|
-
const clearcoat = firstNumber(shader, ["inputs:clearcoat"]);
|
|
358
|
-
if (clearcoat !== void 0) result.clearcoat = clearcoat;
|
|
359
|
-
const clearcoatRoughness = firstNumber(shader, ["inputs:clearcoatRoughness"]);
|
|
360
|
-
if (clearcoatRoughness !== void 0) result.clearcoatRoughness = clearcoatRoughness;
|
|
361
|
-
if (shader.GetAttribute("inputs:useSpecularWorkflow").Get() === 1) {
|
|
362
|
-
const specular = firstColor(shader, ["inputs:specularColor"]);
|
|
363
|
-
if (specular) result.specularColor = specular;
|
|
364
|
-
}
|
|
365
|
-
const colorTex = findTexture(shader, TEXTURE_LOOKUPS.color);
|
|
366
|
-
if (colorTex !== void 0) result.colorTexture = colorTex;
|
|
367
|
-
const opacityTex = findTexture(shader, TEXTURE_LOOKUPS.opacity);
|
|
368
|
-
if (opacityTex !== void 0) result.opacityTexture = opacityTex;
|
|
369
|
-
const normal = findTexture(shader, TEXTURE_LOOKUPS.normal);
|
|
370
|
-
if (normal !== void 0) result.normalTexture = normal;
|
|
371
|
-
const roughTex = findTexture(shader, TEXTURE_LOOKUPS.roughness);
|
|
372
|
-
if (roughTex !== void 0) result.roughnessTexture = roughTex;
|
|
373
|
-
const metalTex = findTexture(shader, TEXTURE_LOOKUPS.metalness);
|
|
374
|
-
if (metalTex !== void 0) result.metalnessTexture = metalTex;
|
|
375
|
-
const aoTex = findTexture(shader, TEXTURE_LOOKUPS.occlusion);
|
|
376
|
-
if (aoTex !== void 0) result.occlusionTexture = aoTex;
|
|
377
|
-
const emissiveTex = findTexture(shader, TEXTURE_LOOKUPS.emissive);
|
|
378
|
-
if (emissiveTex !== void 0) result.emissiveTexture = emissiveTex;
|
|
379
|
-
const ormFile = shader.GetAttribute("inputs:ORM_texture").Get();
|
|
380
|
-
if (shader.GetAttribute("inputs:enable_ORM_texture").Get() === true && ormFile instanceof AssetPath && ormFile.path) {
|
|
381
|
-
const transform = mdlTextureTransform(shader);
|
|
382
|
-
const orm = { path: ormFile.path, ...transform ? { transform } : {} };
|
|
383
|
-
result.occlusionTexture = { ...orm, outputChannel: "r" };
|
|
384
|
-
result.roughnessTexture = { ...orm, outputChannel: "g" };
|
|
385
|
-
result.metalnessTexture = { ...orm, outputChannel: "b" };
|
|
386
|
-
}
|
|
387
|
-
return result;
|
|
388
|
-
}
|
|
389
|
-
function findTexture(shader, lookup) {
|
|
390
|
-
for (const name of lookup.direct) {
|
|
391
|
-
const v = shader.GetAttribute(name).Get();
|
|
392
|
-
if (v instanceof AssetPath && v.path) {
|
|
393
|
-
const transform = mdlTextureTransform(shader);
|
|
394
|
-
return { path: v.path, ...transform ? { transform } : {} };
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
for (const name of lookup.surface) {
|
|
398
|
-
const conn = shader.GetAttribute(name).GetConnections()[0];
|
|
399
|
-
if (!conn) continue;
|
|
400
|
-
const texPrim = shader.GetStage().GetPrimAtPath(conn.split(".")[0]);
|
|
401
|
-
if (!texPrim) continue;
|
|
402
|
-
const file = texPrim.GetAttribute("inputs:file").Get();
|
|
403
|
-
if (file instanceof AssetPath && file.path) {
|
|
404
|
-
const tex = readUvTexture(texPrim, file.path);
|
|
405
|
-
const channel = outputChannelOf(conn);
|
|
406
|
-
if (channel) tex.outputChannel = channel;
|
|
407
|
-
return tex;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
return void 0;
|
|
411
|
-
}
|
|
412
|
-
function outputChannelOf(connection) {
|
|
413
|
-
const m = /\.outputs:(\w+)$/.exec(connection);
|
|
414
|
-
switch (m?.[1]) {
|
|
415
|
-
case "r":
|
|
416
|
-
case "g":
|
|
417
|
-
case "b":
|
|
418
|
-
case "a":
|
|
419
|
-
return m[1];
|
|
420
|
-
case "rgb":
|
|
421
|
-
case "rgba":
|
|
422
|
-
return "rgb";
|
|
423
|
-
default:
|
|
424
|
-
return void 0;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
function mdlTextureTransform(shader) {
|
|
428
|
-
const transform = {};
|
|
429
|
-
const translation = numArray(shader, "inputs:texture_translate", 2);
|
|
430
|
-
if (translation) transform.translation = translation;
|
|
431
|
-
const scale = numArray(shader, "inputs:texture_scale", 2);
|
|
432
|
-
if (scale) transform.scale = scale;
|
|
433
|
-
const rotation = shader.GetAttribute("inputs:texture_rotate").Get();
|
|
434
|
-
if (typeof rotation === "number") transform.rotation = rotation;
|
|
435
|
-
return Object.keys(transform).length > 0 ? transform : void 0;
|
|
436
|
-
}
|
|
437
|
-
var WRAP_VALUES = /* @__PURE__ */ new Set(["repeat", "clamp", "mirror", "black"]);
|
|
438
|
-
function readUvTexture(texPrim, path) {
|
|
439
|
-
const tex = { path };
|
|
440
|
-
const wrapS = texPrim.GetAttribute("inputs:wrapS").Get();
|
|
441
|
-
if (typeof wrapS === "string" && WRAP_VALUES.has(wrapS)) tex.wrapS = wrapS;
|
|
442
|
-
const wrapT = texPrim.GetAttribute("inputs:wrapT").Get();
|
|
443
|
-
if (typeof wrapT === "string" && WRAP_VALUES.has(wrapT)) tex.wrapT = wrapT;
|
|
444
|
-
const scale = numArray(texPrim, "inputs:scale", 4);
|
|
445
|
-
if (scale) tex.scale = scale;
|
|
446
|
-
const bias = numArray(texPrim, "inputs:bias", 4);
|
|
447
|
-
if (bias) tex.bias = bias;
|
|
448
|
-
const sourceColorSpace = texPrim.GetAttribute("inputs:sourceColorSpace").Get();
|
|
449
|
-
if (sourceColorSpace === "raw" || sourceColorSpace === "sRGB" || sourceColorSpace === "auto") {
|
|
450
|
-
tex.sourceColorSpace = sourceColorSpace;
|
|
451
|
-
}
|
|
452
|
-
const st = readStChain(texPrim);
|
|
453
|
-
if (st.transform) tex.transform = st.transform;
|
|
454
|
-
if (st.uvSet) tex.uvSet = st.uvSet;
|
|
455
|
-
return tex;
|
|
456
|
-
}
|
|
457
|
-
function connectedPrim(prim, input) {
|
|
458
|
-
const conn = prim.GetAttribute(input).GetConnections()[0];
|
|
459
|
-
if (!conn) return null;
|
|
460
|
-
return prim.GetStage().GetPrimAtPath(conn.split(".")[0]);
|
|
461
|
-
}
|
|
462
|
-
function readStChain(texPrim) {
|
|
463
|
-
const out = {};
|
|
464
|
-
let node = connectedPrim(texPrim, "inputs:st");
|
|
465
|
-
if (node && node.GetAttribute("info:id").Get() === "UsdTransform2d") {
|
|
466
|
-
const transform = {};
|
|
467
|
-
const translation = numArray(node, "inputs:translation", 2);
|
|
468
|
-
if (translation) transform.translation = translation;
|
|
469
|
-
const scale = numArray(node, "inputs:scale", 2);
|
|
470
|
-
if (scale) transform.scale = scale;
|
|
471
|
-
const rotation = node.GetAttribute("inputs:rotation").Get();
|
|
472
|
-
if (typeof rotation === "number") transform.rotation = rotation;
|
|
473
|
-
if (Object.keys(transform).length > 0) out.transform = transform;
|
|
474
|
-
node = connectedPrim(node, "inputs:in");
|
|
475
|
-
}
|
|
476
|
-
if (node && node.GetAttribute("info:id").Get() === "UsdPrimvarReader_float2") {
|
|
477
|
-
const varname = node.GetAttribute("inputs:varname").Get();
|
|
478
|
-
if (typeof varname === "string" && varname.length > 0) out.uvSet = varname;
|
|
479
|
-
}
|
|
480
|
-
return out;
|
|
481
|
-
}
|
|
482
|
-
function numArray(prim, name, length) {
|
|
483
|
-
const v = prim.GetAttribute(name).Get();
|
|
484
|
-
if (Array.isArray(v) && v.length >= length && v.every((n) => typeof n === "number")) {
|
|
485
|
-
return v.slice(0, length);
|
|
486
|
-
}
|
|
487
|
-
return void 0;
|
|
488
|
-
}
|
|
489
|
-
function findBinding(prim) {
|
|
490
|
-
let chosen;
|
|
491
|
-
let p = prim;
|
|
492
|
-
while (p) {
|
|
493
|
-
for (const name of ["material:binding:preview", "material:binding"]) {
|
|
494
|
-
const rel = p.GetRelationship(name);
|
|
495
|
-
const target = rel.GetTargets()[0];
|
|
496
|
-
if (!target) continue;
|
|
497
|
-
const stronger = rel.GetMetadata("bindMaterialAs") === "strongerThanDescendants";
|
|
498
|
-
if (chosen === void 0 || stronger) chosen = target;
|
|
499
|
-
break;
|
|
500
|
-
}
|
|
501
|
-
p = p.GetParent();
|
|
502
|
-
}
|
|
503
|
-
return chosen;
|
|
504
|
-
}
|
|
505
|
-
function findSurfaceShader(material) {
|
|
506
|
-
for (const out of SURFACE_OUTPUTS) {
|
|
507
|
-
const conn = material.GetAttribute(out).GetConnections()[0];
|
|
508
|
-
if (conn) {
|
|
509
|
-
const shaderPath = conn.split(".")[0];
|
|
510
|
-
const shader = material.GetStage().GetPrimAtPath(shaderPath);
|
|
511
|
-
if (shader) return shader;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
return material.GetChildren().find((c) => c.GetTypeName() === "Shader") ?? void 0;
|
|
515
|
-
}
|
|
516
|
-
function firstColor(shader, names) {
|
|
517
|
-
for (const name of names) {
|
|
518
|
-
const v = shader.GetAttribute(name).Get();
|
|
519
|
-
if (Array.isArray(v) && v.length >= 3 && v.every((n) => typeof n === "number")) {
|
|
520
|
-
return [v[0], v[1], v[2]];
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
return void 0;
|
|
524
|
-
}
|
|
525
|
-
function firstNumber(shader, names) {
|
|
526
|
-
for (const name of names) {
|
|
527
|
-
const v = shader.GetAttribute(name).Get();
|
|
528
|
-
if (typeof v === "number") return v;
|
|
529
|
-
}
|
|
530
|
-
return void 0;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
287
|
// src/robot/buildKinematicTree.ts
|
|
534
288
|
var WORLD = "";
|
|
535
289
|
function buildKinematicTree(robot, options = {}) {
|
|
@@ -810,61 +564,6 @@ function leafName(path) {
|
|
|
810
564
|
return parts[parts.length - 1] ?? path;
|
|
811
565
|
}
|
|
812
566
|
|
|
813
|
-
// src/usd/AssetResolver.ts
|
|
814
|
-
var DefaultAssetResolver = class {
|
|
815
|
-
resolve(assetPath, baseUrl) {
|
|
816
|
-
try {
|
|
817
|
-
return new URL(assetPath, baseUrl || void 0).href;
|
|
818
|
-
} catch {
|
|
819
|
-
return joinPosix(baseUrl, assetPath);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
async fetchText(url) {
|
|
823
|
-
const res = await fetch(url);
|
|
824
|
-
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
|
|
825
|
-
return res.text();
|
|
826
|
-
}
|
|
827
|
-
async fetchBytes(url) {
|
|
828
|
-
const res = await fetch(url);
|
|
829
|
-
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
|
|
830
|
-
return new Uint8Array(await res.arrayBuffer());
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
function createMemoryResolver(files) {
|
|
834
|
-
const decoder = new TextDecoder();
|
|
835
|
-
const encoder = new TextEncoder();
|
|
836
|
-
return {
|
|
837
|
-
resolve(assetPath, baseUrl) {
|
|
838
|
-
return joinPosix(baseUrl, assetPath);
|
|
839
|
-
},
|
|
840
|
-
fetchText(url) {
|
|
841
|
-
const v = files[url];
|
|
842
|
-
if (v === void 0) return Promise.reject(new Error(`asset not found: ${url}`));
|
|
843
|
-
return Promise.resolve(typeof v === "string" ? v : decoder.decode(v));
|
|
844
|
-
},
|
|
845
|
-
fetchBytes(url) {
|
|
846
|
-
const v = files[url];
|
|
847
|
-
if (v === void 0) return Promise.reject(new Error(`asset not found: ${url}`));
|
|
848
|
-
return Promise.resolve(typeof v === "string" ? encoder.encode(v) : v);
|
|
849
|
-
}
|
|
850
|
-
};
|
|
851
|
-
}
|
|
852
|
-
function joinPosix(baseUrl, rel) {
|
|
853
|
-
if (rel.startsWith("/")) return normalizePosix(rel);
|
|
854
|
-
const dir = baseUrl.slice(0, baseUrl.lastIndexOf("/") + 1);
|
|
855
|
-
return normalizePosix(dir + rel);
|
|
856
|
-
}
|
|
857
|
-
function normalizePosix(path) {
|
|
858
|
-
const isAbsolute = path.startsWith("/");
|
|
859
|
-
const out = [];
|
|
860
|
-
for (const part of path.split("/")) {
|
|
861
|
-
if (part === "" || part === ".") continue;
|
|
862
|
-
if (part === "..") out.pop();
|
|
863
|
-
else out.push(part);
|
|
864
|
-
}
|
|
865
|
-
return (isAbsolute ? "/" : "") + out.join("/");
|
|
866
|
-
}
|
|
867
|
-
|
|
868
567
|
// src/parser/reader.ts
|
|
869
568
|
var ParseError = class extends Error {
|
|
870
569
|
constructor(message, line, col) {
|
|
@@ -3584,6 +3283,33 @@ function stripKeys(meta, keys) {
|
|
|
3584
3283
|
}
|
|
3585
3284
|
return out;
|
|
3586
3285
|
}
|
|
3286
|
+
|
|
3287
|
+
// src/usd/mdl/loadMdlModules.ts
|
|
3288
|
+
function collectMdlAssetPaths(stage) {
|
|
3289
|
+
const paths = /* @__PURE__ */ new Set();
|
|
3290
|
+
for (const prim of stage.Traverse()) {
|
|
3291
|
+
if (prim.GetTypeName() !== "Shader") continue;
|
|
3292
|
+
const asset = prim.GetAttribute("info:mdl:sourceAsset").Get();
|
|
3293
|
+
if (asset instanceof AssetPath && asset.path) paths.add(asset.path);
|
|
3294
|
+
}
|
|
3295
|
+
return [...paths];
|
|
3296
|
+
}
|
|
3297
|
+
async function loadMdlModules(stage, resolver, baseUrl) {
|
|
3298
|
+
const paths = collectMdlAssetPaths(stage);
|
|
3299
|
+
if (paths.length === 0) return void 0;
|
|
3300
|
+
const modules = /* @__PURE__ */ new Map();
|
|
3301
|
+
await Promise.all(
|
|
3302
|
+
paths.map(async (path) => {
|
|
3303
|
+
try {
|
|
3304
|
+
const module = parseMdl(await resolver.fetchText(resolver.resolve(path, baseUrl)));
|
|
3305
|
+
if (module.materials.size > 0) modules.set(path, module);
|
|
3306
|
+
} catch {
|
|
3307
|
+
}
|
|
3308
|
+
})
|
|
3309
|
+
);
|
|
3310
|
+
if (modules.size === 0) return void 0;
|
|
3311
|
+
return (assetPath) => modules.get(assetPath);
|
|
3312
|
+
}
|
|
3587
3313
|
var USD_ENTRY = /\.(usda|usdc|usd)$/i;
|
|
3588
3314
|
function isZip(bytes) {
|
|
3589
3315
|
if (bytes.length < 4 || bytes[0] !== 80 || bytes[1] !== 75) return false;
|
|
@@ -3620,6 +3346,6 @@ function openUsdz(bytes) {
|
|
|
3620
3346
|
return { rootEntry, resolver };
|
|
3621
3347
|
}
|
|
3622
3348
|
|
|
3623
|
-
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT,
|
|
3624
|
-
//# sourceMappingURL=chunk-
|
|
3625
|
-
//# sourceMappingURL=chunk-
|
|
3349
|
+
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, collectMdlAssetPaths, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, getMaterialSubsets, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMesh, isNonVisualPurpose, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, jointValueFromSI, jointValueToSI, loadMdlModules, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, toBytes, tokenize };
|
|
3350
|
+
//# sourceMappingURL=chunk-6W4LQVEQ.js.map
|
|
3351
|
+
//# sourceMappingURL=chunk-6W4LQVEQ.js.map
|