Content

Model loading

181 symbols, imported from @driftengine/assets.

Explained in Importing models.

Classes

Animation
Everything that animates a datablock: its active action, then its NLA tracks bottom to top.
BlendData
A parsed file: its blocks, its catalogue, and the maps from an address to a block.
BlendNeedsBlender
Thrown when a .blend holds something only Blender can evaluate, with each thing named.
BlendStruct
One struct in the file, read by field name.
DrftLoader
A .drft loaded progressively: the model builds up on screen instead of appearing.
TextureSet

Interfaces

AssetReference
A texture a model named, with its bytes when the model carried them inline.
BlendBlock
One block: a run of count structs of catalogue type sdna, at offset in the file.
BlendColorLayer
BlendGltf
BlendHeader
What the first bytes say, before any block is read.
BlendMeshData
BlendPlaced
One drawn object, or an empty that carries others, at its place in the world.
BlendPrimitive
BlendSurface
A material's surface, channel by channel. Factors multiply the map where there is one.
ChannelInput
ChannelSource
A channel of an image, as a socket reads it.
ClusterDag
ClusterLevel
ClusterOptions
ClusterSet
CoarseLevelOptions
Curve
One keyframed property of one animated datablock.
DdsImage
What a decoded surface is: level 0, RGBA, eight bits a channel.
DnaField
One field of a catalogued struct, with its offset already summed.
DnaStruct
DrawGrouping
The fields a merged group carries, resolved from a material and its override.
DrawSurfaceOverride
The override DrftLoaderOptions.surface may return for a material.
DrftFieldPlacement
One field, where it stands.
DrftLoaderOptions
DrftLoadProgress
How far a load has got, and every field here now answers about the picture rather than about the work.
DrftPart
DtexTiles
Where each tile's bytes sit in the latent payload, and what they hash to.
EncodedMaterial
EncodeMaterialOptions
GltfAnimated
GltfDocument
GltfSkin
Skins and animations out of a glTF document, sorted into the order a palette can be resolved in.
IesProfile
A fixture's measured intensity, as a grid over vertical and horizontal angles.
ImageInfo
What an image is, from its own first bytes. One responsibility: identify, never decode.
Impostor
Ktx2Texture
A KTX2 file's blocks, and the colour space its format names.
LoadedRegion
LoadedRegionLevel
Localised
ModelImport
What a reader found, before anything is oriented, welded or written.
ModelSource
A model file, plus the capabilities its format may need to be read.
ModifierVerdict
What an object's modifier stack means for the direct reader.
ObjectSdf
What an object's distance field is, and why it is baked rather than computed.
ProxyCell
A cell's geometry, keyed by the identifier core/src/world/cell.ts gives it.
RadianceImage
An equirectangular image, linear, three floats a texel, row 0 at the top.
Recognised
What a file turned out to be, and what a person should do with it.
Repeats
SimplifyOptions
SlotNeeds
What a material slot asks of the geometry that wears it.
StlAppearance
What a caller may supply, since the format carries none of it.
ThreeMfResult
What a .3mf yields, in the shape every other reader in this directory returns.
UsdResult
What a .usda yields, in the shape every other reader in this directory returns.
ViewFrame
The sphere a bake frames its views on: a centre and a radius, and nothing about direction.
ZipEntry
One file in the archive. bytes is decompressed and ready to read.

Functions

