reset lighting and clip planes between scenes

This commit is contained in:
David Rose 2005-05-13 00:23:19 +00:00
parent 4d6434e210
commit 5fdd7cab0e

View File

@ -524,9 +524,41 @@ begin_frame() {
// textures. // textures.
_prepared_objects->update(this); _prepared_objects->update(this);
// Undo any lighting we had enabled last frame, to force the lights #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 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;
} }