9.3
124 3D: Compiled geometry and instances
struct
(struct compiled-geometry3d ( key mesh local-bounds face-normals edge-adjacency analysis) #:transparent) key : any/c mesh : mesh3d? local-bounds : aabb3? face-normals : vector? edge-adjacency : vector? analysis : mesh3d-analysis?
A camera-independent
geometry resource. Its canonical key includes local vertices, triangle and
explicit-edge topology, normals, and per-vertex colours; it excludes material,
opacity, transforms, camera, lights, and viewport settings.
struct
(struct compiled-instance3d ( path geometry-key world-transform normal-transform material opacity clip-planes drawing-index surface-mode) #:transparent) path : (listof symbol?) geometry-key : any/c world-transform : affine3? normal-transform : linear3? material : material3d? opacity : real? clip-planes : list? drawing-index : exact-nonnegative-integer? surface-mode : (or/c 'visible 'depth-only 'none)
The
ordered placement and style of one compiled geometry use.
struct
(struct compiled-stroke3d ( path points closed? world-transform style opacity clip-planes drawing-index source-kind source-metadata) #:transparent) path : (listof symbol?) points : vector? closed? : boolean? world-transform : affine3? style : stroke3d? opacity : real? clip-planes : list? drawing-index : exact-nonnegative-integer? source-kind : symbol? source-metadata : immutable-hash?
A camera-independent sampled centreline. Screen
width, dashes, clipping, depth classification, and cap/join coverage are
prepared only for a concrete frame.
struct
(struct compiled-point-marker3d ( path position world-transform style opacity clip-planes drawing-index) #:transparent) path : (listof symbol?) position : vec3? world-transform : affine3? style : point-style3d? opacity : real? clip-planes : list? drawing-index : exact-nonnegative-integer?
A
camera-independent point marker.
struct
(struct compiled-arrow-marker3d ( path from to world-transform style opacity clip-planes drawing-index) #:transparent) path : (listof symbol?) from : vec3? to : vec3? world-transform : affine3? style : arrow-style3d? opacity : real? clip-planes : list? drawing-index : exact-nonnegative-integer?
A camera-independent arrowhead marker.
struct
(struct compiled-edge-overlay3d ( path geometry-key world-transform normal-transform style opacity clip-planes drawing-index) #:transparent) path : (listof symbol?) geometry-key : any/c world-transform : affine3? normal-transform : linear3? style : edge-style3d? opacity : real? clip-planes : list? drawing-index : exact-nonnegative-integer?
An
outlined mesh reference whose feature selection is deliberately deferred until
camera-frame preparation.
struct
(struct compiled-view3d ( geometries instances strokes point-markers arrow-markers edge-overlays background render-mode transparency-mode) #:transparent) geometries : vector? instances : vector? strokes : vector? point-markers : vector? arrow-markers : vector? edge-overlays : vector? background : any/c render-mode : symbol? transparency-mode : symbol?
The immutable camera-independent renderer input. Use
compiled-view3d-primitives for stable drawing-index order across these
primitive vectors.
struct
(struct frame3d-spec (camera lights width height) #:transparent) camera : camera3d? lights : list? width : exact-positive-integer? height : exact-positive-integer?
The state which
may change from one rendered frame to the next.
procedure
(compile-view3d view) → compiled-view3d?
view : view3d?
Lowers a spatial
tree deterministically, sharing equal geometry resources in first encounter
order. It does not inspect the view’s camera.
procedure
(compiled-view3d-primitives view) → vector?
view : compiled-view3d?
Returns
the mesh instances, strokes, point markers, arrow markers, and edge overlays in
stable drawing-index order.
procedure
(view3d->frame3d-spec view width height) → frame3d-spec?
view : view3d? width : exact-positive-integer? height : exact-positive-integer?
Extracts frame-varying camera, light, and viewport state.
procedure
(view3d->render3d-request view width height [ #:cancellation-token cancellation-token #:attachments attachments #:theme theme]) → render3d-request? view : view3d? width : exact-positive-integer? height : exact-positive-integer? cancellation-token : any/c = #f attachments : (listof symbol?) = '(color) theme : color-theme? = #f
Conveniently compiles view and packages
the resulting compiled view, frame specification, and requested attachments.
The canonical attachment names are 'color, 'linear-depth,
'object-id, and 'normal. A renderer may return a superset,
but cannot omit a requested attachment. The resulting request owns an immutable
color-context snapshot. Without #:theme, it captures an enclosing
render context when present, otherwise the built-in light theme.