Browse Source

filter: Fix issue with cached CullResult persisting after cleanup

This can cause issues if a DR gets assigned an inactive camera - the old cull result will persist and be used for draw.  Possibly we need to do this in set_camera.

Reproduced by #1166
rdb 4 years ago
parent
commit
1f84469cd9

+ 2 - 0
direct/src/filter/FilterManager.py

@@ -366,6 +366,8 @@ class FilterManager(DirectObject):
         self.camstate = self.caminit
         self.camera.node().setInitialState(self.caminit)
         self.region.setCamera(self.camera)
+        if hasattr(self.region, 'clearCullResult'):
+            self.region.clearCullResult()
         self.nextsort = self.win.getSort() - 1000
         self.basex = 0
         self.basey = 0

+ 9 - 0
panda/src/display/displayRegion.cxx

@@ -514,6 +514,15 @@ get_screenshot() {
   return tex;
 }
 
+/**
+ *
+ */
+void DisplayRegion::
+clear_cull_result() {
+  CDCullWriter cdata_cull(_cycler_cull, true);
+  cdata_cull->_cull_result = nullptr;
+}
+
 /**
  * Returns a special scene graph constructed to represent the results of the
  * last frame's cull operation.

+ 1 - 0
panda/src/display/displayRegion.h

@@ -160,6 +160,7 @@ PUBLISHED:
   bool get_screenshot(PNMImage &image);
   PT(Texture) get_screenshot();
 
+  void clear_cull_result();
   virtual PT(PandaNode) make_cull_result_graph();
 
 public: