Implement draw transform

This commit is contained in:
luboslenco
2025-07-12 16:03:47 +02:00
parent e5d3d65e5e
commit 9d829cc02e
9 changed files with 36 additions and 33 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
#[set(everything)]
const constants: {
P: float4x4;
W: float3x3;
pos: float4; // xywh
tex: float4; // xywh
col: float4;
@@ -30,6 +30,7 @@ fun draw_image_vert(input: vert_in): vert_out {
var ctex: float4 = constants.tex;
output.pos = float4(input.pos, 0.0, 1.0);
output.pos.xyz = constants.W * output.pos.xyz;
output.pos.xy = output.pos.xy * cpos.zw + cpos.xy;
output.pos.xy = output.pos.xy * 2.0 - 1.0;
output.pos.y = -output.pos.y;
+2 -1
View File
@@ -1,7 +1,7 @@
#[set(everything)]
const constants: {
P: float4x4;
W: float3x3;
pos: float4; // xywh
col: float4;
};
@@ -21,6 +21,7 @@ fun draw_rect_vert(input: vert_in): vert_out {
var cpos: float4 = constants.pos;
output.pos = float4(input.pos, 0.0, 1.0);
// output.pos.xyz = constants.W * output.pos.xyz;
output.pos.xy = output.pos.xy * cpos.zw + cpos.xy;
output.pos.xy = output.pos.xy * 2.0 - 1.0;
output.pos.y = -output.pos.y;
+2 -1
View File
@@ -1,7 +1,7 @@
#[set(everything)]
const constants: {
P: float4x4;
W: float3x3;
pos: float4; // xywh
tex: float4; // xywh
col: float4;
@@ -30,6 +30,7 @@ fun draw_text_vert(input: vert_in): vert_out {
var ctex: float4 = constants.tex;
output.pos = float4(input.pos, 0.0, 1.0);
// output.pos.xyz = constants.W * output.pos.xyz;
output.pos.xy = output.pos.xy * cpos.zw + cpos.xy;
output.pos.xy = output.pos.xy * 2.0 - 1.0;
output.pos.y = -output.pos.y;
+2 -1
View File
@@ -1,7 +1,7 @@
#[set(everything)]
const constants: {
P: float4x4;
W: float3x3;
pos0: float2;
pos1: float2;
pos2: float2;
@@ -28,6 +28,7 @@ fun draw_tris_vert(input: vert_in): vert_out {
else if (vertex_id() == 2) {
output.pos = float4(constants.pos2, 0.0, 1.0);
}
// output.pos.xyz = constants.W * output.pos.xyz;
output.pos.xy = output.pos.xy * 2.0 - 1.0;
output.pos.y = -output.pos.y;
output.col = constants.col;
+1 -1
View File
@@ -1,7 +1,7 @@
#[set(everything)]
const constants: {
P: float4x4;
W: float3x3;
pos: float4; // xywh
tex: float4; // xywh
col: float4;
+1 -1
View File
@@ -1,7 +1,7 @@
#[set(everything)]
const constants: {
P: float4x4;
W: float3x3;
pos: float4; // xywh
tex: float4; // xywh
col: float4;