public RenderFrame(Game game) { Game = game; DummyBlendedMaterial = new EmptyMaterial(null); for (int i = 0; i < RenderItems.Length; i++) { RenderItems[i] = new Dictionary <Material, RenderItemCollection>(); } if (Game.Settings.DynamicShadows) { if (ShadowMap == null) { var shadowMapSize = Game.Settings.ShadowMapResolution; ShadowMap = new RenderTarget2D[RenderProcess.ShadowMapCount]; ShadowMapRenderTarget = new RenderTarget2D[RenderProcess.ShadowMapCount]; for (var shadowMapIndex = 0; shadowMapIndex < RenderProcess.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[RenderProcess.ShadowMapCount]; ShadowMapLightProj = new Matrix[RenderProcess.ShadowMapCount]; ShadowMapLightViewProjShadowProj = new Matrix[RenderProcess.ShadowMapCount]; ShadowMapCenter = new Vector3[RenderProcess.ShadowMapCount]; RenderShadowSceneryItems = new RenderItemCollection[RenderProcess.ShadowMapCount]; RenderShadowForestItems = new RenderItemCollection[RenderProcess.ShadowMapCount]; RenderShadowTerrainItems = new RenderItemCollection[RenderProcess.ShadowMapCount]; for (var shadowMapIndex = 0; shadowMapIndex < RenderProcess.ShadowMapCount; shadowMapIndex++) { RenderShadowSceneryItems[shadowMapIndex] = new RenderItemCollection(); RenderShadowForestItems[shadowMapIndex] = new RenderItemCollection(); RenderShadowTerrainItems[shadowMapIndex] = new RenderItemCollection(); } } XNACameraView = Matrix.Identity; XNACameraProjection = Matrix.CreateOrthographic(game.RenderProcess.DisplaySize.X, game.RenderProcess.DisplaySize.Y, 1, 100); ScreenChanged(); }