mirror of https://github.com/sotrh/learn-wgpu
updated to 0.12
parent
0eed08b713
commit
2073b0fbc1
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,43 @@
|
||||
struct SimulationData {
|
||||
clear_color: vec4<f32>;
|
||||
canvas_size: vec2<f32>;
|
||||
mouse_pos: vec2<f32>;
|
||||
time: vec2<f32>;
|
||||
};
|
||||
|
||||
struct FragmentOutput {
|
||||
[[location(0)]] frag_color: vec4<f32>;
|
||||
};
|
||||
|
||||
var<private> clip_coords_1: vec3<f32>;
|
||||
var<private> frag_color: vec4<f32>;
|
||||
[[group(0), binding(0)]]
|
||||
var<uniform> global: SimulationData;
|
||||
|
||||
fn main_1() {
|
||||
var t: f32;
|
||||
var uv: vec3<f32>;
|
||||
var col: vec4<f32>;
|
||||
|
||||
let _e10 = global.time;
|
||||
t = _e10.x;
|
||||
let _e13 = clip_coords_1;
|
||||
uv = ((_e13 * 0.5) + vec3<f32>(0.5));
|
||||
let _e20 = uv;
|
||||
let _e28 = t;
|
||||
let _e30 = uv;
|
||||
let _e36 = global.clear_color;
|
||||
let _e38 = t;
|
||||
col = mix(vec4<f32>(_e30.x, _e30.y, _e30.z, 1.0), _e36, vec4<f32>(sin(_e38)));
|
||||
let _e43 = col;
|
||||
frag_color = _e43;
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main([[location(0)]] clip_coords: vec3<f32>) -> FragmentOutput {
|
||||
clip_coords_1 = clip_coords;
|
||||
main_1();
|
||||
let _e15 = frag_color;
|
||||
return FragmentOutput(_e15);
|
||||
}
|
Binary file not shown.
@ -0,0 +1,33 @@
|
||||
struct VertexOutput {
|
||||
[[location(0)]] clip_coords: vec3<f32>;
|
||||
[[builtin(position)]] member: vec4<f32>;
|
||||
};
|
||||
|
||||
var<private> clip_coords: vec3<f32>;
|
||||
var<private> gl_VertexIndex: u32;
|
||||
var<private> gl_Position: vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var x: f32;
|
||||
var y: f32;
|
||||
|
||||
let _e2 = gl_VertexIndex;
|
||||
x = f32((((u32(_e2) + 2u) / 3u) % 2u));
|
||||
let _e12 = gl_VertexIndex;
|
||||
y = f32((((u32(_e12) + 1u) / 3u) % 2u));
|
||||
let _e25 = x;
|
||||
let _e31 = y;
|
||||
gl_Position = vec4<f32>((-(1.0) + (_e25 * 2.0)), (-(1.0) + (_e31 * 2.0)), 0.0, 1.0);
|
||||
let _e38 = gl_Position;
|
||||
clip_coords = _e38.xyz;
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn main([[builtin(vertex_index)]] param: u32) -> VertexOutput {
|
||||
gl_VertexIndex = param;
|
||||
main_1();
|
||||
let _e5 = clip_coords;
|
||||
let _e7 = gl_Position;
|
||||
return VertexOutput(_e5, _e7);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "snow"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
framework = { version = "0.1", path = "../framework"}
|
@ -0,0 +1,33 @@
|
||||
use anyhow::*;
|
||||
|
||||
struct Snow {
|
||||
|
||||
}
|
||||
|
||||
impl framework::Demo for Snow {
|
||||
fn init(display: &framework::Display) -> Result<Self, Error> {
|
||||
Ok(Self {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fn process_mouse(&mut self, dx: f64, dy: f64) {
|
||||
|
||||
}
|
||||
|
||||
fn resize(&mut self, display: &framework::Display) {
|
||||
|
||||
}
|
||||
|
||||
fn update(&mut self, display: &framework::Display, dt: std::time::Duration) {
|
||||
|
||||
}
|
||||
|
||||
fn render(&mut self, display: &mut framework::Display) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
framework::run::<Snow>();
|
||||
}
|
Loading…
Reference in New Issue