mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-09 15:54:24 +00:00
37 lines
887 B
Rust
37 lines
887 B
Rust
|
use gfx::{self, *};
|
||
|
use ggez::graphics::Shader;
|
||
|
use ggez::{Context, GameResult};
|
||
|
|
||
|
gfx_defines! {
|
||
|
constant WaterShaderParams {
|
||
|
resolution: [f32; 2] = "u_Resolution",
|
||
|
t: f32 = "u_Tick",
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub struct Shaders {
|
||
|
pub water_shader: Shader<WaterShaderParams>,
|
||
|
pub water_shader_params: WaterShaderParams,
|
||
|
}
|
||
|
|
||
|
impl Shaders {
|
||
|
pub fn new(ctx: &mut Context) -> GameResult<Shaders> {
|
||
|
let water_shader_params = WaterShaderParams {
|
||
|
t: 0.0,
|
||
|
resolution: [0.0, 0.0],
|
||
|
};
|
||
|
|
||
|
Ok(Shaders {
|
||
|
water_shader: Shader::new(
|
||
|
ctx,
|
||
|
"/builtin/shaders/basic_150.vert.glsl",
|
||
|
"/builtin/shaders/water_150.frag.glsl",
|
||
|
water_shader_params,
|
||
|
"WaterShaderParams",
|
||
|
None,
|
||
|
)?,
|
||
|
water_shader_params,
|
||
|
})
|
||
|
}
|
||
|
}
|