From f61014c2ea17db746939f9f2978af078b370801c Mon Sep 17 00:00:00 2001 From: ehofman Date: Sun, 10 Oct 2004 17:41:11 +0000 Subject: [PATCH] Frederic: Add display list support without changing plib. --- src/Scenery/tileentry.cxx | 15 +++++++++++++++ src/Scenery/tileentry.hxx | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/src/Scenery/tileentry.cxx b/src/Scenery/tileentry.cxx index 153d49183..8b987b0ad 100644 --- a/src/Scenery/tileentry.cxx +++ b/src/Scenery/tileentry.cxx @@ -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; igetKid(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,8 @@ 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. + makeDList( terra_transform ); + terra_transform->ref(); terrain_branch->addKid( terra_transform ); diff --git a/src/Scenery/tileentry.hxx b/src/Scenery/tileentry.hxx index a442f7604..de188cd90 100644 --- a/src/Scenery/tileentry.hxx +++ b/src/Scenery/tileentry.hxx @@ -259,6 +259,11 @@ public: */ inline SGBucket get_tile_bucket() const { return tile_bucket; } + /** + * Apply ssgLeaf::makeDList to all leaf of a branch + */ + void makeDList( ssgBranch *b ); + /** * Add terrain mesh and ground lighting to scene graph. */