actionCurves
The F-curves an action holds for slot: its channel bag in a layered action, every curve otherwise.
activeScene
The scene the file was saved looking at.
assetCandidates
Paths to try for a reference, best first, relative to the folder holding the model.
bakeObjectSdf
Bake one mesh into a signed distance field.
bakeSceneField
The field of every mesh include admits, merged, at voxelM spacing, as the file's whole-geometry entry. Null when nothing is admitted.
basenameOf
Everything after the last separator.
blackbody
The colour of a black body at kelvin, in linear Rec. 709, scaled to unit luminance: what Blender multiplies a light's colour by when the light takes its colour from a temperature.
blendCompression
The compression a .blend was saved with, by its magic, or null for a plain file.
blendToGltf
Build the document.
buildClusterDag
buildClusters
buildCoarseLevel
Build the coarse level, or null when there is nothing to build one from.
buildImpostor
Bake directions² views of a mesh into one atlas.
buildProxy
One mesh standing in for a whole cell group, or null when it is not worth having.
cappedSize
The size width by height is halved to until its longer side is at most maxSide.
colliderBeside
The collision hull a vehicle folder ships beside its model, or null.
componentCount
How many connected pieces the indices make of the mesh. Unreferenced vertices count as their own.
convertHandedness
Mirror an asset into the engine's right-handed frame, in place.
cornerNormals
The normal every corner is shaded with, three floats per corner, in the mesh's own space.
customProperties
An ID's custom properties that are plain values, for glTF's extras.
ddsBlocks
The surface's blocks and stored levels, as views over bytes.
ddsToRgba
Decode a DDS surface's level 0 into RGBA.
decodeBc
A whole surface of blocks into RGBA, eight bits a channel, width by height. A surface that is not a whole number of blocks is decoded block by block and cropped, which is what the format does: the blocks cover a padded rectangle and the texels past the declared size are padding.
decodeBcImage
blocks as an RGBA image, eight bits a channel, every channel meaning what an image's does.
deriveTangentsFor
Derive a tangent frame for a mesh that has none, after it has been welded.
describeImage
Identify an image and read its dimensions, or refuse by name.
describeRecognised
The refusal, as one block of text a person can act on.
describeUpAxis
What the turn does, in words, for the line the baker prints.
downscaleRgba
A box average from width×height down to outWidth×outHeight, four bytes a texel.
drawKeyOf
The key two parts must share to be merged into one draw.
dropDefaultAttributes
dtexFromEncoded
encoded as a DtexMaterial, with channels saying what each of its outputs is.
dtexTileBytes
The bytes of one tile, by where it is rather than by its number.
encodeEtc2
rgba at width by height as format blocks, row of blocks after row of blocks.
encodeEtc2Chain
rgba at width by height, and each level below it to 1x1, as format blocks.
encodeMaterial
extensionOf
The extension of a file name, lower case, including the dot. Empty when it has none.
faceNormals
Each face's normal, by the rule Blender uses for its size: two edges of a triangle, the two diagonals of a quad, and Newell's method beyond that.
fbxToMeshes
Geometry out of a parsed tree, one MeshData per Geometry record.
findEntry
The first entry whose name matches, or null. Case-insensitive, since archives disagree.
findRepeats
The prototype and placements for the largest candidate count that mesh is exactly that many rigid copies of, or null when none is.
flipBc5Green
A copy of blocks, a level of BC5, with every block's green half turned over.
frameOf
The frame that fits every mesh given. A radius of zero for a point, rather than a NaN.
gltfToMeshes
Turn a document into meshes in world space, one per primitive.
imageMime
A packed image's media type, from its first bytes.
imagePath
Where an unpacked image lives, relative to the .blend when Blender wrote it that way.
isBlend
Whether these bytes are an uncompressed .blend.
isDds
Whether these bytes are a DDS at all. The magic, and nothing inferred from a file name.
isOutlineWorthWriting
Whether a built level is worth writing into a file as an outline.
judgeModifiers
Judge an object's modifier stack.
latentImageOf
The latent as the interpreter takes it: normalised floats, components wide, with its chain.
levelsBeside
The separate levels of detail a bundle ships beside its model, finest first.
localiseNodes
Move each mesh into the frame of the node that placed it, and report every node's world matrix.
localMatrix
The object's transform relative to its parent: location, rotation and scale, deltas folded in.
materialSlots
An object's material slots: the object's own material where its slot says so, else the mesh's.
meshPrimitives
Split a mesh into one primitive per material slot it uses.
mirrorNodes
Mirror an asset's hierarchy by the same reflection convertHandedness mirrors its geometry by.
octahedralCoord
The octahedral coordinate a direction came from: the inverse of octahedralDirection.
octahedralDirection
The direction a tile of the atlas was baked from, for an octahedral coordinate in [0, 1].
openBlend
Open a .blend's bytes, decompressing them first where the file was saved compressed.
orientLights
Authored lights, turned into the engine's frame by the turn orientMeshes gives the geometry.
orientMeshes
Stand an asset up, given which of its axes points at the sky.
orientNodes
Turn an asset's hierarchy by the same rotation orientMeshes turns its geometry by.
orientTransforms
Column-major 4×4 placements, turned into the engine's frame: O · M · Oᵀ for each, with O the same turn orientMeshes gives the geometry. A copy the file moved along its own +z is then moved along the engine's +y, and a placement that was a rotation stays one of the same angle.
packedImage
The bytes a packed image holds, or null where it lives in a file beside the .blend.
parseMtl
Parse a .mtl.
parseObj
Parse an OBJ. materials is the parsed .mtl, if the caller resolved one.
parseStl
parseThreeMfModel
Read the 3dmodel.model XML out of a 3MF archive.
parseUpAxis
Read an axis a person typed. z and +z mean the same thing; anything else is refused.
parseUsda
Read a .usda document.
placeObjects
Walk the scene into placed objects, naming in refusals anything that needs Blender to run.
prepareFbxInflate
prepareZipInflate
The same trick for a zip, which is how a .3mf and a bought archive both arrive.
proxyResolution
The grid a level uses. Each level halves the last, which is what makes it a hierarchy.
rasteriseView
An orthographic rasterisation of a mesh from one direction, as resolution² RGBA texels.
readBlend
A .blend as a glTF document, refusing it whole when any part of it needs evaluating.
readBlendMesh
Read a mesh datablock into plain arrays.
readBlendSurface
Read one material's surface.
readCurve
One F-curve, ready to evaluate.
readerFor
Whether this project has a reader for an extension. Lower case or not.
readGlb
Split a .glb into its JSON and its binary chunk.
readGltfSkins
readIesProfile
Read an LM-63 photometric file.
readKtx2
bytes as a KTX2 file of one 2D block texture. Throws, naming the reason, on anything else.
readModel
Read one model file into meshes.
readRadianceHdr
Read a Radiance RGBE file into linear radiance.
readZip
Every file in an archive, decompressed.
recognise
What this file actually is, when it is something with no reader here.
resolveDrawGrouping
Resolve what a part will actually be drawn with.
sampleImpostor
Sample the impostor as the shader would: bilinear inside a tile, bilinear across the four tiles around the requested direction.
simplifyMesh
textureColorSpaces
How each of an asset's images should be sampled, decided from what its materials call them.
threeMfToMeshes
Read a .3mf archive.
tileGridFromDtex
The grid a chunk's table describes, or null where the material is one image and not streamed.
triangulateFace
Triangles of one face, as corner indices, appended to out.
unpackBlend
The plain bytes of a .blend, decompressing first where the file says it is compressed.
usdzToMeshes
Read a .usdz: a zip holding a .usda or a .usdc, plus whatever images it names.
weldMesh
Weld one mesh. Returns the same mesh when nothing can be merged.
writePartMaterial
part's maps and factors into out, resolving each map through textures.
zstdFrames
Each frame's compressed and decompressed length, from the seek table, or null where there is none.

