-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprelude.rs
57 lines (48 loc) · 1.64 KB
/
prelude.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Stuff that gets imported by a lot of other files.
pub use winit::dpi;
pub use std::path::{PathBuf, Path};
pub use std::sync::{Arc, Mutex, mpsc};
// spirv is littleendian
pub use byteorder::{ByteOrder, LittleEndian};
pub use crate::views::view::{FractalViewable, FractalViewData, FractalViewManager};
pub use crate::views::utils::{
create_buffer,
WHOLE_VERTICES, RIGHT_HALF_VERTICES, LEFT_HALF_VERTICES
};
pub use crate::utils::{
AtomicDevice,
ABSOLUTE_PATH, Position, POSITION_SIZE,
WindowSize, WINDOW_SIZE_SIZE,
Zoom, ZOOM_SIZE,
Iterations, ITERATIONS_SIZE,
Vertex, VERTEX_SIZE,
Julia, JULIA_SIZE
};
pub use views::view::Buffers;
pub use notify::{RecommendedWatcher, DebouncedEvent};
pub use std::ops::Deref;
lazy_static! {
/// Vertex shader compiled at build and loaded lazily
pub static ref VERT_SHADER: Vec<u32> = {
let bytes = include_bytes!("../../shaders/vertices.vert.spv");
let mut rs = vec![0; bytes.len()/4];
LittleEndian::read_u32_into(bytes, &mut rs);
log::info!("Read bytes len originally {:?}, to {:?}", bytes.len(), rs.len());
rs
};
/// Pre-compiled shader
pub static ref FRAG_SHADER_INIT: Vec<u32> = {
let bytes = include_bytes!("../../shaders/mandelbrot.frag.spv");
let mut rs = vec![0; bytes.len()/4];
LittleEndian::read_u32_into(bytes, &mut rs);
rs
};
/// Path to shader file which gets reloaded in `main`.
pub static ref FRAG_SHADER_PATH: PathBuf = {
let mut frag_shader_path_buf: PathBuf = ABSOLUTE_PATH.clone();
let x = ["shaders", "mandelbrot.frag"].iter().collect();
frag_shader_path_buf.push::<PathBuf>(x);
log::info!("Frag shader path: {:?}", frag_shader_path_buf);
frag_shader_path_buf
};
}