fix cursor unlock on windows
This commit is contained in:
@@ -47,9 +47,9 @@ impl Client<'_> {
|
||||
}
|
||||
if self.keep_cursor {
|
||||
let size = window.inner_size();
|
||||
window
|
||||
.set_cursor_position(PhysicalPosition::new(size.width / 2, size.height / 2))
|
||||
.expect("cursor move");
|
||||
// window
|
||||
// .set_cursor_position(PhysicalPosition::new(size.width / 2, size.height / 2))
|
||||
// .expect("cursor move");
|
||||
}
|
||||
|
||||
// camera orientation
|
||||
|
||||
@@ -152,7 +152,7 @@ fn trace_full(pos_view: vec4<f32>, dir_view: vec4<f32>) -> vec4<f32> {
|
||||
let t_corner = vox_pos * inc_t + min_adj;
|
||||
let node = voxels[group.offset + node_start + (child ^ inv_dir_bits)];
|
||||
if node >= LEAF_BIT {
|
||||
if node != skip {
|
||||
if node != skip && node != LEAF_BIT {
|
||||
skip = node;
|
||||
let normal = normals[axis];
|
||||
let sun_dir = global_lights[0].dir;
|
||||
@@ -310,7 +310,7 @@ fn trace_light(pos_view: vec4<f32>, dir_view: vec4<f32>) -> vec4<f32> {
|
||||
let t_corner = vox_pos * inc_t + min_adj;
|
||||
let node = voxels[group.offset + node_start + (child ^ inv_dir_bits)];
|
||||
if node >= LEAF_BIT {
|
||||
if node != skip {
|
||||
if node != skip && node != LEAF_BIT {
|
||||
skip = node;
|
||||
if data == 3 {
|
||||
let dist = (t - old_t) / t_mult;
|
||||
|
||||
@@ -54,12 +54,14 @@ fn main(@builtin(global_invocation_id) cell: vec3<u32>) {
|
||||
)) - 1.0);
|
||||
while res.data != 0 {
|
||||
let data = res.data & LEAF_MASK;
|
||||
if data != 0 {
|
||||
let vcolor = get_color(data);
|
||||
let diffuse = max(dot(global_lights[0].dir, normals[res.ray.axis]) + 0.1, 0.0);
|
||||
let light = max(diffuse, ambient);
|
||||
let new_color = min(vcolor.xyz * light, vec3<f32>(1.0));
|
||||
color += vec4<f32>(new_color.xyz * vcolor.a, vcolor.a) * (1.0 - color.a);
|
||||
if color.a > FULL_ALPHA { break; }
|
||||
}
|
||||
let old_t = res.ray.t;
|
||||
res = ray_next(res.ray, res.data);
|
||||
if data == 3 {
|
||||
@@ -76,9 +78,11 @@ fn main(@builtin(global_invocation_id) cell: vec3<u32>) {
|
||||
var light = 1.0;
|
||||
while res.data != 0 {
|
||||
let data = res.data & LEAF_MASK;
|
||||
if data != 0 {
|
||||
let vcolor = get_color(data);
|
||||
if data != 3 { light -= vcolor.a * light; }
|
||||
if light <= 0 { break; }
|
||||
}
|
||||
let old_t = res.ray.t;
|
||||
res = ray_next(res.ray, res.data);
|
||||
if data == 3 {
|
||||
|
||||
Reference in New Issue
Block a user