added raymarching demo for testing

This commit is contained in:
Piotrek
2021-04-14 15:42:31 +02:00
parent 70bb7a3e6e
commit 8094d8168d
10 changed files with 174 additions and 30 deletions
+8 -1
View File
@@ -58,9 +58,16 @@ fn main() {
let mut compiler = shaderc::Compiler::new().expect("Unable to create shader compiler");
for shader in shaders {
println!("cargo:rerun-if-changed={}", shader.src_path.as_os_str().to_str().unwrap());
let compiled = compiler.compile_into_spirv(&shader.source, shader.kind, &shader.src_path.to_str().unwrap(), "main", Some(&options)).unwrap();
let compiled = compiler.compile_into_spirv(&shader.source, shader.kind, &shader.src_path.to_str().unwrap(), "main", Some(&options))
.expect("Shader error:");
write(shader.spv_path, compiled.as_binary_u8()).unwrap();
}
// Rebuild if any of the cginc change
for path_str in glob("./src/shaders/**/*.cginc").unwrap() {
let path = path_str.unwrap();
println!("cargo:rerun-if-changed={}", path.as_os_str().to_str().unwrap());
}
}