Example #1
0
        void radiosityProgressTimer_Tick(object sender, EventArgs e)
        {
            int complete = RadiosityRenderer.Progress;
            int total    = RadiosityRenderer.ProgressTotal;

            radiosityProgressBuffer.Add(complete);

            float estimate = radiosityEstimateTimeRemaining();

            #region Use estimate to notify user
            if ((estimate != 0f) && (radiosityElapsedSeconds > 5f))
            {
                radiositySecondsRemaining.Add(estimate);
                if (radiositySecondsRemaining.itemsAdded >= radiositySecondsRemaining.Size)
                {
                    // use buffered data
                    float totalSeconds = 0f;
                    for (int x = 0; x < radiositySecondsRemaining.Size; x++)
                    {
                        totalSeconds += radiositySecondsRemaining[x];
                    }
                    estimate = totalSeconds / radiositySecondsRemaining.Size;
                }

                this.liRadiosityStatus.Text = string.Format("{4} ({0} out of {1} photons complete) ETA: {2:f2} Elapsed: {3:f1}", complete, total, Strings.ComputeReadableTime(estimate), Strings.ComputeReadableTime(radiosityElapsedSeconds), RadiosityRenderer.StoreCount);
            }
            else
            {
                this.liRadiosityStatus.Text = string.Format("{4} ({0} out of {1} photons complete) ETA: waiting... Elapsed: {3:f1}", complete, total, 0f, Strings.ComputeReadableTime(radiosityElapsedSeconds), RadiosityRenderer.CurrentOperation);
            }
            pbarxRadiosity.Text = RadiosityRenderer.CurrentOperation;
            barStatusBar.Refresh();
            #endregion

            pbarxRadiosity.Maximum = total;
            pbarxRadiosity.Value   = complete;

            //if (complete == total)
            //        RadiosityOnComplete();
            if (complete != total)
            {
                float elapsed = (float)radiosityProgressTimer.Interval / 1000f;
                radiosityElapsedSeconds += elapsed;
                if (!RadiosityRenderer.UpdateRequested)
                {
                    radiosityElapsedSinceUpdate += elapsed;
                    if (radiosityElapsedSinceUpdate >= 10f)
                    {
                        RadiosityRenderer.RequestUpdate();
                        radiosityElapsedSinceUpdate = 0f;
                    }
                }
            }
        }
Example #2
0
 /// <summary>
 /// Called when user presses the cancel button in the lightmap option dialog.
 /// </summary>
 private void OnRadiosityCancel()
 {
     RadiosityRenderer.RequestStop();
 }