Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-3d

Source of release 0.9.5

0.9.5 / src / core / material.lucb

from luce_gpu import gpu
import errors

pub type Color = gpu.Color

pub interface Material:
    func color() -> Color
    func is_lit() -> bool
    ## How far a surface fades to see-through grey: 0 draws it as shaded,
    ## 1 most faded (luce-gpu's mesh_fade). Faded objects draw last.
    func fade() -> f64

pub func check_color(color: Color) -> !:
    if not (color.red >= 0.0 and color.red <= 1.0 and color.green >= 0.0 and color.green <= 1.0 and color.blue >= 0.0 and color.blue <= 1.0):
        error(errors.invalid, "material and light colors must be finite linear RGB in 0..1")