@onerjs/loaders 8.56.1 → 8.56.2
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/SPLAT/gaussianSplattingStream.d.ts +31 -0
- package/SPLAT/gaussianSplattingStream.js +49 -0
- package/SPLAT/gaussianSplattingStream.js.map +1 -1
- package/USD/index.d.ts +2 -0
- package/USD/index.js +4 -0
- package/USD/index.js.map +1 -0
- package/USD/pure.d.ts +3 -0
- package/USD/pure.js +5 -0
- package/USD/pure.js.map +1 -0
- package/USD/usdCommandProtocol.d.ts +83 -0
- package/USD/usdCommandProtocol.js +173 -0
- package/USD/usdCommandProtocol.js.map +1 -0
- package/USD/usdFileLoader.d.ts +6 -0
- package/USD/usdFileLoader.js +9 -0
- package/USD/usdFileLoader.js.map +1 -0
- package/USD/usdFileLoader.metadata.d.ts +20 -0
- package/USD/usdFileLoader.metadata.js +18 -0
- package/USD/usdFileLoader.metadata.js.map +1 -0
- package/USD/usdFileLoader.pure.d.ts +102 -0
- package/USD/usdFileLoader.pure.js +341 -0
- package/USD/usdFileLoader.pure.js.map +1 -0
- package/USD/usdFileLoader.types.d.ts +11 -0
- package/USD/usdFileLoader.types.js +2 -0
- package/USD/usdFileLoader.types.js.map +1 -0
- package/USD/usdLoadingOptions.d.ts +123 -0
- package/USD/usdLoadingOptions.js +3 -0
- package/USD/usdLoadingOptions.js.map +1 -0
- package/USD/usdSceneMaterializer.d.ts +9 -0
- package/USD/usdSceneMaterializer.js +982 -0
- package/USD/usdSceneMaterializer.js.map +1 -0
- package/USD/usdWorkerMessages.d.ts +57 -0
- package/USD/usdWorkerMessages.js +3 -0
- package/USD/usdWorkerMessages.js.map +1 -0
- package/dynamic.js +10 -0
- package/dynamic.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/pure.d.ts +1 -0
- package/pure.js +1 -0
- package/pure.js.map +1 -1
package/USD/index.d.ts
ADDED
package/USD/index.js
ADDED
package/USD/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/loaders/src/USD/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\nexport * from \"./usdFileLoader\";\nexport * from \"./usdLoadingOptions\";\n"]}
|
package/USD/pure.d.ts
ADDED
package/USD/pure.js
ADDED
package/USD/pure.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../dev/loaders/src/USD/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,6DAA6D;AAC7D,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\n/* eslint-disable @typescript-eslint/no-restricted-imports */\nexport * from \"./usdFileLoader.pure\";\nexport * from \"./usdLoadingOptions\";\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export declare const COMMAND_MAGIC = 1111774037;
|
|
2
|
+
export declare const PROTOCOL_VERSION = 5;
|
|
3
|
+
export declare const MISSING_OFFSET = 4294967295;
|
|
4
|
+
export declare const enum Command {
|
|
5
|
+
Scene = 1,
|
|
6
|
+
Texture = 2,
|
|
7
|
+
Material = 3,
|
|
8
|
+
TransformNode = 4,
|
|
9
|
+
Skeleton = 5,
|
|
10
|
+
Geometry = 6,
|
|
11
|
+
Mesh = 7,
|
|
12
|
+
Instance = 8,
|
|
13
|
+
Animation = 9,
|
|
14
|
+
AnalyticPrimitive = 10,
|
|
15
|
+
ThinInstances = 11,
|
|
16
|
+
MorphTarget = 12
|
|
17
|
+
}
|
|
18
|
+
export declare const enum AnalyticPrimitiveType {
|
|
19
|
+
Cube = 0,
|
|
20
|
+
Sphere = 1,
|
|
21
|
+
Cylinder = 2,
|
|
22
|
+
Cone = 3
|
|
23
|
+
}
|
|
24
|
+
export declare const enum PrimitiveAxis {
|
|
25
|
+
X = 0,
|
|
26
|
+
Y = 1,
|
|
27
|
+
Z = 2
|
|
28
|
+
}
|
|
29
|
+
export declare const enum AnimationTarget {
|
|
30
|
+
Node = 0,
|
|
31
|
+
Bone = 1,
|
|
32
|
+
MorphTarget = 2
|
|
33
|
+
}
|
|
34
|
+
export declare const enum AnimationProperty {
|
|
35
|
+
Position = 0,
|
|
36
|
+
RotationQuaternion = 1,
|
|
37
|
+
Scaling = 2,
|
|
38
|
+
Matrix = 3,
|
|
39
|
+
Influence = 4
|
|
40
|
+
}
|
|
41
|
+
export declare const enum MaterialFlags {
|
|
42
|
+
DoubleSided = 1,
|
|
43
|
+
Unlit = 2,
|
|
44
|
+
AlphaBlend = 4
|
|
45
|
+
}
|
|
46
|
+
export declare const enum TextureOutputChannel {
|
|
47
|
+
R = 0,
|
|
48
|
+
G = 1,
|
|
49
|
+
B = 2,
|
|
50
|
+
A = 3,
|
|
51
|
+
RGB = 4
|
|
52
|
+
}
|
|
53
|
+
export declare const enum USDTextureColorSpace {
|
|
54
|
+
Auto = 0,
|
|
55
|
+
Raw = 1,
|
|
56
|
+
SRGB = 2
|
|
57
|
+
}
|
|
58
|
+
export declare const enum MeshFlags {
|
|
59
|
+
DoubleSided = 1,
|
|
60
|
+
LeftHanded = 2
|
|
61
|
+
}
|
|
62
|
+
export declare const enum GeometryFlags {
|
|
63
|
+
Normals = 1,
|
|
64
|
+
Tangents = 2,
|
|
65
|
+
Uv0 = 4,
|
|
66
|
+
Colors = 8,
|
|
67
|
+
Skin0 = 16,
|
|
68
|
+
Skin1 = 32
|
|
69
|
+
}
|
|
70
|
+
export interface CommandRecord {
|
|
71
|
+
opcode: Command;
|
|
72
|
+
flags: number;
|
|
73
|
+
payloadOffset: number;
|
|
74
|
+
payloadLength: number;
|
|
75
|
+
}
|
|
76
|
+
export declare function readCommands(buffer: ArrayBuffer): CommandRecord[];
|
|
77
|
+
export declare class PayloadReader {
|
|
78
|
+
#private;
|
|
79
|
+
offset: number;
|
|
80
|
+
constructor(buffer: ArrayBuffer, offset: number, length: number);
|
|
81
|
+
u32(): number;
|
|
82
|
+
f32(): number;
|
|
83
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
var _PayloadReader_instances, _PayloadReader_view, _PayloadReader_end, _PayloadReader_require;
|
|
3
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "@onerjs/core/tslib.es6.js";
|
|
4
|
+
export const COMMAND_MAGIC = 0x42445355;
|
|
5
|
+
export const PROTOCOL_VERSION = 5;
|
|
6
|
+
export const MISSING_OFFSET = 0xffffffff;
|
|
7
|
+
export var Command;
|
|
8
|
+
(function (Command) {
|
|
9
|
+
Command[Command["Scene"] = 1] = "Scene";
|
|
10
|
+
Command[Command["Texture"] = 2] = "Texture";
|
|
11
|
+
Command[Command["Material"] = 3] = "Material";
|
|
12
|
+
Command[Command["TransformNode"] = 4] = "TransformNode";
|
|
13
|
+
Command[Command["Skeleton"] = 5] = "Skeleton";
|
|
14
|
+
Command[Command["Geometry"] = 6] = "Geometry";
|
|
15
|
+
Command[Command["Mesh"] = 7] = "Mesh";
|
|
16
|
+
Command[Command["Instance"] = 8] = "Instance";
|
|
17
|
+
Command[Command["Animation"] = 9] = "Animation";
|
|
18
|
+
Command[Command["AnalyticPrimitive"] = 10] = "AnalyticPrimitive";
|
|
19
|
+
Command[Command["ThinInstances"] = 11] = "ThinInstances";
|
|
20
|
+
Command[Command["MorphTarget"] = 12] = "MorphTarget";
|
|
21
|
+
})(Command || (Command = {}));
|
|
22
|
+
export var AnalyticPrimitiveType;
|
|
23
|
+
(function (AnalyticPrimitiveType) {
|
|
24
|
+
AnalyticPrimitiveType[AnalyticPrimitiveType["Cube"] = 0] = "Cube";
|
|
25
|
+
AnalyticPrimitiveType[AnalyticPrimitiveType["Sphere"] = 1] = "Sphere";
|
|
26
|
+
AnalyticPrimitiveType[AnalyticPrimitiveType["Cylinder"] = 2] = "Cylinder";
|
|
27
|
+
AnalyticPrimitiveType[AnalyticPrimitiveType["Cone"] = 3] = "Cone";
|
|
28
|
+
})(AnalyticPrimitiveType || (AnalyticPrimitiveType = {}));
|
|
29
|
+
export var PrimitiveAxis;
|
|
30
|
+
(function (PrimitiveAxis) {
|
|
31
|
+
PrimitiveAxis[PrimitiveAxis["X"] = 0] = "X";
|
|
32
|
+
PrimitiveAxis[PrimitiveAxis["Y"] = 1] = "Y";
|
|
33
|
+
PrimitiveAxis[PrimitiveAxis["Z"] = 2] = "Z";
|
|
34
|
+
})(PrimitiveAxis || (PrimitiveAxis = {}));
|
|
35
|
+
export var AnimationTarget;
|
|
36
|
+
(function (AnimationTarget) {
|
|
37
|
+
AnimationTarget[AnimationTarget["Node"] = 0] = "Node";
|
|
38
|
+
AnimationTarget[AnimationTarget["Bone"] = 1] = "Bone";
|
|
39
|
+
AnimationTarget[AnimationTarget["MorphTarget"] = 2] = "MorphTarget";
|
|
40
|
+
})(AnimationTarget || (AnimationTarget = {}));
|
|
41
|
+
export var AnimationProperty;
|
|
42
|
+
(function (AnimationProperty) {
|
|
43
|
+
AnimationProperty[AnimationProperty["Position"] = 0] = "Position";
|
|
44
|
+
AnimationProperty[AnimationProperty["RotationQuaternion"] = 1] = "RotationQuaternion";
|
|
45
|
+
AnimationProperty[AnimationProperty["Scaling"] = 2] = "Scaling";
|
|
46
|
+
AnimationProperty[AnimationProperty["Matrix"] = 3] = "Matrix";
|
|
47
|
+
AnimationProperty[AnimationProperty["Influence"] = 4] = "Influence";
|
|
48
|
+
})(AnimationProperty || (AnimationProperty = {}));
|
|
49
|
+
export var MaterialFlags;
|
|
50
|
+
(function (MaterialFlags) {
|
|
51
|
+
MaterialFlags[MaterialFlags["DoubleSided"] = 1] = "DoubleSided";
|
|
52
|
+
MaterialFlags[MaterialFlags["Unlit"] = 2] = "Unlit";
|
|
53
|
+
MaterialFlags[MaterialFlags["AlphaBlend"] = 4] = "AlphaBlend";
|
|
54
|
+
})(MaterialFlags || (MaterialFlags = {}));
|
|
55
|
+
export var TextureOutputChannel;
|
|
56
|
+
(function (TextureOutputChannel) {
|
|
57
|
+
TextureOutputChannel[TextureOutputChannel["R"] = 0] = "R";
|
|
58
|
+
TextureOutputChannel[TextureOutputChannel["G"] = 1] = "G";
|
|
59
|
+
TextureOutputChannel[TextureOutputChannel["B"] = 2] = "B";
|
|
60
|
+
TextureOutputChannel[TextureOutputChannel["A"] = 3] = "A";
|
|
61
|
+
TextureOutputChannel[TextureOutputChannel["RGB"] = 4] = "RGB";
|
|
62
|
+
})(TextureOutputChannel || (TextureOutputChannel = {}));
|
|
63
|
+
export var USDTextureColorSpace;
|
|
64
|
+
(function (USDTextureColorSpace) {
|
|
65
|
+
USDTextureColorSpace[USDTextureColorSpace["Auto"] = 0] = "Auto";
|
|
66
|
+
USDTextureColorSpace[USDTextureColorSpace["Raw"] = 1] = "Raw";
|
|
67
|
+
USDTextureColorSpace[USDTextureColorSpace["SRGB"] = 2] = "SRGB";
|
|
68
|
+
})(USDTextureColorSpace || (USDTextureColorSpace = {}));
|
|
69
|
+
export var MeshFlags;
|
|
70
|
+
(function (MeshFlags) {
|
|
71
|
+
MeshFlags[MeshFlags["DoubleSided"] = 1] = "DoubleSided";
|
|
72
|
+
MeshFlags[MeshFlags["LeftHanded"] = 2] = "LeftHanded";
|
|
73
|
+
})(MeshFlags || (MeshFlags = {}));
|
|
74
|
+
export var GeometryFlags;
|
|
75
|
+
(function (GeometryFlags) {
|
|
76
|
+
GeometryFlags[GeometryFlags["Normals"] = 1] = "Normals";
|
|
77
|
+
GeometryFlags[GeometryFlags["Tangents"] = 2] = "Tangents";
|
|
78
|
+
GeometryFlags[GeometryFlags["Uv0"] = 4] = "Uv0";
|
|
79
|
+
GeometryFlags[GeometryFlags["Colors"] = 8] = "Colors";
|
|
80
|
+
GeometryFlags[GeometryFlags["Skin0"] = 16] = "Skin0";
|
|
81
|
+
GeometryFlags[GeometryFlags["Skin1"] = 32] = "Skin1";
|
|
82
|
+
})(GeometryFlags || (GeometryFlags = {}));
|
|
83
|
+
function expectedPayloadLength(opcode) {
|
|
84
|
+
switch (opcode) {
|
|
85
|
+
case 1 /* Command.Scene */:
|
|
86
|
+
return 12;
|
|
87
|
+
case 2 /* Command.Texture */:
|
|
88
|
+
return 48;
|
|
89
|
+
case 3 /* Command.Material */:
|
|
90
|
+
return 96;
|
|
91
|
+
case 4 /* Command.TransformNode */:
|
|
92
|
+
case 5 /* Command.Skeleton */:
|
|
93
|
+
return 20;
|
|
94
|
+
case 6 /* Command.Geometry */:
|
|
95
|
+
return 60;
|
|
96
|
+
case 7 /* Command.Mesh */:
|
|
97
|
+
return 40;
|
|
98
|
+
case 8 /* Command.Instance */:
|
|
99
|
+
return 16;
|
|
100
|
+
case 9 /* Command.Animation */:
|
|
101
|
+
return 32;
|
|
102
|
+
case 10 /* Command.AnalyticPrimitive */:
|
|
103
|
+
return 44;
|
|
104
|
+
case 11 /* Command.ThinInstances */:
|
|
105
|
+
return 12;
|
|
106
|
+
case 12 /* Command.MorphTarget */:
|
|
107
|
+
return 32;
|
|
108
|
+
default:
|
|
109
|
+
throw new Error(`Unknown OpenUSD Babylon command opcode ${opcode}.`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export function readCommands(buffer) {
|
|
113
|
+
const view = new DataView(buffer);
|
|
114
|
+
if (view.byteLength < 16 || view.getUint32(0, true) !== COMMAND_MAGIC) {
|
|
115
|
+
throw new Error("Invalid OpenUSD Babylon command buffer.");
|
|
116
|
+
}
|
|
117
|
+
if (view.getUint16(4, true) !== PROTOCOL_VERSION) {
|
|
118
|
+
throw new Error(`Unsupported OpenUSD Babylon protocol ${view.getUint16(4, true)}.`);
|
|
119
|
+
}
|
|
120
|
+
const count = view.getUint32(8, true);
|
|
121
|
+
const commands = [];
|
|
122
|
+
let offset = 16;
|
|
123
|
+
for (let index = 0; index < count; ++index) {
|
|
124
|
+
if (offset + 8 > view.byteLength) {
|
|
125
|
+
throw new Error("Truncated OpenUSD Babylon command header.");
|
|
126
|
+
}
|
|
127
|
+
const opcode = view.getUint16(offset, true);
|
|
128
|
+
const flags = view.getUint16(offset + 2, true);
|
|
129
|
+
const payloadLength = view.getUint32(offset + 4, true);
|
|
130
|
+
const payloadOffset = offset + 8;
|
|
131
|
+
const expectedLength = expectedPayloadLength(opcode);
|
|
132
|
+
if (payloadLength !== expectedLength) {
|
|
133
|
+
throw new Error(`Invalid payload length ${payloadLength} for command ${opcode}; ` + `expected ${expectedLength}.`);
|
|
134
|
+
}
|
|
135
|
+
if (payloadOffset + payloadLength > view.byteLength) {
|
|
136
|
+
throw new Error("Truncated OpenUSD Babylon command payload.");
|
|
137
|
+
}
|
|
138
|
+
commands.push({ opcode, flags, payloadOffset, payloadLength });
|
|
139
|
+
offset = payloadOffset + payloadLength;
|
|
140
|
+
}
|
|
141
|
+
if (offset !== view.byteLength) {
|
|
142
|
+
throw new Error("Unexpected trailing data in OpenUSD Babylon command buffer.");
|
|
143
|
+
}
|
|
144
|
+
return commands;
|
|
145
|
+
}
|
|
146
|
+
export class PayloadReader {
|
|
147
|
+
constructor(buffer, offset, length) {
|
|
148
|
+
_PayloadReader_instances.add(this);
|
|
149
|
+
_PayloadReader_view.set(this, void 0);
|
|
150
|
+
_PayloadReader_end.set(this, void 0);
|
|
151
|
+
__classPrivateFieldSet(this, _PayloadReader_view, new DataView(buffer), "f");
|
|
152
|
+
this.offset = offset;
|
|
153
|
+
__classPrivateFieldSet(this, _PayloadReader_end, offset + length, "f");
|
|
154
|
+
}
|
|
155
|
+
u32() {
|
|
156
|
+
__classPrivateFieldGet(this, _PayloadReader_instances, "m", _PayloadReader_require).call(this, 4);
|
|
157
|
+
const value = __classPrivateFieldGet(this, _PayloadReader_view, "f").getUint32(this.offset, true);
|
|
158
|
+
this.offset += 4;
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
f32() {
|
|
162
|
+
__classPrivateFieldGet(this, _PayloadReader_instances, "m", _PayloadReader_require).call(this, 4);
|
|
163
|
+
const value = __classPrivateFieldGet(this, _PayloadReader_view, "f").getFloat32(this.offset, true);
|
|
164
|
+
this.offset += 4;
|
|
165
|
+
return value;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
_PayloadReader_view = new WeakMap(), _PayloadReader_end = new WeakMap(), _PayloadReader_instances = new WeakSet(), _PayloadReader_require = function _PayloadReader_require(byteLength) {
|
|
169
|
+
if (this.offset + byteLength > __classPrivateFieldGet(this, _PayloadReader_end, "f")) {
|
|
170
|
+
throw new Error("OpenUSD Babylon command payload read exceeded its bounds.");
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=usdCommandProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usdCommandProtocol.js","sourceRoot":"","sources":["../../../../dev/loaders/src/USD/usdCommandProtocol.ts"],"names":[],"mappings":"AAAA,yDAAyD;;;AAEzD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;AACxC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,MAAM,CAAN,IAAkB,OAajB;AAbD,WAAkB,OAAO;IACrB,uCAAS,CAAA;IACT,2CAAW,CAAA;IACX,6CAAY,CAAA;IACZ,uDAAiB,CAAA;IACjB,6CAAY,CAAA;IACZ,6CAAY,CAAA;IACZ,qCAAQ,CAAA;IACR,6CAAY,CAAA;IACZ,+CAAa,CAAA;IACb,gEAAsB,CAAA;IACtB,wDAAkB,CAAA;IAClB,oDAAgB,CAAA;AACpB,CAAC,EAbiB,OAAO,KAAP,OAAO,QAaxB;AAED,MAAM,CAAN,IAAkB,qBAKjB;AALD,WAAkB,qBAAqB;IACnC,iEAAQ,CAAA;IACR,qE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,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,MAAM,OAAO,aAAa;IAKtB,YAAY,MAAmB,EAAE,MAAc,EAAE,MAAc;;QAJtD,sCAAgB;QAChB,qCAAa;QAIlB,uBAAA,IAAI,uBAAS,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAA,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,uBAAA,IAAI,sBAAQ,MAAM,GAAG,MAAM,MAAA,CAAC;IAChC,CAAC;IAED,GAAG;QACC,uBAAA,IAAI,wDAAS,MAAb,IAAI,EAAU,CAAC,CAAC,CAAC;QACjB,MAAM,KAAK,GAAG,uBAAA,IAAI,2BAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;QACjB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,GAAG;QACC,uBAAA,IAAI,wDAAS,MAAb,IAAI,EAAU,CAAC,CAAC,CAAC;QACjB,MAAM,KAAK,GAAG,uBAAA,IAAI,2BAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;QACjB,OAAO,KAAK,CAAC;IACjB,CAAC;CAOJ;4KALY,UAAkB;IACvB,IAAI,IAAI,CAAC,MAAM,GAAG,UAAU,GAAG,uBAAA,IAAI,0BAAK,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IACjF,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\nexport const COMMAND_MAGIC = 0x42445355;\nexport const PROTOCOL_VERSION = 5;\nexport const MISSING_OFFSET = 0xffffffff;\n\nexport const enum Command {\n Scene = 1,\n Texture = 2,\n Material = 3,\n TransformNode = 4,\n Skeleton = 5,\n Geometry = 6,\n Mesh = 7,\n Instance = 8,\n Animation = 9,\n AnalyticPrimitive = 10,\n ThinInstances = 11,\n MorphTarget = 12,\n}\n\nexport const enum AnalyticPrimitiveType {\n Cube = 0,\n Sphere = 1,\n Cylinder = 2,\n Cone = 3,\n}\n\nexport const enum PrimitiveAxis {\n X = 0,\n Y = 1,\n Z = 2,\n}\n\nexport const enum AnimationTarget {\n Node = 0,\n Bone = 1,\n MorphTarget = 2,\n}\n\nexport const enum AnimationProperty {\n Position = 0,\n RotationQuaternion = 1,\n Scaling = 2,\n Matrix = 3,\n Influence = 4,\n}\n\nexport const enum MaterialFlags {\n DoubleSided = 1 << 0,\n Unlit = 1 << 1,\n AlphaBlend = 1 << 2,\n}\n\nexport const enum TextureOutputChannel {\n R = 0,\n G = 1,\n B = 2,\n A = 3,\n RGB = 4,\n}\n\nexport const enum USDTextureColorSpace {\n Auto = 0,\n Raw = 1,\n SRGB = 2,\n}\n\nexport const enum MeshFlags {\n DoubleSided = 1 << 0,\n LeftHanded = 1 << 1,\n}\n\nexport const enum GeometryFlags {\n Normals = 1 << 0,\n Tangents = 1 << 1,\n Uv0 = 1 << 2,\n Colors = 1 << 3,\n Skin0 = 1 << 4,\n Skin1 = 1 << 5,\n}\n\nexport interface CommandRecord {\n opcode: Command;\n flags: number;\n payloadOffset: number;\n payloadLength: number;\n}\n\nfunction expectedPayloadLength(opcode: Command): number {\n switch (opcode) {\n case Command.Scene:\n return 12;\n case Command.Texture:\n return 48;\n case Command.Material:\n return 96;\n case Command.TransformNode:\n case Command.Skeleton:\n return 20;\n case Command.Geometry:\n return 60;\n case Command.Mesh:\n return 40;\n case Command.Instance:\n return 16;\n case Command.Animation:\n return 32;\n case Command.AnalyticPrimitive:\n return 44;\n case Command.ThinInstances:\n return 12;\n case Command.MorphTarget:\n return 32;\n default:\n throw new Error(`Unknown OpenUSD Babylon command opcode ${opcode}.`);\n }\n}\n\nexport function readCommands(buffer: ArrayBuffer): CommandRecord[] {\n const view = new DataView(buffer);\n if (view.byteLength < 16 || view.getUint32(0, true) !== COMMAND_MAGIC) {\n throw new Error(\"Invalid OpenUSD Babylon command buffer.\");\n }\n if (view.getUint16(4, true) !== PROTOCOL_VERSION) {\n throw new Error(`Unsupported OpenUSD Babylon protocol ${view.getUint16(4, true)}.`);\n }\n const count = view.getUint32(8, true);\n const commands: CommandRecord[] = [];\n let offset = 16;\n for (let index = 0; index < count; ++index) {\n if (offset + 8 > view.byteLength) {\n throw new Error(\"Truncated OpenUSD Babylon command header.\");\n }\n const opcode = view.getUint16(offset, true) as Command;\n const flags = view.getUint16(offset + 2, true);\n const payloadLength = view.getUint32(offset + 4, true);\n const payloadOffset = offset + 8;\n const expectedLength = expectedPayloadLength(opcode);\n if (payloadLength !== expectedLength) {\n throw new Error(`Invalid payload length ${payloadLength} for command ${opcode}; ` + `expected ${expectedLength}.`);\n }\n if (payloadOffset + payloadLength > view.byteLength) {\n throw new Error(\"Truncated OpenUSD Babylon command payload.\");\n }\n commands.push({ opcode, flags, payloadOffset, payloadLength });\n offset = payloadOffset + payloadLength;\n }\n if (offset !== view.byteLength) {\n throw new Error(\"Unexpected trailing data in OpenUSD Babylon command buffer.\");\n }\n return commands;\n}\n\nexport class PayloadReader {\n readonly #view: DataView;\n readonly #end: number;\n offset: number;\n\n constructor(buffer: ArrayBuffer, offset: number, length: number) {\n this.#view = new DataView(buffer);\n this.offset = offset;\n this.#end = offset + length;\n }\n\n u32(): number {\n this.#require(4);\n const value = this.#view.getUint32(this.offset, true);\n this.offset += 4;\n return value;\n }\n\n f32(): number {\n this.#require(4);\n const value = this.#view.getFloat32(this.offset, true);\n this.offset += 4;\n return value;\n }\n\n #require(byteLength: number): void {\n if (this.offset + byteLength > this.#end) {\n throw new Error(\"OpenUSD Babylon command payload read exceeded its bounds.\");\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
3
|
+
* Import "./usdFileLoader.pure" for tree-shakeable, side-effect-free usage.
|
|
4
|
+
*/
|
|
5
|
+
export * from "./usdFileLoader.types.js";
|
|
6
|
+
export * from "./usdFileLoader.pure.js";
|
|
7
|
+
import { RegisterUSDFileLoader } from "./usdFileLoader.pure.js";
|
|
8
|
+
RegisterUSDFileLoader();
|
|
9
|
+
//# sourceMappingURL=usdFileLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usdFileLoader.js","sourceRoot":"","sources":["../../../../dev/loaders/src/USD/usdFileLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,qBAAqB,EAAE,CAAC","sourcesContent":["/**\n * Re-exports the pure implementation and applies the runtime registration side effect.\n * Import \"./usdFileLoader.pure\" for tree-shakeable, side-effect-free usage.\n */\nexport * from \"./usdFileLoader.types\";\nexport * from \"./usdFileLoader.pure\";\n\nimport { RegisterUSDFileLoader } from \"./usdFileLoader.pure\";\nRegisterUSDFileLoader();\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the USD loader plugin metadata.
|
|
3
|
+
*/
|
|
4
|
+
export declare const USDFileLoaderMetadata: {
|
|
5
|
+
readonly name: "usd";
|
|
6
|
+
readonly extensions: {
|
|
7
|
+
readonly ".usd": {
|
|
8
|
+
readonly isBinary: true;
|
|
9
|
+
};
|
|
10
|
+
readonly ".usda": {
|
|
11
|
+
readonly isBinary: true;
|
|
12
|
+
};
|
|
13
|
+
readonly ".usdc": {
|
|
14
|
+
readonly isBinary: true;
|
|
15
|
+
};
|
|
16
|
+
readonly ".usdz": {
|
|
17
|
+
readonly isBinary: true;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
/**
|
|
3
|
+
* Defines the USD loader plugin metadata.
|
|
4
|
+
*/
|
|
5
|
+
export const USDFileLoaderMetadata = {
|
|
6
|
+
name: "usd",
|
|
7
|
+
extensions: {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
+
".usd": { isBinary: true },
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
+
".usda": { isBinary: true },
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
+
".usdc": { isBinary: true },
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
+
".usdz": { isBinary: true },
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=usdFileLoader.metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usdFileLoader.metadata.js","sourceRoot":"","sources":["../../../../dev/loaders/src/USD/usdFileLoader.metadata.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAIzD;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,IAAI,EAAE,KAAK;IACX,UAAU,EAAE;QACR,gEAAgE;QAChE,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1B,gEAAgE;QAChE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC3B,gEAAgE;QAChE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC3B,gEAAgE;QAChE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;KACkB;CACN,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { type ISceneLoaderPluginExtensions, type ISceneLoaderPluginMetadata } from \"core/Loading/sceneLoader\";\n\n/**\n * Defines the USD loader plugin metadata.\n */\nexport const USDFileLoaderMetadata = {\n name: \"usd\",\n extensions: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \".usd\": { isBinary: true },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \".usda\": { isBinary: true },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \".usdc\": { isBinary: true },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n \".usdz\": { isBinary: true },\n } as const satisfies ISceneLoaderPluginExtensions,\n} as const satisfies ISceneLoaderPluginMetadata;\n"]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/** This file must only contain pure code and pure imports */
|
|
2
|
+
import { AssetContainer } from "@onerjs/core/assetContainer.js";
|
|
3
|
+
import { type ISceneLoaderAsyncResult, type ISceneLoaderPluginAsync, type ISceneLoaderPluginFactory, type ISceneLoaderProgressEvent, type SceneLoaderPluginOptions } from "@onerjs/core/Loading/sceneLoader.js";
|
|
4
|
+
import { type Scene } from "@onerjs/core/scene.pure.js";
|
|
5
|
+
import { type USDFileLoaderOptions } from "./usdLoadingOptions.js";
|
|
6
|
+
/**
|
|
7
|
+
* OpenUSD scene loader backed by a WebAssembly command-buffer extractor.
|
|
8
|
+
*/
|
|
9
|
+
export declare class USDFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
|
10
|
+
/**
|
|
11
|
+
* Default URLs for the prebuilt OpenUSD importer assets.
|
|
12
|
+
*/
|
|
13
|
+
static DefaultConfiguration: {
|
|
14
|
+
glueUrl: string;
|
|
15
|
+
wasmUrl: string;
|
|
16
|
+
dataUrl: string;
|
|
17
|
+
workerUrl: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Defines the name of the plugin.
|
|
21
|
+
*/
|
|
22
|
+
readonly name: "usd";
|
|
23
|
+
/**
|
|
24
|
+
* Defines the extensions the plugin can load.
|
|
25
|
+
*/
|
|
26
|
+
readonly extensions: {
|
|
27
|
+
readonly ".usd": {
|
|
28
|
+
readonly isBinary: true;
|
|
29
|
+
};
|
|
30
|
+
readonly ".usda": {
|
|
31
|
+
readonly isBinary: true;
|
|
32
|
+
};
|
|
33
|
+
readonly ".usdc": {
|
|
34
|
+
readonly isBinary: true;
|
|
35
|
+
};
|
|
36
|
+
readonly ".usdz": {
|
|
37
|
+
readonly isBinary: true;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
private readonly _options;
|
|
41
|
+
private _worker;
|
|
42
|
+
private _workerUrl;
|
|
43
|
+
private _workerBlobUrl;
|
|
44
|
+
private _nextRequestId;
|
|
45
|
+
private readonly _pending;
|
|
46
|
+
private readonly _activeLoads;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a USD loader.
|
|
49
|
+
* @param options Options controlling worker assets, supporting files, and diagnostics.
|
|
50
|
+
*/
|
|
51
|
+
constructor(options?: Partial<USDFileLoaderOptions>);
|
|
52
|
+
/**
|
|
53
|
+
* Creates a configured plugin instance for a SceneLoader operation.
|
|
54
|
+
* @param options SceneLoader plugin options.
|
|
55
|
+
* @returns The configured USD loader.
|
|
56
|
+
*/
|
|
57
|
+
createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync;
|
|
58
|
+
/**
|
|
59
|
+
* Imports all objects from a USD stage into a scene.
|
|
60
|
+
* @param _meshesNames Mesh name filtering is not currently supported.
|
|
61
|
+
* @param scene The scene receiving the imported objects.
|
|
62
|
+
* @param data The USD, USDA, USDC, or USDZ bytes.
|
|
63
|
+
* @param rootUrl The source root URL.
|
|
64
|
+
* @param onProgress SceneLoader progress callback.
|
|
65
|
+
* @param fileName Name of the root USD layer.
|
|
66
|
+
* @returns The imported Babylon.js objects.
|
|
67
|
+
*/
|
|
68
|
+
importMeshAsync(_meshesNames: string | readonly string[] | null | undefined, scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<ISceneLoaderAsyncResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Loads a USD stage into a scene.
|
|
71
|
+
* @param scene The scene receiving the imported objects.
|
|
72
|
+
* @param data The USD, USDA, USDC, or USDZ bytes.
|
|
73
|
+
* @param rootUrl The source root URL.
|
|
74
|
+
* @param onProgress SceneLoader progress callback.
|
|
75
|
+
* @param fileName Name of the root USD layer.
|
|
76
|
+
*/
|
|
77
|
+
loadAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Loads a USD stage into an asset container.
|
|
80
|
+
* @param scene The scene used to create imported objects.
|
|
81
|
+
* @param data The USD, USDA, USDC, or USDZ bytes.
|
|
82
|
+
* @param rootUrl The source root URL.
|
|
83
|
+
* @param onProgress SceneLoader progress callback.
|
|
84
|
+
* @param fileName Name of the root USD layer.
|
|
85
|
+
* @returns The populated asset container.
|
|
86
|
+
*/
|
|
87
|
+
loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
|
|
88
|
+
/**
|
|
89
|
+
* Releases the worker and rejects pending loads.
|
|
90
|
+
*/
|
|
91
|
+
dispose(): void;
|
|
92
|
+
private _loadAsync;
|
|
93
|
+
private _getWorker;
|
|
94
|
+
private _terminateWorker;
|
|
95
|
+
}
|
|
96
|
+
/** @internal */
|
|
97
|
+
export declare function _RegisterUSDLoaderDependencies(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Registers the USD scene loader plugin and its Babylon.js runtime dependencies.
|
|
100
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
101
|
+
*/
|
|
102
|
+
export declare function RegisterUSDFileLoader(): void;
|