Skip to content
This repository has been archived by the owner on Jan 30, 2022. It is now read-only.

[WIP] Bloom example #24

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
67 changes: 64 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cgmath = "0.14.1"
image = "0.14.0"
winit = "0.11.0"
time = "0.1.37"
failure = "0.1.1"

[[bin]]
name = "deferred"
Expand All @@ -20,6 +21,10 @@ path = "deferred/main.rs"
name = "msaa-renderpass"
path = "msaa-renderpass/main.rs"

[[bin]]
name = "bloom"
path = "bloom/main.rs"

[[bin]]
name = "triangle"
path = "triangle/main.rs"
126 changes: 126 additions & 0 deletions bloom/cube.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#[derive(Debug, Clone)]
pub struct Vertex {
a_position: [f32; 3],
a_uv: [f32; 2],
}
impl_vertex!(Vertex, a_position, a_uv);

pub const VERTICES: [Vertex; 24] = [
// back
Vertex {
a_position: [-1.0, -1.0, 1.0],
a_uv: [0.0, 0.0],
},
Vertex {
a_position: [1.0, -1.0, 1.0],
a_uv: [1.0, 0.0],
},
Vertex {
a_position: [1.0, 1.0, 1.0],
a_uv: [1.0, 1.0],
},
Vertex {
a_position: [-1.0, 1.0, 1.0],
a_uv: [0.0, 1.0],
},
// front
Vertex {
a_position: [-1.0, -1.0, -1.0],
a_uv: [0.0, 0.0],
},
Vertex {
a_position: [-1.0, 1.0, -1.0],
a_uv: [1.0, 0.0],
},
Vertex {
a_position: [1.0, 1.0, -1.0],
a_uv: [1.0, 1.0],
},
Vertex {
a_position: [1.0, -1.0, -1.0],
a_uv: [0.0, 1.0],
},
// top
Vertex {
a_position: [-1.0, 1.0, -1.0],
a_uv: [0.0, 0.0],
},
Vertex {
a_position: [-1.0, 1.0, 1.0],
a_uv: [1.0, 0.0],
},
Vertex {
a_position: [1.0, 1.0, 1.0],
a_uv: [1.0, 1.0],
},
Vertex {
a_position: [1.0, 1.0, -1.0],
a_uv: [0.0, 1.0],
},
// bottom
Vertex {
a_position: [-1.0, -1.0, -1.0],
a_uv: [0.0, 0.0],
},
Vertex {
a_position: [1.0, -1.0, -1.0],
a_uv: [1.0, 0.0],
},
Vertex {
a_position: [1.0, -1.0, 1.0],
a_uv: [1.0, 1.0],
},
Vertex {
a_position: [-1.0, -1.0, 1.0],
a_uv: [0.0, 1.0],
},
// left
Vertex {
a_position: [1.0, -1.0, -1.0],
a_uv: [0.0, 0.0],
},
Vertex {
a_position: [1.0, 1.0, -1.0],
a_uv: [1.0, 0.0],
},
Vertex {
a_position: [1.0, 1.0, 1.0],
a_uv: [1.0, 1.0],
},
Vertex {
a_position: [1.0, -1.0, 1.0],
a_uv: [0.0, 1.0],
},
// right
Vertex {
a_position: [-1.0, -1.0, -1.0],
a_uv: [0.0, 0.0],
},
Vertex {
a_position: [-1.0, -1.0, 1.0],
a_uv: [1.0, 0.0],
},
Vertex {
a_position: [-1.0, 1.0, 1.0],
a_uv: [1.0, 1.0],
},
Vertex {
a_position: [-1.0, 1.0, -1.0],
a_uv: [0.0, 1.0],
},
];

pub const INDICES: [u16; 36] = [
// back
0, 1, 2, 2, 3, 0,
// front
4, 5, 6, 6, 7, 4,
// top
8, 9, 10, 10, 11, 8,
// bottom
12, 13, 14, 14, 15, 12,
// left
16, 17, 18, 18, 19, 16,
// right
20, 21, 22, 22, 23, 20,
];
Loading