*** empty log message ***

This commit is contained in:
David Rose 2001-03-13 23:28:01 +00:00
parent c2c59d71bc
commit 25a0389533
4 changed files with 42 additions and 16 deletions

View File

@ -94,6 +94,7 @@ reset() {
_depth_clear_value = 1.0;
_stencil_clear_value = 0.0;
_accum_clear_value.set(0.0, 0.0, 0.0, 0.0);
_clear_buffer_type = RenderBuffer::T_back | RenderBuffer::T_depth;
_normals_enabled = false;
}
@ -330,6 +331,28 @@ set_accum_clear_value(const Colorf& value) {
_accum_clear_value = value;
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsStateGuardian::enable_frame_clear
// Access: Public
// Description: Activates or deactivates the automatic clearing of
// the frame buffer and/or depth buffer at the beginning
// of each frame.
//
// If clear_color is true, the color buffer will be
// cleared; if clear_depth is true, the depth buffer
// will be cleared.
////////////////////////////////////////////////////////////////////
void GraphicsStateGuardian::
enable_frame_clear(bool clear_color, bool clear_depth) {
_clear_buffer_type = 0;
if (clear_color) {
_clear_buffer_type |= RenderBuffer::T_back;
}
if (clear_depth) {
_clear_buffer_type |= RenderBuffer::T_depth;
}
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsStateGuardian::wants_normals
// Access: Public, Virtual

View File

@ -62,6 +62,8 @@ PUBLISHED:
return _accum_clear_value;
}
void enable_frame_clear(bool clear_color, bool clear_depth);
public:
void release_all_textures();
@ -138,6 +140,7 @@ protected:
float _depth_clear_value;
bool _stencil_clear_value;
Colorf _accum_clear_value;
int _clear_buffer_type;
int _display_region_stack_level;
int _frame_buffer_stack_level;

View File

@ -639,11 +639,13 @@ render_frame(const AllAttributesWrapper &initial_state) {
_decal_level = 0;
// First, clear the entire window.
PT(DisplayRegion) win_dr =
_win->make_scratch_display_region(_win->get_width(), _win->get_height());
clear(get_render_buffer(RenderBuffer::T_back | RenderBuffer::T_depth), win_dr);
if (_clear_buffer_type != 0) {
// First, clear the entire window.
PT(DisplayRegion) win_dr =
_win->make_scratch_display_region(_win->get_width(), _win->get_height());
clear(get_render_buffer(_clear_buffer_type), win_dr);
}
// Now render each of our layers in order.
int max_channel_index = _win->get_max_channel_index();
for (int c = 0; c < max_channel_index; c++) {

View File

@ -463,18 +463,16 @@ render_frame(const AllAttributesWrapper &initial_state) {
_win->begin_frame();
_decal_level = 0;
// First, clear the entire window.
PT(DisplayRegion) win_dr =
_win->make_scratch_display_region(_win->get_width(), _win->get_height());
if (win_dr == (DisplayRegion*)NULL)
{
cerr << "null scratch " << endl;
exit(0);
if (_clear_buffer_type != 0) {
// First, clear the entire window.
PT(DisplayRegion) win_dr =
_win->make_scratch_display_region(_win->get_width(), _win->get_height());
nassertv(win_dr != (DisplayRegion*)NULL);
DisplayRegionStack old_dr = push_display_region(win_dr);
prepare_display_region();
clear(get_render_buffer(_clear_buffer_type));
pop_display_region(old_dr);
}
DisplayRegionStack old_dr = push_display_region(win_dr);
prepare_display_region();
clear(get_render_buffer(RenderBuffer::T_back | RenderBuffer::T_depth));
pop_display_region(old_dr);
// Now render each of our layers in order.
int max_channel_index = _win->get_max_channel_index();