internal void AddDepthPass(MyShadowmapQuery shadowmapQuery) { var worldToProjection = shadowmapQuery.ProjectionInfo.WorldToProjection; int frustumMask = AddFrustum(ref worldToProjection); MyDepthPass pass = MyObjectPoolManager.Allocate <MyDepthPass>(); pass.DebugName = MyVisibilityCuller.ToString(shadowmapQuery.QueryType); pass.ProcessingMask = frustumMask; pass.ViewProjection = shadowmapQuery.ProjectionInfo.CurrentLocalToProjection; pass.Viewport = shadowmapQuery.Viewport; pass.FrustumIndex = shadowmapQuery.Index; pass.Dsv = shadowmapQuery.DepthBuffer; bool isCascade = shadowmapQuery.QueryType == MyFrustumEnum.ShadowCascade; pass.IsCascade = isCascade; pass.DefaultRasterizer = isCascade ? MyRasterizerStateManager.CascadesRasterizerStateOld : MyRasterizerStateManager.ShadowRasterizerState; pass.PerFrame(); RenderingPasses[Size - 1] = pass; }
int GetPassId(VRageRender.MyDepthPass oldDepthPass) { if (oldDepthPass.IsCascade) { return(MyPassIdResolver.GetCascadeDepthPassId(oldDepthPass.FrustumIndex)); } else { return(MyPassIdResolver.GetSingleDepthPassId(oldDepthPass.FrustumIndex)); } }
internal void AddDepthPass(ref MatrixD worldToProjection, Matrix viewProjectionLocal, MyViewport viewport, DepthStencilView depthTarget, bool isCascade, string debugName) { int frustumMask = AddFrustum(ref worldToProjection); MyDepthPass pass = MyObjectPoolManager.Allocate <MyDepthPass>(); pass.DebugName = debugName; pass.ProcessingMask = frustumMask; pass.ViewProjection = viewProjectionLocal; pass.Viewport = viewport; pass.DSV = depthTarget; pass.DefaultRasterizer = isCascade ? MyRender11.m_cascadesRasterizerState : MyRender11.m_shadowRasterizerState; pass.PerFrame(); RenderingPasses[Size - 1] = pass; }
internal static void AddShadowCaster(BoundingFrustumD frustum, Matrix viewProjectionLocal, MyViewport viewport, DepthStencilView depthTarget, bool isCascade, string debugName) { var frustumMask = m_cullQuery.AddFrustum(frustum); MyDepthPass pass = new MyDepthPass(); pass.DebugName = debugName; pass.Cleanup(); pass.ProcessingMask = frustumMask; pass.ViewProjection = viewProjectionLocal; pass.Viewport = viewport; pass.DSV = depthTarget; pass.DefaultRasterizer = isCascade ? MyRender11.m_cascadesRasterizerState : MyRender11.m_shadowRasterizerState; pass.PerFrame(); m_wavefront.Add(pass); }
void InitRenderPasses(MyCullQuery cullQuery, List <MyRenderPass> renderPasses) { renderPasses.Clear(); foreach (var query in cullQuery.RenderingPasses) { if (query == null) { continue; } Matrix matrix = query.ViewProjection; MyViewport viewport = query.Viewport; if (query is VRageRender.MyGBufferPass) { VRageRender.MyGBufferPass oldGBufferPass = (VRageRender.MyGBufferPass)query; MyGBuffer gbuffer = oldGBufferPass.GBuffer; MyGBufferPass gbufferPass; int passId = GetPassId(oldGBufferPass); m_gbufferPassesPool.AllocateOrCreate(out gbufferPass); gbufferPass.Init(passId, matrix, viewport, gbuffer); renderPasses.Add(gbufferPass); } if (query is VRageRender.MyDepthPass) { VRageRender.MyDepthPass oldDepthPass = (VRageRender.MyDepthPass)query; IDsvBindable dsv = oldDepthPass.Dsv; MyDepthPass depthPass; bool isCascade = oldDepthPass.IsCascade; int passId = GetPassId(oldDepthPass); m_depthPassesPool.AllocateOrCreate(out depthPass); depthPass.Init(passId, matrix, viewport, dsv, isCascade, oldDepthPass.DebugName); renderPasses.Add(depthPass); } } }
public static void Cleanup(MyDepthPass renderPass) { renderPass.Cleanup(); }