Draws many dynamic Connector3D lines as a single instanced batch. More...
| Import Statement: | import Clayground.Canvas3D |
ConnectorLayer3D owns one LineBatch3D and collects the Connector3D items that target it, so N connectors cost a single draw call. Every frame it reads the scene positions of each connector's from and to nodes and, when any endpoint moved, patches only the changed entries of the instance table and issues one upload - no geometry rebuild. Connectors can be added and removed at runtime (Repeater3D-friendly); membership changes rebuild the batch once, coalesced across a frame.
A Connector3D attaches to a layer either by being declared inside it or by setting its layer property (the robust choice for Repeater3D delegates).
Note: Place the layer at the scene root without a transform: connector endpoints are taken as scene positions and fed to the batch directly.
Example usage:
import QtQuick3D import Clayground.Canvas3D View3D { id: view ConnectorLayer3D { id: links viewportSize: Qt.vector2d(view.width, view.height) color: "#00d9ff" width: 2 } Repeater3D { model: satellites Node { id: sat Connector3D { layer: links; from: sat; to: hub } } } }
See also Connector3D and LineBatch3D.
arcHeight : real |
Arc lift as a fraction of link length (only when segmentsPerLink > 1).
The bezier control point sits at the link midpoint raised by arcHeight * linkLength along world +Y, so longer links bow higher. Ignored while segmentsPerLink is 1 (straight links).
color : color |
Default line color for connectors that do not set their own.
count : int |
The number of connectors currently drawn in the batch.
depthBias : real |
Depth bias forwarded to the batch, see LineBatch3D::depthBias.
flowTime : real |
Animation clock forwarded to the batch, see LineBatch3D::flowTime.
Drive it from your own clock (typically a FrameAnimation's elapsedTime) to march flowing/pulsing connector styles. Gate that clock on the layer's visibility so idle connectors cost nothing.
segmentsPerLink : int |
Number of straight segments each connector is drawn with.
The default 1 draws every connector as a single straight segment and keeps the fast endpoint-only per-frame path unchanged. A value > 1 samples each connector as a quadratic bezier arc (lifted by arcHeight) with segmentsPerLink segments, so flowing patterns curve along a mail-style arc while the whole layer stays one draw call. Changing this at runtime rebuilds the batch.
styleId : int |
Default styleId for connectors that do not set their own.
styles : list |
Style table forwarded to the batch, see LineBatch3D::styles.
viewportSize : vector2d |
The enclosing View3D pixel size, forwarded to the batch. Required in Pixel width mode.
width : real |
Default line width for connectors that do not set their own.
widthUnits : enumeration |
How connector width is interpreted, see LineBatch3D::widthUnits.