Files
Mikemon/src/shaders/wgsl/character_shadow.wgsl
T
Sven Balzer 963ccc4ec8
buildbot/windows Build done.
buildbot/linux Build done.
change rendering offsets for character, character shadow and trees
change default camera tilt
2026-08-05 21:50:13 +02:00

118 lines
4.3 KiB
WebGPU Shading Language

struct _MatrixStorage_float4x4_ColMajorstd140_0
{
@align(16) data_0 : array<vec4<f32>, i32(4)>,
};
@binding(0) @group(1) var<uniform> view_projection_matrix_0 : _MatrixStorage_float4x4_ColMajorstd140_0;
@binding(0) @group(2) var texture1_texture_0 : texture_2d<f32>;
@binding(1) @group(2) var texture1_sampler_0 : sampler;
@binding(0) @group(3) var<uniform> tint_0 : vec3<f32>;
struct VertexShaderOutput_0
{
@builtin(position) pos_0 : vec4<f32>,
@location(0) uv_0 : vec2<f32>,
};
struct vertexInput_0
{
@location(2) world_pos_0 : vec2<f32>,
};
@vertex
fn main_vertex( _S1 : vertexInput_0, @builtin(vertex_index) vertex_index_0 : u32) -> VertexShaderOutput_0
{
var output_0 : VertexShaderOutput_0;
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), 0.0f, 1.0f))));
output_0.uv_0 = vertex_uv_0;
return output_0;
}
fn GetDimensions_0( texture_texture_0 : texture_2d<f32>, texture_sampler_0 : sampler, width_0 : ptr<function, f32>, height_0 : ptr<function, f32>)
{
{var dim = textureDimensions((texture_texture_0));(((*width_0))) = f32(dim.x);(((*height_0))) = f32(dim.y);};
return;
}
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 _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), (_S12)));
}
struct FragmentShaderOutput_0
{
@location(0) color_0 : vec4<f32>,
};
struct pixelInput_0
{
@location(0) uv_1 : vec2<f32>,
};
@fragment
fn main_fragment( _S13 : pixelInput_0, @builtin(position) pos_1 : vec4<f32>) -> FragmentShaderOutput_0
{
var output_1 : FragmentShaderOutput_0;
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;
}