public RenderFrame(Game game) { shadowMapCount = RenderProcess.ShadowMapCount; dynamicShadows = game.Settings.DynamicShadows; this.game = game; DummyBlendedMaterial = new EmptyMaterial(null); for (int i = 0; i < renderItems.Length; i++) { renderItems[i] = new Dictionary <Material, List <RenderItem> >(); } if (dynamicShadows) { if (shadowMap == null) { int shadowMapSize = game.Settings.ShadowMapResolution; shadowMap = new RenderTarget2D[shadowMapCount]; shadowMapRenderTarget = new RenderTarget2D[shadowMapCount]; for (int shadowMapIndex = 0; shadowMapIndex < shadowMapCount; shadowMapIndex++) { shadowMapRenderTarget[shadowMapIndex] = new RenderTarget2D(game.RenderProcess.GraphicsDevice, shadowMapSize, shadowMapSize, false, SurfaceFormat.Rg32, DepthFormat.Depth16, 0, RenderTargetUsage.PreserveContents); shadowMap[shadowMapIndex] = new RenderTarget2D(game.RenderProcess.GraphicsDevice, shadowMapSize, shadowMapSize, false, SurfaceFormat.Rg32, DepthFormat.Depth16, 0, RenderTargetUsage.PreserveContents); } } shadowMapLightView = new Matrix[shadowMapCount]; shadowMapLightProjection = new Matrix[shadowMapCount]; shadowMapLightViewProjection = new Matrix[shadowMapCount]; shadowMapLightViewProjectionShadowProjection = new Matrix[shadowMapCount]; shadowMapCenter = new Vector3[shadowMapCount]; renderShadowSceneryItems = new List <RenderItem> [shadowMapCount]; renderShadowForestItems = new List <RenderItem> [shadowMapCount]; renderShadowTerrainItems = new List <RenderItem> [shadowMapCount]; for (var shadowMapIndex = 0; shadowMapIndex < shadowMapCount; shadowMapIndex++) { renderShadowSceneryItems[shadowMapIndex] = new List <RenderItem>(); renderShadowForestItems[shadowMapIndex] = new List <RenderItem>(); renderShadowTerrainItems[shadowMapIndex] = new List <RenderItem>(); } } identity = Matrix.Identity; projection = Matrix.CreateOrthographic(game.RenderProcess.DisplaySize.X, game.RenderProcess.DisplaySize.Y, 1, 100); MatrixExtension.Multiply(in identity, in projection, out cameraViewProjection); renderItemComparer = new RenderItem.Comparer(Vector3.Zero); }