mirror of
https://github.com/storytold/materialcraft.git
synced 2026-11-28 17:19:17 +01:00
Replace the legacy Rust procedural library with clean-room native primitives, typed function execution and FX-Map graphs. Save supported content as native SBS and organize the model, evaluators, codecs and editors into focused modules. Add shared graph editing behavior, flat filtered node menus, frame and comment editing, named Explorer outputs and an original atomic sample. Document the tested scope and remaining interoperability work.
21 lines
450 B
Rust
21 lines
450 B
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/// One stop of a [`Gradient`]: position 0..1 and linear RGBA
|
|
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct GradientKey {
|
|
pub pos: f32,
|
|
pub color: [f32; 4],
|
|
#[serde(default = "midpoint")]
|
|
pub midpoint: f32,
|
|
}
|
|
|
|
fn midpoint() -> f32 {
|
|
0.5
|
|
}
|
|
|
|
impl GradientKey {
|
|
pub fn new(pos: f32, color: [f32; 4]) -> Self {
|
|
Self { pos, color, midpoint: 0.5 }
|
|
}
|
|
}
|