public override void LoadContent () { LightmapMaterials = new DefaultMaterialSet(Game.Services); LightingEnvironment.DefaultSubdivision = 512f; BackgroundEnvironment = new LightingEnvironment(); ForegroundEnvironment = new LightingEnvironment(); BackgroundRenderer = new LightingRenderer(Game.Content, Game.RenderCoordinator, LightmapMaterials, BackgroundEnvironment); ForegroundRenderer = new LightingRenderer(Game.Content, Game.RenderCoordinator, LightmapMaterials, ForegroundEnvironment); // Add a global sun AddAmbientLight(746, -300); // Add clipped suns for areas with weird shadowing behavior AddAmbientLight(746, 200, new Bounds( new Vector2(38, 33), new Vector2(678, 678) )); AddAmbientLight(740, 240, new Bounds( new Vector2(805, 34), new Vector2(1257, 546) )); AddAmbientLight(741, 750, new Bounds( new Vector2(0, 674), new Vector2(1257, 941) )); AddAmbientLight(741, 1025, new Bounds( new Vector2(0, 941), new Vector2(1257, 1250) )); GenerateObstructionsFromTiles(); Layers[0] = Game.Content.Load<Texture2D>("layers_bg"); Layers[1] = Game.Content.Load<Texture2D>("layers_fg"); Layers[2] = Game.Content.Load<Texture2D>("layers_chars"); Layers[3] = Game.Content.Load<Texture2D>("layers_torches"); MaskedForegroundMaterial = LightmapMaterials.ScreenSpaceLightmappedBitmap.SetStates(blendState: BlendState.Additive); ParticleRenderer = new ParticleRenderer(LightmapMaterials) { Viewport = new Bounds(Vector2.Zero, new Vector2(Width, Height)) }; Spark.Texture = Game.Content.Load<Texture2D>("spark"); ParticleRenderer.Systems = new[] { Sparks = new ParticleSystem<Spark>( new DotNetTimeProvider(), BackgroundEnvironment ) }; SparkLights = new ParticleLightManager<Spark>( Sparks, new[] { BackgroundEnvironment, ForegroundEnvironment }, UpdateSectorLight ); }
public override void LoadContent() { LightmapMaterials = new DefaultMaterialSet(Game.Services); LightingEnvironment.DefaultSubdivision = 512f; BackgroundEnvironment = new LightingEnvironment(); ForegroundEnvironment = new LightingEnvironment(); BackgroundRenderer = new LightingRenderer(Game.Content, Game.RenderCoordinator, LightmapMaterials, BackgroundEnvironment); ForegroundRenderer = new LightingRenderer(Game.Content, Game.RenderCoordinator, LightmapMaterials, ForegroundEnvironment); // Add a global sun AddAmbientLight(746, -300); // Add clipped suns for areas with weird shadowing behavior AddAmbientLight(746, 200, new Bounds( new Vector2(38, 33), new Vector2(678, 678) )); AddAmbientLight(740, 240, new Bounds( new Vector2(805, 34), new Vector2(1257, 546) )); AddAmbientLight(741, 750, new Bounds( new Vector2(0, 674), new Vector2(1257, 941) )); AddAmbientLight(741, 1025, new Bounds( new Vector2(0, 941), new Vector2(1257, 1250) )); GenerateObstructionsFromTiles(); Layers[0] = Game.Content.Load <Texture2D>("layers_bg"); Layers[1] = Game.Content.Load <Texture2D>("layers_fg"); Layers[2] = Game.Content.Load <Texture2D>("layers_chars"); Layers[3] = Game.Content.Load <Texture2D>("layers_torches"); MaskedForegroundMaterial = LightmapMaterials.ScreenSpaceLightmappedBitmap.SetStates(blendState: BlendState.Additive); ParticleRenderer = new ParticleRenderer(LightmapMaterials) { Viewport = new Bounds(Vector2.Zero, new Vector2(Width, Height)) }; Spark.Texture = Game.Content.Load <Texture2D>("spark"); ParticleRenderer.Systems = new[] { Sparks = new ParticleSystem <Spark>( new DotNetTimeProvider(), BackgroundEnvironment ) }; SparkLights = new ParticleLightManager <Spark>( Sparks, new[] { BackgroundEnvironment, ForegroundEnvironment }, UpdateSectorLight ); }