/// <summary> /// Renders the scene. /// </summary> /// <param name="context">The context.</param> /// <param name="renderables">The renderables.</param> /// <param name="parameter">The parameter.</param> public override void RenderScene(IRenderContext context, List <RenderCore> renderables, ref RenderParameter parameter) { if (scheduler.ScheduleAndRun(renderables, deferredContextPool, context, parameter, RenderType.Opaque, commandList)) { RenderParameter param = parameter; renderOthersTask = Task.Run(() => { RenderOthers(renderables, RenderType.Particle, context, deferredContextPool, ref param, postCommandList, 0); RenderOthers(renderables, RenderType.Transparent, context, deferredContextPool, ref param, postCommandList, 1); }); foreach (var command in commandList.OrderBy(x => x.Key)) { ImmediateContext.DeviceContext.ExecuteCommandList(command.Value, true); command.Value.Dispose(); } commandList.Clear(); renderOthersTask.Wait(); renderOthersTask = null; for (int i = 0; i < postCommandList.Length; ++i) { if (postCommandList[i] != null) { ImmediateContext.DeviceContext.ExecuteCommandList(postCommandList[i], true); RemoveAndDispose(ref postCommandList[i]); } } } else { base.RenderScene(context, renderables, ref parameter); } }
/// <summary> /// Renders the scene. /// </summary> /// <param name="context">The context.</param> /// <param name="renderables">The renderables.</param> /// <param name="parameter">The parameter.</param> /// <returns>Number of node has been rendered</returns> public override int RenderOpaque(RenderContext context, List <SceneNode> renderables, ref RenderParameter parameter) { if (scheduler.ScheduleAndRun(renderables, deferredContextPool, context, parameter, commandList, out int counter)) { RenderParameter param = parameter; foreach (var command in commandList.OrderBy(x => x.Key)) { ImmediateContext.ExecuteCommandList(command.Value, true); command.Value.Dispose(); } commandList.Clear(); return(counter); } else { return(base.RenderOpaque(context, renderables, ref parameter)); } }