public void Render(DX11RenderContext context) { Device device = context.Device; if (!this.updateddevices.Contains(context)) { this.Update(null, context); } if (this.rendereddevices.Contains(context)) { return; } if (this.FInEnabled[0]) { renderer.EnableDepth = false; renderer.DepthStencil = null; renderer.DepthMode = eDepthBufferMode.None; renderer.SetRenderTargets(this.swapchain); renderer.SetTargets(); if (this.FInClear[0]) { //Remove Shader view if bound as is context.CurrentDeviceContext.ClearRenderTargetView(this.swapchain.RTV, this.FInBgColor[0].Color); } //Only call render if layer connected if (this.FInLayer.PluginIO.IsConnected) { float cw = (float)this.form.ClientSize.Width; float ch = (float)this.form.ClientSize.Height; settings.ViewportCount = 1; settings.ViewportIndex = 0; settings.View = Matrix.Identity; settings.Projection = Matrix.Identity; settings.ViewProjection = Matrix.Identity; settings.BackBuffer = this.swapchain; settings.RenderWidth = 1920; settings.RenderHeight = 1200; settings.ResourceSemantics.Clear(); settings.CustomSemantics.Clear(); //Call render on all layers for (int j = 0; j < this.FInLayer.SliceCount; j++) { this.FInLayer[j][context].Render(this.FInLayer.PluginIO, context, settings); } } renderer.CleanTargets(); } this.rendereddevices.Add(context); }
public void Render(DX11RenderContext context) { Device device = context.Device; if (!this.updateddevices.Contains(context)) { this.Update(context); } if (this.rendereddevices.Contains(context)) { return; } if (this.FInEnabled[0]) { renderer.DepthStencil = this.depthmanager.GetDepthStencil(context); renderer.EnableDepth = renderer.DepthStencil != null; renderer.DepthMode = this.depthmanager.Mode; renderer.SetRenderTargets(this.swapchain); renderer.SetTargets(); if (this.FInClear[0]) { //Remove Shader view if bound as is context.CurrentDeviceContext.ClearRenderTargetView(this.swapchain.RTV, this.FInBgColor[0].Color); this.depthmanager.Clear(context); } //Only call render if layer connected if (this.FInLayer.IsConnected) { float cw = (float)this.form.ClientSize.Width; float ch = (float)this.form.ClientSize.Height; settings.ViewportCount = 1; settings.ViewportIndex = 0; settings.View = Matrix.Identity; settings.Projection = Matrix.Identity; settings.ViewProjection = Matrix.Identity; settings.BackBuffer = this.swapchain; settings.RenderWidth = this.swapchain.Width; settings.RenderHeight = this.swapchain.Height; settings.ResourceSemantics.Clear(); settings.CustomSemantics.Clear(); this.FInLayer.RenderAll(context, settings); } renderer.CleanTargets(); } this.rendereddevices.Add(context); }
public void Render(DX11RenderContext context) { Device device = context.Device; if (this.FInEnabled[0]) { renderer.EnableDepth = false; renderer.DepthStencil = null; renderer.DepthMode = eDepthBufferMode.None; renderer.SetRenderTargets(this.swapchain); renderer.SetTargets(); if (this.FInClear[0]) { //Remove Shader view if bound as is context.CurrentDeviceContext.ClearRenderTargetView(this.swapchain.RTV, this.FInBgColor[0].Color); } //Only call render if layer connected if (this.FInLayer.IsConnected) { settings.ViewportCount = 1; settings.ViewportIndex = 0; settings.View = Matrix.Identity; settings.Projection = Matrix.Identity; settings.ViewProjection = Matrix.Identity; settings.BackBuffer = this.swapchain; settings.RenderWidth = (int)cw; settings.RenderHeight = (int)ch; settings.ResourceSemantics.Clear(); settings.CustomSemantics.Clear(); this.FInLayer.RenderAll(context, settings); } renderer.CleanTargets(); } }
public void Render(DX11RenderContext context) { Device device = context.Device; if (!this.updateddevices.Contains(context)) { this.Update(context); } if (this.rendereddevices.Contains(context)) { return; } Exception exception = null; if (this.FInEnabled[0]) { if (this.BeginQuery != null) { this.BeginQuery(context); } DX11SwapChain chain = this.FOutBackBuffer[0][context]; DX11GraphicsRenderer renderer = this.renderers[context]; renderer.EnableDepth = this.FInDepthBuffer[0]; renderer.DepthStencil = this.depthmanager.GetDepthStencil(context); renderer.DepthMode = this.depthmanager.Mode; renderer.SetRenderTargets(chain); renderer.SetTargets(); try { if (this.FInClear[0]) { //Remove Shader view if bound as is context.CurrentDeviceContext.ClearRenderTargetView(chain.RTV, this.FInBgColor[0]); } if (this.FInClearDepth[0]) { if (this.FInDepthBuffer[0]) { this.depthmanager.Clear(context, this.FInClearDepthValue[0]); } } //Only call render if layer connected if (this.FInLayer.IsConnected) { int rtmax = Math.Max(this.FInProjection.SliceCount, this.FInView.SliceCount); rtmax = Math.Max(rtmax, this.FInViewPort.SliceCount); settings.ViewportCount = rtmax; bool viewportpop = this.FInViewPort.IsConnected; for (int i = 0; i < rtmax; i++) { this.RenderSlice(context, settings, i, viewportpop); } } if (this.EndQuery != null) { this.EndQuery(context); } } catch (Exception ex) { exception = ex; } finally { renderer.CleanTargets(); } } this.rendereddevices.Add(context); //Rethrow if (exception != null) { throw exception; } }
public void Render(DX11RenderContext context) { if (this.currentSpreadMax == 0) { return; } Device device = context.Device; //Just in case if (!this.updateddevices.Contains(context)) { this.Update(context); } if (this.rendereddevices.Contains(context)) { return; } if (this.FInEnabled[0]) { DX11GraphicsRenderer renderer = this.renderers[context]; if (this.BeginQuery != null) { this.BeginQuery(context); } this.BeforeRender(renderer, context); Exception exception = null; try { renderer.SetTargets(); if (this.FInClearDepth[0] && this.FInDepthBuffer[0]) { this.depthmanager.Clear(context, this.FInClearDepthValue[0]); } this.DoClear(context); if (this.FInLayer.IsConnected) { int rtmax = Math.Max(this.FInProjection.SliceCount, this.FInView.SliceCount); rtmax = Math.Max(rtmax, this.FInViewPort.SliceCount); settings.ViewportCount = rtmax; bool viewportpop = this.FInViewPort.IsConnected; float cw = (float)this.width; float ch = (float)this.height; for (int i = 0; i < rtmax; i++) { settings.ViewportIndex = i; settings.ApplyTransforms(this.FInView[i], this.FInProjection[i], this.FInAspect[i], this.FInCrop[i]); settings.RenderWidth = this.width; settings.RenderHeight = this.height; settings.BackBuffer = this.GetMainTarget(context); settings.CustomSemantics.Clear(); settings.ResourceSemantics.Clear(); if (viewportpop) { context.RenderTargetStack.PushViewport(this.FInViewPort[i].Normalize(cw, ch)); } try { this.FInLayer.RenderAll(context, settings); } catch (Exception ex) { Console.WriteLine(ex.Message); } if (viewportpop) { context.RenderTargetStack.Pop(); } } } //Post render this.AfterRender(renderer, context); } catch (Exception ex) { exception = ex; } finally { if (this.EndQuery != null) { this.EndQuery(context); } renderer.CleanTargets(); } this.rendereddevices.Add(context); if (exception != null) { throw exception; } } }
public void Render(DX11RenderContext context) { Device device = context.Device; if (!this.updateddevices.Contains(context)) { this.Update(null, context); } if (this.rendereddevices.Contains(context)) { return; } if (this.FInEnabled[0]) { if (this.BeginQuery != null) { this.BeginQuery(context); } DX11SwapChain chain = this.FOutBackBuffer[0][context]; DX11GraphicsRenderer renderer = this.renderers[context]; renderer.EnableDepth = this.FInDepthBuffer[0]; renderer.DepthStencil = this.depthmanager.GetDepthStencil(context); renderer.DepthMode = this.depthmanager.Mode; renderer.SetRenderTargets(chain); renderer.SetTargets(); if (this.FInClear[0]) { //Remove Shader view if bound as is context.CurrentDeviceContext.ClearRenderTargetView(chain.RTV, this.FInBgColor[0].Color); } if (this.FInClearDepth[0]) { if (this.FInDepthBuffer[0]) { this.depthmanager.Clear(context); } } //Only call render if layer connected if (this.FInLayer.PluginIO.IsConnected) { int rtmax = Math.Max(this.FInProjection.SliceCount, this.FInView.SliceCount); rtmax = Math.Max(rtmax, this.FInViewPort.SliceCount); settings.ViewportCount = rtmax; bool viewportpop = this.FInViewPort.PluginIO.IsConnected; float cw = (float)this.ClientSize.Width; float ch = (float)this.ClientSize.Height; for (int i = 0; i < rtmax; i++) { settings.ViewportIndex = i; settings.View = this.FInView[i]; Matrix proj = this.FInProjection[i]; Matrix aspect = Matrix.Invert(this.FInAspect[i]); Matrix crop = Matrix.Invert(this.FInCrop[i]); settings.Projection = proj * aspect * crop; settings.ViewProjection = settings.View * settings.Projection; settings.BackBuffer = this.FOutBackBuffer[0][context]; settings.RenderWidth = this.FOutBackBuffer[0][context].Resource.Description.Width; settings.RenderHeight = this.FOutBackBuffer[0][context].Resource.Description.Height; settings.ResourceSemantics.Clear(); settings.CustomSemantics.Clear(); if (viewportpop) { context.RenderTargetStack.PushViewport(this.FInViewPort[i].Normalize(cw, ch)); } //Call render on all layers for (int j = 0; j < this.FInLayer.SliceCount; j++) { this.FInLayer[j][context].Render(this.FInLayer.PluginIO, context, settings); } if (viewportpop) { context.RenderTargetStack.PopViewport(); } } } if (this.EndQuery != null) { this.EndQuery(context); } renderer.CleanTargets(); //OnDevice.RenderTargetStack.Pop(); } this.rendereddevices.Add(context); }
public void Render(DX11RenderContext context) { Device device = context.Device; //Just in case if (!this.updateddevices.Contains(context)) { this.Update(null, context); } if (this.rendereddevices.Contains(context)) { return; } if (this.FInEnabled[0]) { if (this.BeginQuery != null) { this.BeginQuery(context); } DX11GraphicsRenderer renderer = this.renderers[context]; this.BeforeRender(renderer, context); renderer.SetTargets(); if (this.FInClearDepth[0] && this.FInDepthBuffer[0]) { this.depthmanager.Clear(context); } if (this.FInClear[0]) { renderer.Clear(this.FInBgColor[0]); } if (this.FInLayer.PluginIO.IsConnected) { int rtmax = Math.Max(this.FInProjection.SliceCount, this.FInView.SliceCount); rtmax = Math.Max(rtmax, this.FInViewPort.SliceCount); DX11RenderSettings settings = new DX11RenderSettings(); settings.ViewportCount = rtmax; bool viewportpop = this.FInViewPort.PluginIO.IsConnected; float cw = (float)this.width; float ch = (float)this.height; for (int i = 0; i < rtmax; i++) { settings.ViewportIndex = i; settings.View = this.FInView[i]; Matrix proj = this.FInProjection[i]; Matrix aspect = Matrix.Invert(this.FInAspect[i]); Matrix crop = Matrix.Invert(this.FInCrop[i]); settings.Projection = proj * aspect * crop; settings.ViewProjection = settings.View * settings.Projection; settings.RenderWidth = this.width; settings.RenderHeight = this.height; settings.BackBuffer = this.GetMainTarget(context); settings.CustomSemantics.Clear(); settings.ResourceSemantics.Clear(); if (viewportpop) { context.RenderTargetStack.PushViewport(this.FInViewPort[i].Normalize(cw, ch)); } //Call render on all layers for (int j = 0; j < this.FInLayer.SliceCount; j++) { try { this.FInLayer[j][context].Render(this.FInLayer.PluginIO, context, settings); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (viewportpop) { context.RenderTargetStack.PopViewport(); } } } //Post render this.AfterRender(renderer, context); renderer.CleanTargets(); if (this.EndQuery != null) { this.EndQuery(context); } this.rendereddevices.Add(context); } }