StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.
| 1 | // Advanced triangle shader demonstrating the shader management system |
| 2 | // This shader supports hot-reload and automatic recompilation |
| 3 | |
| 4 | struct VertexInput { |
| 5 | @location(0) position: vec2<f32>, |
| 6 | @location(1) color: vec3<f32>, |
| 7 | } |
| 8 | |
| 9 | struct VertexOutput { |
| 10 | @builtin(position) clip_position: vec4<f32>, |
| 11 | @location(0) color: vec3<f32>, |
| 12 | } |
| 13 | |
| 14 | // Vertex shader |
| 15 | @vertex |
| 16 | fn vs_main(input: VertexInput) -> VertexOutput { |
| 17 | var output: VertexOutput; |
| 18 | output.clip_position = vec4<f32>(input.position, 0.0, 1.0); |
| 19 | output.color = input.color; |
| 20 | return output; |
| 21 | } |
| 22 | |
| 23 | // Fragment shader with animated color effect |
| 24 | @fragment |
| 25 | fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> { |
| 26 | // Simple color animation based on position |
| 27 | let animated_color = input.color * (sin(input.clip_position.x * 0.01) * 0.5 + 0.5); |
| 28 | return vec4<f32>(animated_color, 1.0); |
| 29 | } |