From d8acc3a8f272453233f66320acf8e5492e3da7fd Mon Sep 17 00:00:00 2001 From: ehofman Date: Tue, 2 Mar 2004 13:28:12 +0000 Subject: [PATCH] Use a round-robin scheme rather than returning a random textured state. --- simgear/scene/material/mat.cxx | 8 ++++++-- simgear/scene/material/mat.hxx | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) 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" -- 2.39.5