3.6 KiB
Datoviz Module Layers
Status: active architecture note Updated on: 2026-05-27 Scope: source-tree and public-module layering for reusable Datoviz subsystems.
Purpose
Datoviz v0.4 keeps one aggregate shared library, but its source modules should still express a
clear dependency graph. The scene layer has grown into a high-level visualization subsystem, and
some code currently under src/scene is useful without the retained scene graph. Those reusable
pieces should move into scene-independent public modules when they have a clear second consumer
such as VisPy2, app overlays, tests, or future bindings.
The concrete scene split plan is SCENE_SPLIT_REFACTOR_PLAN.md.
Layer Model
The intended source layers are:
- Foundation:
common,math,thread,fileio. - Domain primitives: scene-independent visualization primitives such as
geom,controller, and future candidates likecolor,field, andtext. - Runtime/backend:
input,window,vk,vklite,canvas,stream,video. - Render protocol:
drp2. - High-level systems:
scene,app, and optional GUI integration.
Top-level source directories may remain siblings even when they belong to different layers. The
layering should be enforced by CMake targets, include dependencies, tests, and documentation rather
than by broad buckets such as utils/ or runtime/.
Promotion Rules
A module should move out of scene only when all of these are true:
- it can be tested without constructing a
DvzScene, - it does not include
_scene.hor depend on retained scene object ownership, - it has a plausible non-scene consumer,
- its public API does not expose scene handles unless through compatibility wrappers,
- scene can consume it as a client instead of owning the implementation.
Scene-specific wrappers, panel binding, controller links, invalidation, and retained-object lifetime
remain in scene.
First Extraction: Controller
The first promoted domain primitive is controller.
It owns scene-independent camera/controller state machines:
DvzCamera,DvzPanzoom,DvzArcball,DvzFly,DvzTurntable.
The public controller API is available through datoviz/controller.h and
datoviz/controller/*.h. Existing datoviz/scene/*.h controller headers remain compatibility
wrappers for scene-owned constructor APIs such as dvz_panzoom(DvzScene*, ...) and
panel-owned camera APIs such as dvz_panel_set_camera_desc().
The implementation boundary is:
controllerowns pure allocation, state mutation, input-event interpretation, matrix/camera updates, and destruction for individual controllers,sceneownsDvzController*handles, links between scene-owned controllers, panel binding, figure invalidation, and app-facing controller integration,appmay use scene-owned controllers through the scene API until it needs a separate hosted controller path.
Future Candidates
Likely future promotions from scene are:
color: colormaps, categorical palettes, transfer functions, colorizers, and sparse label color lookup helpers.field: sampled-field descriptors, regions, sample profiles, scalar/RGBA/label interpretation, and update validation.text: font defaults, shaping, glyph metrics, atlas generation/cache, and text block layout.geom: additional scene-independent geometry generators such as polygon tessellation, arrows, tubes, marker shapes, and orientation gizmo axes.
FramePlan, visual pipeline descriptors, render contracts, and query semantics should stay in
scene until a non-scene producer needs them.