Skip to content

Commit 2a11632

Browse files
committed
Use Godot Math::abs
1 parent a081865 commit 2a11632

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

render/wireframe_canvas/wireframe_canvas_rendering_engine_4d.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,18 @@ void WireframeCanvasRenderingEngine4D::render_frame() {
6969
const int b_index = edge_indices[edge_index * 2 + 1];
7070
const Vector4 a_vert_4d = camera_relative_vertices[a_index];
7171
const Vector4 b_vert_4d = camera_relative_vertices[b_index];
72-
72+
// Cull edges that are too far in the W axis.
7373
if (camera_has_w_fading) {
7474
real_t fade_denom = camera_w_fade_distance;
7575
if (camera_has_perspective) {
7676
fade_denom += camera_w_fade_slope * -0.5f * (a_vert_4d.z + b_vert_4d.z);
7777
}
78-
79-
if (abs((a_vert_4d.w + b_vert_4d.w) / 2.0) > fade_denom) {
80-
// The edge is too far in the w axis from the camera, so we can skip this edge.
78+
if (Math::abs((a_vert_4d.w + b_vert_4d.w) / 2.0f) > fade_denom) {
79+
// The edge is too far in the W axis from the camera, so we can skip this edge.
8180
continue;
8281
}
8382
}
84-
83+
// Cull or clip edges that are behind the camera.
8584
if (a_vert_4d.z > negative_camera_clip_depth_near) {
8685
if (b_vert_4d.z > negative_camera_clip_depth_near) {
8786
// Both points are behind the camera, so we skip this edge.

0 commit comments

Comments
 (0)