]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tileentry.cxx
Check for the plib version when using display lists, just to be sure.
[flightgear.git] / src / Scenery / tileentry.cxx
index 153d49183ceaa1e8e10472607d295244941419b8..108e6d0c831835dd0d15d0d7fc2d0997db2a08bc 100644 (file)
@@ -982,6 +982,19 @@ FGTileEntry::load( const string_list &path_list, bool is_base )
     }
 }
 
+void
+FGTileEntry::makeDList( ssgBranch *b )
+{
+    int nb = b->getNumKids();
+    for (int i = 0; i<nb; i++) {
+        ssgEntity *e = b->getKid(i);
+        if (e->isAKindOf(ssgTypeLeaf())) {
+            ((ssgLeaf*)e)->makeDList();
+        } else if (e->isAKindOf(ssgTypeBranch())) {
+            makeDList( (ssgBranch*)e );
+        }
+    }
+}
 
 void
 FGTileEntry::add_ssg_nodes( ssgBranch *terrain_branch,
@@ -992,6 +1005,10 @@ FGTileEntry::add_ssg_nodes( ssgBranch *terrain_branch,
 {
     // bump up the ref count so we can remove this later without
     // having ssg try to free the memory.
+#if PLIB_VERSION > 183
+    makeDList( terra_transform );
+#endif
+
     terra_transform->ref();
     terrain_branch->addKid( terra_transform );