.
This commit is contained in:
commit
7f37187c92
46 changed files with 62931 additions and 0 deletions
72
data/batch_vert.hlsl
Normal file
72
data/batch_vert.hlsl
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
cbuffer renderer_data : register(b0) {
|
||||
float2 one_over_window_size;
|
||||
//float2 one_over_texture_size;
|
||||
float zoom;
|
||||
float padding;
|
||||
};
|
||||
|
||||
struct input_t {
|
||||
uint vtx_index : SV_VertexID;
|
||||
float4 quad : BATCH_QUAD;
|
||||
float4 tex_quad : BATCH_TEX_QUAD;
|
||||
float4 colour : BATCH_COLOUR;
|
||||
};
|
||||
|
||||
struct output_t {
|
||||
float4 pos : SV_Position;
|
||||
float2 uv : TEXCOORD1;
|
||||
float4 col : TEXCOORD2;
|
||||
};
|
||||
|
||||
static const int indices[6] = {
|
||||
0, 1, 2, 2, 3, 0,
|
||||
};
|
||||
|
||||
static const float3 positions[4] = {
|
||||
float3(0, 0, 0),
|
||||
float3(0, 1, 0),
|
||||
float3(1, 1, 0),
|
||||
float3(1, 0, 0),
|
||||
};
|
||||
|
||||
static const float2 uvs[4] = {
|
||||
float2(0.0f, 0.0f),
|
||||
float2(0.0f, 1.0f),
|
||||
float2(1.0f, 1.0f),
|
||||
float2(1.0f, 0.0f),
|
||||
};
|
||||
|
||||
output_t main(input_t input) {
|
||||
output_t output;
|
||||
|
||||
int vtx = indices[input.vtx_index];
|
||||
|
||||
float3 pos = positions[vtx];
|
||||
|
||||
pos.xy = ((pos.xy * input.quad.zw) + input.quad.xy) * zoom;
|
||||
pos.xy = (pos.xy * one_over_window_size) * 2.0 - 1.0;
|
||||
|
||||
pos.y = -pos.y;
|
||||
|
||||
/*
|
||||
x = ((x * ovws.x) * zoom * quad.w) - 1 + (quad.x * ovws.x * zoom);
|
||||
*/
|
||||
|
||||
// pos.xy *= one_over_window_size;
|
||||
// pos.xy *= zoom;
|
||||
// pos.xy *= input.quad.zw;
|
||||
// pos.x -= 1.0;
|
||||
// pos.y += 1.0;
|
||||
|
||||
// pos.xy += float2(input.quad.x, -input.quad.y) * one_over_window_size * zoom;
|
||||
|
||||
float2 uv = uvs[vtx];
|
||||
uv *= input.tex_quad.zw;
|
||||
uv += input.tex_quad.xy;
|
||||
|
||||
output.pos = float4(pos, 1.0);
|
||||
output.uv = uv;
|
||||
output.col = input.colour;
|
||||
|
||||
return output;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue