From: ehofman Date: Tue, 2 Mar 2004 13:28:12 +0000 (+0000) Subject: Use a round-robin scheme rather than returning a random textured state. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d8acc3a8f272453233f66320acf8e5492e3da7fd;p=simgear.git Use a round-robin scheme rather than returning a random textured state. --- diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index 4efa7ad8..3ae2d37d 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -202,13 +202,17 @@ SGMaterial::load_texture ( int n ) ssgSimpleState * SGMaterial::get_state (int n) const { + static unsigned current = 0; + if (_status.size() == 0) { SG_LOG( SG_GENERAL, SG_WARN, "No state available."); return NULL; } - int r = int( sg_random() * _status.size() ); - return (n >= 0) ? _status[n].state : _status[r].state; + if ( ++current >= _status.size()) + current = 0; + + return (n >= 0) ? _status[n].state : _status[current].state; } diff --git a/simgear/scene/material/mat.hxx b/simgear/scene/material/mat.hxx index 084f736f..e34fe4d2 100644 --- a/simgear/scene/material/mat.hxx +++ b/simgear/scene/material/mat.hxx @@ -39,7 +39,6 @@ #include #include -#include #include "matmodel.hxx"