Fix shadows not compiling without myouDebugShadows.

This commit is contained in:
Alberto Torres 2024-09-13 02:31:47 +02:00
parent 60a896f513
commit 52a4c00ffe

View file

@ -126,8 +126,6 @@ proc renderShadow*(self: SimpleShadowManager, scene: Scene,
min_z: float32 = 0) =
# Find the projection matrix that fits all bounding points and sphere
# TODO: option to rotate proj to favor vertical lines?
when not defined(release):
debug_mesh.clear_vertices()
let rotm = self.light.world_matrix.to_mat3_rotation
let rotmi = rotm.inverse
var pmin = vec3(Inf)
@ -182,9 +180,6 @@ proc renderShadowWithCamera*(self: SimpleShadowManager, camera: Camera) =
# it assumes that all world matrices are already up to date
# TODO: accept a cameradata instead?
when not defined(release):
debug_mesh.clear_vertices()
template depth_to_screen(d: float32, proj: Mat4): float32 =
# TODO: make more efficient and put in Camera
@ -220,6 +215,8 @@ proc renderShadowWithCamera*(self: SimpleShadowManager, camera: Camera) =
self.renderShadow(camera.scene, points, min_z=zrange*4)
method renderShadow*(self: SimpleShadowManager, camera: Camera): bool {.locks:"unknown".} =
when defined(myouDebugShadows):
debug_mesh.clear_vertices()
if self.use_camera:
self.renderShadowWithCamera(
camera = camera)