Skip to content

Commit b7b9800

Browse files
committed
sync shaders
1 parent 26fa023 commit b7b9800

File tree

6 files changed

+3
-46
lines changed

6 files changed

+3
-46
lines changed

crates/renderling/src/bvol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn intersect_planes(p0: &Vec4, p1: &Vec4, p2: &Vec4) -> Vec3 {
4444

4545
/// Calculates distance between plane and point
4646
pub fn dist_bpp(plane: &Vec4, point: Vec3) -> f32 {
47-
(plane.x * point.x + plane.y * point.y + plane.z * point.z + plane.w).abs()
47+
plane.x * point.x + plane.y * point.y + plane.z * point.z + plane.w
4848
}
4949

5050
/// Calculates the most inside vertex of an AABB.

crates/renderling/src/camera.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ impl Camera {
8181
self.projection * self.view
8282
}
8383

84+
/// Returns **roughly** the location of the znear plane.
8485
pub fn z_near(&self) -> f32 {
8586
dist_bpp(&self.frustum.planes[0], self.position)
8687
}
@@ -156,25 +157,3 @@ pub fn default_ortho2d(width: f32, height: f32) -> (Mat4, Mat4) {
156157
let view = Mat4::IDENTITY;
157158
(projection, view)
158159
}
159-
160-
#[cfg(test)]
161-
mod test {
162-
use super::*;
163-
164-
#[test]
165-
fn camera_znear_zfar() {
166-
let znear = 0.01;
167-
let zfar = 100.0;
168-
let projection = Mat4::perspective_rh(core::f32::consts::PI / 4.0, 1.0, znear, zfar);
169-
let view = Mat4::look_at_rh(Vec3::new(5.0, 5.0, 10.0), Vec3::ZERO, Vec3::Y);
170-
let camera = Camera::new(projection, view);
171-
172-
log::info!("near_plane: {}", camera.frustum.planes[0]);
173-
log::info!("znear: {}", camera.z_near());
174-
log::info!("far_plane: {}", camera.frustum.planes[5]);
175-
log::info!("zfar: {}", camera.z_far());
176-
177-
assert_eq!(znear, camera.z_near(), "znear");
178-
assert_eq!(zfar, camera.z_far(), "zfar");
179-
}
180-
}

crates/renderling/src/cull.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use spirv_std::num_traits::Float;
99
use spirv_std::{
1010
arch::IndexUnchecked,
1111
image::{sample_with, Image, ImageWithMethods},
12-
spirv, Sampler,
12+
spirv,
1313
};
1414

1515
use crate::draw::DrawIndirectArgs;

crates/renderling/src/linkage/compute_occlusion_culling.rs

Lines changed: 0 additions & 22 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)