-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_wgsl_output.rs
More file actions
36 lines (32 loc) · 1.04 KB
/
debug_wgsl_output.rs
File metadata and controls
36 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use wgsl_shader_studio::isf_auto_converter::*;
fn main() {
let mut converter = IsfAutoConverter::new();
let basic_isf = r#"
/*{
"NAME": "Basic Color",
"DESCRIPTION": "Simple color shader",
"INPUTS": [
{"NAME": "brightness", "TYPE": "float", "DEFAULT": 1.0, "MIN": 0.0, "MAX": 2.0}
]
}*/
void main() {
vec2 uv = isf_FragNormCoord;
float time = TIME * brightness;
vec3 color = vec3(sin(time + uv.x * 10.0), cos(time + uv.y * 10.0), 0.5);
gl_FragColor = vec4(color, 1.0);
}
"#;
match converter.convert_to_wgsl_advanced(basic_isf) {
Ok(result) => {
println!("=== GENERATED WGSL ===");
println!("{}", result.wgsl_code);
println!("\n=== EXPECTED PATTERNS ===");
println!("Looking for: uniforms.brightness");
println!("Looking for: isf_FragNormCoord");
println!("Looking for: TIME");
}
Err(e) => {
println!("Error: {}", e);
}
}
}