]> git.mxchange.org Git - simgear.git/commitdiff
Use a round-robin scheme rather than returning a random textured state.
authorehofman <ehofman>
Tue, 2 Mar 2004 13:28:12 +0000 (13:28 +0000)
committerehofman <ehofman>
Tue, 2 Mar 2004 13:28:12 +0000 (13:28 +0000)
simgear/scene/material/mat.cxx
simgear/scene/material/mat.hxx

index 4efa7ad86414e3a8149fb8683ef2087a85b070d7..3ae2d37dae455b0478c96733081617940946d1fd 100644 (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;
 }
 
 
index 084f736ff54cb5db2dc29868a5580ac87ddcdc7f..e34fe4d2ead4bc5a41b07f96b3577f1c10651869 100644 (file)
@@ -39,7 +39,6 @@
 #include <plib/ssg.h>
 
 #include <simgear/props/props.hxx>
-#include <simgear/math/sg_random.h>
 
 #include "matmodel.hxx"