From 68caf780b09ab89aa479de92a3a1d8c45d35af66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Garc=C3=ADa=20Li=C3=B1=C3=A1n?= Date: Fri, 18 Dec 2020 23:28:43 +0100 Subject: [PATCH] Clustered Shading: Don't use static variables, use class member variables instead --- simgear/scene/viewer/ClusteredShading.cxx | 5 ++--- simgear/scene/viewer/ClusteredShading.hxx | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/simgear/scene/viewer/ClusteredShading.cxx b/simgear/scene/viewer/ClusteredShading.cxx index cb325544..25d15247 100644 --- a/simgear/scene/viewer/ClusteredShading.cxx +++ b/simgear/scene/viewer/ClusteredShading.cxx @@ -194,10 +194,9 @@ ClusteredShading::update(const SGLightList &light_list) _slice_bias->set(-_depth_slices * log2(_zNear) / log2(_zFar / _zNear)); const osg::Viewport *vp = _camera->getViewport(); - static int old_width = 0, old_height = 0; int width = vp->width(); int height = vp->height(); - if (width != old_width || height != old_height) { - old_width = width; old_height = height; + if (width != _old_width || height != _old_height) { + _old_width = width; _old_height = height; _n_htiles = (width + _tile_size - 1) / _tile_size; _n_vtiles = (height + _tile_size - 1) / _tile_size; diff --git a/simgear/scene/viewer/ClusteredShading.hxx b/simgear/scene/viewer/ClusteredShading.hxx index 1fa6366a..1bf3b9f8 100644 --- a/simgear/scene/viewer/ClusteredShading.hxx +++ b/simgear/scene/viewer/ClusteredShading.hxx @@ -79,6 +79,9 @@ protected: float _zNear = 0.0f; float _zFar = 0.0f; + int _old_width = 0; + int _old_height = 0; + int _n_htiles = 0; int _n_vtiles = 0;