@driftengine/assets 3.61.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/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +9 -0
- package/dist/assetPath.d.ts +51 -0
- package/dist/assetPath.js +59 -0
- package/dist/coarseLevel.d.ts +94 -0
- package/dist/coarseLevel.js +606 -0
- package/dist/dds.d.ts +41 -0
- package/dist/dds.js +425 -0
- package/dist/drawKey.d.ts +64 -0
- package/dist/drawKey.js +42 -0
- package/dist/drftLoader.d.ts +420 -0
- package/dist/drftLoader.js +996 -0
- package/dist/drftTextures.d.ts +87 -0
- package/dist/drftTextures.js +138 -0
- package/dist/fbx.d.ts +86 -0
- package/dist/fbx.js +792 -0
- package/dist/fbxHarness.d.ts +68 -0
- package/dist/fbxHarness.js +185 -0
- package/dist/fbxInflate.d.ts +60 -0
- package/dist/fbxInflate.js +204 -0
- package/dist/fbxMaterial.d.ts +87 -0
- package/dist/fbxMaterial.js +345 -0
- package/dist/fbxRig.d.ts +130 -0
- package/dist/fbxRig.js +601 -0
- package/dist/gltf.d.ts +242 -0
- package/dist/gltf.js +904 -0
- package/dist/gltfAccessor.d.ts +2 -0
- package/dist/gltfAccessor.js +106 -0
- package/dist/gltfSkin.d.ts +32 -0
- package/dist/gltfSkin.js +144 -0
- package/dist/iesPhotometry.d.ts +44 -0
- package/dist/iesPhotometry.js +94 -0
- package/dist/imageInfo.d.ts +31 -0
- package/dist/imageInfo.js +119 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +132 -0
- package/dist/kn5.d.ts +158 -0
- package/dist/kn5.js +557 -0
- package/dist/loadProgress.d.ts +118 -0
- package/dist/loadProgress.js +1 -0
- package/dist/localise.d.ts +35 -0
- package/dist/localise.js +253 -0
- package/dist/obj.d.ts +54 -0
- package/dist/obj.js +335 -0
- package/dist/orient.d.ts +104 -0
- package/dist/orient.js +241 -0
- package/dist/radianceHdr.d.ts +36 -0
- package/dist/radianceHdr.js +172 -0
- package/dist/readModel.d.ts +153 -0
- package/dist/readModel.js +386 -0
- package/dist/recognise.d.ts +38 -0
- package/dist/recognise.js +97 -0
- package/dist/stl.d.ts +22 -0
- package/dist/stl.js +131 -0
- package/dist/tangentOrder.d.ts +24 -0
- package/dist/tangentOrder.js +31 -0
- package/dist/threemf.d.ts +46 -0
- package/dist/threemf.js +254 -0
- package/dist/uploadBudget.d.ts +82 -0
- package/dist/uploadBudget.js +86 -0
- package/dist/usd.d.ts +49 -0
- package/dist/usd.js +542 -0
- package/dist/weld.d.ts +44 -0
- package/dist/weld.js +237 -0
- package/dist/zip.d.ts +35 -0
- package/dist/zip.js +110 -0
- package/package.json +61 -0
- package/src/assetPath.ts +79 -0
- package/src/coarseLevel.ts +720 -0
- package/src/dds.ts +507 -0
- package/src/drawKey.ts +91 -0
- package/src/drftLoader.ts +1197 -0
- package/src/drftTextures.ts +153 -0
- package/src/fbx.ts +934 -0
- package/src/fbxHarness.ts +215 -0
- package/src/fbxInflate.ts +258 -0
- package/src/fbxMaterial.ts +410 -0
- package/src/fbxRig.ts +652 -0
- package/src/gltf.ts +1161 -0
- package/src/gltfAccessor.ts +127 -0
- package/src/gltfSkin.ts +210 -0
- package/src/iesPhotometry.ts +136 -0
- package/src/imageInfo.ts +130 -0
- package/src/index.ts +162 -0
- package/src/kn5.ts +705 -0
- package/src/loadProgress.ts +131 -0
- package/src/localise.ts +275 -0
- package/src/obj.ts +386 -0
- package/src/orient.ts +262 -0
- package/src/radianceHdr.ts +195 -0
- package/src/readModel.ts +515 -0
- package/src/recognise.ts +124 -0
- package/src/stl.ts +147 -0
- package/src/tangentOrder.ts +32 -0
- package/src/threemf.ts +303 -0
- package/src/uploadBudget.ts +90 -0
- package/src/usd.ts +642 -0
- package/src/weld.ts +264 -0
- package/src/zip.ts +130 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*! DriftEngine | Copyright 2026 Drift Technologies | Apache-2.0 | https://github.com/drftrun/driftengine */
|
|
2
|
+
/**
|
|
3
|
+
* Reading a model, and getting it onto the GPU.
|
|
4
|
+
*
|
|
5
|
+
* Separate from `@driftengine/drft` because these need a renderer: the loader uploads, and
|
|
6
|
+
* the readers exist to produce something the loader can upload. A procedurally generated
|
|
7
|
+
* world imports none of this and pays for none of it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* And the whole load as one object: streamed, uploaded within a per-frame budget, faded in, and
|
|
12
|
+
* merged down to one draw per material at the end. What it reports is *phases as data* — a
|
|
13
|
+
* consumer writes the words, because what to call a stage is a decision about an audience.
|
|
14
|
+
*/
|
|
15
|
+
export { DrftLoader } from './drftLoader.ts';
|
|
16
|
+
export type { DrftFit, DrftLoaderOptions } from './drftLoader.ts';
|
|
17
|
+
/*
|
|
18
|
+
* The loader's own draw-call grouping, exported because a consumer counting draws needs it and was
|
|
19
|
+
* keeping a copy that could not be kept in step. See `drawKey.ts`.
|
|
20
|
+
*/
|
|
21
|
+
export { drawKeyOf, resolveDrawGrouping } from './drawKey.ts';
|
|
22
|
+
export type { DrawGrouping, DrawSurfaceOverride } from './drawKey.ts';
|
|
23
|
+
export type { DrftLoadPhase, DrftLoadProgress, DrftPart } from './loadProgress.ts';
|
|
24
|
+
/* Addressing a texture by name, so a consumer never holds an ordinal. */
|
|
25
|
+
export { TextureSet, textureColorSpaces } from './drftTextures.ts';
|
|
26
|
+
export { assetCandidates, basenameOf } from './assetPath.ts';
|
|
27
|
+
/* An image identified from its own header, because a declared mime type is optional in glTF
|
|
28
|
+
and wrong often enough that reading the bytes is the only reliable answer. */
|
|
29
|
+
export { describeImage } from './imageInfo.ts';
|
|
30
|
+
export type { ImageInfo } from './imageInfo.ts';
|
|
31
|
+
export type { AssetReference } from './assetPath.ts';
|
|
32
|
+
export { readGlb, gltfToMeshes } from './gltf.ts';
|
|
33
|
+
export type { GltfDocument } from './gltf.ts';
|
|
34
|
+
export { parseObj, parseMtl } from './obj.ts';
|
|
35
|
+
export { parseStl } from './stl.ts';
|
|
36
|
+
/*
|
|
37
|
+
* Radiance RGBE, for an environment a scene did not photograph.
|
|
38
|
+
*
|
|
39
|
+
* Opt-in on exactly the terms SDF text is: a consumer that never loads an environment never
|
|
40
|
+
* imports this, ships none of it, and the engine still carries no image of its own. That is what
|
|
41
|
+
* keeps the zero-texture-files rule met on its own terms rather than waived.
|
|
42
|
+
*/
|
|
43
|
+
export { readRadianceHdr } from './radianceHdr.ts';
|
|
44
|
+
/* IESNA LM-63, on the same opt-in terms: a consumer that loads no profile ships no parser. */
|
|
45
|
+
export { readIesProfile } from './iesPhotometry.ts';
|
|
46
|
+
export type { IesProfile } from './iesPhotometry.ts';
|
|
47
|
+
export type { RadianceImage } from './radianceHdr.ts';
|
|
48
|
+
export type { StlAppearance } from './stl.ts';
|
|
49
|
+
/*
|
|
50
|
+
* The zip-container formats and the recognise-only tier, exported for the same reason as
|
|
51
|
+
* the readers above: every one of them is pure, takes its decompressor as a parameter and
|
|
52
|
+
* touches no filesystem, so a consumer that wants to open a dropped file in a worker can.
|
|
53
|
+
* See docs/FORMAT.md §3.3 for what that costs and why it is not the default.
|
|
54
|
+
*/
|
|
55
|
+
export { parseUsda, usdzToMeshes } from './usd.ts';
|
|
56
|
+
export type { UsdResult } from './usd.ts';
|
|
57
|
+
export { parseThreeMfModel, threeMfToMeshes } from './threemf.ts';
|
|
58
|
+
export type { ThreeMfResult } from './threemf.ts';
|
|
59
|
+
export { readZip, findEntry } from './zip.ts';
|
|
60
|
+
export type { ZipEntry } from './zip.ts';
|
|
61
|
+
export { recognise, describeRecognised } from './recognise.ts';
|
|
62
|
+
export type { Recognised } from './recognise.ts';
|
|
63
|
+
export { fbxToMeshes } from './fbx.ts';
|
|
64
|
+
export type { Inflate } from './fbx.ts';
|
|
65
|
+
/*
|
|
66
|
+
* One dispatcher from a file to meshes, so a browser and the baker cannot disagree about which
|
|
67
|
+
* reader a `.glb` needs. Every capability it may want is a parameter: the filesystem, the two
|
|
68
|
+
* decompressors and the resolution of a name a file states are all the caller's to supply.
|
|
69
|
+
*/
|
|
70
|
+
export { readModel, readerFor, extensionOf, MODEL_FORMATS } from './readModel.ts';
|
|
71
|
+
export type { ModelSource, ModelImport } from './readModel.ts';
|
|
72
|
+
/*
|
|
73
|
+
* The browser's decompressor, and the two-pass trick that makes an async one usable by a
|
|
74
|
+
* synchronous parser. `DecompressionStream` is all a page has and it only works as a stream, so
|
|
75
|
+
* every compressed span is recorded on one walk, expanded concurrently, and looked up on the
|
|
76
|
+
* next. See `fbxInflate.ts` for why neither making the reader async nor shipping a DEFLATE
|
|
77
|
+
* implementation was the answer.
|
|
78
|
+
*/
|
|
79
|
+
export {
|
|
80
|
+
browserInflate,
|
|
81
|
+
browserInflateRaw,
|
|
82
|
+
prepareFbxInflate,
|
|
83
|
+
prepareZipInflate,
|
|
84
|
+
} from './fbxInflate.ts';
|
|
85
|
+
export type { AsyncInflate } from './fbxInflate.ts';
|
|
86
|
+
/*
|
|
87
|
+
* Turning what a reader produced into what the GPU wants: one vertex per distinct corner, and
|
|
88
|
+
* no array holding one repeated number. An importer emits a vertex per triangle corner, which
|
|
89
|
+
* on a real asset is roughly six times more than the model has.
|
|
90
|
+
*/
|
|
91
|
+
export { weldMesh, dropDefaultAttributes } from './weld.ts';
|
|
92
|
+
/*
|
|
93
|
+
* The frame is derived after the weld and not inside a reader, for the reason `tangentOrder.ts`
|
|
94
|
+
* measures: a soup carrying a frame per corner has nothing left to merge.
|
|
95
|
+
*/
|
|
96
|
+
export { deriveTangentsFor } from './tangentOrder.ts';
|
|
97
|
+
/*
|
|
98
|
+
* One coarse mesh standing in for a whole asset, so a load can open on an outline rather than on
|
|
99
|
+
* nothing. Baked, because a coarse model has to exist as geometry before it can be drawn, and
|
|
100
|
+
* built for the whole subject at once: a decimated body reads as a car, 187 coarse parts do not.
|
|
101
|
+
*/
|
|
102
|
+
export { buildCoarseLevel, isOutlineWorthWriting, DEFAULT_COARSE_CELLS } from './coarseLevel.ts';
|
|
103
|
+
export type { CoarseLevelOptions } from './coarseLevel.ts';
|
|
104
|
+
/*
|
|
105
|
+
* Which way is up, applied as one format-agnostic turn on the shared intermediate. Told rather
|
|
106
|
+
* than guessed: every rule for measuring it from the geometry is wrong on something ordinary,
|
|
107
|
+
* and guessing is what put a car upside down and reported it as verified.
|
|
108
|
+
*/
|
|
109
|
+
export { orientMeshes, parseUpAxis, describeUpAxis } from './orient.ts';
|
|
110
|
+
export type { UpAxis } from './orient.ts';
|
|
111
|
+
|
|
112
|
+
/* Skins and clips out of a glTF document. See the module for why it is not part of `gltf.ts`. */
|
|
113
|
+
export { readGltfSkins } from './gltfSkin.ts';
|
|
114
|
+
export type { GltfAnimated, GltfSkin } from './gltfSkin.ts';
|
|
115
|
+
|
|
116
|
+
/*
|
|
117
|
+
* The tier 2 vehicle-container reader is deliberately **not** re-exported here.
|
|
118
|
+
*
|
|
119
|
+
* The barrel is the documented public surface, and `readModel` is how every format in this
|
|
120
|
+
* directory is meant to be reached: it dispatches by content, applies the orientation and
|
|
121
|
+
* handedness the file declared, and returns one shape whichever reader answered. Exporting a
|
|
122
|
+
* single format's entry point would document a second way in that no consumer needs, and this
|
|
123
|
+
* one has a further reason to stay behind the dispatcher. `scripts/kn5-check.mjs` imports the
|
|
124
|
+
* module directly, which is what an in-repo probe is for.
|
|
125
|
+
*/
|
|
126
|
+
/*
|
|
127
|
+
* The mirror an up-axis rotation deliberately cannot express, kept beside the rotations so the
|
|
128
|
+
* next left-handed format gets the same conversion instead of writing its own.
|
|
129
|
+
*/
|
|
130
|
+
export { convertHandedness } from './orient.ts';
|
|
131
|
+
export type { Handedness } from './orient.ts';
|
|
132
|
+
/*
|
|
133
|
+
* The hierarchy's half of the up-axis turn. Kept beside `orientMeshes` because calling one
|
|
134
|
+
* without the other leaves a file whose graph and geometry disagree about where every part is.
|
|
135
|
+
*/
|
|
136
|
+
export { orientNodes } from './orient.ts';
|
|
137
|
+
/*
|
|
138
|
+
* And the hierarchy's half of a mirror, which is the same pairing one step further out: a format
|
|
139
|
+
* that declares itself left-handed gets `convertHandedness` over its meshes and this over its
|
|
140
|
+
* graph, or the two desynchronise while each stays individually well formed.
|
|
141
|
+
*/
|
|
142
|
+
export { mirrorNodes } from './orient.ts';
|
|
143
|
+
/*
|
|
144
|
+
* **World-space meshes into parts a consumer can turn, and `docs/HANDBOOK.md` §10.1 has told
|
|
145
|
+
* people to import it from here since it was written.** It was not exported, so the one consumer
|
|
146
|
+
* that followed the handbook reached the module by sub-path — the exception this repository
|
|
147
|
+
* reserves for the chemistry library — and `scripts/docs.test.mjs` now checks every import the
|
|
148
|
+
* documentation prints against the barrel it names.
|
|
149
|
+
*/
|
|
150
|
+
export { localiseNodes } from './localise.ts';
|
|
151
|
+
export type { Localised } from './localise.ts';
|
|
152
|
+
/*
|
|
153
|
+
* The collision hull a vehicle folder ships beside its model, found by convention so a consumer
|
|
154
|
+
* does not have to know the convention.
|
|
155
|
+
*/
|
|
156
|
+
export { colliderBeside, levelsBeside } from './readModel.ts';
|
|
157
|
+
/*
|
|
158
|
+
* DDS block decoding, for the block-compressed textures a vehicle model carries. Baker work: RGBA
|
|
159
|
+
* is larger than the source and nothing ships a block decoder into a frame.
|
|
160
|
+
*/
|
|
161
|
+
export { ddsToRgba, isDds } from './dds.ts';
|
|
162
|
+
export type { DdsImage } from './dds.ts';
|