Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

A 3D scene made live (live play, a game's render) draws what its program draws (part of #26). Each frame's live rows now send what a render keys, the way it keys it. Toward making a full 3D render step React once (#26's leftover): its 3D made live as each frame is stepped, as a game's is, instead of in runtimes of their own beforehand. Rendering 155 3D compositions both ways (RAEA_3D=program and =live, per-frame hashes) found these differences, all bugs in live play too: - A spot's cone (inner, outer) wasn't sent after its first frame. On 3d/spotlight, live scored SSIM 0.94 against Bevy's own frame 20, the program 0.99. - A zero scale's rotation came out NaN and was sent again every frame, since NaN never equals itself. It is now the identity, or the frame before's in the program. - The fast path sent a bulb's place as the World's f32, where the program rounds it to 6 decimals. - Live frames sent only the camera's place, look, fov, focus and ambient. They now send every column a render keys (cam_keyed: a roll's up_*, the view window, sky and environment, aberration, depth of field, lens, motion blur, paint). Both live paths build the camera row with the program's own camera code (camera_row, camera_diff); the fast path's copy of it is gone. - Colour columns were rounded to 6 decimals, while a hex colour is its byte over 255, so a part whose colour ever changes drew a hair off on every frame until it did. They are exact now, in the program too. - The fast path kept glam's sign for a rotation where the full path takes the identity's side. That's the same matrix, but RAEA_LIVE3D_CHECK=1 refused it.

shinyobjectz90f65721d94d
diff --git a/bench/live-3d/check.sh b/bench/live-3d/check.sh
new file mode 100755
index 00000000..a933543c
--- /dev/null
+++ b/bench/live-3d/check.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# #26: a 3D composition's 3D made live, frame by frame as it's stepped (as live play and a game's render make it),
+# draws what its rows made beforehand draw (a render's program), pixel for pixel. Each composition below is rendered
+# to per-frame hashes with RAEA_3D=program and with RAEA_3D=live (RAEA_LIVE3D_CHECK=1: each live frame's fast rows
+# also held against its full rows), and the two must be identical. They caught what live frames sent otherwise than
+# a render keys it: a spot's cone (spotlight), a zero scale's NaN rotation and a bulb's f32 place
+# (spherical_area_lights, lighting), a colour as rounded floats against its hex (screenshake), a rotation's sign
+# (shapes); atmospheric_fog keeps the camera's own spawns, the at-3d scene a ShaderMesh's uniforms. Exits 1 on a failure.
+# bench/live-3d/check.sh (RAEA_BIN: the raea to run, default target/release/raea)
+cd "$(dirname "$0")/../.." || exit 2
+BIN=${RAEA_BIN:-$PWD/target/release/raea}
+export RAEA_SIGN=0 RAEA_MARK=0 RAEA_EXPORT_CACHE=0
+OUT=$(mktemp -d "${TMPDIR:-/tmp}/raea-live-3d.XXXXXX")
+trap 'rm -rf "$OUT"' EXIT
+status=0
+for f in bench/at-3d/scene.tsx sdk/raea/bench/bevy-parity/3d/spotlight.tsx sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx \
+ sdk/raea/bench/bevy-parity/3d/atmospheric_fog.tsx examples/games/screenshake.tsx examples/games/shapes.tsx examples/games/lighting.tsx; do
+ n=$(basename "$f" .tsx)
+ RAEA_3D=program "$BIN" render "$f" -o "$OUT/$n.program.txt" > "$OUT/$n.program.log" 2>&1 || { echo "FAIL $f: the programmed render failed"; tail -3 "$OUT/$n.program.log"; status=1; continue; }
+ RAEA_3D=live RAEA_LIVE3D_CHECK=1 "$BIN" render "$f" -o "$OUT/$n.live.txt" > "$OUT/$n.live.log" 2>&1 || { echo "FAIL $f: the live render failed: $(grep -o 'RAEA_LIVE3D_CHECK.\{0,160\}' "$OUT/$n.live.log" | head -1)"; status=1; continue; }
+ d=$(diff <(cut -d' ' -f2 "$OUT/$n.program.txt") <(cut -d' ' -f2 "$OUT/$n.live.txt") | grep -c '^<')
+ if [ "$d" = 0 ]; then echo "PASS $f ($(wc -l < "$OUT/$n.live.txt" | tr -d ' ') frames)"; else echo "FAIL $f: $d frames differ"; status=1; fi
+done
+exit $status
diff --git a/runtime/scene/src/fast.rs b/runtime/scene/src/fast.rs
index 9b597d9c..47bc4c44 100644
--- a/runtime/scene/src/fast.rs
+++ b/runtime/scene/src/fast.rs
@@ -60,56 +60,13 @@ impl LiveScene {
}
}
let mut out: Vec<raea_core_program::eval::Tup> = Vec::new();
- // the camera, as diff holds it
- let mut cam: [(&str, Option<f64>); 9] = [("x", None), ("y", None), ("z", None), ("look_x", None), ("look_y", None), ("look_z", None), ("fov", None), ("ambient", None), ("focus", None)];
- match its.iter().find(|i| i.kind == "camera") {
- Some(c) => {
- let pos = vec3(&c.props, "position", [0.0, 0.0, 5.0]);
- let look = vec3(&c.props, "lookAt", [0.0, 0.0, 0.0]);
- for k in 0..3 {
- cam[k].1 = Some(r6(pos[k]));
- cam[3 + k].1 = Some(r6(look[k]));
- }
- cam[6].1 = Some(r6(n(&c.props, "fov", 50.0)));
- if self.cam.contains_key("focus") {
- cam[8].1 = Some(r6(focus_of(c)));
- }
- }
- None => {
- for (k, d) in [0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 50.0].into_iter().enumerate() {
- cam[k].1 = Some(match self.cam.get(cam[k].0) {
- Some(V::N(v)) => *v,
- _ => d,
- });
- }
- }
- }
- let amb = its.iter().filter(|i| i.kind == "ambient").map(|i| light_power("ambient", &i.props)).sum::<f64>();
- cam[7].1 = if amb > 0.0 { Some(r6(amb)) } else { self.cam.contains_key("ambient").then_some(0.0) };
- let mut vals = BTreeMap::new();
- for (k, v) in cam {
- if let Some(v) = v.map(V::N) {
- if self.cam.get(k) != Some(&v) {
- self.cam.insert(k.into(), v.clone());
- vals.insert(k.to_string(), v);
- }
- }
- }
- // the paint look's keyed values, as camera_of keys them
- if self.cam.contains_key("paint_bands") {
- if let Some(l) = its.iter().find(|i| i.kind == "framelook") {
- for (k, v) in paint_keyed(&l.props) {
- let v = V::N(r6(v));
- if self.cam.get(k) != Some(&v) {
- self.cam.insert(k.into(), v.clone());
- vals.insert(k.to_string(), v);
- }
- }
- }
- }
- if !vals.is_empty() {
- out.push(raea_core_program::eval::Tup { kind: "camera".into(), id: "cam".into(), vals });
- }
+ // the camera as diff holds it: the same row and columns (camera_row, camera_diff), so whatever of it a render
+ // keys (a roll, a sky, a view window, #26) changes here too
+ let all = [its];
+ let its = &all[0];
+ // (its spawns aren't wanted here: a row of another kind sends a frame down the full path)
+ let cam = self.camera_row(&all, f.clear, &mut Program::default());
+ out.extend(Self::camera_diff(&mut self.cam, &cam));
for r in self.rows.values_mut() {
r.seen = false;
}
@@ -120,13 +77,17 @@ impl LiveScene {
let mut nw = 0usize;
let mut put = |k: &'static str, v: f64| {
// a Transform's columns as the World's f32 holds them (FC1d), the rest to 6 decimals
- want[nw] = (k, Some(if PLACE.contains(&k) { v } else { r6(v) }));
+ want[nw] = (k, Some(if PLACE.contains(&k) || k.starts_with("col_") { v } else { r6(v) }));
nw += 1;
};
let mut color: Option<std::borrow::Cow<str>> = None;
let place = |put: &mut dyn FnMut(&'static str, f64)| {
let (s, q, t) = it.world.to_scale_rotation_translation();
- // Bevy's quaternion as it is (docs/control.feature FC1d)
+ // a zero scale's rotation comes out NaN, sent again every frame (NaN never equals itself): none (#26)
+ let q = if q.is_finite() { q } else { bevy::math::Quat::IDENTITY };
+ // Bevy's quaternion as it is (docs/control.feature FC1d), on the identity's side as the full path's
+ // placement puts a frame's (q and -q make the same matrix, bit for bit; RAEA_LIVE3D_CHECK held them apart)
+ let q = if q.w < 0.0 { -q } else { q };
for (name, v) in [("x", t.x), ("y", t.y), ("z", t.z), ("q_x", q.x), ("q_y", q.y), ("q_z", q.z), ("q_w", q.w)] {
put(name, v as f64);
}
@@ -146,15 +107,23 @@ impl LiveScene {
let pos = [w.x as f64, w.y as f64, w.z as f64];
let target = vec3(&it.props, "target", [0.0; 3]);
if !dir {
- put("x", pos[0]);
- put("y", pos[1]);
- put("z", pos[2]);
+ // to 6 decimals, as parts.rs keys a light's place (it isn't a Transform's column there): the
+ // World's f32 moved every bulb a hair on the second frame (#26)
+ put("x", r6(pos[0]));
+ put("y", r6(pos[1]));
+ put("z", r6(pos[2]));
}
if it.kind != "point" {
put("dir_x", target[0] - pos[0]);
put("dir_y", target[1] - pos[1]);
put("dir_z", target[2] - pos[2]);
}
+ if it.kind == "spot" {
+ // its cone, as parts.rs keys it: a spot whose angle moves (3d/spotlight) kept its first (#26)
+ let outer = n(&it.props, "angle", std::f64::consts::FRAC_PI_3).clamp(0.0, std::f64::consts::FRAC_PI_2);
+ put("inner", outer * (1.0 - n(&it.props, "penumbra", 0.0).clamp(0.0, 1.0)));
+ put("outer", outer);
+ }
"light"
}
"mesh" => {
@@ -253,7 +222,7 @@ impl LiveScene {
if r.recoloured {
let c = rgb(c);
for (k, name) in ["col_r", "col_g", "col_b"].into_iter().enumerate() {
- set(&mut want, &mut nw, name, Some(r6(c[k])), false);
+ set(&mut want, &mut nw, name, Some(c[k]), false);
}
}
if !r.first.contains_key("emissive") {
diff --git a/runtime/scene/src/lib.rs b/runtime/scene/src/lib.rs
index f7e4b74a..0be4537e 100644
--- a/runtime/scene/src/lib.rs
+++ b/runtime/scene/src/lib.rs
@@ -231,6 +231,8 @@ fn placement(p: &mut Program, row: &mut BTreeMap<String, V>, id: &str, its: &[It
let mut prev = bevy::math::Quat::IDENTITY;
let per: Vec<[f64; 10]> = its.iter().map(|it| {
let (s, q, t) = it.world.to_scale_rotation_translation();
+ // a zero scale has no rotation (it comes out NaN, keyed on every frame since NaN never equals itself): the one before
+ let q = if q.is_finite() { q } else { prev };
prev = if q.dot(prev) < 0.0 { -q } else { q };
[t.x as f64, t.y as f64, t.z as f64, prev.x as f64, prev.y as f64, prev.z as f64, prev.w as f64, s.x as f64, s.y as f64, s.z as f64]
}).collect();
diff --git a/runtime/scene/src/live.rs b/runtime/scene/src/live.rs
index 272cc127..0a9b4a6a 100644
--- a/runtime/scene/src/live.rs
+++ b/runtime/scene/src/live.rs
@@ -55,7 +55,7 @@ pub(crate) const MORPH_COLS: [&str; 64] = ["morph0", "morph1", "morph2", "morph3
/// The columns a frame may change, per kind (what `rows_into` and `camera` key); everything else is the first frame's.
pub(crate) fn live_dynamic(kind: &str) -> &'static [&'static str] {
match kind {
- "light" => &["lux", "lumens", "x", "y", "z", "dir_x", "dir_y", "dir_z"],
+ "light" => &["lux", "lumens", "x", "y", "z", "dir_x", "dir_y", "dir_z", "inner", "outer"],
"mesh" => &["x", "y", "z", "q_x", "q_y", "q_z", "q_w", "scale_x", "scale_y", "scale_z", "visible", "col_r", "col_g", "col_b", "rough", "metal", "emissive_k", "opacity", "sh_r", "sh_g", "sh_b", "rim_k", "spec_k", "outline_w", "pass"],
"model" => &["x", "y", "z", "q_x", "q_y", "q_z", "q_w", "scale_x", "scale_y", "scale_z", "visible", "anim_t", "mix0_t", "mix0_w", "mix1_t", "mix1_w", "mix2_t", "mix2_w", "mix3_t", "mix3_w", "morph0", "morph1", "morph2", "morph3", "morph4", "morph5", "morph6", "morph7", "morph8", "morph9", "morph10", "morph11", "morph12", "morph13", "morph14", "morph15", "morph16", "morph17", "morph18", "morph19", "morph20", "morph21", "morph22", "morph23", "morph24", "morph25", "morph26", "morph27", "morph28", "morph29", "morph30", "morph31", "morph32", "morph33", "morph34", "morph35", "morph36", "morph37", "morph38", "morph39", "morph40", "morph41", "morph42", "morph43", "morph44", "morph45", "morph46", "morph47", "morph48", "morph49", "morph50", "morph51", "morph52", "morph53", "morph54", "morph55", "morph56", "morph57", "morph58", "morph59", "morph60", "morph61", "morph62", "morph63", "g0_w", "g0_t", "g1_w", "g1_t", "g2_w", "g2_t", "g3_w", "g3_t", "g4_w", "g4_t", "g5_w", "g5_t", "g6_w", "g6_t", "g7_w", "g7_t", "g8_w", "g8_t", "g9_w", "g9_t", "g10_w", "g10_t", "g11_w", "g11_t", "g12_w", "g12_t", "g13_w", "g13_t", "g14_w", "g14_t", "g15_w", "g15_t", "look", "glitch_explode", "glitch_scramble", "glitch_jitter", "glitch_snap", "glitch_smear_x", "glitch_smear_y", "glitch_smear_z", "glitch_seed", "cloth_frame", "screen_power", "pass"],
"panel" => &["x", "y", "z", "q_x", "q_y", "q_z", "q_w", "scale_x", "scale_y", "scale_z", "visible", "screen_power", "screen_bright", "pass"],
@@ -64,25 +64,32 @@ pub(crate) fn live_dynamic(kind: &str) -> &'static [&'static str] {
}
}
+/// A camera column a render keys when it changes (raea-runtime-look camera.rs), which a live frame sends when it does:
+/// its place and look, lens, roll (up_*), view window, ambient, sky and environment, aberration, depth of field, motion
+/// blur, the paint look and its parts' rotations (*_qx..qw). The rest is the first frame's, as a render's is.
+pub(crate) fn cam_keyed(k: &str) -> bool {
+ ["lens_", "mb_", "up_", "view_"].iter().any(|p| k.starts_with(p))
+ || ["_qx", "_qy", "_qz", "_qw"].iter().any(|q| k.ends_with(q))
+ || matches!(k, "x" | "y" | "z" | "look_x" | "look_y" | "look_z" | "fov" | "focus" | "ortho" | "ambient" | "skybox_k" | "env_i" | "env_k" | "env_rot" | "sky_k" | "aberration" | "dof_aperture" | "paint_bands" | "paint_grain" | "paint_rag" | "paint_seed")
+}
+
impl LiveScene {
/// Start again (the engine was dropped: a new size).
pub fn reset(&mut self) {
*self = LiveScene::default();
}
- /// The frame's rows as a render's program would hold them at this frame: the camera row and each part's full row,
- /// by identity, with the row ids this scene keeps.
- pub(crate) fn current(&mut self, f: Shot) -> (BTreeMap<String, V>, Vec<(String, String, BTreeMap<String, V>)>) {
- let all = vec![items_of(f.scene)];
- let mut p = Program::default();
+ /// The frame's camera row, as a render's program holds it at this frame (camera.rs), its spawns into `p`: a frame
+ /// without a camera holds the one before.
+ pub(crate) fn camera_row(&self, all: &[Vec<Item>], clear: Option<&str>, p: &mut Program) -> BTreeMap<String, V> {
let mut cam = BTreeMap::new();
cam.insert("id".into(), V::S("cam".into()));
// the holder's background as the clear colour; with none, Bevy's ClearColor resource (srgb 43, 44, 47 unless a
// <BevyResource type="bevy_camera::clear_color::ClearColor"> sets it), not black (docs/control conventions C17)
- if let Some(bg) = f.clear.and_then(hex_of) {
+ if let Some(bg) = clear.and_then(hex_of) {
cam.insert("bg".into(), V::S(bg));
}
- camera(&all, &mut p, &mut cam);
+ camera(all, p, &mut cam);
if !all[0].iter().any(|i| i.kind == "camera") {
// no camera this frame: a render holds the one before (filled)
for k in ["x", "y", "z", "look_x", "look_y", "look_z", "fov", "focus"] {
@@ -94,6 +101,31 @@ impl LiveScene {
}
}
}
+ cam
+ }
+
+ /// What the camera row changes, of the columns a render keys (cam_keyed): the camera's tuple, or None.
+ pub(crate) fn camera_diff(sent: &mut BTreeMap<String, V>, cam: &BTreeMap<String, V>) -> Option<raea_core_program::eval::Tup> {
+ let mut vals = BTreeMap::new();
+ for k in cam.keys().map(String::as_str).filter(|k| cam_keyed(k)).chain(["ambient"]) {
+ let v = cam.get(k).cloned().or_else(|| (k == "ambient" && sent.contains_key("ambient")).then_some(V::N(0.0)));
+ if let Some(v) = v {
+ if sent.get(k) != Some(&v) {
+ sent.insert(k.into(), v.clone());
+ vals.insert(k.to_string(), v);
+ }
+ }
+ }
+ (!vals.is_empty()).then(|| raea_core_program::eval::Tup { kind: "camera".into(), id: "cam".into(), vals })
+ }
+
+ /// The frame's rows as a render's program would hold them at this frame: the camera row and each part's full row,
+ /// by identity, with the row ids this scene keeps.
+ pub(crate) fn current(&mut self, f: Shot) -> (BTreeMap<String, V>, Vec<(String, String, BTreeMap<String, V>)>) {
+ let all = vec![items_of(f.scene)];
+ // the camera's own spawns (its fog, sky...) in the frame's program with the rest
+ let mut p = Program::default();
+ let cam = self.camera_row(&all, f.clear, &mut p);
let tr = Tracks::of(&all);
rows_into_of(&all, &tr, &mut p);
// each local row (this frame's tracks, numbered as rows_into numbers them) by its identity
@@ -212,22 +244,8 @@ impl LiveScene {
/// What this frame changes, from its camera row and parts' rows (`current`'s)
pub(crate) fn diff(&mut self, cam: BTreeMap<String, V>, rows: Vec<(String, String, BTreeMap<String, V>)>) -> (Vec<raea_core_program::eval::Tup>, Vec<(String, String)>) {
let mut out: Vec<raea_core_program::eval::Tup> = Vec::new();
- // the camera: where it is and looks, its lens and the ambient light (0 once there's none)
- let mut vals = BTreeMap::new();
- // and the lens's and motion blur's, whatever of theirs the frame keys
- let keyed: Vec<String> = cam.keys().filter(|k| k.starts_with("lens_") || k.starts_with("mb_") || *k == "ortho").cloned().collect();
- for k in ["x", "y", "z", "look_x", "look_y", "look_z", "fov", "ambient", "focus", "paint_bands", "paint_grain", "paint_rag", "paint_seed"].into_iter().chain(keyed.iter().map(String::as_str)) {
- let v = cam.get(k).cloned().or_else(|| (k == "ambient" && self.cam.contains_key("ambient")).then_some(V::N(0.0)));
- if let Some(v) = v {
- if self.cam.get(k) != Some(&v) {
- self.cam.insert(k.into(), v.clone());
- vals.insert(k.to_string(), v);
- }
- }
- }
- if !vals.is_empty() {
- out.push(raea_core_program::eval::Tup { kind: "camera".into(), id: "cam".into(), vals });
- }
+ // the camera: whatever of it a render keys, and the ambient light (0 once there's none)
+ out.extend(Self::camera_diff(&mut self.cam, &cam));
let mut seen: std::collections::HashSet<String> = std::collections::HashSet::new();
for (kind, id, row) in rows {
seen.insert(id.clone());
@@ -259,7 +277,7 @@ impl LiveScene {
if let Some(V::S(c)) = row.get("color") {
let c = rgb(c);
for (k, name) in ["col_r", "col_g", "col_b"].iter().enumerate() {
- want.insert(name.to_string(), V::N(r6(c[k])));
+ want.insert(name.to_string(), V::N(c[k]));
}
}
}
diff --git a/runtime/scene/src/models.rs b/runtime/scene/src/models.rs
index 6223b577..ae1e4103 100644
--- a/runtime/scene/src/models.rs
+++ b/runtime/scene/src/models.rs
@@ -203,7 +203,7 @@ pub(crate) fn sheet(p: &mut Program, row: &mut BTreeMap<String, V>, id: &str, it
pub(crate) fn tint(p: &mut Program, row: &mut BTreeMap<String, V>, id: &str, its: &[Item], default: &str) {
let colors: Vec<[f64; 3]> = its.iter().map(|i| rgb(&hex(i.props.get("color")).unwrap_or(default.into()))).collect();
for (c, name) in ["col_r", "col_g", "col_b"].iter().enumerate() {
- column(p, row, id, name, &colors.iter().map(|v| v[c]).collect::<Vec<_>>());
+ exact(p, row, id, name, &colors.iter().map(|v| v[c]).collect::<Vec<_>>());
}
}
@@ -267,8 +267,8 @@ pub(crate) fn fogs_rows(tr: &Tracks, p: &mut Program) {
if colors.iter().any(|c| *c != colors[0]) {
let c: Vec<[f64; 3]> = colors.iter().map(|c| rgb(c)).collect();
for (k, name) in ["col_r", "col_g", "col_b"].iter().enumerate() {
- p.keys.insert((id.clone(), name.to_string()), c.iter().enumerate().map(|(f, v)| (f as i64, r6(v[k]), "linear".to_string())).collect());
- row.insert(name.to_string(), V::N(r6(c[0][k])));
+ p.keys.insert((id.clone(), name.to_string()), c.iter().enumerate().map(|(f, v)| (f as i64, v[k], "linear".to_string())).collect());
+ row.insert(name.to_string(), V::N(c[0][k]));
}
}
let first = &its[0].props;
@@ -299,7 +299,7 @@ pub(crate) fn fires_rows(tr: &Tracks, p: &mut Program) {
if colors.iter().any(|c| *c != colors[0]) {
let c: Vec<[f64; 3]> = colors.iter().map(|c| rgb(c)).collect();
for (k, name) in ["col_r", "col_g", "col_b"].iter().enumerate() {
- column(p, &mut row, &id, name, &c.iter().map(|v| v[k]).collect::<Vec<_>>());
+ exact(p, &mut row, &id, name, &c.iter().map(|v| v[k]).collect::<Vec<_>>());
}
}
let first = &its[0].props;
diff --git a/runtime/scene/src/parts.rs b/runtime/scene/src/parts.rs
index 0ac7026b..eee2a995 100644
--- a/runtime/scene/src/parts.rs
+++ b/runtime/scene/src/parts.rs
@@ -132,8 +132,9 @@ pub(crate) fn meshes_rows(tr: &Tracks, names: &[String], p: &mut Program) {
let c: Vec<[f64; 3]> = colors.iter().map(|c| rgb(c)).collect();
for (k, name) in ["col_r", "col_g", "col_b"].iter().enumerate() {
let vals: Vec<f64> = c.iter().map(|v| v[k]).collect();
- p.keys.insert((id.clone(), name.to_string()), vals.iter().enumerate().map(|(f, v)| (f as i64, r6(*v), "linear".to_string())).collect());
- row.insert(name.to_string(), V::N(r6(vals[0])));
+ // exact, as the hex's byte over 255 (the engine reads either into the same f32: #26)
+ p.keys.insert((id.clone(), name.to_string()), vals.iter().enumerate().map(|(f, v)| (f as i64, *v, "linear".to_string())).collect());
+ row.insert(name.to_string(), V::N(vals[0]));
}
}
let m0 = &mats[0];
@@ -344,7 +345,7 @@ pub(crate) fn texts_rows(tr: &Tracks, names: &[String], p: &mut Program) {
if colors.iter().any(|c| *c != colors[0]) {
let c: Vec<[f64; 3]> = colors.iter().map(|c| rgb(c)).collect();
for (ch, col) in ["col_r", "col_g", "col_b"].iter().enumerate() {
- column(p, &mut row, &gid, col, &c.iter().map(|v| v[ch]).collect::<Vec<_>>());
+ exact(p, &mut row, &gid, col, &c.iter().map(|v| v[ch]).collect::<Vec<_>>());
}
}
let op: Vec<f64> = gs.iter().map(|g| g.get("o").and_then(Value::as_f64).unwrap_or(1.0).clamp(0.0, 1.0)).collect();