Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-3d

Source of release 0.9.1

0.9.1 / src / materials / lambert.lucb

import interop
from core.material import Material, Color, check_color

pub struct MeshLambertMaterial: Material:
    var tint: Color

    pub func init(color: Color = Color(1.0, 1.0, 1.0)) -> !:
        try check_color(color)
        self.tint = color

    pub func color() -> Color:
        return self.tint

    pub func set_color(color: Color) -> !:
        try check_color(color)
        self.tint = color

    pub func is_lit() -> bool:
        return true

    pub func close():
        # Color is inline; the shared owner enforces closure across mesh aliases.
        _ = self.tint

pub let lambert_material_type: interop.Type[MeshLambertMaterial] = interop.Type[MeshLambertMaterial]("MeshLambertMaterial", MeshLambertMaterial.close, closeable = true, main_thread = true)