Kaynağa Gözat

reset lighting and clip planes between scenes

David Rose 20 yıl önce
ebeveyn
işleme
5fdd7cab0e
1 değiştirilmiş dosya ile 34 ekleme ve 33 silme
  1. 34 33
      panda/src/display/graphicsStateGuardian.cxx

+ 34 - 33
panda/src/display/graphicsStateGuardian.cxx

@@ -523,10 +523,42 @@ begin_frame() {
   // up to release in the past frame, and load up any newly requested
   // up to release in the past frame, and load up any newly requested
   // textures.
   // textures.
   _prepared_objects->update(this);
   _prepared_objects->update(this);
+
+#ifdef DO_PSTATS
+  // For Pstats to track our current texture memory usage, we have to
+  // reset the set of current textures each frame.
+  init_frame_pstats();
+
+  // But since we don't get sent a new issue_texture() unless our
+  // texture state has changed, we have to be sure to clear the
+  // current texture state now.  A bit unfortunate, but probably not
+  // measurably expensive.
+  modify_state(get_untextured_state());
+#endif
+  return true;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsStateGuardian::begin_scene
+//       Access: Public, Virtual
+//  Description: Called between begin_frame() and end_frame() to mark
+//               the beginning of drawing commands for a "scene"
+//               (usually a particular DisplayRegion) within a frame.
+//               All 3-D drawing commands, except the clear operation,
+//               must be enclosed within begin_scene() .. end_scene().
+//
+//               The return value is true if successful (in which case
+//               the scene will be drawn and end_scene() will be
+//               called later), or false if unsuccessful (in which
+//               case nothing will be drawn and end_scene() will not
+//               be called).
+////////////////////////////////////////////////////////////////////
+bool GraphicsStateGuardian::
+begin_scene() {
   
   
-  // Undo any lighting we had enabled last frame, to force the lights
+  // Undo any lighting we had enabled last scene, to force the lights
   // to be reissued, in case their parameters or positions have
   // to be reissued, in case their parameters or positions have
-  // changed between frames.
+  // changed between scenes.
   if (_lighting_enabled_this_frame) {
   if (_lighting_enabled_this_frame) {
     for (int i = 0; i < (int)_light_info.size(); i++) {
     for (int i = 0; i < (int)_light_info.size(); i++) {
       if (_light_info[i]._enabled) {
       if (_light_info[i]._enabled) {
@@ -559,37 +591,6 @@ begin_frame() {
     _clip_planes_enabled_this_frame = false;
     _clip_planes_enabled_this_frame = false;
   }
   }
 
 
-#ifdef DO_PSTATS
-  // For Pstats to track our current texture memory usage, we have to
-  // reset the set of current textures each frame.
-  init_frame_pstats();
-
-  // But since we don't get sent a new issue_texture() unless our
-  // texture state has changed, we have to be sure to clear the
-  // current texture state now.  A bit unfortunate, but probably not
-  // measurably expensive.
-  modify_state(get_untextured_state());
-#endif
-  return true;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: GraphicsStateGuardian::begin_scene
-//       Access: Public, Virtual
-//  Description: Called between begin_frame() and end_frame() to mark
-//               the beginning of drawing commands for a "scene"
-//               (usually a particular DisplayRegion) within a frame.
-//               All 3-D drawing commands, except the clear operation,
-//               must be enclosed within begin_scene() .. end_scene().
-//
-//               The return value is true if successful (in which case
-//               the scene will be drawn and end_scene() will be
-//               called later), or false if unsuccessful (in which
-//               case nothing will be drawn and end_scene() will not
-//               be called).
-////////////////////////////////////////////////////////////////////
-bool GraphicsStateGuardian::
-begin_scene() {
   return true;
   return true;
 }
 }