dymokomi/luced-3d
Source of release 0.11.4
## The viewport's grids, built in Base (OverlayLines.add_grid): the
## ground's and a sketch plane's, at the snapping step (snapping.grid_step)
## round where the camera looks, a brighter line every fifth. They are depth
## tested but write no depth: a mesh in front hides them, and Gaussian
## splats and fog, which are drawn after them and write no depth either,
## cover them where they are dense, as they cover anything behind them.
from luce_gpu.gpu import RenderTarget, Color
from luce_3d.graphics import PerspectiveCamera, Vector3
from overlay_lines import OverlayLines
## A grid on the plane through `center` spanned by unit axes `u` and `v`:
## 60 cells of `step` across in `minor`, every fifth line in `major`.
pub func draw_grid(camera: PerspectiveCamera, target: RenderTarget, center: Vector3, u: Vector3, v: Vector3, step: float, minor: Color, major: Color) -> unit!:
let fine = OverlayLines.make()
fine.add_grid(center, u, v, step * 30.0, 60)
fine.batch().draw(camera, target, minor, writes_depth = false)
let bold = OverlayLines.make()
bold.add_grid(center, u, v, step * 30.0, 12)
bold.batch().draw(camera, target, major, writes_depth = false)