Clustered Shading: Don't use static variables, use class member variables instead

This commit is contained in:
Fernando García Liñán 2020-12-18 23:28:43 +01:00
parent d1aa5a0b82
commit 68caf780b0
2 changed files with 5 additions and 3 deletions

View File

@ -194,10 +194,9 @@ ClusteredShading::update(const SGLightList &light_list)
_slice_bias->set(-_depth_slices * log2(_zNear) / log2(_zFar / _zNear)); _slice_bias->set(-_depth_slices * log2(_zNear) / log2(_zFar / _zNear));
const osg::Viewport *vp = _camera->getViewport(); const osg::Viewport *vp = _camera->getViewport();
static int old_width = 0, old_height = 0;
int width = vp->width(); int height = vp->height(); int width = vp->width(); int height = vp->height();
if (width != old_width || height != old_height) { if (width != _old_width || height != _old_height) {
old_width = width; old_height = height; _old_width = width; _old_height = height;
_n_htiles = (width + _tile_size - 1) / _tile_size; _n_htiles = (width + _tile_size - 1) / _tile_size;
_n_vtiles = (height + _tile_size - 1) / _tile_size; _n_vtiles = (height + _tile_size - 1) / _tile_size;

View File

@ -79,6 +79,9 @@ protected:
float _zNear = 0.0f; float _zNear = 0.0f;
float _zFar = 0.0f; float _zFar = 0.0f;
int _old_width = 0;
int _old_height = 0;
int _n_htiles = 0; int _n_htiles = 0;
int _n_vtiles = 0; int _n_vtiles = 0;