mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -07:00
Just learned about the private storage class. The rain pass can use it to look up the corner positions of quads, rather than derive them mathematically.
This commit is contained in:
@@ -285,6 +285,11 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
|
||||
|
||||
// Vertex shader
|
||||
|
||||
var<private> quadCorners : array<vec2<f32>, NUM_VERTICES_PER_QUAD> = array<vec2<f32>, NUM_VERTICES_PER_QUAD>(
|
||||
vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 0.0), vec2<f32>(0.0, 1.0),
|
||||
vec2<f32>(1.0, 1.0), vec2<f32>(0.0, 1.0), vec2<f32>(1.0, 0.0)
|
||||
);
|
||||
|
||||
[[stage(vertex)]] fn vertMain(input : VertInput) -> VertOutput {
|
||||
|
||||
var volumetric = bool(config.volumetric);
|
||||
@@ -295,10 +300,7 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
|
||||
var i = i32(input.index);
|
||||
var quadIndex = i / NUM_VERTICES_PER_QUAD;
|
||||
|
||||
var quadCorner = vec2<f32>(
|
||||
f32(i % 2),
|
||||
f32((i + 1) % NUM_VERTICES_PER_QUAD / 3)
|
||||
);
|
||||
var quadCorner = quadCorners[i % NUM_VERTICES_PER_QUAD];
|
||||
|
||||
var quadPosition = vec2<f32>(
|
||||
f32(quadIndex % i32(quadGridSize.x)),
|
||||
|
||||
Reference in New Issue
Block a user