Ignore:
Timestamp:
11/27/15 02:46:03 (9 years ago)
Author:
Maciej Komosinski
Message:

Avoid unnecessary computation (time scale is determined by simulation speed only)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • experiments/frams/foraminifera/data/scripts/foraminifera.show

    r446 r448  
    1414
    1515global Params; //to easily transfer changes in identical properties from this show to expdef
    16 global lasttimescale; //to display time scale when it changes significantly
     16global last_simspeed; //to display time scale when it changes significantly
    1717
    1818function onLoad()
    1919{
    2020        Simulator.init();
    21         lasttimescale=0;
     21        last_simspeed=0;
    2222        GLDisplay.desiredsimspeed = 50;
    2323        GLDisplay.minfps = 10;
     
    3838}
    3939
    40 function updateBanner(timescale)
     40function updateBanner()
    4141{
    4242        GLDisplay.banner="World size is %g mm." % (framsToMicrons(World.wrldsiz)/1000);
    43         GLDisplay.banner+="\nShowing real-time x %g." % timescale;
     43        GLDisplay.banner+="\nShowing real-time x %g." % timeScale();
    4444}
    4545
    4646function onShowStep()
    4747{
    48         var timescale=timeScale();
    49         if (timescale<lasttimescale*0.9 || timescale>lasttimescale*1.1) //significant change
     48        if (Simulator.simspeed<last_simspeed*0.9 || Simulator.simspeed>last_simspeed*1.1) //significant change
    5049        {
    51                 updateBanner(timescale);
    52                 lasttimescale=timescale;
     50                updateBanner();
     51                last_simspeed=Simulator.simspeed;
    5352        }
    5453}
Note: See TracChangeset for help on using the changeset viewer.