private void RenderLoopController() { while (true) { RenderTask task = new RenderTask(); bool hasTask = false; lock (renderQueue) { if (this.renderQueue.Count > 0) { task = renderQueue[0]; renderQueue.RemoveAt(0); hasTask = true; } } if (hasTask) { Render(task.TaskID, task.NodesToUpdateRendering, false); } else { //TODO(Luke): Fix this with a proper messaging loop rather than //a polling model Thread.Sleep(10); } } }
/// <summary> /// Schedule the render task specified for execution /// </summary> /// <param name="renderTask"></param> public void RequestRenderAsync(RenderTask renderTask) { //Simplist strategy for now, always render everything lock (renderQueue) { renderQueue.Add(renderTask); } }