aboutsummaryrefslogtreecommitdiffstats
path: root/src/shader.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader.rs')
-rw-r--r--src/shader.rs24
1 files changed, 24 insertions, 0 deletions
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<String> {
+ 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(())
+ }
+}