painter.rs
524 B · rust · 17 lines
1use super::models::Cell6d;2use mrlycore::cell::mapping;3use mrlycore::colors::Color;4use mrlycore::enums::Mode;5use std::collections::HashMap;67/// Colors each triangle by its type through the custom or default mapping in the given or type mode.8pub fn paint(9 mut cell: Cell6d,10 custom: Option<&HashMap<u8, Vec<Color>>>,11 mode: Option<Mode>,12) -> Cell6d {13 let defaults = mapping();14 let mapping = custom.unwrap_or(&defaults);15 cell.cell = cell.cell.paint(mapping, mode.unwrap_or(Mode::Type));16 cell17}