fixed minor regression, cleaned up source tree

master
mitchellhansen 5 years ago
parent 1f33d96ae5
commit 28878dc345

@ -0,0 +1,21 @@
#version 450
layout(location = 0) in vec2 tex_coords;
layout(location = 1) in vec4 out_color;
layout(location = 0) out vec4 f_color;
layout(set = 0, binding = 0) uniform sampler2D tex;
layout(set = 0, binding = 1, rgba32ui) readonly uniform uimage2D img;
void main() {
ivec2 pos = ivec2(gl_FragCoord.x, gl_FragCoord.y);
f_color = imageLoad(img, ivec2(pos)) / (255.0);
float gamma = 0.5;
f_color.rgb = pow(f_color.rgb, vec3(1.0/gamma));
//f_color = out_color;
// f_color = texture(tex, tex_coords);
}

@ -0,0 +1,13 @@
#version 450
layout(location = 0) in vec2 position;
layout(location = 1) in vec4 color;
layout(location = 0) out vec2 tex_coords;
layout(location = 1) out vec4 out_color;
void main() {
out_color = color;
gl_Position = vec4(position, 0.0, 1.0);
tex_coords = position;
}

@ -16,5 +16,6 @@ void main() {
float gamma = 0.5;
f_color.rgb = pow(f_color.rgb, vec3(1.0/gamma));
//f_color = out_color;
// f_color = texture(tex, tex_coords);
}

@ -6,6 +6,8 @@ layout(location = 0) out vec2 tex_coords;
layout(location = 1) out vec4 out_color;
void main() {
out_color = color;
gl_Position = vec4(position, 0.0, 1.0);
tex_coords = position;
}

@ -301,7 +301,7 @@ impl<'a> VkProcessor<'a> {
println!("Allocating Buffers...");
let color = [0.,0.,0.,0.];
let color = [1.,0.,0.,0.];
let vertex_buffer = {

@ -244,7 +244,7 @@ impl ShaderKernels {
third_constant: 0.0,
})
// The content of the vertex buffer describes a list of triangles.
.triangle_list_with_adjacency()
.triangle_fan()
// Use a resizable viewport set to draw over the entire window
.viewports_dynamic_scissors_irrelevant(1)
// See `vertex_shader`.

@ -1,114 +0,0 @@
use sfml::graphics::{Texture, Sprite, IntRect, Drawable, RenderTarget, RenderStates};
use sfml::system::Vector2u;
use sfml::graphics::Transformable;
//pub struct Thing<'a> {
//
// loader: WorkpieceLoader,
// workpiece: Workpiece<'a>
//
//}
//
//impl<'a> Thing<'a> {
//
// pub fn new(pixels: Vec<u8>) -> Thing<'a> {
//
// let mut workpieceloader = WorkpieceLoader::new(String::from("resources/images/funky-bird.jpg"));
// workpieceloader.load_first_stage(pixels);
//
// let mut workpiece = Workpiece::new();
// workpiece.load_first_stage(&mut workpieceloader.first_stage_texture);
//
// Thing {
// loader: workpieceloader,
// workpiece: workpiece
// }
// }
//}
/*
first_thing = Thing1::new();
second_thing = Thing1::new();
let mut container_thing = Thing2::new();
container_thing.field = &mut first_thing;
container_thing.field = &mut second_thing;
first_thing.field = 10;
*/
#[derive(Clone)]
pub struct WorkpieceLoader {
pub swatch_texture: Texture,
pub first_stage_texture: Texture,
pub xy: Vector2u,
pub vec: Vec<Texture>,
}
impl WorkpieceLoader {
pub fn new(filepath: String) -> WorkpieceLoader {
let texture = Texture::from_file(filepath.as_str()).expect("Couldn't load image");
let xy = texture.size();
WorkpieceLoader {
swatch_texture: texture,
first_stage_texture: Texture::new(xy.x, xy.y).unwrap(),
xy: xy,
vec: vec![]
}
}
pub fn load_first_stage(&mut self, pixels: Vec<u8>) {
self.vec.clear();
let mut t = Texture::new(self.xy.x, self.xy.y).expect("Couldn't load image");
t.update_from_pixels(pixels.as_slice(), self.xy.x, self.xy.y, 0, 0);
self.vec.push(t);
}
pub fn get_first(&mut self) -> &Texture {
&self.first_stage_texture
}
}
pub struct Workpiece<'a> {
pub render_sprite: Sprite<'a>
}
impl<'a> Workpiece<'a> {
pub fn new() -> Workpiece<'a> {
Workpiece {
render_sprite: Sprite::new()
}
}
pub fn load_first_stage(&mut self, texture: &'a mut Texture) {
self.render_sprite.set_texture(texture, false);
self.render_sprite.set_position((0., 0.));
}
}
impl<'s> Drawable for Workpiece<'s> {
fn draw<'a: 'shader, 'texture, 'shader, 'shader_texture>(
&'a self,
render_target: &mut RenderTarget,
_: RenderStates<'texture, 'shader, 'shader_texture>,
) {
}
}
Loading…
Cancel
Save