Browse Source

fix camera.set_active()

David Rose 19 years ago
parent
commit
c8991502bf
1 changed files with 12 additions and 10 deletions
  1. 12 10
      panda/src/display/graphicsEngine.cxx

+ 12 - 10
panda/src/display/graphicsEngine.cxx

@@ -271,7 +271,7 @@ make_output(GraphicsPipe *pipe,
             int x_size, int y_size, int flags,
             int x_size, int y_size, int flags,
             GraphicsStateGuardian *gsg,
             GraphicsStateGuardian *gsg,
             GraphicsOutput *host) {
             GraphicsOutput *host) {
-  
+
   //  The code here is tricky because the gsg that is passed in
   //  The code here is tricky because the gsg that is passed in
   //  might be in the uninitialized state.  As a result,
   //  might be in the uninitialized state.  As a result,
   //  pipe::make_output may not be able to tell which DirectX
   //  pipe::make_output may not be able to tell which DirectX
@@ -351,7 +351,7 @@ make_output(GraphicsPipe *pipe,
       (prop.get_aux_float() == 0)) {
       (prop.get_aux_float() == 0)) {
     can_use_parasite = true;
     can_use_parasite = true;
   }
   }
-  
+
   // If parasite buffers are preferred, then try a parasite first.
   // If parasite buffers are preferred, then try a parasite first.
   
   
   if ((prefer_parasite_buffer) &&
   if ((prefer_parasite_buffer) &&
@@ -404,7 +404,7 @@ make_output(GraphicsPipe *pipe,
   }
   }
 
 
   // Could not create a window to the user's specs.
   // Could not create a window to the user's specs.
-  
+
   return NULL;
   return NULL;
 }
 }
 
 
@@ -1018,7 +1018,10 @@ cull_and_draw_together(GraphicsOutput *win, DisplayRegion *dr,
   gsg->prepare_display_region(dr_reader, dr_reader->get_stereo_channel());
   gsg->prepare_display_region(dr_reader, dr_reader->get_stereo_channel());
 
 
   PT(SceneSetup) scene_setup = setup_scene(gsg, dr_reader);
   PT(SceneSetup) scene_setup = setup_scene(gsg, dr_reader);
-  if (!gsg->set_scene(scene_setup)) {
+  if (scene_setup == (SceneSetup *)NULL) {
+    // Never mind.
+
+  } else if (!gsg->set_scene(scene_setup)) {
     // The scene or lens is inappropriate somehow.
     // The scene or lens is inappropriate somehow.
     display_cat.error()
     display_cat.error()
       << gsg->get_type() << " cannot render scene with specified lens.\n";
       << gsg->get_type() << " cannot render scene with specified lens.\n";
@@ -1132,13 +1135,12 @@ cull_to_bins(GraphicsOutput *win, DisplayRegion *dr, Thread *current_thread) {
     BinCullHandler cull_handler(cull_result);
     BinCullHandler cull_handler(cull_result);
     do_cull(&cull_handler, scene_setup, gsg, current_thread);
     do_cull(&cull_handler, scene_setup, gsg, current_thread);
 
 
-    {
-      PStatTimer timer(_cull_sort_pcollector, current_thread);
-      cull_result->finish_cull(scene_setup, current_thread);
-      // Save the results for next frame.
-      dr->set_cull_result(cull_result, scene_setup, current_thread);
-    }
+    PStatTimer timer(_cull_sort_pcollector, current_thread);
+    cull_result->finish_cull(scene_setup, current_thread);
   }
   }
+  
+  // Save the results for next frame.
+  dr->set_cull_result(cull_result, scene_setup, current_thread);
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////