Beispiel #1
0
        public bool Update(double xp, double zp, float zoom, GLControl gl)               // Foreground UI thread, tells it if anything has changed..
        {
            Debug.Assert(Application.MessageLoop);

            StarGrid grd = null;

            bool displayed = false;

            while (computed.TryTake(out grd))                               // remove from the computed queue and mark done
            {
                grd.Display(gl);                                            // swap to using this one..
                Thread.MemoryBarrier();                                     // finish above before clearing working
                grd.Working = false;
                displayed   = true;
            }

            Thread.MemoryBarrier();                                         // finish above

            curx = xp;
            curz = zp;

            ewh.Set();                                                      // tick thread again to consider..

            return(displayed);                                              // return if we updated anything..
        }