|
|
@@ -118,6 +118,23 @@ PStatCollector GraphicsEngine::_occlusion_passed_pcollector("Occlusion results:V
|
|
|
PStatCollector GraphicsEngine::_occlusion_failed_pcollector("Occlusion results:Occluded");
|
|
|
PStatCollector GraphicsEngine::_occlusion_tests_pcollector("Occlusion tests");
|
|
|
|
|
|
+// This is used to keep track of which scenes we have already culled.
|
|
|
+struct CullKey {
|
|
|
+ GraphicsStateGuardian *_gsg;
|
|
|
+ NodePath _camera;
|
|
|
+ int _lens_index;
|
|
|
+};
|
|
|
+
|
|
|
+INLINE static bool operator < (const CullKey &a, const CullKey &b) {
|
|
|
+ if (a._gsg != b._gsg) {
|
|
|
+ return a._gsg < b._gsg;
|
|
|
+ }
|
|
|
+ if (a._camera != b._camera) {
|
|
|
+ return a._camera < b._camera;
|
|
|
+ }
|
|
|
+ return a._lens_index < b._lens_index;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Creates a new GraphicsEngine object. The Pipeline is normally left to
|
|
|
* default to NULL, which indicates the global render pipeline, but it may be
|
|
|
@@ -1375,7 +1392,6 @@ cull_to_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) {
|
|
|
|
|
|
// Keep track of the cameras we have already used in this thread to render
|
|
|
// DisplayRegions.
|
|
|
- typedef pair<NodePath, int> CullKey;
|
|
|
typedef pmap<CullKey, DisplayRegion *> AlreadyCulled;
|
|
|
AlreadyCulled already_culled;
|
|
|
|
|
|
@@ -1390,10 +1406,13 @@ cull_to_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) {
|
|
|
if (dr != (DisplayRegion *)NULL) {
|
|
|
DisplayRegionPipelineReader *dr_reader =
|
|
|
new DisplayRegionPipelineReader(dr, current_thread);
|
|
|
- NodePath camera = dr_reader->get_camera();
|
|
|
- int lens_index = dr_reader->get_lens_index();
|
|
|
|
|
|
- AlreadyCulled::iterator aci = already_culled.insert(AlreadyCulled::value_type(CullKey(camera, lens_index), (DisplayRegion *)NULL)).first;
|
|
|
+ CullKey key;
|
|
|
+ key._gsg = win->get_gsg();
|
|
|
+ key._camera = dr_reader->get_camera();
|
|
|
+ key._lens_index = dr_reader->get_lens_index();
|
|
|
+
|
|
|
+ AlreadyCulled::iterator aci = already_culled.insert(AlreadyCulled::value_type(key, (DisplayRegion *)NULL)).first;
|
|
|
if ((*aci).second == NULL) {
|
|
|
// We have not used this camera already in this thread. Perform
|
|
|
// the cull operation.
|