Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-geocore

Source of release 0.7.7

0.7.7 / src / core / geometry.lucb

## The renderer's view of geometry: per-vertex records (`Vertex`) and the
## `Geometry` interface luce-3d draws through, plus axis-aligned `Bounds`.
import interop
from math.vector import Vector3

## One drawn vertex: position, normal, uv and color.
pub struct Vertex:
    pub let position: Vector3
    pub let normal: Vector3
    pub let u: f64
    pub let v: f64
    ## Optional linear RGB multiplier; white preserves existing materials.
    pub let color: Vector3 = Vector3(1.0, 1.0, 1.0)

## An axis-aligned box.
pub struct Bounds:
    pub let minimum: Vector3
    pub let maximum: Vector3

## Geometry storage is immutable after construction. Interface results own any
## backing storage required by a managed implementation; Base borrows until release.
pub interface Geometry:
    func vertex_count() -> i64
    func index_count() -> i64
    func vertex(index: i64) -> interop.Outcome[Vertex]
    func index(offset: i64) -> interop.Outcome[i64]
    func bounds() -> Bounds