Implement draw transform
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,7 +1,7 @@
|
||||
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
P: float4x4;
|
||||
W: float3x3;
|
||||
pos: float4; // xywh
|
||||
tex: float4; // xywh
|
||||
col: float4;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
P: float4x4;
|
||||
W: float3x3;
|
||||
pos: float4; // xywh
|
||||
tex: float4; // xywh
|
||||
col: float4;
|
||||
|
||||
Reference in New Issue
Block a user