diff --git a/example/common.glsl b/example/common.glsl index 3a59be0..620813f 100644 --- a/example/common.glsl +++ b/example/common.glsl @@ -8,7 +8,7 @@ uniform sampler2D tex; uniform float sliders[32]; uniform vec4 buttons[32]; -vec3 gay(float x) { +vec3 rainbow(float x) { x = x * 3.0 - 1.5; return clamp(vec3(-x, 1.0-abs(x), x), 0.0, 1.0); } diff --git a/example/compute/test_comp.glsl b/example/compute/test_comp.glsl index 2ec5c45..92a95b4 100644 --- a/example/compute/test_comp.glsl +++ b/example/compute/test_comp.glsl @@ -4,15 +4,15 @@ layout(local_size_x = 1, local_size_y = 1) in; layout(rgba32f) uniform image2D img_output; void main() { - // base pixel colour for image - vec4 pixel = vec4(0.0, 0.0, 1.0, 1.0); - // get index in global work group i.e x,y position - ivec2 pixel_coords = ivec2(gl_GlobalInvocationID.xy); - pixel.rg = pixel_coords / vec2(512.); - // - // interesting stuff happens here later - // + // base pixel colour for image + vec4 pixel = vec4(0, 0, 1, 1); - // output to a specific pixel in the image - imageStore(img_output, pixel_coords, pixel); + // get index in global work group i.e x,y position + ivec2 pixel_coords = ivec2(gl_GlobalInvocationID.xy); + pixel.rg = pixel_coords / vec2(512); + + // interesting stuff goes here + + // output to a specific pixel in the image + imageStore(img_output, pixel_coords, pixel); } diff --git a/example/post.glsl b/example/post.glsl index a20b1f7..2628b2e 100644 --- a/example/post.glsl +++ b/example/post.glsl @@ -14,7 +14,7 @@ void main() { float x = float(i) / float(iter - 1); float s = 1.0 + 0.3 * (sliders[0]) * (x - 0.5); vec2 tuv = 0.5 + s * (uv - 0.5); - acc += vec4(gay(x), 1) * texture2D(tex, tuv); + acc += vec4(rainbow(x), 1) * texture2D(tex, tuv); } acc /= float(iter); diff --git a/example/vertex/shader.vert b/example/vertex/shader.vert index a8242ef..249d275 100644 --- a/example/vertex/shader.vert +++ b/example/vertex/shader.vert @@ -8,27 +8,25 @@ uniform float time; const float pi = acos(-1.0); -mat2 rot(float a) -{ - float s=sin(a), c=cos(a); - return mat2(c,s,-s,c); +mat2 rot(float a) { + float s=sin(a), c=cos(a); + return mat2(c,s,-s,c); } void main() { - float a = 8.0 * pi * gl_VertexID / vertex_count; + float a = 8.0 * pi * gl_VertexID / vertex_count; - float r = 26.0 / 8.0; - vec2 off = vec2(sin(r*a) + 2.3, cos(r*a) + 1.0); - vec3 p = vec3(sin(a), 1, cos(a)) * off.xyx; + float r = 26.0 / 8.0; + vec2 off = vec2(sin(r*a) + 2.3, cos(r*a) + 1.0); + vec3 p = vec3(sin(a), 1, cos(a)) * off.xyx; - p.xz *= rot(time); - p.yz *= rot(0.6); + p.xz *= rot(time); + p.yz *= rot(0.6); - v_color = vec4(1.0 / abs(p.z + 1.0)); + v_color = vec4(1.0 / abs(p.z + 1.0)); - p.z += 5; - p.x *= resolution.w; + p.z += 5; + p.x *= resolution.w; - gl_Position = vec4(p, p.z); - gl_PointSize = 1.0; + gl_Position = vec4(p, p.z); } diff --git a/src/jockey/config.rs b/src/jockey/config.rs index f3c62f9..feda2de 100644 --- a/src/jockey/config.rs +++ b/src/jockey/config.rs @@ -25,7 +25,7 @@ impl Config { let reader = std::fs::File::open(file_path)?; let object: Value = serde_yaml::from_reader(reader)?; - let mut midi_devices = vec![]; + let mut midi_devices = Vec::new(); match object.get("midi_devices") { Some(Value::Sequence(xs)) => { @@ -61,7 +61,7 @@ impl Config { } }; - let mut ndi_sources = vec![]; + let mut ndi_sources = Vec::new(); match object.get("ndi_sources") { Some(Value::Sequence(xs)) => { for val in xs { diff --git a/src/jockey/mod.rs b/src/jockey/mod.rs index e5458e3..6975fbe 100644 --- a/src/jockey/mod.rs +++ b/src/jockey/mod.rs @@ -214,7 +214,7 @@ impl Jockey { midi, audio, ndi, - pipeline_files: vec![], + pipeline_files: Vec::new(), pipeline, pipeline_index: 0, pipeline_partial: None, diff --git a/src/jockey/network.rs b/src/jockey/network.rs index e437ad2..678a706 100644 --- a/src/jockey/network.rs +++ b/src/jockey/network.rs @@ -39,12 +39,12 @@ impl Ndi { let locals = match find_local.current_sources(1000) { Ok(s) => s, - Err(FindSourcesTimeout) => vec![], + Err(FindSourcesTimeout) => Vec::new(), }; let remotes = match find_remote.current_sources(1000) { Ok(s) => s, - Err(FindSourcesTimeout) => vec![], + Err(FindSourcesTimeout) => Vec::new(), }; let mut sources = sources.lock().unwrap(); diff --git a/src/jockey/pipeline.rs b/src/jockey/pipeline.rs index 8855881..3c6f3c5 100644 --- a/src/jockey/pipeline.rs +++ b/src/jockey/pipeline.rs @@ -291,7 +291,7 @@ impl Pipeline { // parse images section let images = match object.get("images") { Some(Value::Sequence(s)) => s.clone(), - None => vec![], + None => Vec::new(), s => return Err(format!("Expected \"images\" to be an array, got {:?}", s)), }; @@ -350,7 +350,7 @@ impl Pipeline { //parse ndi section let ndi_sources = match object.get("ndi") { Some(Value::Sequence(s)) => s.clone(), - None => vec![], + None => Vec::new(), Some(s) => { return Err(format!( "Expected \"ndi\" to be an array, got {:?} instead.", diff --git a/src/jockey/shaders/pass.frag b/src/jockey/shaders/pass.frag index d27ef62..f7743fa 100644 --- a/src/jockey/shaders/pass.frag +++ b/src/jockey/shaders/pass.frag @@ -1,4 +1,8 @@ #version 140 + in vec4 v_color; out vec4 color; -void main(){color=v_color;} + +void main() { + color = v_color; +} diff --git a/src/jockey/shaders/pass.vert b/src/jockey/shaders/pass.vert index 8728c17..2cfc2fa 100644 --- a/src/jockey/shaders/pass.vert +++ b/src/jockey/shaders/pass.vert @@ -1,3 +1,7 @@ #version 140 + in vec2 position; -void main(){gl_Position=vec4(position,0,1);} + +void main() { + gl_Position = vec4(position, 0, 1); +}