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
This commit is contained in:
rdb 2021-08-03 10:59:10 +02:00
parent ea45ff691d
commit 1f84469cd9
3 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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.

View File

@ -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: