Compare commits

..

No commits in common. "69b619dbf5fc26996cbfb4bb0244a108c3162150" and "5ff4ecacdd4b4d5d15cb4e37609cd49eb86daaa3" have entirely different histories.

3 changed files with 7 additions and 30 deletions

View File

@ -16,7 +16,7 @@ use std::sync::Arc;
use redis_ctrl::{RedisCtrl, Order}; use redis_ctrl::{RedisCtrl, Order};
use conf::Conf; use conf::Conf;
use errors::LJResult; use errors::LJResult;
use point::{Point,Color}; use point::Point;
use transformer::Transformers; use transformer::Transformers;
use log::{LevelFilter, info, /* warn, */ error}; use log::{LevelFilter, info, /* warn, */ error};
use env_logger::Builder; use env_logger::Builder;
@ -87,10 +87,9 @@ fn run_all() -> LJResult<()> {
// 6 : Max Intensity Change = reread redis key /intensity // 6 : Max Intensity Change = reread redis key /intensity
// 7 : kpps change = reread redis key /kpps // 7 : kpps change = reread redis key /kpps
// 8 : color balance change = reread redis keys /red /green /blue // 8 : color balance change = reread redis keys /red /green /blue
match order { match order {
Order::Draw | Order::Black => { Order::Draw => {
world_state.black = order == Order::Black;
let frame = get_next_frame( let frame = get_next_frame(
&config, &config,
&transformers, &transformers,
@ -156,27 +155,6 @@ fn get_next_frame(
for transformer in transformers { for transformer in transformers {
line = transformer.apply(&line, world_state); line = transformer.apply(&line, world_state);
} }
info!("-> {}", world_state.black);
// LIMITER and BLACK
line = line.into_iter()
.map(| p | {
let color = if world_state.black {
Color { r: 0, g: 0, b: 0 }
} else {
Color {
r: p.color.r.min(world_state.intensity),
g: p.color.g.min(world_state.intensity),
b: p.color.b.min(world_state.intensity)
}
};
Point { color,
..p
}
})
.collect();
//info!("Line: {:?}", line); //info!("Line: {:?}", line);
Ok(line) Ok(line)

View File

@ -7,9 +7,9 @@ pub struct Point {
#[derive(Debug,Clone,Copy,Default,PartialEq)] #[derive(Debug,Clone,Copy,Default,PartialEq)]
pub struct Color { pub struct Color {
pub r: u8, r: u8,
pub g: u8, g: u8,
pub b: u8 b: u8
} }
impl From<(f32,f32,u32)> for Point { impl From<(f32,f32,u32)> for Point {

View File

@ -43,8 +43,7 @@ pub struct WorldState {
pub client_key: String, //u8, pub client_key: String, //u8,
pub intensity: u8, pub intensity: u8,
pub kpps: u32, pub kpps: u32,
pub color: Color, pub color: Color
pub black: bool
} }
impl WorldState { impl WorldState {