Backport shadow-depth-bits config var to 1.9

This commit is contained in:
rdb 2016-07-09 14:27:33 +02:00
parent 47d1b4e220
commit 11861cb73d
4 changed files with 17 additions and 5 deletions

View File

@ -17,6 +17,7 @@ This issue fixes several bugs that were still found in 1.9.2.
* Improve performance of texture load and store operations
* Fix crashes with pbuffers on Intel cards on Windows
* Support for Autodesk Maya 2016.5
* Add shadow-depth-bits config var to control shadow map depth
------------------------ RELEASE 1.9.2 ------------------------

View File

@ -445,6 +445,12 @@ ConfigVariableDouble pixel_zoom
("pixel-zoom", 1.0,
PRC_DESC("The default pixel_zoom factor for new windows."));
ConfigVariableInt shadow_depth_bits
("shadow-depth-bits", 1,
PRC_DESC("The minimum number of depth buffer bits requested when rendering "
"shadow maps. Set this to 32 for more depth resolution in shadow "
"maps."));
ConfigVariableColor background_color
("background-color", "0.41 0.41 0.41 0.0",
PRC_DESC("Specifies the rgb(a) value of the default background color for a "

View File

@ -102,6 +102,7 @@ extern EXPCL_PANDA_DISPLAY ConfigVariableInt stencil_bits;
extern EXPCL_PANDA_DISPLAY ConfigVariableInt accum_bits;
extern EXPCL_PANDA_DISPLAY ConfigVariableInt multisamples;
extern EXPCL_PANDA_DISPLAY ConfigVariableInt back_buffers;
extern EXPCL_PANDA_DISPLAY ConfigVariableInt shadow_depth_bits;
extern EXPCL_PANDA_DISPLAY ConfigVariableDouble pixel_zoom;

View File

@ -3176,13 +3176,17 @@ make_shadow_buffer(const NodePath &light_np, GraphicsOutputBase *host) {
nassertr(light->_sbuffers.count(this) == 0, NULL);
display_cat.debug() << "Constructing shadow buffer for light '" << light->get_name()
<< "', size=" << light->_sb_xsize << "x" << light->_sb_ysize
<< ", sort=" << light->_sb_sort << "\n";
if (display_cat.is_debug()) {
display_cat.debug()
<< "Constructing shadow buffer for light '" << light->get_name()
<< "', size=" << light->_sb_xsize << "x" << light->_sb_ysize
<< ", sort=" << light->_sb_sort << "\n";
}
// Setup some flags and properties
// Determine the properties for creating the depth buffer.
FrameBufferProperties fbp;
fbp.set_depth_bits(1); // We only need depth
fbp.set_depth_bits(shadow_depth_bits);
WindowProperties props = WindowProperties::size(light->_sb_xsize, light->_sb_ysize);
int flags = GraphicsPipe::BF_refuse_window;
if (is_point) {