three-usd-robot 0.8.1 → 0.10.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 +20 -9
- package/dist/{ThreeUsdRobot-BZ_vlr1R.d.ts → ThreeUsdRobot-B7Z4oORO.d.ts} +7 -1
- package/dist/{ThreeUsdRobotLoader-HteyMZf1.d.ts → ThreeUsdRobotLoader-NdFAVN96.d.ts} +9 -2
- package/dist/{buildKinematicTree-D4R0hEtN.d.ts → buildKinematicTree-BCySuZZn.d.ts} +168 -1
- package/dist/chunk-CDQPWWMQ.js +951 -0
- package/dist/chunk-CDQPWWMQ.js.map +1 -0
- package/dist/{chunk-PHHMWMCA.js → chunk-NFKK5LJK.js} +460 -49
- package/dist/chunk-NFKK5LJK.js.map +1 -0
- package/dist/{chunk-P6CHTMGW.js → chunk-SSSDVLUK.js} +3 -3
- package/dist/{chunk-P6CHTMGW.js.map → chunk-SSSDVLUK.js.map} +1 -1
- package/dist/{chunk-FUPFJOXW.js → chunk-WROYLUSS.js} +8 -2
- package/dist/chunk-WROYLUSS.js.map +1 -0
- package/dist/core.d.ts +47 -162
- package/dist/core.js +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.js +1 -1
- package/dist/index.d.ts +80 -17
- package/dist/index.js +6 -6
- package/dist/react.d.ts +3 -3
- package/dist/react.js +3 -3
- package/package.json +3 -3
- package/dist/chunk-FUPFJOXW.js.map +0 -1
- package/dist/chunk-JHOX3VUW.js +0 -508
- package/dist/chunk-JHOX3VUW.js.map +0 -1
- package/dist/chunk-PHHMWMCA.js.map +0 -1
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as UsdaFile,
|
|
2
|
-
export { e as AssetPath, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, c as JointDriveDescription,
|
|
1
|
+
import { U as UsdaFile, b as Vec3, V as Vec2, M as Mat4, L as LinkDescription, S as Stage, R as RobotDescription, P as Prim, x as UsdValue, J as JointType, A as Axis, s as SdfPath, d as LinkInertialDescription } from './buildKinematicTree-BCySuZZn.js';
|
|
2
|
+
export { e as AssetPath, f as Attribute, g as AttributeSpec, B as BuildTreeOptions, C as CompositionArc, D as DEFAULT_METERS_PER_UNIT, h as DEG2RAD, a as JointDescription, c as JointDriveDescription, i as KinematicNode, K as KinematicTree, j as Layer, k as ListOp, l as MetadataMap, m as PrimSpec, n as PropertySpec, Q as Quat, o as RAD2DEG, p as Relationship, q as RelationshipSpec, r as SampleChannel, t as Specifier, T as TreeEdge, u as UpAxis, v as UsdDictionary, w as UsdMatrix, y as Variability, z as Vec4, E as buildKinematicTree, F as channelFromSamples, G as decomposeRigid, H as fromUsdMatrix, I as getTranslation, N as identity4, O as interpolate, W as invert, X as makeEuler, Y as makeRotationFromQuat, Z as makeRotationX, _ as makeRotationY, $ as makeRotationZ, a0 as makeScale, a1 as makeTranslation, a2 as multiply, a3 as multiplyAll, a4 as toUsdMatrix } from './buildKinematicTree-BCySuZZn.js';
|
|
3
3
|
import { A as AssetResolver } from './bytes-MOJ2oN-u.js';
|
|
4
4
|
export { B as BinarySource, D as DefaultAssetResolver, U as UsdSource, c as createMemoryResolver, j as joinPosix, t as toBytes } from './bytes-MOJ2oN-u.js';
|
|
5
5
|
|
|
@@ -70,163 +70,6 @@ declare class ParseError extends Error {
|
|
|
70
70
|
/** Serialize a parsed (or authored) USDA layer to text. */
|
|
71
71
|
declare function serializeUsda(file: UsdaFile): string;
|
|
72
72
|
|
|
73
|
-
/** A parsed USDA layer (`SdfLayer`-like, read-only). */
|
|
74
|
-
declare class Layer {
|
|
75
|
-
private readonly _file;
|
|
76
|
-
constructor(_file: UsdaFile);
|
|
77
|
-
/** Serialize this layer back to USDA text (`SdfLayer::ExportToString`-like). */
|
|
78
|
-
ExportToString(): string;
|
|
79
|
-
GetVersion(): string;
|
|
80
|
-
GetPseudoRootMetadata(): MetadataMap;
|
|
81
|
-
GetMetadata(key: string): UsdValue | undefined;
|
|
82
|
-
GetDefaultPrimName(): string | undefined;
|
|
83
|
-
GetRootPrimSpecs(): PrimSpec[];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* A typed attribute on a prim (`UsdAttribute`-like).
|
|
88
|
-
*
|
|
89
|
-
* Mirrors the pxr USD API: `GetAttribute` always returns an `Attribute` object;
|
|
90
|
-
* call {@link Attribute.IsValid} to check whether the attribute is actually
|
|
91
|
-
* authored on the prim.
|
|
92
|
-
*/
|
|
93
|
-
declare class Attribute {
|
|
94
|
-
private readonly _prim;
|
|
95
|
-
private readonly _name;
|
|
96
|
-
private readonly _spec;
|
|
97
|
-
constructor(_prim: Prim, _name: string, _spec: AttributeSpec | null);
|
|
98
|
-
IsValid(): boolean;
|
|
99
|
-
GetPrim(): Prim;
|
|
100
|
-
GetName(): string;
|
|
101
|
-
GetBaseName(): string;
|
|
102
|
-
GetNamespace(): string;
|
|
103
|
-
/** Scalar type name (without the `[]` suffix); pair with {@link IsArray}. */
|
|
104
|
-
GetTypeName(): string;
|
|
105
|
-
IsArray(): boolean;
|
|
106
|
-
GetVariability(): Variability;
|
|
107
|
-
IsCustom(): boolean;
|
|
108
|
-
/** True if a default value or any time sample is authored. */
|
|
109
|
-
HasValue(): boolean;
|
|
110
|
-
HasAuthoredValue(): boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Resolve the attribute value. With no `time`, returns the default value (or
|
|
113
|
-
* the earliest time sample if only samples are authored). With a `time`,
|
|
114
|
-
* returns the exact sample if present, else the default, else the earliest
|
|
115
|
-
* sample. Returns `undefined` when nothing is authored.
|
|
116
|
-
*/
|
|
117
|
-
Get(time?: number): UsdValue | undefined;
|
|
118
|
-
GetTimeSamples(): Map<number, UsdValue>;
|
|
119
|
-
GetConnections(): SdfPath[];
|
|
120
|
-
}
|
|
121
|
-
/** A relationship on a prim (`UsdRelationship`-like). */
|
|
122
|
-
declare class Relationship {
|
|
123
|
-
private readonly _prim;
|
|
124
|
-
private readonly _name;
|
|
125
|
-
private readonly _spec;
|
|
126
|
-
constructor(_prim: Prim, _name: string, _spec: RelationshipSpec | null);
|
|
127
|
-
IsValid(): boolean;
|
|
128
|
-
GetPrim(): Prim;
|
|
129
|
-
GetName(): string;
|
|
130
|
-
GetBaseName(): string;
|
|
131
|
-
GetNamespace(): string;
|
|
132
|
-
IsCustom(): boolean;
|
|
133
|
-
GetTargets(): SdfPath[];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* A composed prim on a {@link Stage} (`UsdPrim`-like).
|
|
138
|
-
*
|
|
139
|
-
* The pseudo-root (path `/`) is represented by a Prim with a `null` spec; its
|
|
140
|
-
* children are the stage's root prims.
|
|
141
|
-
*/
|
|
142
|
-
declare class Prim {
|
|
143
|
-
private readonly _stage;
|
|
144
|
-
private readonly _spec;
|
|
145
|
-
private readonly _path;
|
|
146
|
-
private readonly _parent;
|
|
147
|
-
private readonly _children;
|
|
148
|
-
private _attributes?;
|
|
149
|
-
private _relationships?;
|
|
150
|
-
constructor(_stage: Stage, _spec: PrimSpec | null, _path: string, _parent: Prim | null);
|
|
151
|
-
/** @internal Used by {@link Stage} while building the prim tree. */
|
|
152
|
-
_addChild(child: Prim): void;
|
|
153
|
-
GetStage(): Stage;
|
|
154
|
-
IsValid(): boolean;
|
|
155
|
-
IsPseudoRoot(): boolean;
|
|
156
|
-
GetName(): string;
|
|
157
|
-
GetPath(): string;
|
|
158
|
-
GetTypeName(): string;
|
|
159
|
-
GetSpecifier(): Specifier | null;
|
|
160
|
-
GetParent(): Prim | null;
|
|
161
|
-
GetChildren(): Prim[];
|
|
162
|
-
GetChild(name: string): Prim | null;
|
|
163
|
-
private attrMap;
|
|
164
|
-
/** Always returns an Attribute; check {@link Attribute.IsValid}. */
|
|
165
|
-
GetAttribute(name: string): Attribute;
|
|
166
|
-
HasAttribute(name: string): boolean;
|
|
167
|
-
GetAttributes(): Attribute[];
|
|
168
|
-
private relMap;
|
|
169
|
-
/** Always returns a Relationship; check {@link Relationship.IsValid}. */
|
|
170
|
-
GetRelationship(name: string): Relationship;
|
|
171
|
-
HasRelationship(name: string): boolean;
|
|
172
|
-
GetRelationships(): Relationship[];
|
|
173
|
-
GetMetadata(key: string): UsdValue | undefined;
|
|
174
|
-
GetAllMetadata(): MetadataMap;
|
|
175
|
-
/** Applied API schema names from `apiSchemas` (e.g. `PhysicsArticulationRootAPI`). */
|
|
176
|
-
GetAppliedSchemas(): string[];
|
|
177
|
-
/**
|
|
178
|
-
* Whether the given API schema is applied. Matches the bare schema name as
|
|
179
|
-
* well as multi-apply instances (e.g. `HasAPI("PhysicsDriveAPI")` is true for
|
|
180
|
-
* an applied `PhysicsDriveAPI:angular`).
|
|
181
|
-
*/
|
|
182
|
-
HasAPI(schemaName: string): boolean;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/** OpenUSD's fallback stage linear unit when `metersPerUnit` is unauthored. */
|
|
186
|
-
declare const DEFAULT_METERS_PER_UNIT = 0.01;
|
|
187
|
-
type UpAxis = "Y" | "Z";
|
|
188
|
-
/**
|
|
189
|
-
* A composed USD stage (`UsdStage`-like) backed by a single in-memory USDA
|
|
190
|
-
* layer. Multi-layer composition (sublayers / references / payloads) arrives in
|
|
191
|
-
* M8; for now a stage wraps exactly one parsed layer.
|
|
192
|
-
*/
|
|
193
|
-
declare class Stage {
|
|
194
|
-
private readonly _layer;
|
|
195
|
-
private readonly _byPath;
|
|
196
|
-
private readonly _pseudoRoot;
|
|
197
|
-
private constructor();
|
|
198
|
-
/** Parse and open a stage from USDA source text. */
|
|
199
|
-
static OpenFromString(usda: string): Stage;
|
|
200
|
-
/** Open a stage from an already-parsed layer. */
|
|
201
|
-
static OpenFromFile(file: UsdaFile): Stage;
|
|
202
|
-
private buildPrim;
|
|
203
|
-
GetRootLayer(): Layer;
|
|
204
|
-
/**
|
|
205
|
-
* Serialize the stage's backing layer to USDA text. Loader-built stages wrap
|
|
206
|
-
* the fully composed layer, so this is a flattened (`usdcat --flatten`-like)
|
|
207
|
-
* export of everything that was read — including binary-crate sources.
|
|
208
|
-
*/
|
|
209
|
-
ExportToString(): string;
|
|
210
|
-
GetPseudoRoot(): Prim;
|
|
211
|
-
/** Returns the prim at the absolute path, or `null` if none exists. */
|
|
212
|
-
GetPrimAtPath(path: string): Prim | null;
|
|
213
|
-
/** The stage's default prim (from layer `defaultPrim` metadata), if any. */
|
|
214
|
-
GetDefaultPrim(): Prim | null;
|
|
215
|
-
/** Depth-first traversal of all prims (excludes the pseudo-root). */
|
|
216
|
-
Traverse(): Prim[];
|
|
217
|
-
GetMetadata(key: string): UsdValue | undefined;
|
|
218
|
-
/** Stage up axis (`upAxis` metadata); defaults to `"Y"` per OpenUSD. */
|
|
219
|
-
GetUpAxis(): UpAxis;
|
|
220
|
-
/** Stage linear unit (`metersPerUnit` metadata); defaults to {@link DEFAULT_METERS_PER_UNIT}. */
|
|
221
|
-
GetMetersPerUnit(): number;
|
|
222
|
-
/** Animation start time code, if authored. */
|
|
223
|
-
GetStartTimeCode(): number | undefined;
|
|
224
|
-
/** Animation end time code, if authored. */
|
|
225
|
-
GetEndTimeCode(): number | undefined;
|
|
226
|
-
/** Time codes per second for playback; defaults to 24. */
|
|
227
|
-
GetTimeCodesPerSecond(): number;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
73
|
/**
|
|
231
74
|
* Geometry access for the robot exporter (M13).
|
|
232
75
|
*
|
|
@@ -527,12 +370,45 @@ declare class CrateReader {
|
|
|
527
370
|
private readSpecs;
|
|
528
371
|
/** Decode a `ValueRep` into a {@link UsdValue} (or `undefined` if unsupported). */
|
|
529
372
|
getValue(rep: bigint): UsdValue | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* Decode a `timeSamples` field (a {@link CrateType.TimeSamples} rep) into
|
|
375
|
+
* parallel times/values arrays; `undefined` if `rep` is some other type.
|
|
376
|
+
*
|
|
377
|
+
* Layout (pxr `crateFile.cpp`, `Write(TimeSamples)`): an `int64` offset —
|
|
378
|
+
* relative to its own position — jumps over the recursively-written times
|
|
379
|
+
* data to the times `ValueRep` (a `DoubleVector`); a second such offset
|
|
380
|
+
* jumps over the samples' data to `[u64 count][count × ValueRep]`. Sample
|
|
381
|
+
* reps decode through {@link getValue}, so every scalar/array type works.
|
|
382
|
+
*/
|
|
383
|
+
getTimeSamples(rep: bigint): {
|
|
384
|
+
times: number[];
|
|
385
|
+
values: (UsdValue | undefined)[];
|
|
386
|
+
} | undefined;
|
|
530
387
|
private readInlined;
|
|
531
388
|
private readScalar;
|
|
389
|
+
/** Array headers store a u32 count before crate 0.7.0, a u64 from 0.7.0 on. */
|
|
390
|
+
private arrayHeader;
|
|
532
391
|
private readArray;
|
|
392
|
+
/**
|
|
393
|
+
* Decode an array whose rep has the compressed bit. Int arrays are
|
|
394
|
+
* integer-compressed; half/float/double arrays (crate 0.6.0+) carry a code
|
|
395
|
+
* byte — `'i'` when every value is integral, `'t'` for a lookup table +
|
|
396
|
+
* compressed indexes. Arrays under {@link MIN_COMPRESSED_ARRAY_SIZE} elements
|
|
397
|
+
* are stored raw even when the bit is set (mirrors pxr's writer).
|
|
398
|
+
*/
|
|
399
|
+
private readCompressedArray;
|
|
533
400
|
private readFloat32s;
|
|
534
401
|
private readFloat64s;
|
|
535
|
-
private
|
|
402
|
+
private readHalfs;
|
|
403
|
+
private readInt32s;
|
|
404
|
+
/** Read `count` fixed-size `n`-tuples (vec2/3/4 of the given element kind). */
|
|
405
|
+
private readTupleArray;
|
|
406
|
+
/**
|
|
407
|
+
* Read a `VtDictionary`: `[u64 count]`, then per entry a string index (key)
|
|
408
|
+
* followed by a recursive VtValue — an `int64` offset (relative to its own
|
|
409
|
+
* position) over the value's data to an 8-byte `ValueRep`.
|
|
410
|
+
*/
|
|
411
|
+
private readDictionary;
|
|
536
412
|
/**
|
|
537
413
|
* Read an `SdfVariantSelectionMap`: `[u64 count]` then `count` pairs of
|
|
538
414
|
* string indexes (`variantSetName → variantName`). Surfaces as a dictionary
|
|
@@ -605,7 +481,16 @@ declare function isScope(prim: Prim): boolean;
|
|
|
605
481
|
declare function isMesh(prim: Prim): boolean;
|
|
606
482
|
/** True for a `Cube` / `Sphere` / `Cylinder` / `Capsule` / `Cone` prim. */
|
|
607
483
|
declare function isSolidGprim(prim: Prim): boolean;
|
|
608
|
-
/** True for
|
|
484
|
+
/** True for a `Points` (point cloud) prim. */
|
|
485
|
+
declare function isPoints(prim: Prim): boolean;
|
|
486
|
+
/** True for a `BasisCurves` (linear / cubic curve batch) prim. */
|
|
487
|
+
declare function isBasisCurves(prim: Prim): boolean;
|
|
488
|
+
/** True for a gprim schema the runtime knows about but cannot render (yet). */
|
|
489
|
+
declare function isUnsupportedGprim(prim: Prim): boolean;
|
|
490
|
+
/**
|
|
491
|
+
* True for any gprim the runtime can render: a `Mesh`, a parametric solid,
|
|
492
|
+
* a `Points` cloud, or a `BasisCurves` batch.
|
|
493
|
+
*/
|
|
609
494
|
declare function isRenderableGprim(prim: Prim): boolean;
|
|
610
495
|
/** Depth-first iterator over all descendant prims (excluding `prim` itself). */
|
|
611
496
|
declare function iterDescendants(prim: Prim): Generator<Prim>;
|
|
@@ -664,4 +549,4 @@ declare function getJointStatePosition(prim: Prim, kind: "angular" | "linear"):
|
|
|
664
549
|
/** Read `UsdPhysicsMassAPI` properties, or `undefined` when none are authored (M16). */
|
|
665
550
|
declare function getMassProperties(prim: Prim): LinkInertialDescription | undefined;
|
|
666
551
|
|
|
667
|
-
export { ARTICULATION_ROOT_API, AssetResolver,
|
|
552
|
+
export { ARTICULATION_ROOT_API, AssetResolver, Axis, COLLISION_API, type CollisionApproximation, type ComposeOptions, CrateReader, type ExportMaterial, type ExportMesh, type ExportPhysicsMaterial, type ExportRobotOptions, type ExtractOptions, JointType, LinkDescription, LinkInertialDescription, MASS_API, MESH_COLLISION_API, Mat4, PACKAGE_NAME, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, type ResolvedXform, RobotDescription, type RobotGeometryProvider, SdfPath, Stage, type TextureChannel, TokenizeError, UsdValue, UsdaFile, type UsdzPackage, VERSION, type ValidateRobotOptions, type ValidationIssue, type ValidationSeverity, Vec2, Vec3, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, driveKindFor, exportRobotUsda, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMesh, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, stageGeometryProvider, tokenize, validateRobotDescription, writeUsdz };
|
package/dist/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-
|
|
2
|
-
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isRenderableGprim, isScope, isSolidGprim, isXform, isZip, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, toBytes, tokenize } from './chunk-
|
|
1
|
+
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-SSSDVLUK.js';
|
|
2
|
+
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMesh, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, toBytes, tokenize } from './chunk-NFKK5LJK.js';
|
|
3
3
|
export { AssetPath, DEG2RAD, Quat, RAD2DEG, UsdMatrix, channelFromSamples, decomposeRigid, fromUsdMatrix, getTranslation, identity4, interpolate, invert, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, toUsdMatrix } from './chunk-IYKPVUZ2.js';
|
|
4
4
|
//# sourceMappingURL=core.js.map
|
|
5
5
|
//# sourceMappingURL=core.js.map
|
package/dist/extras.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ThreeUsdRobot } from './ThreeUsdRobot-
|
|
1
|
+
import { T as ThreeUsdRobot } from './ThreeUsdRobot-B7Z4oORO.js';
|
|
2
2
|
import 'three';
|
|
3
|
-
import './buildKinematicTree-
|
|
3
|
+
import './buildKinematicTree-BCySuZZn.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* `three-usd-robot/extras`
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { T as ThreeUsdRobot, J as JointObject } from './ThreeUsdRobot-
|
|
3
|
-
import './buildKinematicTree-
|
|
2
|
+
import { T as ThreeUsdRobot, J as JointObject } from './ThreeUsdRobot-B7Z4oORO.js';
|
|
3
|
+
import './buildKinematicTree-BCySuZZn.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Per-link appearance helpers: highlight (tint), material replacement, and
|
package/dist/helpers.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ARTICULATION_ROOT_API,
|
|
1
|
+
import { CollisionApproximation, ExportPhysicsMaterial, RobotGeometryProvider, ExportRobotOptions, ExportMaterial, ExportMesh } from './core.js';
|
|
2
|
+
export { ARTICULATION_ROOT_API, COLLISION_API, ComposeOptions, CrateReader, ExtractOptions, MASS_API, MESH_COLLISION_API, PACKAGE_NAME, PHYSICS_MATERIAL_API, ParseError, RIGID_BODY_API, ResolvedXform, TextureChannel, TokenizeError, UsdzPackage, VERSION, ValidateRobotOptions, ValidationIssue, ValidationSeverity, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, driveKindFor, exportRobotUsda, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMesh, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, stageGeometryProvider, tokenize, validateRobotDescription, writeUsdz } from './core.js';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
|
-
import { A as Axis, V as Vec2, b as Vec3, R as RobotDescription, c as JointDriveDescription, d as LinkInertialDescription, K as KinematicTree, U as UsdaFile, M as Mat4 } from './buildKinematicTree-
|
|
5
|
-
export { e as AssetPath, f as AttributeSpec, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, J as JointType,
|
|
6
|
-
import { T as ThreeUsdRobot } from './ThreeUsdRobot-
|
|
7
|
-
export { J as JointObject, L as LinkObject, a as ThreeUsdRobotOptions, W as WorldUpAxis } from './ThreeUsdRobot-
|
|
4
|
+
import { A as Axis, V as Vec2, b as Vec3, S as Stage, P as Prim, R as RobotDescription, c as JointDriveDescription, d as LinkInertialDescription, K as KinematicTree, U as UsdaFile, M as Mat4 } from './buildKinematicTree-BCySuZZn.js';
|
|
5
|
+
export { e as AssetPath, f as Attribute, g as AttributeSpec, B as BuildTreeOptions, C as CompositionArc, D as DEFAULT_METERS_PER_UNIT, h as DEG2RAD, a as JointDescription, J as JointType, i as KinematicNode, j as Layer, L as LinkDescription, k as ListOp, l as MetadataMap, m as PrimSpec, n as PropertySpec, Q as Quat, o as RAD2DEG, p as Relationship, q as RelationshipSpec, r as SampleChannel, s as SdfPath, t as Specifier, T as TreeEdge, u as UpAxis, v as UsdDictionary, w as UsdMatrix, x as UsdValue, y as Variability, z as Vec4, E as buildKinematicTree, F as channelFromSamples, G as decomposeRigid, H as fromUsdMatrix, I as getTranslation, N as identity4, O as interpolate, W as invert, X as makeEuler, Y as makeRotationFromQuat, Z as makeRotationX, _ as makeRotationY, $ as makeRotationZ, a0 as makeScale, a1 as makeTranslation, a2 as multiply, a3 as multiplyAll, a4 as toUsdMatrix } from './buildKinematicTree-BCySuZZn.js';
|
|
6
|
+
import { T as ThreeUsdRobot } from './ThreeUsdRobot-B7Z4oORO.js';
|
|
7
|
+
export { J as JointObject, L as LinkObject, a as ThreeUsdRobotOptions, W as WorldUpAxis } from './ThreeUsdRobot-B7Z4oORO.js';
|
|
8
8
|
import { A as AssetResolver } from './bytes-MOJ2oN-u.js';
|
|
9
9
|
export { B as BinarySource, D as DefaultAssetResolver, U as UsdSource, c as createMemoryResolver, j as joinPosix, t as toBytes } from './bytes-MOJ2oN-u.js';
|
|
10
|
-
export { a as ThreeUsdRobotLoader, T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-
|
|
10
|
+
export { a as ThreeUsdRobotLoader, T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-NdFAVN96.js';
|
|
11
11
|
|
|
12
12
|
/** Unit vector for a USD joint axis token. Returns a fresh vector each call. */
|
|
13
13
|
declare function axisVector(axis: Axis): THREE.Vector3;
|
|
@@ -47,6 +47,19 @@ type ResolvedTexture = {
|
|
|
47
47
|
scale?: [number, number, number, number];
|
|
48
48
|
/** `inputs:bias` — added to the sampled value. */
|
|
49
49
|
bias?: [number, number, number, number];
|
|
50
|
+
/**
|
|
51
|
+
* UV-set (primvar) name the texture reads, resolved through the `inputs:st`
|
|
52
|
+
* connection to a `UsdPrimvarReader_float2.inputs:varname`. Absent ⇒ `"st"`.
|
|
53
|
+
*/
|
|
54
|
+
uvSet?: string;
|
|
55
|
+
/** `inputs:sourceColorSpace` — overrides the per-channel colorspace default. */
|
|
56
|
+
sourceColorSpace?: "raw" | "sRGB" | "auto";
|
|
57
|
+
/**
|
|
58
|
+
* Which output the consuming input connects to (`outputs:r` → `"r"`, …).
|
|
59
|
+
* three.js samples fixed channels (roughness = G, metalness = B, ao = R);
|
|
60
|
+
* a mismatch is surfaced as a load warning.
|
|
61
|
+
*/
|
|
62
|
+
outputChannel?: "r" | "g" | "b" | "a" | "rgb";
|
|
50
63
|
};
|
|
51
64
|
type ResolvedMaterial = {
|
|
52
65
|
/** Name of the bound `Material` prim, for round-tripping and debugging. */
|
|
@@ -61,6 +74,16 @@ type ResolvedMaterial = {
|
|
|
61
74
|
* clip / cutout); when `0`/absent, sub-unit opacity blends translucently.
|
|
62
75
|
*/
|
|
63
76
|
opacityThreshold?: number;
|
|
77
|
+
/** `inputs:ior` — promotes the three material to `MeshPhysicalMaterial`. */
|
|
78
|
+
ior?: number;
|
|
79
|
+
/** `inputs:clearcoat` (physical promotion). */
|
|
80
|
+
clearcoat?: number;
|
|
81
|
+
/** `inputs:clearcoatRoughness` (physical promotion). */
|
|
82
|
+
clearcoatRoughness?: number;
|
|
83
|
+
/** `inputs:specularColor`, only when `inputs:useSpecularWorkflow = 1`. */
|
|
84
|
+
specularColor?: Vec3;
|
|
85
|
+
/** OmniPBR `inputs:emissive_intensity` — multiplies the emissive color. */
|
|
86
|
+
emissiveIntensity?: number;
|
|
64
87
|
/** Diffuse/albedo texture, if any. */
|
|
65
88
|
colorTexture?: ResolvedTexture;
|
|
66
89
|
/** Opacity / alpha texture (may be the same image as `colorTexture`). */
|
|
@@ -103,6 +126,8 @@ type TextureOptions = {
|
|
|
103
126
|
wrapS?: TextureWrap;
|
|
104
127
|
wrapT?: TextureWrap;
|
|
105
128
|
transform?: TextureTransform;
|
|
129
|
+
/** UV channel index (0 = `uv`, 1 = `uv1`, …) for multi-UV-set meshes. */
|
|
130
|
+
channel?: number;
|
|
106
131
|
};
|
|
107
132
|
/** Resolve an authored texture asset path to a `THREE.Texture` (or `null`). */
|
|
108
133
|
type TextureProvider = (assetPath: string, options?: TextureOptions) => THREE.Texture | null;
|
|
@@ -119,11 +144,11 @@ declare function createTextureProvider(resolver: AssetResolver, baseUrl: string)
|
|
|
119
144
|
* `Sphere` / `Cylinder` / `Capsule` / `Cone`) — to Three.js geometry and
|
|
120
145
|
* attaches them under the robot's link objects.
|
|
121
146
|
*
|
|
122
|
-
* Meshes are triangulated with a simple fan
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* at the root in M9.
|
|
147
|
+
* Meshes are triangulated with a simple fan. Primvars (`st` UV sets, `normals`,
|
|
148
|
+
* `displayColor`) resolve with USD interpolation semantics — `:indices`
|
|
149
|
+
* de-referencing, vertex vs faceVarying (de-indexed) layouts, multiple UV
|
|
150
|
+
* channels. Solids tessellate from their schema attributes. Geometry is left
|
|
151
|
+
* in stage units; the global `metersPerUnit` scale is applied at the root in M9.
|
|
127
152
|
*/
|
|
128
153
|
|
|
129
154
|
type MeshKind = "visual" | "collision";
|
|
@@ -132,10 +157,21 @@ type BindMeshesOptions = {
|
|
|
132
157
|
loadCollisions?: boolean;
|
|
133
158
|
/** Resolves diffuse texture asset paths to `THREE.Texture` (M-tex). */
|
|
134
159
|
textureProvider?: TextureProvider;
|
|
160
|
+
/** Render `BasisCurves` with authored `widths` as tube meshes (M18). */
|
|
161
|
+
curveTubes?: boolean;
|
|
162
|
+
/** Receives fidelity diagnostics (channel-packing mismatches, M19). */
|
|
163
|
+
onWarn?: (message: string) => void;
|
|
135
164
|
};
|
|
136
165
|
/**
|
|
137
166
|
* Build a `BufferGeometry` from a Mesh prim, or `null` if it has no points.
|
|
138
167
|
*
|
|
168
|
+
* Primvars resolve with full interpolation semantics (M19): `:indices` arrays
|
|
169
|
+
* are de-referenced, vertex-interpolated `st` sets / `normals` /
|
|
170
|
+
* `displayColor` bind onto the shared vertices, and any faceVarying primvar
|
|
171
|
+
* (or per-face color) switches the mesh to a de-indexed layout where every
|
|
172
|
+
* face corner owns its vertex. Extra UV sets become `uv1`, `uv2`, … in
|
|
173
|
+
* {@link meshUvSetNames} order.
|
|
174
|
+
*
|
|
139
175
|
* When the mesh carries `materialBind` face subsets, the triangles are ordered
|
|
140
176
|
* subset by subset and a geometry group is added for each — so the mesh can be
|
|
141
177
|
* drawn with one material per subset (see {@link buildMeshMaterials}). Group
|
|
@@ -150,6 +186,26 @@ declare function buildMeshGeometry(meshPrim: Prim): THREE.BufferGeometry | null;
|
|
|
150
186
|
* section. Returns `null` for unsupported prim types.
|
|
151
187
|
*/
|
|
152
188
|
declare function buildGprimGeometry(prim: Prim): THREE.BufferGeometry | null;
|
|
189
|
+
type BuildGprimOptions = {
|
|
190
|
+
/** Resolves texture asset paths for mesh materials. */
|
|
191
|
+
textureProvider?: TextureProvider;
|
|
192
|
+
/**
|
|
193
|
+
* Render `BasisCurves` that author `widths` as tube meshes instead of
|
|
194
|
+
* 1-px lines (default `false`).
|
|
195
|
+
*/
|
|
196
|
+
curveTubes?: boolean;
|
|
197
|
+
/** Receives fidelity diagnostics (channel-packing mismatches, M19). */
|
|
198
|
+
onWarn?: (message: string) => void;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Build a renderable `THREE.Object3D` for any supported gprim (M18):
|
|
202
|
+
* `Mesh` and the parametric solids become a `THREE.Mesh` (via
|
|
203
|
+
* {@link buildGprimGeometry} + {@link buildMeshMaterials}), `Points` a
|
|
204
|
+
* `THREE.Points`, and `BasisCurves` a `THREE.Group` holding one line — or,
|
|
205
|
+
* with {@link BuildGprimOptions.curveTubes}, one tube mesh — per curve.
|
|
206
|
+
* Returns `null` for unsupported prim types and degenerate geometry.
|
|
207
|
+
*/
|
|
208
|
+
declare function buildGprimObject(prim: Prim, stage?: Stage, options?: BuildGprimOptions): THREE.Object3D | null;
|
|
153
209
|
/**
|
|
154
210
|
* Build a material for a gprim. Color priority: bound `UsdShade` material
|
|
155
211
|
* (when `stage` is given) → `primvars:displayColor` → default gray. Textures
|
|
@@ -160,7 +216,9 @@ declare function buildGprimGeometry(prim: Prim): THREE.BufferGeometry | null;
|
|
|
160
216
|
*/
|
|
161
217
|
declare function buildMeshMaterial(meshPrim: Prim, stage?: Stage, textures?: TextureProvider,
|
|
162
218
|
/** Resolve the material binding from here instead (a `GeomSubset`). */
|
|
163
|
-
bindingPrim?: Prim
|
|
219
|
+
bindingPrim?: Prim,
|
|
220
|
+
/** Receives fidelity diagnostics (channel-packing mismatches, M19). */
|
|
221
|
+
onWarn?: (message: string) => void): THREE.Material;
|
|
164
222
|
/**
|
|
165
223
|
* Attach visual (and optionally collision) meshes to every link of a built
|
|
166
224
|
* {@link ThreeUsdRobot}. Each mesh is positioned by its transform relative to
|
|
@@ -169,12 +227,17 @@ bindingPrim?: Prim): THREE.Material;
|
|
|
169
227
|
declare function bindRobotMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: RobotDescription, options?: BindMeshesOptions): void;
|
|
170
228
|
/**
|
|
171
229
|
* Attach the gprims that belong to no link — the static scenery of a cell that
|
|
172
|
-
* also contains robots.
|
|
173
|
-
*
|
|
174
|
-
*
|
|
230
|
+
* also contains robots. The authored prim hierarchy is mirrored with
|
|
231
|
+
* `THREE.Group` nodes (each carrying `userData.primPath` and its prim's local
|
|
232
|
+
* transform), so grouped scenery — a pallet and its cartons, a fence and its
|
|
233
|
+
* wires — stays one movable subtree. World placements are unchanged, and the
|
|
234
|
+
* loader's up-axis and unit normalization still applies at the robot root.
|
|
235
|
+
* Collision-only and guide/proxy prims are skipped.
|
|
175
236
|
*/
|
|
176
237
|
declare function bindSceneMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: RobotDescription, options?: {
|
|
177
238
|
textureProvider?: TextureProvider;
|
|
239
|
+
curveTubes?: boolean;
|
|
240
|
+
onWarn?: (message: string) => void;
|
|
178
241
|
}): number;
|
|
179
242
|
|
|
180
243
|
/**
|
|
@@ -310,4 +373,4 @@ type ExportThreeUsdRobotOptions = Omit<ExportRobotOptions, "geometry"> & {
|
|
|
310
373
|
/** Export a loaded robot back to a USDA AST (pass the result to `serializeUsda`). */
|
|
311
374
|
declare function exportThreeUsdRobot(robot: ThreeUsdRobot, options?: ExportThreeUsdRobotOptions): UsdaFile;
|
|
312
375
|
|
|
313
|
-
export { type AddJointOptions, type AddLinkOptions, AssetResolver, Axis, type BindMeshesOptions, CollisionApproximation, ExportMaterial, ExportMesh, ExportPhysicsMaterial, ExportRobotOptions, type ExportThreeUsdRobotOptions, type GeometryToExportMeshOptions, JointDriveDescription, KinematicTree, LinkInertialDescription, Mat4, type MeshKind, Prim, type ResolvedMaterial, type ResolvedTexture, RobotBuilder, type RobotBuilderOptions, RobotDescription, RobotGeometryProvider, Stage, type TextureColorSpace, type TextureOptions, type TextureProvider, type TextureTransform, type TextureWrap, ThreeUsdRobot, UsdaFile, Vec2, Vec3, type WorldFrame, axisVector, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildMeshGeometry, buildMeshMaterial, createTextureProvider, exportThreeUsdRobot, geometryToExportMesh, materialToExportMaterial, resolveBoundMaterial, threeGeometryProvider };
|
|
376
|
+
export { type AddJointOptions, type AddLinkOptions, AssetResolver, Axis, type BindMeshesOptions, type BuildGprimOptions, CollisionApproximation, ExportMaterial, ExportMesh, ExportPhysicsMaterial, ExportRobotOptions, type ExportThreeUsdRobotOptions, type GeometryToExportMeshOptions, JointDriveDescription, KinematicTree, LinkInertialDescription, Mat4, type MeshKind, Prim, type ResolvedMaterial, type ResolvedTexture, RobotBuilder, type RobotBuilderOptions, RobotDescription, RobotGeometryProvider, Stage, type TextureColorSpace, type TextureOptions, type TextureProvider, type TextureTransform, type TextureWrap, ThreeUsdRobot, UsdaFile, Vec2, Vec3, type WorldFrame, axisVector, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildGprimObject, buildMeshGeometry, buildMeshMaterial, createTextureProvider, exportThreeUsdRobot, geometryToExportMesh, materialToExportMaterial, resolveBoundMaterial, threeGeometryProvider };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { stageGeometryProvider, exportRobotUsda } from './chunk-
|
|
2
|
-
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-
|
|
3
|
-
export { ThreeUsdRobotLoader, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildMeshGeometry, buildMeshMaterial, createTextureProvider } from './chunk-
|
|
4
|
-
import { refineJointType, buildKinematicTree } from './chunk-
|
|
5
|
-
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isRenderableGprim, isScope, isSolidGprim, isXform, isZip, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, resolveBoundMaterial, serializeUsda, toBytes, tokenize } from './chunk-
|
|
6
|
-
export { JointObject, LinkObject, ThreeUsdRobot, axisVector } from './chunk-
|
|
1
|
+
import { stageGeometryProvider, exportRobotUsda } from './chunk-SSSDVLUK.js';
|
|
2
|
+
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-SSSDVLUK.js';
|
|
3
|
+
export { ThreeUsdRobotLoader, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildGprimObject, buildMeshGeometry, buildMeshMaterial, createTextureProvider } from './chunk-CDQPWWMQ.js';
|
|
4
|
+
import { refineJointType, buildKinematicTree } from './chunk-NFKK5LJK.js';
|
|
5
|
+
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMesh, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, resolveBoundMaterial, serializeUsda, toBytes, tokenize } from './chunk-NFKK5LJK.js';
|
|
6
|
+
export { JointObject, LinkObject, ThreeUsdRobot, axisVector } from './chunk-WROYLUSS.js';
|
|
7
7
|
import { identity4, multiply, invert } from './chunk-IYKPVUZ2.js';
|
|
8
8
|
export { AssetPath, DEG2RAD, Quat, RAD2DEG, UsdMatrix, channelFromSamples, decomposeRigid, fromUsdMatrix, getTranslation, identity4, interpolate, invert, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, toUsdMatrix } from './chunk-IYKPVUZ2.js';
|
|
9
9
|
import * as THREE from 'three';
|
package/dist/react.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _react_three_fiber from '@react-three/fiber';
|
|
2
2
|
import { ThreeElements } from '@react-three/fiber';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { T as ThreeUsdRobot } from './ThreeUsdRobot-
|
|
5
|
-
import { T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-
|
|
4
|
+
import { T as ThreeUsdRobot } from './ThreeUsdRobot-B7Z4oORO.js';
|
|
5
|
+
import { T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-NdFAVN96.js';
|
|
6
6
|
import 'three';
|
|
7
|
-
import './buildKinematicTree-
|
|
7
|
+
import './buildKinematicTree-BCySuZZn.js';
|
|
8
8
|
import './bytes-MOJ2oN-u.js';
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ThreeUsdRobotLoader } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { ThreeUsdRobotLoader } from './chunk-CDQPWWMQ.js';
|
|
2
|
+
import './chunk-NFKK5LJK.js';
|
|
3
|
+
import './chunk-WROYLUSS.js';
|
|
4
4
|
import './chunk-IYKPVUZ2.js';
|
|
5
5
|
import { useFrame } from '@react-three/fiber';
|
|
6
6
|
import * as React from 'react';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "three-usd-robot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Kinematic OpenUSD robot loader for Three.js — load Isaac Sim / OpenUSD robot assets, extract joints and links, and control articulations in the browser.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"format": "biome format --write .",
|
|
59
59
|
"check": "biome check --write .",
|
|
60
60
|
"demo:factory": "tsx scripts/demo-factory.ts",
|
|
61
|
-
"demo:install": "npm install --prefix examples/vite-
|
|
62
|
-
"demo:build": "npm run demo:factory && npm run build --prefix examples/vite-
|
|
61
|
+
"demo:install": "npm install --prefix examples/vite-usd-inspector",
|
|
62
|
+
"demo:build": "npm run demo:factory && npm run build --prefix examples/vite-usd-inspector"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@react-three/fiber": ">=8",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/three/axis.ts","../src/three/JointObject.ts","../src/three/LinkObject.ts","../src/three/ThreeUsdRobot.ts"],"names":["THREE","THREE2","THREE3"],"mappings":";;;AAIO,SAAS,WAAW,IAAA,EAA2B;AACpD,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,GAAA;AACH,MAAA,OAAO,IAAUA,MAAA,CAAA,OAAA,CAAQ,CAAA,EAAG,CAAA,EAAG,CAAC,CAAA;AAAA,IAClC,KAAK,GAAA;AACH,MAAA,OAAO,IAAUA,MAAA,CAAA,OAAA,CAAQ,CAAA,EAAG,CAAA,EAAG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AA,IAAQ,IAAA,CAAK,WAAA,CAAY,MAAA,EAAO,EAAG;AAC5C,QAAA,MAAM,CAAA,GAAI,IAAU,MAAA,CAAA,UAAA,CAAW,IAAA,CAAK,UAAU,CAAA;AAC9C,QAAA,CAAA,CAAE,IAAA,GAAO,CAAA,EAAG,IAAA,CAAK,QAAQ,CAAA,MAAA,CAAA;AACzB,QAAA,IAAA,CAAK,IAAI,CAAC,CAAA;AACV,QAAA,IAAA,CAAK,gBAAA,CAAiB,KAAK,CAAC,CAAA;AAAA,MAC9B;AAAA,IACF;AACA,IAAA,KAAA,MAAW,CAAA,IAAK,IAAA,CAAK,gBAAA,EAAkB,CAAA,CAAE,OAAA,GAAU,CAAA;AAAA,EACrD;AAAA,EAEQ,iBAAA,CAAkB,MAAc,OAAA,EAAwB;AAC9D,IAAA,IAAA,CAAK,QAAA,CAAS,CAAC,CAAA,KAAM;AACnB,MAAA,IAAK,CAAA,CAAE,QAAA,CAA+B,IAAA,KAAS,IAAA,IAAQ,OAAA,GAAU,OAAA;AAAA,IACnE,CAAC,CAAA;AAAA,EACH;AACF;AAGA,SAAS,SAAA,CAAU,KAAqB,CAAA,EAAe;AACrD,EAAA,GAAA,CAAI,gBAAA,GAAmB,KAAA;AACvB,EAAA,GAAA,CAAI,MAAA,CAAO,UAAU,CAAC,CAAA;AACtB,EAAA,GAAA,CAAI,sBAAA,GAAyB,IAAA;AAC/B","file":"chunk-FUPFJOXW.js","sourcesContent":["import * as THREE from \"three\";\nimport type { Axis } from \"../robot/RobotDescription.js\";\n\n/** Unit vector for a USD joint axis token. Returns a fresh vector each call. */\nexport function axisVector(axis: Axis): THREE.Vector3 {\n switch (axis) {\n case \"X\":\n return new THREE.Vector3(1, 0, 0);\n case \"Y\":\n return new THREE.Vector3(0, 1, 0);\n case \"Z\":\n return new THREE.Vector3(0, 0, 1);\n }\n}\n","import * as THREE from \"three\";\nimport type { Axis, JointDescription, JointType } from \"../robot/RobotDescription.js\";\nimport { axisVector } from \"./axis.js\";\n\n/**\n * The articulated \"motion\" node of a joint, inserted between the joint's two\n * fixed frames (`jointFrame0` and `inverse(jointFrame1)`). {@link setValue}\n * rotates it about the axis (revolute/continuous) or slides it along the axis\n * (prismatic); fixed joints are inert.\n */\nexport class JointObject extends THREE.Object3D {\n readonly isJointObject = true;\n readonly jointName: string;\n /** Full USD prim path of the joint — the collision-proof address. */\n readonly primPath: string;\n readonly jointType: JointType;\n readonly axisToken: Axis;\n readonly axis: THREE.Vector3;\n readonly lower: number | undefined;\n readonly upper: number | undefined;\n\n private _value = 0;\n\n constructor(joint: JointDescription) {\n super();\n this.name = joint.name;\n this.jointName = joint.name;\n this.primPath = joint.primPath;\n this.jointType = joint.type;\n this.axisToken = joint.axis;\n this.axis = axisVector(joint.axis);\n this.lower = joint.lower;\n this.upper = joint.upper;\n }\n\n get value(): number {\n return this._value;\n }\n\n get articulated(): boolean {\n return this.jointType !== \"fixed\";\n }\n\n /**\n * Set the joint value (radians for revolute/continuous, length for prismatic).\n * Optionally clamps to authored limits. Returns the value actually applied.\n */\n setValue(value: number, clampToLimits = true): number {\n if (!this.articulated) return this._value; // fixed joint: inert\n\n let v = value;\n if (clampToLimits) {\n if (this.lower !== undefined && v < this.lower) v = this.lower;\n if (this.upper !== undefined && v > this.upper) v = this.upper;\n }\n this._value = v;\n\n if (this.jointType === \"prismatic\") {\n this.position.copy(this.axis).multiplyScalar(v);\n this.quaternion.identity();\n } else {\n this.quaternion.setFromAxisAngle(this.axis, v);\n this.position.set(0, 0, 0);\n }\n return v;\n }\n}\n","import * as THREE from \"three\";\nimport type { LinkDescription } from \"../robot/RobotDescription.js\";\n\n/**\n * Three.js node for a robot link. Its frame is the USD link prim's frame;\n * visual/collision meshes (M6) attach as children relative to it. Placement\n * relative to the parent is supplied by the joint chain, so a link's own local\n * matrix is identity (except the root, which carries the world-fixed placement).\n */\nexport class LinkObject extends THREE.Object3D {\n readonly isLinkObject = true;\n readonly linkName: string;\n readonly primPath: string;\n\n constructor(link: LinkDescription) {\n super();\n this.name = link.name;\n this.linkName = link.name;\n this.primPath = link.primPath;\n // Placement comes from the parent joint chain; keep the local matrix fixed.\n this.matrixAutoUpdate = false;\n }\n}\n","import * as THREE from \"three\";\nimport { interpolate } from \"../kinematics/sampling.js\";\nimport { type Mat4, invert, multiply } from \"../kinematics/transforms.js\";\nimport type {\n JointDescription,\n LinkDescription,\n RobotDescription,\n} from \"../robot/RobotDescription.js\";\nimport type { KinematicTree } from \"../robot/buildKinematicTree.js\";\nimport { JointObject } from \"./JointObject.js\";\nimport { LinkObject } from \"./LinkObject.js\";\n\n/** Target world up-axis: normalize to Y-up / Z-up, or keep the authored orientation. */\nexport type WorldUpAxis = \"Y\" | \"Z\" | \"keep\";\n\nexport type ThreeUsdRobotOptions = {\n /** Clamp `setJointValue` to authored limits (default `true`). */\n clampJointLimits?: boolean;\n /** Size of the built-in joint-axis / link-frame helpers (stage units, default `0.15`). */\n helperSize?: number;\n /**\n * Target world up-axis. The root is rotated so the stage's authored `upAxis`\n * lands in that convention: `\"Y\"` for a standard three.js scene, `\"Z\"` for a\n * robotics-style Z-up world, `\"keep\"` for no correction. Takes precedence\n * over the deprecated {@link ThreeUsdRobotOptions.upAxisConversion}.\n */\n worldUp?: WorldUpAxis;\n /**\n * Legacy up-axis correction: `\"auto\"` ≡ `worldUp: \"Y\"`, `\"Y\"` / `\"none\"` ≡\n * `worldUp: \"keep\"`, and `\"Z\"` forces the Z-up→Y-up rotation regardless of\n * stage metadata. Default `\"none\"` (the loader defaults to `\"auto\"`).\n * @deprecated Use {@link ThreeUsdRobotOptions.worldUp}.\n */\n upAxisConversion?: \"auto\" | \"Y\" | \"Z\" | \"none\";\n /** Extra uniform scale multiplied with the stage `metersPerUnit` (default `1`). */\n unitScale?: number;\n /** Seed joints from their authored initial value (drive target / joint state). Default `true`. */\n applyInitialPose?: boolean;\n};\n\n/**\n * A Three.js `Object3D` that realizes a {@link RobotDescription} as a kinematic\n * hierarchy and drives forward kinematics via {@link setJointValue}.\n *\n * Per joint the hierarchy is\n * `parentLink → jointFrame0 → jointMotion → jointFrame1⁻¹ → childLink`,\n * where only `jointMotion` (a {@link JointObject}) changes with the joint value;\n * world poses then fall out of Three.js's `updateMatrixWorld`.\n *\n * **Naming contract** — a link/joint's key is its prim's leaf name when that\n * is unique across the robot, else its full prim path (deterministic; see the\n * extractor). Every accessor taking a name equally accepts the full prim path,\n * which is stable regardless of collisions; {@link getLinkObjectsByPath} /\n * {@link getJointObjectsByPath} enumerate the path-keyed tables.\n */\nexport class ThreeUsdRobot extends THREE.Object3D {\n readonly isThreeUsdRobot = true;\n readonly robot: RobotDescription;\n readonly tree: KinematicTree;\n readonly clampJointLimits: boolean;\n\n private readonly linkObjects = new Map<string, LinkObject>();\n private readonly jointObjects = new Map<string, JointObject>();\n private readonly linkKeyByPath = new Map<string, string>();\n private readonly jointKeyByPath = new Map<string, string>();\n private dirty = true;\n\n private readonly helperSize: number;\n private _showVisual = true;\n private _showCollision = false;\n private _showJointAxes = false;\n private _showLinkFrames = false;\n private jointAxesHelpers: THREE.AxesHelper[] = [];\n private linkFrameHelpers: THREE.AxesHelper[] = [];\n\n constructor(robot: RobotDescription, tree: KinematicTree, options: ThreeUsdRobotOptions = {}) {\n super();\n this.name = robot.name;\n this.robot = robot;\n this.tree = tree;\n this.clampJointLimits = options.clampJointLimits ?? true;\n this.helperSize = options.helperSize ?? 0.15;\n\n // Create a node for every link up front; index links and joints by path.\n for (const [key, link] of Object.entries(robot.links)) {\n this.linkObjects.set(key, new LinkObject(link));\n this.linkKeyByPath.set(link.primPath, key);\n }\n for (const [key, joint] of Object.entries(robot.joints)) {\n this.jointKeyByPath.set(joint.primPath, key);\n }\n\n this.attachRoot();\n this.attachTreeEdges();\n this.attachIsolatedLinks();\n this.applyStageNormalization(robot, options);\n if (options.applyInitialPose ?? true) this.applyInitialPose(robot);\n }\n\n /** Orient (authored upAxis → target world up) and scale (metersPerUnit × unitScale) the root. */\n private applyStageNormalization(robot: RobotDescription, options: ThreeUsdRobotOptions): void {\n const scale = (robot.metersPerUnit || 1) * (options.unitScale ?? 1);\n if (scale !== 1) this.scale.setScalar(scale);\n\n const rotateX = (angle: number) =>\n this.quaternion.setFromAxisAngle(new THREE.Vector3(1, 0, 0), angle);\n\n if (options.worldUp) {\n if (options.worldUp === \"Y\" && robot.upAxis === \"Z\") rotateX(-Math.PI / 2);\n else if (options.worldUp === \"Z\" && robot.upAxis === \"Y\") rotateX(Math.PI / 2);\n return; // matching axis or \"keep\": leave as authored\n }\n const conv = options.upAxisConversion ?? \"none\";\n if (conv === \"Z\" || (conv === \"auto\" && robot.upAxis === \"Z\")) rotateX(-Math.PI / 2);\n }\n\n /** Apply each joint's authored initial value, if any. */\n private applyInitialPose(robot: RobotDescription): void {\n for (const [key, joint] of Object.entries(robot.joints)) {\n if (joint.initialValue === undefined) continue;\n this.jointObjects.get(key)?.setValue(joint.initialValue, this.clampJointLimits);\n }\n this.dirty = true;\n }\n\n private attachRoot(): void {\n const rootObj = this.linkObjects.get(this.tree.root);\n if (!rootObj) return; // empty robot\n const rootJointKey = this.tree.rootJoint;\n const rootLink = this.robot.links[this.tree.root];\n if (rootJointKey) {\n const j = this.robot.joints[rootJointKey];\n // World-fixed placement: jointFrame0 (in world) · inverse(jointFrame1).\n if (j) setMatrix(rootObj, multiply(j.jointFrame0, invert(j.jointFrame1)));\n } else if (rootLink?.worldTransform) {\n // Floating base: keep the authored stage placement.\n setMatrix(rootObj, rootLink.worldTransform);\n }\n this.add(rootObj);\n }\n\n private attachTreeEdges(): void {\n for (const linkKey of this.tree.order) {\n const node = this.tree.nodes[linkKey];\n if (!node || node.parent === null || node.jointToParent === null) continue;\n\n const parentObj = this.linkObjects.get(node.parent);\n const childObj = this.linkObjects.get(linkKey);\n const joint = this.robot.joints[node.jointToParent];\n if (!parentObj || !childObj || !joint) continue;\n\n this.attachJointChain(parentObj, childObj, node.jointToParent, joint);\n }\n }\n\n /** Build `parent → frame0 → motion → frame1⁻¹ → child` for one joint. */\n private attachJointChain(\n parent: LinkObject,\n child: LinkObject,\n jointKey: string,\n joint: JointDescription,\n ): void {\n const frame0 = new THREE.Group();\n frame0.name = `${joint.name}:frame0`;\n setMatrix(frame0, joint.jointFrame0);\n\n const motion = new JointObject(joint);\n\n const frame1Inv = new THREE.Group();\n frame1Inv.name = `${joint.name}:frame1Inv`;\n setMatrix(frame1Inv, invert(joint.jointFrame1));\n\n parent.add(frame0);\n frame0.add(motion);\n motion.add(frame1Inv);\n frame1Inv.add(child);\n\n this.jointObjects.set(jointKey, motion);\n }\n\n private attachIsolatedLinks(): void {\n for (const key of this.tree.isolatedLinks) {\n const obj = this.linkObjects.get(key);\n if (!obj || obj.parent) continue;\n // Not placeable by any joint chain — keep the authored stage placement\n // (other machines / free bodies on a multi-articulation stage).\n const worldTransform = this.robot.links[key]?.worldTransform;\n if (worldTransform) setMatrix(obj, worldTransform);\n this.add(obj);\n }\n }\n\n // -- Naming --------------------------------------------------------------\n\n /** Resolve a link reference — key or full prim path — to the extractor key. */\n private linkKey(ref: string): string {\n if (this.linkObjects.has(ref)) return ref;\n return this.linkKeyByPath.get(ref) ?? ref;\n }\n\n /** Resolve a joint reference — key or full prim path — to the extractor key. */\n private jointKey(ref: string): string {\n if (this.jointObjects.has(ref)) return ref;\n return this.jointKeyByPath.get(ref) ?? ref;\n }\n\n // -- Joint control -------------------------------------------------------\n\n /**\n * Set one joint value, addressed by key or full prim path. Unknown joints\n * are ignored. Returns whether it applied.\n */\n setJointValue(name: string, value: number): boolean {\n const joint = this.jointObjects.get(this.jointKey(name));\n if (!joint) return false;\n joint.setValue(value, this.clampJointLimits);\n this.dirty = true;\n return true;\n }\n\n /** Set several joint values at once (matrix update is coalesced). */\n setJointValues(values: Record<string, number>): void {\n for (const [name, value] of Object.entries(values)) {\n const joint = this.jointObjects.get(this.jointKey(name));\n if (joint) {\n joint.setValue(value, this.clampJointLimits);\n this.dirty = true;\n }\n }\n }\n\n getJointValue(name: string): number | undefined {\n return this.jointObjects.get(this.jointKey(name))?.value;\n }\n\n /** Recompute world matrices. Called lazily by the getters; safe to call directly. */\n updateKinematics(): void {\n this.updateMatrixWorld(true);\n this.dirty = false;\n }\n\n private ensureUpdated(): void {\n if (this.dirty) this.updateKinematics();\n }\n\n // -- Queries -------------------------------------------------------------\n\n /** World matrix of a link, addressed by key or full prim path. */\n getLinkWorldMatrix(name: string): THREE.Matrix4 {\n const obj = this.linkObjects.get(this.linkKey(name));\n if (!obj) throw new Error(`unknown link \"${name}\"`);\n this.ensureUpdated();\n return obj.matrixWorld.clone();\n }\n\n getLinkWorldPosition(name: string): THREE.Vector3 {\n return new THREE.Vector3().setFromMatrixPosition(this.getLinkWorldMatrix(name));\n }\n\n /** Link object by key or full prim path. */\n getLinkObject(name: string): LinkObject | undefined {\n return this.linkObjects.get(this.linkKey(name));\n }\n\n /** Joint object by key or full prim path. */\n getJointObject(name: string): JointObject | undefined {\n return this.jointObjects.get(this.jointKey(name));\n }\n\n /**\n * Table of link prim path → {@link LinkObject}. Prim paths are the\n * collision-proof way to pin a link (e.g. to attach tools or gizmos).\n */\n getLinkObjectsByPath(): Map<string, LinkObject> {\n const out = new Map<string, LinkObject>();\n for (const [path, key] of this.linkKeyByPath) {\n const obj = this.linkObjects.get(key);\n if (obj) out.set(path, obj);\n }\n return out;\n }\n\n /**\n * Table of joint prim path → {@link JointObject}, covering the joints\n * realized in the kinematic tree (loop joints have no motion node).\n */\n getJointObjectsByPath(): Map<string, JointObject> {\n const out = new Map<string, JointObject>();\n for (const [path, key] of this.jointKeyByPath) {\n const obj = this.jointObjects.get(key);\n if (obj) out.set(path, obj);\n }\n return out;\n }\n\n getJoints(): JointDescription[] {\n return Object.values(this.robot.joints);\n }\n\n getLinks(): LinkDescription[] {\n return Object.values(this.robot.links);\n }\n\n /** Names of the articulated (controllable) joints. */\n getJointNames(): string[] {\n return [...this.jointObjects.keys()];\n }\n\n getLinkNames(): string[] {\n return [...this.linkObjects.keys()];\n }\n\n getKinematicTree(): KinematicTree {\n return this.tree;\n }\n\n /** Authored stage up-axis (`\"Y\"` or `\"Z\"`) — unaffected by `worldUp` normalization. */\n get upAxis(): \"Y\" | \"Z\" {\n return this.robot.upAxis;\n }\n\n /** Authored stage scale in meters per unit (already applied to the root). */\n get metersPerUnit(): number {\n return this.robot.metersPerUnit;\n }\n\n // -- Animation playback --------------------------------------------------\n\n /** Playback rate in time codes per second (from the stage; default 24). */\n getTimeCodesPerSecond(): number {\n return this.robot.timeCodesPerSecond ?? 24;\n }\n\n /** Whether any joint has a time-sampled trajectory. */\n hasAnimation(): boolean {\n return Object.values(this.robot.joints).some((j) => j.valueSamples !== undefined);\n }\n\n /**\n * Animation range in time codes: the union of authored joint sample ranges,\n * falling back to the stage `startTimeCode`/`endTimeCode`. `null` if neither.\n */\n getTimeRange(): { start: number; end: number } | null {\n let start = Number.POSITIVE_INFINITY;\n let end = Number.NEGATIVE_INFINITY;\n for (const joint of Object.values(this.robot.joints)) {\n const times = joint.valueSamples?.times;\n if (!times || times.length === 0) continue;\n start = Math.min(start, times[0]!);\n end = Math.max(end, times[times.length - 1]!);\n }\n if (start <= end) return { start, end };\n\n const { startTimeCode, endTimeCode } = this.robot;\n if (startTimeCode !== undefined && endTimeCode !== undefined) {\n return { start: startTimeCode, end: endTimeCode };\n }\n return null;\n }\n\n /** Sample every animated joint at time code `t` and apply the values. */\n setTime(t: number): void {\n for (const [key, joint] of Object.entries(this.robot.joints)) {\n if (joint.valueSamples) this.setJointValue(key, interpolate(joint.valueSamples, t));\n }\n }\n\n // -- Display toggles -----------------------------------------------------\n\n get showVisual(): boolean {\n return this._showVisual;\n }\n set showVisual(v: boolean) {\n this._showVisual = v;\n this.setKindVisibility(\"visual\", v);\n }\n\n get showCollision(): boolean {\n return this._showCollision;\n }\n set showCollision(v: boolean) {\n this._showCollision = v;\n this.setKindVisibility(\"collision\", v);\n }\n\n get showJointAxes(): boolean {\n return this._showJointAxes;\n }\n set showJointAxes(v: boolean) {\n this._showJointAxes = v;\n if (v && this.jointAxesHelpers.length === 0) {\n for (const joint of this.jointObjects.values()) {\n const h = new THREE.AxesHelper(this.helperSize);\n h.name = `${joint.jointName}:axes`;\n joint.add(h);\n this.jointAxesHelpers.push(h);\n }\n }\n for (const h of this.jointAxesHelpers) h.visible = v;\n }\n\n get showLinkFrames(): boolean {\n return this._showLinkFrames;\n }\n set showLinkFrames(v: boolean) {\n this._showLinkFrames = v;\n if (v && this.linkFrameHelpers.length === 0) {\n for (const link of this.linkObjects.values()) {\n const h = new THREE.AxesHelper(this.helperSize);\n h.name = `${link.linkName}:frame`;\n link.add(h);\n this.linkFrameHelpers.push(h);\n }\n }\n for (const h of this.linkFrameHelpers) h.visible = v;\n }\n\n private setKindVisibility(kind: string, visible: boolean): void {\n this.traverse((o) => {\n if ((o.userData as { kind?: string }).kind === kind) o.visible = visible;\n });\n }\n}\n\n/** Assign a fixed local matrix to an object (disables Three.js auto-update). */\nfunction setMatrix(obj: THREE.Object3D, m: Mat4): void {\n obj.matrixAutoUpdate = false;\n obj.matrix.fromArray(m);\n obj.matrixWorldNeedsUpdate = true;\n}\n"]}
|