Model loading · class

PartDraws

Parts drawn, cast and prepared by every rule a container needs; DrftLoader.draw is one.

Explained in Importing models.

class PartDraws
import { PartDraws } from '@driftengine/assets';

Constructor

new

constructor(renderer: RendererApi)
ParameterTypeDescription
rendererRendererApi

Methods

draw

draw(parts: readonly DrftPart[], textures: TextureSet<SurfaceTextureHandle> | null): number

Draw every part into the open mesh pass. Returns the draws issued.

ParameterTypeDescription
partsreadonly DrftPart[]
texturesTextureSet<SurfaceTextureHandle> | null

cast

cast(sink: ShadowCasterSink, parts: readonly DrftPart[], textures: TextureSet<SurfaceTextureHandle> | null): void

Offer every part that stands in the light to a shadow pass, or to a mirror's replay.

ParameterTypeDescription
sinkShadowCasterSink
partsreadonly DrftPart[]
texturesTextureSet<SurfaceTextureHandle> | null

prepare

prepare(parts: readonly DrftPart[], textures: TextureSet<SurfaceTextureHandle> | null): Promise<void>

Compile, off the frame, what every part's draw will take, then wait for it: each in its own material, translucent as well where it will be drawn so, through its batch where it has copies. What it cannot reach is the shadow passes' and a probe's own pipelines, which one frame drawn behind a loading screen compiles; see RendererApi.prepareMesh.

ParameterTypeDescription
partsreadonly DrftPart[]
texturesTextureSet<SurfaceTextureHandle> | null