remove vertex_buffer and index_buffer for characters and character shadows
refactor world shader vertex position calculation
This commit is contained in:
+2
-33
@@ -44,8 +44,6 @@ static R_Buffer view_projection_matrix_buffer;
|
||||
static R_Buffer per_frame_buffer;
|
||||
static R_Buffer tint_color_buffer;
|
||||
|
||||
static R_Buffer vertex_buffer;
|
||||
static R_Buffer index_buffer;
|
||||
static R_Buffer player_instance_buffer;
|
||||
static R_Buffer tile_uvs_buffer;
|
||||
|
||||
@@ -170,23 +168,6 @@ enum Settings_Category {
|
||||
SETTINGS_AUDIO,
|
||||
};
|
||||
|
||||
struct Vertex {
|
||||
vec3 pos;
|
||||
vec2 uv;
|
||||
};
|
||||
|
||||
static Vertex vertices[] = {
|
||||
{{ -0.5f, 0.5f, 0.0f }, { 0.0f, 0.0f }},
|
||||
{{ -0.5f, -0.5f, 0.0f }, { 0.0f, 1.0f }},
|
||||
{{ 0.5f, -0.5f, 0.0f }, { 1.0f, 1.0f }},
|
||||
{{ 0.5f, 0.5f, 0.0f }, { 1.0f, 0.0f }},
|
||||
};
|
||||
|
||||
static Uint16 indices[] = {
|
||||
0, 1, 2,
|
||||
0, 2, 3,
|
||||
};
|
||||
|
||||
struct Instance {
|
||||
vec2 pos;
|
||||
uint32_t sprite_selection;
|
||||
@@ -892,18 +873,6 @@ static bool init_resources() {
|
||||
return false;
|
||||
}
|
||||
|
||||
vertex_buffer = renderer_buffer_create(R_BUFFER_USAGE_VERTEX, sizeof(vertices), vertices, "vertex_buffer");
|
||||
if (!vertex_buffer) {
|
||||
log_error("Failed to create buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
index_buffer = renderer_buffer_create(R_BUFFER_USAGE_INDEX, sizeof(indices), indices, "index_buffer");
|
||||
if (!index_buffer) {
|
||||
log_error("Failed to create buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
player_instance_buffer = renderer_buffer_create(R_BUFFER_USAGE_VERTEX, sizeof(player_instance), &player_instance, "player_instance_buffer");
|
||||
if (!player_instance_buffer) {
|
||||
log_error("Failed to create buffer.");
|
||||
@@ -1564,7 +1533,7 @@ static void render_game() {
|
||||
{
|
||||
ZoneScopedN("Draw Player");
|
||||
renderer_frame_set_shader(R_SHADER_CHARACTER_SHADOW);
|
||||
renderer_frame_draw(vertex_buffer, index_buffer, player_instance_buffer, 6, 1, &(R_Draw_Resources){
|
||||
renderer_frame_draw(NULL, NULL, player_instance_buffer, 6, 1, &(R_Draw_Resources){
|
||||
.vertex_uniform_buffers = (R_Buffer[]){ view_projection_matrix_buffer },
|
||||
|
||||
.num_vertex_uniform_buffers = 1,
|
||||
@@ -1577,7 +1546,7 @@ static void render_game() {
|
||||
});
|
||||
|
||||
renderer_frame_set_shader(R_SHADER_CHARACTER);
|
||||
renderer_frame_draw(vertex_buffer, index_buffer, player_instance_buffer, 6, 1, &(R_Draw_Resources){
|
||||
renderer_frame_draw(NULL, NULL, player_instance_buffer, 6, 1, &(R_Draw_Resources){
|
||||
.vertex_uniform_buffers = (R_Buffer[]){ view_projection_matrix_buffer },
|
||||
|
||||
.num_vertex_uniform_buffers = 1,
|
||||
|
||||
+10
-48
@@ -343,8 +343,8 @@ void renderer_frame_draw(R_Buffer vertex_buffer, R_Buffer index_buffer, R_Buffer
|
||||
for (int i = 0; i < resources->num_fragment_storage_buffers; i++) SDL_BindGPUFragmentStorageBuffers(render_pass, i, &resources->fragment_storage_buffers[i]->buffer, 1);
|
||||
for (int i = 0; i < resources->num_fragment_uniform_buffers; i++) SDL_PushGPUFragmentUniformData(render_command_buffer, i, resources->fragment_uniform_buffers[i]->cpu_uniform_data, resources->fragment_uniform_buffers[i]->num_bytes);
|
||||
|
||||
if (vertex_buffer) SDL_BindGPUVertexBuffers(render_pass, 0, &(SDL_GPUBufferBinding){ .buffer = vertex_buffer->buffer, .offset = 0 }, 1);
|
||||
if (instance_buffer) SDL_BindGPUVertexBuffers(render_pass, 1, &(SDL_GPUBufferBinding){ .buffer = instance_buffer->buffer, .offset = 0 }, 1);
|
||||
if (vertex_buffer) SDL_BindGPUVertexBuffers(render_pass, 0, &(SDL_GPUBufferBinding){ .buffer = vertex_buffer->buffer, .offset = 0 }, 1);
|
||||
if (instance_buffer) SDL_BindGPUVertexBuffers(render_pass, vertex_buffer ? 1 : 0, &(SDL_GPUBufferBinding){ .buffer = instance_buffer->buffer, .offset = 0 }, 1);
|
||||
|
||||
if (index_buffer) {
|
||||
SDL_BindGPUIndexBuffer(render_pass, &(SDL_GPUBufferBinding){ .buffer = index_buffer->buffer, .offset = 0 }, SDL_GPU_INDEXELEMENTSIZE_16BIT);
|
||||
@@ -454,48 +454,29 @@ bool renderer_init(SDL_Window *window_) {
|
||||
.vertex_buffer_descriptions = (SDL_GPUVertexBufferDescription[]){
|
||||
{
|
||||
.slot = 0,
|
||||
.pitch = 20,
|
||||
.input_rate = SDL_GPU_VERTEXINPUTRATE_VERTEX,
|
||||
|
||||
.instance_step_rate = 0,
|
||||
},
|
||||
{
|
||||
.slot = 1,
|
||||
.pitch = 12,
|
||||
.input_rate = SDL_GPU_VERTEXINPUTRATE_INSTANCE,
|
||||
|
||||
.instance_step_rate = 0,
|
||||
},
|
||||
},
|
||||
.num_vertex_buffers = 2,
|
||||
.num_vertex_buffers = 1,
|
||||
|
||||
.vertex_attributes = (SDL_GPUVertexAttribute[]){
|
||||
{
|
||||
.location = 0,
|
||||
.buffer_slot = 0,
|
||||
.format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3,
|
||||
.offset = 0,
|
||||
},
|
||||
{
|
||||
.location = 1,
|
||||
.buffer_slot = 0,
|
||||
.format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2,
|
||||
.offset = 12,
|
||||
},
|
||||
{
|
||||
.location = 2,
|
||||
.buffer_slot = 1,
|
||||
.buffer_slot = 0,
|
||||
.format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2,
|
||||
.offset = 0,
|
||||
},
|
||||
{
|
||||
.location = 3,
|
||||
.buffer_slot = 1,
|
||||
.buffer_slot = 0,
|
||||
.format = SDL_GPU_VERTEXELEMENTFORMAT_UINT,
|
||||
.offset = 8,
|
||||
},
|
||||
},
|
||||
.num_vertex_attributes = 4,
|
||||
.num_vertex_attributes = 2,
|
||||
},
|
||||
|
||||
.primitive_type = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST,
|
||||
@@ -611,48 +592,29 @@ bool renderer_init(SDL_Window *window_) {
|
||||
.vertex_buffer_descriptions = (SDL_GPUVertexBufferDescription[]){
|
||||
{
|
||||
.slot = 0,
|
||||
.pitch = 20,
|
||||
.input_rate = SDL_GPU_VERTEXINPUTRATE_VERTEX,
|
||||
|
||||
.instance_step_rate = 0,
|
||||
},
|
||||
{
|
||||
.slot = 1,
|
||||
.pitch = 12,
|
||||
.input_rate = SDL_GPU_VERTEXINPUTRATE_INSTANCE,
|
||||
|
||||
.instance_step_rate = 0,
|
||||
},
|
||||
},
|
||||
.num_vertex_buffers = 2,
|
||||
.num_vertex_buffers = 1,
|
||||
|
||||
.vertex_attributes = (SDL_GPUVertexAttribute[]){
|
||||
{
|
||||
.location = 0,
|
||||
.buffer_slot = 0,
|
||||
.format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3,
|
||||
.offset = 0,
|
||||
},
|
||||
{
|
||||
.location = 1,
|
||||
.buffer_slot = 0,
|
||||
.format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2,
|
||||
.offset = 12,
|
||||
},
|
||||
{
|
||||
.location = 2,
|
||||
.buffer_slot = 1,
|
||||
.buffer_slot = 0,
|
||||
.format = SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2,
|
||||
.offset = 0,
|
||||
},
|
||||
{
|
||||
.location = 3,
|
||||
.buffer_slot = 1,
|
||||
.buffer_slot = 0,
|
||||
.format = SDL_GPU_VERTEXELEMENTFORMAT_UINT,
|
||||
.offset = 8,
|
||||
},
|
||||
},
|
||||
.num_vertex_attributes = 4,
|
||||
.num_vertex_attributes = 2,
|
||||
},
|
||||
|
||||
.primitive_type = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST,
|
||||
|
||||
+10
-44
@@ -475,8 +475,8 @@ void renderer_frame_draw(R_Buffer vertex_buffer, R_Buffer index_buffer, R_Buffer
|
||||
wgpuRenderPassEncoderSetBindGroup(pass_encoder, 3, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
if (vertex_buffer) wgpuRenderPassEncoderSetVertexBuffer(pass_encoder, 0, vertex_buffer->buffer, 0, WGPU_WHOLE_SIZE);
|
||||
if (instance_buffer) wgpuRenderPassEncoderSetVertexBuffer(pass_encoder, 1, instance_buffer->buffer, 0, WGPU_WHOLE_SIZE);
|
||||
if (vertex_buffer) wgpuRenderPassEncoderSetVertexBuffer(pass_encoder, 0, vertex_buffer->buffer, 0, WGPU_WHOLE_SIZE);
|
||||
if (instance_buffer) wgpuRenderPassEncoderSetVertexBuffer(pass_encoder, vertex_buffer ? 1 : 0, instance_buffer->buffer, 0, WGPU_WHOLE_SIZE);
|
||||
|
||||
if (index_buffer) {
|
||||
wgpuRenderPassEncoderSetIndexBuffer(pass_encoder, index_buffer->buffer, WGPUIndexFormat_Uint16, 0, WGPU_WHOLE_SIZE);
|
||||
@@ -683,14 +683,14 @@ bool renderer_init(SDL_Window *window_) {
|
||||
.chain = { .next = NULL, .sType = WGPUSType_ShaderSourceWGSL },
|
||||
.code = { .data = shader_source, .length = SDL_arraysize(shader_source) },
|
||||
},
|
||||
.label = { .data = "basic shader", .length = WGPU_STRLEN }
|
||||
.label = { .data = "character shader", .length = WGPU_STRLEN }
|
||||
});
|
||||
|
||||
shaders[R_SHADER_CHARACTER] = wgpuDeviceCreateRenderPipeline(device, &(WGPURenderPipelineDescriptor){
|
||||
.label = { .data = "basic render_pipeline", .length = WGPU_STRLEN },
|
||||
.label = { .data = "character render_pipeline", .length = WGPU_STRLEN },
|
||||
|
||||
.layout = wgpuDeviceCreatePipelineLayout(device, &(WGPUPipelineLayoutDescriptor){
|
||||
.label = { .data = "basic pipeline_layout", .length = WGPU_STRLEN },
|
||||
.label = { .data = "character pipeline_layout", .length = WGPU_STRLEN },
|
||||
.bindGroupLayoutCount = 4,
|
||||
.bindGroupLayouts = (WGPUBindGroupLayout[]){
|
||||
wgpuDeviceCreateBindGroupLayout(device, &(WGPUBindGroupLayoutDescriptor){
|
||||
@@ -726,25 +726,8 @@ bool renderer_init(SDL_Window *window_) {
|
||||
.entryPoint = { .data = "main_vertex", .length = WGPU_STRLEN },
|
||||
.constantCount = 0,
|
||||
.constants = NULL,
|
||||
.bufferCount = 2,
|
||||
.bufferCount = 1,
|
||||
.buffers = (WGPUVertexBufferLayout[]){
|
||||
{
|
||||
.stepMode = WGPUVertexStepMode_Vertex,
|
||||
.arrayStride = 20,
|
||||
.attributeCount = 2,
|
||||
.attributes = (WGPUVertexAttribute[]){
|
||||
{
|
||||
.format = WGPUVertexFormat_Float32x3,
|
||||
.offset = 0,
|
||||
.shaderLocation = 0,
|
||||
},
|
||||
{
|
||||
.format = WGPUVertexFormat_Float32x2,
|
||||
.offset = 12,
|
||||
.shaderLocation = 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
.stepMode = WGPUVertexStepMode_Instance,
|
||||
.arrayStride = 12,
|
||||
@@ -804,14 +787,14 @@ bool renderer_init(SDL_Window *window_) {
|
||||
.chain = { .next = NULL, .sType = WGPUSType_ShaderSourceWGSL },
|
||||
.code = { .data = shader_source, .length = SDL_arraysize(shader_source) },
|
||||
},
|
||||
.label = { .data = "basic shader", .length = WGPU_STRLEN }
|
||||
.label = { .data = "character_shadow shader", .length = WGPU_STRLEN }
|
||||
});
|
||||
|
||||
shaders[R_SHADER_CHARACTER_SHADOW] = wgpuDeviceCreateRenderPipeline(device, &(WGPURenderPipelineDescriptor){
|
||||
.label = { .data = "basic render_pipeline", .length = WGPU_STRLEN },
|
||||
.label = { .data = "character_shadow render_pipeline", .length = WGPU_STRLEN },
|
||||
|
||||
.layout = wgpuDeviceCreatePipelineLayout(device, &(WGPUPipelineLayoutDescriptor){
|
||||
.label = { .data = "basic pipeline_layout", .length = WGPU_STRLEN },
|
||||
.label = { .data = "character_shadow pipeline_layout", .length = WGPU_STRLEN },
|
||||
.bindGroupLayoutCount = 4,
|
||||
.bindGroupLayouts = (WGPUBindGroupLayout[]){
|
||||
wgpuDeviceCreateBindGroupLayout(device, &(WGPUBindGroupLayoutDescriptor){
|
||||
@@ -847,25 +830,8 @@ bool renderer_init(SDL_Window *window_) {
|
||||
.entryPoint = { .data = "main_vertex", .length = WGPU_STRLEN },
|
||||
.constantCount = 0,
|
||||
.constants = NULL,
|
||||
.bufferCount = 2,
|
||||
.bufferCount = 1,
|
||||
.buffers = (WGPUVertexBufferLayout[]){
|
||||
{
|
||||
.stepMode = WGPUVertexStepMode_Vertex,
|
||||
.arrayStride = 20,
|
||||
.attributeCount = 2,
|
||||
.attributes = (WGPUVertexAttribute[]){
|
||||
{
|
||||
.format = WGPUVertexFormat_Float32x3,
|
||||
.offset = 0,
|
||||
.shaderLocation = 0,
|
||||
},
|
||||
{
|
||||
.format = WGPUVertexFormat_Float32x2,
|
||||
.offset = 12,
|
||||
.shaderLocation = 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
.stepMode = WGPUVertexStepMode_Instance,
|
||||
.arrayStride = 12,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,9 +5,6 @@
|
||||
struct VertexShaderInput {
|
||||
uint32_t vertex_index : SV_VulkanVertexID;
|
||||
|
||||
[vk::location(0)] float3 pos;
|
||||
[vk::location(1)] float2 uv;
|
||||
|
||||
// Per Instance
|
||||
[vk::location(2)] float2 world_pos;
|
||||
[vk::location(3)] uint sprite_selection;
|
||||
@@ -27,12 +24,25 @@ struct FragmentShaderOutput {
|
||||
VertexShaderOutput main_vertex(VertexShaderInput input) {
|
||||
var output: VertexShaderOutput;
|
||||
|
||||
output.pos = mul(float4(input.world_pos + input.pos.xy, 0, 1), view_projection_matrix);
|
||||
var vertex_pos = float2(0, 0);
|
||||
var vertex_uv = float2(0, 0);
|
||||
|
||||
switch (input.vertex_index) {
|
||||
case 0: { vertex_pos = float2(-0.5, 0.5); vertex_uv = float2(0, 0); } break;
|
||||
case 1: { vertex_pos = float2(-0.5, -0.5); vertex_uv = float2(0, 1); } break;
|
||||
case 2: { vertex_pos = float2( 0.5, -0.5); vertex_uv = float2(1, 1); } break;
|
||||
case 3: { vertex_pos = float2(-0.5, 0.5); vertex_uv = float2(0, 0); } break;
|
||||
case 4: { vertex_pos = float2( 0.5, -0.5); vertex_uv = float2(1, 1); } break;
|
||||
case 5: { vertex_pos = float2( 0.5, 0.5); vertex_uv = float2(1, 0); } break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
output.pos = mul(float4(input.world_pos + vertex_pos, 0, 1), view_projection_matrix);
|
||||
|
||||
uint sprite_x = bitfieldExtract(input.sprite_selection, 16, 16);
|
||||
uint sprite_y = bitfieldExtract(input.sprite_selection, 0, 16);
|
||||
|
||||
output.uv = (float2(sprite_x, sprite_y) + input.uv) * (1.0 / 4.0);
|
||||
output.uv = (float2(sprite_x, sprite_y) + vertex_uv) * (1.0 / 4.0);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
struct VertexShaderInput {
|
||||
uint32_t vertex_index : SV_VulkanVertexID;
|
||||
|
||||
[vk::location(0)] float3 pos;
|
||||
[vk::location(1)] float2 uv;
|
||||
|
||||
// Per Instance
|
||||
[vk::location(2)] float2 world_pos;
|
||||
};
|
||||
@@ -26,10 +23,23 @@ struct FragmentShaderOutput {
|
||||
VertexShaderOutput main_vertex(VertexShaderInput input) {
|
||||
var output: VertexShaderOutput;
|
||||
|
||||
input.pos.xy *= 0.5;
|
||||
var vertex_pos = float2(0, 0);
|
||||
var vertex_uv = float2(0, 0);
|
||||
|
||||
output.pos = mul(float4(input.world_pos + input.pos.xy + float2(0, -0.35), 0, 1), view_projection_matrix);
|
||||
output.uv = input.uv;
|
||||
switch (input.vertex_index) {
|
||||
case 0: { vertex_pos = float2(-0.5, 0.5); vertex_uv = float2(0, 0); } break;
|
||||
case 1: { vertex_pos = float2(-0.5, -0.5); vertex_uv = float2(0, 1); } break;
|
||||
case 2: { vertex_pos = float2( 0.5, -0.5); vertex_uv = float2(1, 1); } break;
|
||||
case 3: { vertex_pos = float2(-0.5, 0.5); vertex_uv = float2(0, 0); } break;
|
||||
case 4: { vertex_pos = float2( 0.5, -0.5); vertex_uv = float2(1, 1); } break;
|
||||
case 5: { vertex_pos = float2( 0.5, 0.5); vertex_uv = float2(1, 0); } break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
vertex_pos *= 0.5;
|
||||
|
||||
output.pos = mul(float4(input.world_pos + vertex_pos + float2(0, -0.35), 0, 1), view_projection_matrix);
|
||||
output.uv = vertex_uv;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -26,19 +26,25 @@ struct FragmentShaderOutput {
|
||||
VertexShaderOutput main_vertex(VertexShaderInput input) {
|
||||
var output: VertexShaderOutput;
|
||||
|
||||
let tile_pos = uint32_t2(input.instance_index % per_frame.map_width, input.instance_index / per_frame.map_width);
|
||||
output.tile = map_texture.Load(uint32_t3(tile_pos, 0));
|
||||
var vertex_pos = float2(0, 0);
|
||||
var vertex_uv = float2(0, 0);
|
||||
|
||||
switch (input.vertex_index) {
|
||||
case 0: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2(-0.5, 0.5), 0, 1), view_projection_matrix); output.uv = float2(0, 0); } break;
|
||||
case 1: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2(-0.5, -0.5), 0, 1), view_projection_matrix); output.uv = float2(0, 1); } break;
|
||||
case 2: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2( 0.5, -0.5), 0, 1), view_projection_matrix); output.uv = float2(1, 1); } break;
|
||||
case 3: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2(-0.5, 0.5), 0, 1), view_projection_matrix); output.uv = float2(0, 0); } break;
|
||||
case 4: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2( 0.5, -0.5), 0, 1), view_projection_matrix); output.uv = float2(1, 1); } break;
|
||||
case 5: { output.pos = mul(float4(float2(tile_pos) - float2(0.5, 0.5) + float2( 0.5, 0.5), 0, 1), view_projection_matrix); output.uv = float2(1, 0); } break;
|
||||
case 0: { vertex_pos = float2(-1.0, 0.0); vertex_uv = float2(0, 0); } break;
|
||||
case 1: { vertex_pos = float2(-1.0, -1.0); vertex_uv = float2(0, 1); } break;
|
||||
case 2: { vertex_pos = float2( 0.0, -1.0); vertex_uv = float2(1, 1); } break;
|
||||
case 3: { vertex_pos = float2(-1.0, 0.0); vertex_uv = float2(0, 0); } break;
|
||||
case 4: { vertex_pos = float2( 0.0, -1.0); vertex_uv = float2(1, 1); } break;
|
||||
case 5: { vertex_pos = float2( 0.0, 0.0); vertex_uv = float2(1, 0); } break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
let tile_pos = uint32_t2(input.instance_index % per_frame.map_width, input.instance_index / per_frame.map_width);
|
||||
|
||||
output.tile = map_texture.Load(uint32_t3(tile_pos, 0));
|
||||
output.pos = mul(float4(tile_pos + vertex_pos, 0, 1), view_projection_matrix);
|
||||
output.uv = vertex_uv;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@ struct VertexShaderOutput_0
|
||||
|
||||
struct vertexInput_0
|
||||
{
|
||||
@location(0) pos_1 : vec3<f32>,
|
||||
@location(1) uv_1 : vec2<f32>,
|
||||
@location(2) world_pos_0 : vec2<f32>,
|
||||
@location(3) sprite_selection_0 : u32,
|
||||
};
|
||||
@@ -27,8 +25,53 @@ struct vertexInput_0
|
||||
fn main_vertex( _S1 : vertexInput_0, @builtin(vertex_index) vertex_index_0 : u32) -> VertexShaderOutput_0
|
||||
{
|
||||
var output_0 : VertexShaderOutput_0;
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(_S1.world_pos_0 + _S1.pos_1.xy, 0.0f, 1.0f))));
|
||||
output_0.uv_0 = (vec2<f32>(f32((u32(_S1.sprite_selection_0>>(u32(16)))&((((u32(1)<<u32(16))-u32(1)))))), f32((u32(_S1.sprite_selection_0>>(u32(0)))&((((u32(1)<<u32(16))-u32(1))))))) + _S1.uv_1) * vec2<f32>(0.25f);
|
||||
const _S2 : vec2<f32> = vec2<f32>(0.0f, 0.0f);
|
||||
var vertex_pos_0 : vec2<f32>;
|
||||
var vertex_uv_0 : vec2<f32>;
|
||||
switch(vertex_index_0)
|
||||
{
|
||||
case u32(0):
|
||||
{
|
||||
vertex_pos_0 = vec2<f32>(-0.5f, 0.5f);
|
||||
vertex_uv_0 = _S2;
|
||||
}
|
||||
case u32(1):
|
||||
{
|
||||
const _S3 : vec2<f32> = vec2<f32>(0.0f, 1.0f);
|
||||
vertex_pos_0 = vec2<f32>(-0.5f, -0.5f);
|
||||
vertex_uv_0 = _S3;
|
||||
}
|
||||
case u32(2):
|
||||
{
|
||||
const _S4 : vec2<f32> = vec2<f32>(1.0f, 1.0f);
|
||||
vertex_pos_0 = vec2<f32>(0.5f, -0.5f);
|
||||
vertex_uv_0 = _S4;
|
||||
}
|
||||
case u32(3):
|
||||
{
|
||||
vertex_pos_0 = vec2<f32>(-0.5f, 0.5f);
|
||||
vertex_uv_0 = _S2;
|
||||
}
|
||||
case u32(4):
|
||||
{
|
||||
const _S5 : vec2<f32> = vec2<f32>(1.0f, 1.0f);
|
||||
vertex_pos_0 = vec2<f32>(0.5f, -0.5f);
|
||||
vertex_uv_0 = _S5;
|
||||
}
|
||||
case u32(5):
|
||||
{
|
||||
const _S6 : vec2<f32> = vec2<f32>(1.0f, 0.0f);
|
||||
vertex_pos_0 = vec2<f32>(0.5f, 0.5f);
|
||||
vertex_uv_0 = _S6;
|
||||
}
|
||||
default :
|
||||
{
|
||||
vertex_pos_0 = _S2;
|
||||
vertex_uv_0 = _S2;
|
||||
}
|
||||
}
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(_S1.world_pos_0 + vertex_pos_0, 0.0f, 1.0f))));
|
||||
output_0.uv_0 = (vec2<f32>(f32((u32(_S1.sprite_selection_0>>(u32(16)))&((((u32(1)<<u32(16))-u32(1)))))), f32((u32(_S1.sprite_selection_0>>(u32(0)))&((((u32(1)<<u32(16))-u32(1))))))) + vertex_uv_0) * vec2<f32>(0.25f);
|
||||
return output_0;
|
||||
}
|
||||
|
||||
@@ -41,15 +84,15 @@ fn GetDimensions_0( texture_texture_0 : texture_2d<f32>, texture_sampler_0 : sa
|
||||
fn pixel_art_sample_0( input_texture_texture_0 : texture_2d<f32>, input_texture_sampler_0 : sampler, input_uv_0 : vec2<f32>) -> vec4<f32>
|
||||
{
|
||||
var dimensions_0 : vec2<f32>;
|
||||
var _S2 : f32 = dimensions_0[i32(0)];
|
||||
var _S3 : f32 = dimensions_0[i32(1)];
|
||||
GetDimensions_0(input_texture_texture_0, input_texture_sampler_0, &(_S2), &(_S3));
|
||||
dimensions_0[i32(0)] = _S2;
|
||||
dimensions_0[i32(1)] = _S3;
|
||||
var _S4 : vec2<f32> = input_uv_0 * dimensions_0.xy;
|
||||
var _S5 : vec2<f32> = (floor(_S4) + min(fract(_S4) / (fwidth((_S4))), vec2<f32>(1.0f, 1.0f)) - vec2<f32>(0.5f)) / dimensions_0.xy;
|
||||
var _S7 : f32 = dimensions_0[i32(0)];
|
||||
var _S8 : f32 = dimensions_0[i32(1)];
|
||||
GetDimensions_0(input_texture_texture_0, input_texture_sampler_0, &(_S7), &(_S8));
|
||||
dimensions_0[i32(0)] = _S7;
|
||||
dimensions_0[i32(1)] = _S8;
|
||||
var _S9 : vec2<f32> = input_uv_0 * dimensions_0.xy;
|
||||
var _S10 : vec2<f32> = (floor(_S9) + min(fract(_S9) / (fwidth((_S9))), vec2<f32>(1.0f, 1.0f)) - vec2<f32>(0.5f)) / dimensions_0.xy;
|
||||
;
|
||||
return (textureSample((input_texture_texture_0), (input_texture_sampler_0), (_S5)));
|
||||
return (textureSample((input_texture_texture_0), (input_texture_sampler_0), (_S10)));
|
||||
}
|
||||
|
||||
struct FragmentShaderOutput_0
|
||||
@@ -59,15 +102,15 @@ struct FragmentShaderOutput_0
|
||||
|
||||
struct pixelInput_0
|
||||
{
|
||||
@location(0) uv_2 : vec2<f32>,
|
||||
@location(0) uv_1 : vec2<f32>,
|
||||
};
|
||||
|
||||
@fragment
|
||||
fn main_fragment( _S6 : pixelInput_0, @builtin(position) pos_2 : vec4<f32>) -> FragmentShaderOutput_0
|
||||
fn main_fragment( _S11 : pixelInput_0, @builtin(position) pos_1 : vec4<f32>) -> FragmentShaderOutput_0
|
||||
{
|
||||
var output_1 : FragmentShaderOutput_0;
|
||||
var _S7 : vec4<f32> = pixel_art_sample_0(texture1_texture_0, texture1_sampler_0, _S6.uv_2);
|
||||
output_1.color_0 = vec4<f32>(_S7.xyz * tint_0.xyz, _S7.w);
|
||||
var _S12 : vec4<f32> = pixel_art_sample_0(texture1_texture_0, texture1_sampler_0, _S11.uv_1);
|
||||
output_1.color_0 = vec4<f32>(_S12.xyz * tint_0.xyz, _S12.w);
|
||||
return output_1;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,33 +17,62 @@ struct VertexShaderOutput_0
|
||||
|
||||
struct vertexInput_0
|
||||
{
|
||||
@location(0) pos_1 : vec3<f32>,
|
||||
@location(1) uv_1 : vec2<f32>,
|
||||
@location(2) world_pos_0 : vec2<f32>,
|
||||
};
|
||||
|
||||
struct VertexShaderInput_0
|
||||
{
|
||||
vertex_index_0 : u32,
|
||||
pos_2 : vec3<f32>,
|
||||
uv_2 : vec2<f32>,
|
||||
world_pos_1 : vec2<f32>,
|
||||
};
|
||||
|
||||
@vertex
|
||||
fn main_vertex( _S1 : vertexInput_0, @builtin(vertex_index) vertex_index_1 : u32) -> VertexShaderOutput_0
|
||||
fn main_vertex( _S1 : vertexInput_0, @builtin(vertex_index) vertex_index_0 : u32) -> VertexShaderOutput_0
|
||||
{
|
||||
var _S2 : VertexShaderInput_0;
|
||||
_S2.vertex_index_0 = vertex_index_1;
|
||||
_S2.pos_2 = _S1.pos_1;
|
||||
_S2.uv_2 = _S1.uv_1;
|
||||
_S2.world_pos_1 = _S1.world_pos_0;
|
||||
var _S3 : vec2<f32> = _S2.pos_2.xy * vec2<f32>(0.5f);
|
||||
_S2.pos_2.x = _S3.x;
|
||||
_S2.pos_2.y = _S3.y;
|
||||
var output_0 : VertexShaderOutput_0;
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(_S2.world_pos_1 + _S2.pos_2.xy + vec2<f32>(0.0f, -0.34999999403953552f), 0.0f, 1.0f))));
|
||||
output_0.uv_0 = _S2.uv_2;
|
||||
const _S2 : vec2<f32> = vec2<f32>(0.0f, 0.0f);
|
||||
var vertex_uv_0 : vec2<f32>;
|
||||
var vertex_pos_0 : vec2<f32>;
|
||||
switch(vertex_index_0)
|
||||
{
|
||||
case u32(0):
|
||||
{
|
||||
const _S3 : vec2<f32> = vec2<f32>(-0.5f, 0.5f);
|
||||
vertex_uv_0 = _S2;
|
||||
vertex_pos_0 = _S3;
|
||||
}
|
||||
case u32(1):
|
||||
{
|
||||
const _S4 : vec2<f32> = vec2<f32>(-0.5f, -0.5f);
|
||||
vertex_uv_0 = vec2<f32>(0.0f, 1.0f);
|
||||
vertex_pos_0 = _S4;
|
||||
}
|
||||
case u32(2):
|
||||
{
|
||||
const _S5 : vec2<f32> = vec2<f32>(0.5f, -0.5f);
|
||||
vertex_uv_0 = vec2<f32>(1.0f, 1.0f);
|
||||
vertex_pos_0 = _S5;
|
||||
}
|
||||
case u32(3):
|
||||
{
|
||||
const _S6 : vec2<f32> = vec2<f32>(-0.5f, 0.5f);
|
||||
vertex_uv_0 = _S2;
|
||||
vertex_pos_0 = _S6;
|
||||
}
|
||||
case u32(4):
|
||||
{
|
||||
const _S7 : vec2<f32> = vec2<f32>(0.5f, -0.5f);
|
||||
vertex_uv_0 = vec2<f32>(1.0f, 1.0f);
|
||||
vertex_pos_0 = _S7;
|
||||
}
|
||||
case u32(5):
|
||||
{
|
||||
const _S8 : vec2<f32> = vec2<f32>(0.5f, 0.5f);
|
||||
vertex_uv_0 = vec2<f32>(1.0f, 0.0f);
|
||||
vertex_pos_0 = _S8;
|
||||
}
|
||||
default :
|
||||
{
|
||||
vertex_uv_0 = _S2;
|
||||
vertex_pos_0 = _S2;
|
||||
}
|
||||
}
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(_S1.world_pos_0 + vertex_pos_0 * vec2<f32>(0.5f) + vec2<f32>(0.0f, -0.34999999403953552f), 0.0f, 1.0f))));
|
||||
output_0.uv_0 = vertex_uv_0;
|
||||
return output_0;
|
||||
}
|
||||
|
||||
@@ -56,15 +85,15 @@ fn GetDimensions_0( texture_texture_0 : texture_2d<f32>, texture_sampler_0 : sa
|
||||
fn pixel_art_sample_0( input_texture_texture_0 : texture_2d<f32>, input_texture_sampler_0 : sampler, input_uv_0 : vec2<f32>) -> vec4<f32>
|
||||
{
|
||||
var dimensions_0 : vec2<f32>;
|
||||
var _S4 : f32 = dimensions_0[i32(0)];
|
||||
var _S5 : f32 = dimensions_0[i32(1)];
|
||||
GetDimensions_0(input_texture_texture_0, input_texture_sampler_0, &(_S4), &(_S5));
|
||||
dimensions_0[i32(0)] = _S4;
|
||||
dimensions_0[i32(1)] = _S5;
|
||||
var _S6 : vec2<f32> = input_uv_0 * dimensions_0.xy;
|
||||
var _S7 : vec2<f32> = (floor(_S6) + min(fract(_S6) / (fwidth((_S6))), vec2<f32>(1.0f, 1.0f)) - vec2<f32>(0.5f)) / dimensions_0.xy;
|
||||
var _S9 : f32 = dimensions_0[i32(0)];
|
||||
var _S10 : f32 = dimensions_0[i32(1)];
|
||||
GetDimensions_0(input_texture_texture_0, input_texture_sampler_0, &(_S9), &(_S10));
|
||||
dimensions_0[i32(0)] = _S9;
|
||||
dimensions_0[i32(1)] = _S10;
|
||||
var _S11 : vec2<f32> = input_uv_0 * dimensions_0.xy;
|
||||
var _S12 : vec2<f32> = (floor(_S11) + min(fract(_S11) / (fwidth((_S11))), vec2<f32>(1.0f, 1.0f)) - vec2<f32>(0.5f)) / dimensions_0.xy;
|
||||
;
|
||||
return (textureSample((input_texture_texture_0), (input_texture_sampler_0), (_S7)));
|
||||
return (textureSample((input_texture_texture_0), (input_texture_sampler_0), (_S12)));
|
||||
}
|
||||
|
||||
struct FragmentShaderOutput_0
|
||||
@@ -74,15 +103,15 @@ struct FragmentShaderOutput_0
|
||||
|
||||
struct pixelInput_0
|
||||
{
|
||||
@location(0) uv_3 : vec2<f32>,
|
||||
@location(0) uv_1 : vec2<f32>,
|
||||
};
|
||||
|
||||
@fragment
|
||||
fn main_fragment( _S8 : pixelInput_0, @builtin(position) pos_3 : vec4<f32>) -> FragmentShaderOutput_0
|
||||
fn main_fragment( _S13 : pixelInput_0, @builtin(position) pos_1 : vec4<f32>) -> FragmentShaderOutput_0
|
||||
{
|
||||
var output_1 : FragmentShaderOutput_0;
|
||||
var _S9 : vec4<f32> = pixel_art_sample_0(texture1_texture_0, texture1_sampler_0, _S8.uv_3);
|
||||
output_1.color_0 = vec4<f32>(_S9.xyz * tint_0.xyz, _S9.w);
|
||||
var _S14 : vec4<f32> = pixel_art_sample_0(texture1_texture_0, texture1_sampler_0, _S13.uv_1);
|
||||
output_1.color_0 = vec4<f32>(_S14.xyz * tint_0.xyz, _S14.w);
|
||||
return output_1;
|
||||
}
|
||||
|
||||
|
||||
+41
-31
@@ -34,49 +34,59 @@ struct VertexShaderOutput_0
|
||||
@vertex
|
||||
fn main_vertex(@builtin(vertex_index) vertex_index_0 : u32, @builtin(instance_index) instance_index_0 : u32) -> VertexShaderOutput_0
|
||||
{
|
||||
var _S1 : u32 = instance_index_0 % per_frame_0.map_width_0;
|
||||
var _S2 : u32 = instance_index_0 / per_frame_0.map_width_0;
|
||||
var _S3 : vec2<u32> = vec2<u32>(_S1, _S2);
|
||||
var output_0 : VertexShaderOutput_0;
|
||||
var _S4 : vec3<i32> = vec3<i32>(vec3<u32>(_S3, u32(0)));
|
||||
output_0.tile_0 = (textureLoad((map_texture_0), ((_S4)).xy, ((_S4)).z).x);
|
||||
const _S1 : vec2<f32> = vec2<f32>(0.0f, 0.0f);
|
||||
var vertex_pos_0 : vec2<f32>;
|
||||
var vertex_uv_0 : vec2<f32>;
|
||||
switch(vertex_index_0)
|
||||
{
|
||||
case u32(0):
|
||||
{
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(vec2<f32>(_S3) - vec2<f32>(0.5f, 0.5f) + vec2<f32>(-0.5f, 0.5f), 0.0f, 1.0f))));
|
||||
output_0.uv_0 = vec2<f32>(0.0f, 0.0f);
|
||||
vertex_pos_0 = vec2<f32>(-1.0f, 0.0f);
|
||||
vertex_uv_0 = _S1;
|
||||
}
|
||||
case u32(1):
|
||||
{
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(vec2<f32>(_S3) - vec2<f32>(0.5f, 0.5f) + vec2<f32>(-0.5f, -0.5f), 0.0f, 1.0f))));
|
||||
output_0.uv_0 = vec2<f32>(0.0f, 1.0f);
|
||||
const _S2 : vec2<f32> = vec2<f32>(0.0f, 1.0f);
|
||||
vertex_pos_0 = vec2<f32>(-1.0f, -1.0f);
|
||||
vertex_uv_0 = _S2;
|
||||
}
|
||||
case u32(2):
|
||||
{
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(vec2<f32>(_S3) - vec2<f32>(0.5f, 0.5f) + vec2<f32>(0.5f, -0.5f), 0.0f, 1.0f))));
|
||||
output_0.uv_0 = vec2<f32>(1.0f, 1.0f);
|
||||
const _S3 : vec2<f32> = vec2<f32>(1.0f, 1.0f);
|
||||
vertex_pos_0 = vec2<f32>(0.0f, -1.0f);
|
||||
vertex_uv_0 = _S3;
|
||||
}
|
||||
case u32(3):
|
||||
{
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(vec2<f32>(_S3) - vec2<f32>(0.5f, 0.5f) + vec2<f32>(-0.5f, 0.5f), 0.0f, 1.0f))));
|
||||
output_0.uv_0 = vec2<f32>(0.0f, 0.0f);
|
||||
vertex_pos_0 = vec2<f32>(-1.0f, 0.0f);
|
||||
vertex_uv_0 = _S1;
|
||||
}
|
||||
case u32(4):
|
||||
{
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(vec2<f32>(_S3) - vec2<f32>(0.5f, 0.5f) + vec2<f32>(0.5f, -0.5f), 0.0f, 1.0f))));
|
||||
output_0.uv_0 = vec2<f32>(1.0f, 1.0f);
|
||||
const _S4 : vec2<f32> = vec2<f32>(1.0f, 1.0f);
|
||||
vertex_pos_0 = vec2<f32>(0.0f, -1.0f);
|
||||
vertex_uv_0 = _S4;
|
||||
}
|
||||
case u32(5):
|
||||
{
|
||||
const _S5 : vec2<f32> = vec2<f32>(0.5f, 0.5f);
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(vec2<f32>(_S3) - _S5 + _S5, 0.0f, 1.0f))));
|
||||
output_0.uv_0 = vec2<f32>(1.0f, 0.0f);
|
||||
const _S5 : vec2<f32> = vec2<f32>(1.0f, 0.0f);
|
||||
vertex_pos_0 = _S1;
|
||||
vertex_uv_0 = _S5;
|
||||
}
|
||||
default :
|
||||
{
|
||||
vertex_pos_0 = _S1;
|
||||
vertex_uv_0 = _S1;
|
||||
}
|
||||
}
|
||||
var _S6 : u32 = instance_index_0 % per_frame_0.map_width_0;
|
||||
var _S7 : u32 = instance_index_0 / per_frame_0.map_width_0;
|
||||
var _S8 : vec2<u32> = vec2<u32>(_S6, _S7);
|
||||
var _S9 : vec3<i32> = vec3<i32>(vec3<u32>(_S8, u32(0)));
|
||||
output_0.tile_0 = (textureLoad((map_texture_0), ((_S9)).xy, ((_S9)).z).x);
|
||||
output_0.pos_0 = (((mat4x4<f32>(view_projection_matrix_0.data_0[i32(0)][i32(0)], view_projection_matrix_0.data_0[i32(1)][i32(0)], view_projection_matrix_0.data_0[i32(2)][i32(0)], view_projection_matrix_0.data_0[i32(3)][i32(0)], view_projection_matrix_0.data_0[i32(0)][i32(1)], view_projection_matrix_0.data_0[i32(1)][i32(1)], view_projection_matrix_0.data_0[i32(2)][i32(1)], view_projection_matrix_0.data_0[i32(3)][i32(1)], view_projection_matrix_0.data_0[i32(0)][i32(2)], view_projection_matrix_0.data_0[i32(1)][i32(2)], view_projection_matrix_0.data_0[i32(2)][i32(2)], view_projection_matrix_0.data_0[i32(3)][i32(2)], view_projection_matrix_0.data_0[i32(0)][i32(3)], view_projection_matrix_0.data_0[i32(1)][i32(3)], view_projection_matrix_0.data_0[i32(2)][i32(3)], view_projection_matrix_0.data_0[i32(3)][i32(3)])) * (vec4<f32>(vec2<f32>(_S8) + vertex_pos_0, 0.0f, 1.0f))));
|
||||
output_0.uv_0 = vertex_uv_0;
|
||||
return output_0;
|
||||
}
|
||||
|
||||
@@ -88,16 +98,16 @@ fn CombinedTextureSampler_Sample_0( this_texture_0 : texture_2d<f32>, this_samp
|
||||
fn pixel_art_sample_0( input_texture_texture_0 : texture_2d<f32>, input_texture_sampler_0 : sampler, input_uv_0 : vec2<f32>, tile_uv_0 : vec4<f32>) -> vec4<f32>
|
||||
{
|
||||
var dimensions_0 : vec2<f32>;
|
||||
var _S6 : f32 = dimensions_0[i32(0)];
|
||||
var _S7 : f32 = dimensions_0[i32(1)];
|
||||
{var dim = textureDimensions((input_texture_texture_0));((_S6)) = f32(dim.x);((_S7)) = f32(dim.y);};
|
||||
dimensions_0[i32(0)] = _S6;
|
||||
dimensions_0[i32(1)] = _S7;
|
||||
var _S8 : vec2<f32> = tile_uv_0.xy;
|
||||
var _S9 : vec2<f32> = tile_uv_0.zw;
|
||||
var _S10 : vec2<f32> = mix(_S8, _S9, input_uv_0);
|
||||
var _S11 : vec2<f32> = vec2<f32>(0.5f);
|
||||
return CombinedTextureSampler_Sample_0(input_texture_texture_0, input_texture_sampler_0, clamp((floor(_S10) + saturate(fract(_S10) / (fwidth((_S10)))) - _S11) / dimensions_0, (_S8 + _S11) / dimensions_0, (_S9 - _S11) / dimensions_0));
|
||||
var _S10 : f32 = dimensions_0[i32(0)];
|
||||
var _S11 : f32 = dimensions_0[i32(1)];
|
||||
{var dim = textureDimensions((input_texture_texture_0));((_S10)) = f32(dim.x);((_S11)) = f32(dim.y);};
|
||||
dimensions_0[i32(0)] = _S10;
|
||||
dimensions_0[i32(1)] = _S11;
|
||||
var _S12 : vec2<f32> = tile_uv_0.xy;
|
||||
var _S13 : vec2<f32> = tile_uv_0.zw;
|
||||
var _S14 : vec2<f32> = mix(_S12, _S13, input_uv_0);
|
||||
var _S15 : vec2<f32> = vec2<f32>(0.5f);
|
||||
return CombinedTextureSampler_Sample_0(input_texture_texture_0, input_texture_sampler_0, clamp((floor(_S14) + saturate(fract(_S14) / (fwidth((_S14)))) - _S15) / dimensions_0, (_S12 + _S15) / dimensions_0, (_S13 - _S15) / dimensions_0));
|
||||
}
|
||||
|
||||
struct FragmentShaderOutput_0
|
||||
@@ -112,11 +122,11 @@ struct pixelInput_0
|
||||
};
|
||||
|
||||
@fragment
|
||||
fn main_fragment( _S12 : pixelInput_0, @builtin(position) pos_1 : vec4<f32>) -> FragmentShaderOutput_0
|
||||
fn main_fragment( _S16 : pixelInput_0, @builtin(position) pos_1 : vec4<f32>) -> FragmentShaderOutput_0
|
||||
{
|
||||
var output_1 : FragmentShaderOutput_0;
|
||||
var _S13 : vec4<f32> = pixel_art_sample_0(block2_tile_atlas_texture_0, block2_tile_atlas_sampler_0, _S12.uv_1, block2_tile_uvs_0[_S12.tile_1]);
|
||||
output_1.color_0 = vec4<f32>(_S13.xyz * block3_tint_0.xyz, _S13.w);
|
||||
var _S17 : vec4<f32> = pixel_art_sample_0(block2_tile_atlas_texture_0, block2_tile_atlas_sampler_0, _S16.uv_1, block2_tile_uvs_0[_S16.tile_1]);
|
||||
output_1.color_0 = vec4<f32>(_S17.xyz * block3_tint_0.xyz, _S17.w);
|
||||
return output_1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user