40 lines
749 B
Plaintext
40 lines
749 B
Plaintext
|
|
|
||
|
|
#[set(everything)]
|
||
|
|
const constants: {
|
||
|
|
WVP: float4x4;
|
||
|
|
};
|
||
|
|
|
||
|
|
struct vert_in {
|
||
|
|
pos: float4;
|
||
|
|
col: float4;
|
||
|
|
}
|
||
|
|
|
||
|
|
struct vert_out {
|
||
|
|
pos: float4;
|
||
|
|
vcolor: float3;
|
||
|
|
}
|
||
|
|
|
||
|
|
fun mesh_poscol_vert(input: vert_in): vert_out {
|
||
|
|
var output: vert_out;
|
||
|
|
var spos: float4 = float4(input.pos.xyz, 1.0);
|
||
|
|
output.vcolor = input.col.rgb;
|
||
|
|
output.pos = constants.WVP * spos;
|
||
|
|
return output;
|
||
|
|
}
|
||
|
|
|
||
|
|
fun mesh_poscol_frag(input: vert_out): float4 {
|
||
|
|
var color: float4;
|
||
|
|
color = float4(input.vcolor, 1.0);
|
||
|
|
// color.rgb = pow(color.rgb, vec3(1.0 / 2.2, 1.0 / 2.2, 1.0 / 2.2));
|
||
|
|
color.r = pow(color.r, 1.0 / 2.2);
|
||
|
|
color.g = pow(color.g, 1.0 / 2.2);
|
||
|
|
color.b = pow(color.b, 1.0 / 2.2);
|
||
|
|
return color;
|
||
|
|
}
|
||
|
|
|
||
|
|
#[pipe]
|
||
|
|
struct pipe {
|
||
|
|
vertex = mesh_poscol_vert;
|
||
|
|
fragment = mesh_poscol_frag;
|
||
|
|
}
|