MAJOR rendering overhaul. Snow deformation, persistent light, flowmap out. Also ECS architexture overhaul
This commit is contained in:
@@ -9,6 +9,10 @@ struct DeformParams {
|
||||
position_z: f32,
|
||||
radius: f32,
|
||||
depth: f32,
|
||||
terrain_width: f32,
|
||||
terrain_height: f32,
|
||||
_padding1: f32,
|
||||
_padding2: f32,
|
||||
}
|
||||
|
||||
@compute @workgroup_size(16, 16, 1)
|
||||
@@ -21,7 +25,7 @@ fn deform(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
||||
|
||||
let coords = vec2<i32>(i32(global_id.x), i32(global_id.y));
|
||||
|
||||
let terrain_size = vec2<f32>(1000.0, 1000.0);
|
||||
let terrain_size = vec2<f32>(params.terrain_width, params.terrain_height);
|
||||
let half_size = terrain_size / 2.0;
|
||||
|
||||
let uv = vec2<f32>(f32(global_id.x) / f32(texture_size.x), f32(global_id.y) / f32(texture_size.y));
|
||||
@@ -34,9 +38,7 @@ fn deform(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
||||
let current_depth = textureLoad(snow_depth, coords).r;
|
||||
|
||||
let falloff = 1.0 - (distance / params.radius);
|
||||
let falloff_smooth = falloff * falloff;
|
||||
|
||||
let deform_amount = params.depth * falloff_smooth;
|
||||
let deform_amount = params.depth * falloff * falloff;
|
||||
let new_depth = max(0.0, current_depth - deform_amount);
|
||||
|
||||
textureStore(snow_depth, coords, vec4<f32>(new_depth, 0.0, 0.0, 0.0));
|
||||
|
||||
Reference in New Issue
Block a user