adding transformations

This commit is contained in:
Kbz-8
2024-11-13 12:17:59 +01:00
parent 71d1c20a27
commit 35b7408eab
18 changed files with 141 additions and 130 deletions

View File

@@ -21,8 +21,8 @@ struct ViewerData
struct SpriteData
{
color: vec4[f32],
position: vec2[f32]
model_matrix: mat4[f32],
color: vec4[f32]
}
external
@@ -34,11 +34,11 @@ external
[entry(vert)]
fn main(input: VertIn) -> VertOut
{
let position: vec4[f32] = vec4[f32](input.pos.xy + model.position, 1.0, 1.0);
let position: vec4[f32] = vec4[f32](input.pos.xy, 1.0, 1.0);
input.uv *= -1.0;
let output: VertOut;
output.uv = input.uv;
output.color = model.color;
output.pos = viewer_data.projection_matrix * position;
output.pos = viewer_data.projection_matrix * model.model_matrix * position;
return output;
}

View File

@@ -1,70 +1,71 @@
3,2,35,7,0,0,1,0,39,0,0,0,70,0,0,0,0,0,0,0,17,0,2,0,1,0,0,0,14,0,
3,0,0,0,0,0,1,0,0,0,15,0,10,0,0,0,0,0,34,0,0,0,109,97,105,110,0,0,0,0,
14,0,0,0,19,0,0,0,25,0,0,0,27,0,0,0,28,0,0,0,3,0,3,0,0,0,0,0,100,0,
13,0,0,0,19,0,0,0,25,0,0,0,27,0,0,0,28,0,0,0,3,0,3,0,0,0,0,0,100,0,
0,0,5,0,5,0,4,0,0,0,86,105,101,119,101,114,68,97,116,97,0,0,6,0,8,0,4,0,0,0,
0,0,0,0,112,114,111,106,101,99,116,105,111,110,95,109,97,116,114,105,120,0,0,0,5,0,5,0,8,0,
0,0,83,112,114,105,116,101,68,97,116,97,0,0,6,0,5,0,8,0,0,0,0,0,0,0,99,111,108,111,
114,0,0,0,6,0,6,0,8,0,0,0,1,0,0,0,112,111,115,105,116,105,111,110,0,0,0,0,5,0,
4,0,22,0,0,0,86,101,114,116,73,110,0,0,6,0,4,0,22,0,0,0,0,0,0,0,112,111,115,0,
6,0,4,0,22,0,0,0,1,0,0,0,117,118,0,0,5,0,4,0,29,0,0,0,86,101,114,116,79,117,
116,0,6,0,5,0,29,0,0,0,0,0,0,0,99,111,108,111,114,0,0,0,6,0,4,0,29,0,0,0,
1,0,0,0,117,118,0,0,6,0,4,0,29,0,0,0,2,0,0,0,112,111,115,0,5,0,5,0,6,0,
0,0,118,105,101,119,101,114,95,100,97,116,97,0,5,0,4,0,10,0,0,0,109,111,100,101,108,0,0,0,
5,0,3,0,14,0,0,0,112,111,115,0,5,0,3,0,19,0,0,0,117,118,0,0,5,0,4,0,25,0,
0,0,99,111,108,111,114,0,0,0,5,0,3,0,27,0,0,0,117,118,0,0,5,0,5,0,28,0,0,0,
112,111,115,105,116,105,111,110,0,0,0,0,5,0,4,0,34,0,0,0,109,97,105,110,0,0,0,0,71,0,
4,0,6,0,0,0,33,0,0,0,0,0,0,0,71,0,4,0,6,0,0,0,34,0,0,0,0,0,0,0,
71,0,4,0,28,0,0,0,11,0,0,0,0,0,0,0,71,0,4,0,14,0,0,0,30,0,0,0,0,0,
0,0,71,0,4,0,19,0,0,0,30,0,0,0,1,0,0,0,71,0,4,0,25,0,0,0,30,0,0,0,
0,0,0,0,71,0,4,0,27,0,0,0,30,0,0,0,1,0,0,0,71,0,3,0,4,0,0,0,2,0,
0,0,72,0,4,0,4,0,0,0,0,0,0,0,5,0,0,0,72,0,5,0,4,0,0,0,0,0,0,0,
7,0,0,0,16,0,0,0,72,0,5,0,4,0,0,0,0,0,0,0,35,0,0,0,0,0,0,0,71,0,
3,0,8,0,0,0,2,0,0,0,72,0,5,0,8,0,0,0,0,0,0,0,35,0,0,0,0,0,0,0,
72,0,5,0,8,0,0,0,1,0,0,0,35,0,0,0,16,0,0,0,72,0,5,0,22,0,0,0,0,0,
0,0,35,0,0,0,0,0,0,0,72,0,5,0,22,0,0,0,1,0,0,0,35,0,0,0,16,0,0,0,
72,0,5,0,29,0,0,0,0,0,0,0,35,0,0,0,0,0,0,0,72,0,5,0,29,0,0,0,1,0,
0,0,35,0,0,0,16,0,0,0,72,0,5,0,29,0,0,0,2,0,0,0,35,0,0,0,32,0,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,0,0,19,0,0,0,1,0,
0,0,59,0,4,0,24,0,0,0,25,0,0,0,3,0,0,0,59,0,4,0,26,0,0,0,27,0,0,0,
3,0,0,0,59,0,4,0,24,0,0,0,28,0,0,0,3,0,0,0,54,0,5,0,11,0,0,0,34,0,
0,0,0,0,0,0,12,0,0,0,248,0,2,0,35,0,0,0,59,0,4,0,17,0,0,0,36,0,0,0,
7,0,0,0,59,0,4,0,32,0,0,0,37,0,0,0,7,0,0,0,59,0,4,0,23,0,0,0,38,0,
0,0,7,0,0,0,65,0,5,0,17,0,0,0,39,0,0,0,38,0,0,0,16,0,0,0,63,0,3,0,
39,0,0,0,14,0,0,0,65,0,5,0,21,0,0,0,40,0,0,0,38,0,0,0,20,0,0,0,63,0,
3,0,40,0,0,0,19,0,0,0,65,0,5,0,17,0,0,0,41,0,0,0,38,0,0,0,16,0,0,0,
61,0,4,0,2,0,0,0,42,0,0,0,41,0,0,0,79,0,7,0,7,0,0,0,43,0,0,0,42,0,
0,0,42,0,0,0,0,0,0,0,1,0,0,0,65,0,5,0,44,0,0,0,45,0,0,0,10,0,0,0,
20,0,0,0,61,0,4,0,7,0,0,0,46,0,0,0,45,0,0,0,129,0,5,0,7,0,0,0,47,0,
0,0,43,0,0,0,46,0,0,0,80,0,6,0,2,0,0,0,48,0,0,0,47,0,0,0,30,0,0,0,
30,0,0,0,62,0,3,0,36,0,0,0,48,0,0,0,65,0,5,0,21,0,0,0,49,0,0,0,38,0,
0,0,20,0,0,0,61,0,4,0,7,0,0,0,50,0,0,0,49,0,0,0,142,0,5,0,7,0,0,0,
51,0,0,0,50,0,0,0,31,0,0,0,65,0,5,0,21,0,0,0,52,0,0,0,38,0,0,0,20,0,
0,0,62,0,3,0,52,0,0,0,51,0,0,0,65,0,5,0,21,0,0,0,53,0,0,0,38,0,0,0,
20,0,0,0,61,0,4,0,7,0,0,0,54,0,0,0,53,0,0,0,65,0,5,0,21,0,0,0,55,0,
0,0,37,0,0,0,20,0,0,0,62,0,3,0,55,0,0,0,54,0,0,0,65,0,5,0,56,0,0,0,
57,0,0,0,10,0,0,0,16,0,0,0,61,0,4,0,2,0,0,0,58,0,0,0,57,0,0,0,65,0,
5,0,17,0,0,0,59,0,0,0,37,0,0,0,16,0,0,0,62,0,3,0,59,0,0,0,58,0,0,0,
65,0,5,0,60,0,0,0,61,0,0,0,6,0,0,0,16,0,0,0,61,0,4,0,3,0,0,0,62,0,
0,0,61,0,0,0,61,0,4,0,2,0,0,0,63,0,0,0,36,0,0,0,145,0,5,0,2,0,0,0,
64,0,0,0,62,0,0,0,63,0,0,0,65,0,5,0,17,0,0,0,65,0,0,0,37,0,0,0,33,0,
0,0,62,0,3,0,65,0,0,0,64,0,0,0,61,0,4,0,29,0,0,0,66,0,0,0,37,0,0,0,
81,0,5,0,2,0,0,0,67,0,0,0,66,0,0,0,0,0,0,0,62,0,3,0,25,0,0,0,67,0,
0,0,81,0,5,0,7,0,0,0,68,0,0,0,66,0,0,0,1,0,0,0,62,0,3,0,27,0,0,0,
68,0,0,0,81,0,5,0,2,0,0,0,69,0,0,0,66,0,0,0,2,0,0,0,62,0,3,0,28,0,
0,0,69,0,0,0,253,0,1,0,56,0,1,0
0,0,0,0,112,114,111,106,101,99,116,105,111,110,95,109,97,116,114,105,120,0,0,0,5,0,5,0,7,0,
0,0,83,112,114,105,116,101,68,97,116,97,0,0,6,0,7,0,7,0,0,0,0,0,0,0,109,111,100,101,
108,95,109,97,116,114,105,120,0,0,0,0,6,0,5,0,7,0,0,0,1,0,0,0,99,111,108,111,114,0,
0,0,5,0,4,0,22,0,0,0,86,101,114,116,73,110,0,0,6,0,4,0,22,0,0,0,0,0,0,0,
112,111,115,0,6,0,4,0,22,0,0,0,1,0,0,0,117,118,0,0,5,0,4,0,29,0,0,0,86,101,
114,116,79,117,116,0,6,0,5,0,29,0,0,0,0,0,0,0,99,111,108,111,114,0,0,0,6,0,4,0,
29,0,0,0,1,0,0,0,117,118,0,0,6,0,4,0,29,0,0,0,2,0,0,0,112,111,115,0,5,0,
5,0,6,0,0,0,118,105,101,119,101,114,95,100,97,116,97,0,5,0,4,0,9,0,0,0,109,111,100,101,
108,0,0,0,5,0,3,0,13,0,0,0,112,111,115,0,5,0,3,0,19,0,0,0,117,118,0,0,5,0,
4,0,25,0,0,0,99,111,108,111,114,0,0,0,5,0,3,0,27,0,0,0,117,118,0,0,5,0,5,0,
28,0,0,0,112,111,115,105,116,105,111,110,0,0,0,0,5,0,4,0,34,0,0,0,109,97,105,110,0,0,
0,0,71,0,4,0,6,0,0,0,33,0,0,0,0,0,0,0,71,0,4,0,6,0,0,0,34,0,0,0,
0,0,0,0,71,0,4,0,28,0,0,0,11,0,0,0,0,0,0,0,71,0,4,0,13,0,0,0,30,0,
0,0,0,0,0,0,71,0,4,0,19,0,0,0,30,0,0,0,1,0,0,0,71,0,4,0,25,0,0,0,
30,0,0,0,0,0,0,0,71,0,4,0,27,0,0,0,30,0,0,0,1,0,0,0,71,0,3,0,4,0,
0,0,2,0,0,0,72,0,4,0,4,0,0,0,0,0,0,0,5,0,0,0,72,0,5,0,4,0,0,0,
0,0,0,0,7,0,0,0,16,0,0,0,72,0,5,0,4,0,0,0,0,0,0,0,35,0,0,0,0,0,
0,0,71,0,3,0,7,0,0,0,2,0,0,0,72,0,4,0,7,0,0,0,0,0,0,0,5,0,0,0,
72,0,5,0,7,0,0,0,0,0,0,0,7,0,0,0,16,0,0,0,72,0,5,0,7,0,0,0,0,0,
0,0,35,0,0,0,0,0,0,0,72,0,5,0,7,0,0,0,1,0,0,0,35,0,0,0,64,0,0,0,
72,0,5,0,22,0,0,0,0,0,0,0,35,0,0,0,0,0,0,0,72,0,5,0,22,0,0,0,1,0,
0,0,35,0,0,0,16,0,0,0,72,0,5,0,29,0,0,0,0,0,0,0,35,0,0,0,0,0,0,0,
72,0,5,0,29,0,0,0,1,0,0,0,35,0,0,0,16,0,0,0,72,0,5,0,29,0,0,0,2,0,
0,0,35,0,0,0,32,0,0,0,22,0,3,0,1,0,0,0,32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59,0,4,0,24,0,0,0,25,0,0,0,3,0,0,0,59,0,
4,0,26,0,0,0,27,0,0,0,3,0,0,0,59,0,4,0,24,0,0,0,28,0,0,0,3,0,0,0,
54,0,5,0,10,0,0,0,34,0,0,0,0,0,0,0,11,0,0,0,248,0,2,0,35,0,0,0,59,0,
4,0,16,0,0,0,36,0,0,0,7,0,0,0,59,0,4,0,32,0,0,0,37,0,0,0,7,0,0,0,
59,0,4,0,23,0,0,0,38,0,0,0,7,0,0,0,65,0,5,0,16,0,0,0,39,0,0,0,38,0,
0,0,15,0,0,0,63,0,3,0,39,0,0,0,13,0,0,0,65,0,5,0,21,0,0,0,40,0,0,0,
38,0,0,0,20,0,0,0,63,0,3,0,40,0,0,0,19,0,0,0,65,0,5,0,16,0,0,0,41,0,
0,0,38,0,0,0,15,0,0,0,61,0,4,0,2,0,0,0,42,0,0,0,41,0,0,0,79,0,7,0,
17,0,0,0,43,0,0,0,42,0,0,0,42,0,0,0,0,0,0,0,1,0,0,0,80,0,6,0,2,0,
0,0,44,0,0,0,43,0,0,0,30,0,0,0,30,0,0,0,62,0,3,0,36,0,0,0,44,0,0,0,
65,0,5,0,21,0,0,0,45,0,0,0,38,0,0,0,20,0,0,0,61,0,4,0,17,0,0,0,46,0,
0,0,45,0,0,0,142,0,5,0,17,0,0,0,47,0,0,0,46,0,0,0,31,0,0,0,65,0,5,0,
21,0,0,0,48,0,0,0,38,0,0,0,20,0,0,0,62,0,3,0,48,0,0,0,47,0,0,0,65,0,
5,0,21,0,0,0,49,0,0,0,38,0,0,0,20,0,0,0,61,0,4,0,17,0,0,0,50,0,0,0,
49,0,0,0,65,0,5,0,21,0,0,0,51,0,0,0,37,0,0,0,20,0,0,0,62,0,3,0,51,0,
0,0,50,0,0,0,65,0,5,0,52,0,0,0,53,0,0,0,9,0,0,0,20,0,0,0,61,0,4,0,
2,0,0,0,54,0,0,0,53,0,0,0,65,0,5,0,16,0,0,0,55,0,0,0,37,0,0,0,15,0,
0,0,62,0,3,0,55,0,0,0,54,0,0,0,65,0,5,0,56,0,0,0,57,0,0,0,6,0,0,0,
15,0,0,0,61,0,4,0,3,0,0,0,58,0,0,0,57,0,0,0,65,0,5,0,59,0,0,0,60,0,
0,0,9,0,0,0,15,0,0,0,61,0,4,0,3,0,0,0,61,0,0,0,60,0,0,0,146,0,5,0,
3,0,0,0,62,0,0,0,58,0,0,0,61,0,0,0,61,0,4,0,2,0,0,0,63,0,0,0,36,0,
0,0,145,0,5,0,2,0,0,0,64,0,0,0,62,0,0,0,63,0,0,0,65,0,5,0,16,0,0,0,
65,0,0,0,37,0,0,0,33,0,0,0,62,0,3,0,65,0,0,0,64,0,0,0,61,0,4,0,29,0,
0,0,66,0,0,0,37,0,0,0,81,0,5,0,2,0,0,0,67,0,0,0,66,0,0,0,0,0,0,0,
62,0,3,0,25,0,0,0,67,0,0,0,81,0,5,0,17,0,0,0,68,0,0,0,66,0,0,0,1,0,
0,0,62,0,3,0,27,0,0,0,68,0,0,0,81,0,5,0,2,0,0,0,69,0,0,0,66,0,0,0,
2,0,0,0,62,0,3,0,28,0,0,0,69,0,0,0,253,0,1,0,56,0,1,0