]> git.mxchange.org Git - simgear.git/commitdiff
Frederic: Use display lists for 3d models also.
authorehofman <ehofman>
Sun, 10 Oct 2004 17:49:27 +0000 (17:49 +0000)
committerehofman <ehofman>
Sun, 10 Oct 2004 17:49:27 +0000 (17:49 +0000)
simgear/scene/model/model.cxx

index e2059c9feb63bb0b17abafb1d85b1140b6bb2b62..645b6fc43fbc33019bd0591f18b3b1c0b990e14b 100644 (file)
@@ -208,6 +208,19 @@ sgMakeAnimation( ssgBranch * model,
 }
 
 
+static void 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 );
+    }
+  }
+}
+
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -258,6 +271,10 @@ sgLoad3DModel( const string &fg_root, const string &path,
       throw sg_exception("Failed to load 3D model");
   }
 
+  if ( model != 0 ) {
+    makeDList( model );
+  }
+
                                 // Set up the alignment node
   ssgTransform * alignmainmodel = new ssgTransform;
   if ( load_panel == 0 )