From 0b898a5594203668ed9cad38b490ab49ba233bd4 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Tue, 16 Nov 2021 17:38:43 -0800 Subject: [PATCH] Add always_sort_to_camera for surfaces --- manimlib/mobject/types/surface.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manimlib/mobject/types/surface.py b/manimlib/mobject/types/surface.py index e2c89b4d..1160c1ae 100644 --- a/manimlib/mobject/types/surface.py +++ b/manimlib/mobject/types/surface.py @@ -162,6 +162,11 @@ class Surface(Mobject): tri_is[k::3] = tri_is[k::3][indices] return self + def always_sort_to_camera(self, camera): + self.add_updater(lambda m: m.sort_faces_back_to_front( + camera.get_location() - self.get_center() + )) + # For shaders def get_shader_data(self): s_points, du_points, dv_points = self.get_surface_points_and_nudged_points()