blob: d7ac430e5e90261a118d6fc0b1fb30e044529d2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
use teleia::*;
const VERT: &'static str = include_str!("assets/shaders/throwshade/vert.glsl");
const FRAG: &'static str = include_str!("assets/shaders/throwshade/frag.glsl");
pub struct ThrowShade {
pub shader: Option<shader::Shader>,
}
impl ThrowShade {
pub fn new() -> Self {
Self {
shader: None,
}
}
pub fn set(&mut self, ctx: &context::Context, src: &str) {
let fsrc = format!("{}\n{}\n", FRAG, src);
if let Some(s) = &mut self.shader {
s.replace(ctx, VERT, &fsrc);
} else {
self.shader = Some(shader::Shader::new_nolib(ctx, VERT, &fsrc));
}
}
}
|