/// <summary> /// Creates a new shadowmap resolver /// </summary> /// <param name="graphicsDevice">The Graphics Device used by the XNA game</param> /// <param name="quadRender"></param> /// <param name="baseSize">The size of the light regions </param> public ShadowmapResolver(GraphicsDevice graphicsDevice, QuadRenderComponent quadRender, ShadowmapSize maxShadowmapSize, ShadowmapSize maxDepthBufferSize) { this.graphicsDevice = graphicsDevice; this.quadRender = quadRender; reductionChainCount = (int)maxShadowmapSize; baseSize = 2 << reductionChainCount; depthBufferSize = 2 << (int)maxDepthBufferSize; }
public static void Init(Game game, GraphicsDevice g, ContentManager c) { ShadowmapSize size = ShadowmapSize.Size1024; if (GameConst.effectSetting == 0) { size = ShadowmapSize.Size256; } else if (GameConst.effectSetting == 0) { size = ShadowmapSize.Size512; } graphics = g; quadRender = new QuadRenderComponent(game); game.Components.Add(quadRender); shadowmapResolver = new ShadowmapResolver(g, quadRender, size, size); shadowmapResolver.LoadContent(c); light = new LightArea(g, ShadowmapSize.Size1024); screenShadows = new RenderTarget2D(g, g.Viewport.Width, g.Viewport.Height); }