From 808d50ccc2aad4730f1b3db9a4f1a2f4665caa45 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Sat, 12 Dec 2020 03:20:55 -0800 Subject: [PATCH] more sprite mesh rendering --- Renderer.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Renderer.cs b/Renderer.cs index 203c265..5c9935d 100644 --- a/Renderer.cs +++ b/Renderer.cs @@ -199,11 +199,12 @@ namespace Kav public void RenderMeshSpriteGBuffer( RenderTargetBinding[] gBuffer, PerspectiveCamera camera, - IEnumerable meshSpriteDrawDatas + IEnumerable meshSpriteDrawDatas, + DepthStencilState depthStencilState ) { GraphicsDevice.SetRenderTargets(gBuffer); GraphicsDevice.RasterizerState = RasterizerState.CullNone; - GraphicsDevice.DepthStencilState = DepthStencilState.Default; + GraphicsDevice.DepthStencilState = depthStencilState; GraphicsDevice.BlendState = BlendState.AlphaBlend; Deferred_GBufferEffect.HardwareInstancingEnabled = false; @@ -377,6 +378,21 @@ namespace Kav ); } + public void RenderDepthIndexed( + RenderTarget2D renderTarget, + PerspectiveCamera camera, + T drawable, + DepthStencilState depthStencilState + ) where T : IIndexDrawable { + GraphicsDevice.SetRenderTarget(renderTarget); + GraphicsDevice.DepthStencilState = depthStencilState; + + SimpleDepthEffect.View = camera.View; + SimpleDepthEffect.Projection = camera.Projection; + + RenderIndexed(GraphicsDevice, drawable, SimpleDepthEffect); + } + public void RenderSkybox( RenderTarget2D renderTarget, PerspectiveCamera camera,