From 0396d313791af347f31d004bbf2842fb11244fac Mon Sep 17 00:00:00 2001 From: Petri Hienonen Date: Sat, 18 Oct 2025 14:24:04 +0300 Subject: Update --- src/shader.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/shader.rs (limited to 'src/shader.rs') diff --git a/src/shader.rs b/src/shader.rs new file mode 100644 index 0000000..47a1621 --- /dev/null +++ b/src/shader.rs @@ -0,0 +1,24 @@ +use anyhow::Result; +use std::path::Path; + +pub struct ShaderManager { + shader_dir: String, +} + +impl ShaderManager { + pub fn new(shader_dir: &str) -> Self { + Self { + shader_dir: shader_dir.to_string(), + } + } + + pub fn load_shader(&self, name: &str) -> Result { + let path = Path::new(&self.shader_dir).join(name); + std::fs::read_to_string(path).map_err(|e| e.into()) + } + + pub fn watch_shaders(&self) -> Result<()> { + // TODO: Implement shader hot-reloading with notify crate + Ok(()) + } +} -- cgit v1.2.3-70-g09d2