Use a round-robin scheme rather than returning a random textured state.

This commit is contained in:
ehofman
2004-03-02 13:28:12 +00:00
parent 5f21c75e02
commit d8acc3a8f2
2 changed files with 6 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -39,7 +39,6 @@
#include <plib/ssg.h>
#include <simgear/props/props.hxx>
#include <simgear/math/sg_random.h>
#include "matmodel.hxx"