Types

AsyncInflate
Turn a deflate stream into bytes, eventually. What a browser can actually offer.
BlendDecompress
Decompress one gzip stream or one zstd frame. Supplied by the host.
DrftFit
How a loaded model is placed: fitted to a size, or left exactly where its file puts it.
DrftLoadPhase
Where a load has got to, in the order a file delivers it.
Etc2Format
The formats this encodes: colour, colour with alpha, and one or two channels of data.
Handedness
Which way round a format's coordinate system is.
Inflate
Turn a deflate stream into bytes. Supplied by the caller; see the note above.
UpAxis
Which way is up in the asset, as a signed axis of the engine's own frame.

Constants

browserInflate
DecompressionStream, which every target browser has and which needs no dependency.
browserInflateRaw
Raw deflate through the browser, which is what a zip needs and what FBX must not be given.
DEFAULT_COARSE_CELLS
The grid this uses when nobody names a resolution, exported because two other places used to carry their own copy of the number and disagreed with it.
IMPOSTOR_GUTTER
Texels of edge repeat around every tile.
IMPOSTOR_TILE
Texels a tile's picture occupies, before its gutter.
MODEL_FORMATS
Every extension this project reads, in the order a bundle should be picked from.
OB_ARMATURE
OB_EMPTY
OB_LAMP
OB_MESH
PROXY_BASE_CELLS
Grid cells along the longest axis of a level-0 proxy.
PROXY_MIN_CELLS
The finest a proxy is allowed to get, matching buildCoarseLevel's own floor.