protected override void Initialize() { base.Initialize(); // Größe und Position des Raums festlegen room.Size = new Vector3(1000.0f, 500.0f, 1000.0f); room.Position = new Vector3(0.0f, 250.0f, 0.0f); float sin = (float)Math.Sin(MathHelper.ToRadians(30.0f)); float cos = (float)Math.Cos(MathHelper.ToRadians(30.0f)); // Lichter hinzufügen lightService.Size = Vector3.One * 10.0f; lightService.Position = Vector3.Up * 100.0f; lightService.AddLight(new Vector3(0.0f, 0.0f, 1.0f) * 60.0f, Color.Red.ToVector3()); lightService.AddLight(new Vector3(+cos, 0.0f, -sin) * 60.0f, Color.Green.ToVector3()); lightService.AddLight(new Vector3(-cos, 0.0f, -sin) * 60.0f, Color.Blue.ToVector3()); // Kamera-Position festlegen camera.Position = new Vector3(0.0f, 80.0f, 200.0f); // Shadow Cube erstellen shadowCube = new RenderTargetCube(GraphicsDevice, 1024, false, SurfaceFormat.Single, DepthFormat.Depth24); int width = GraphicsDevice.PresentationParameters.BackBufferWidth; int height = GraphicsDevice.PresentationParameters.BackBufferHeight; // Blur Map erstellen blurMap = new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Single, DepthFormat.Depth24); spriteBatch = new SpriteBatch(GraphicsDevice); // Quad für Lightmap Blurring erstellen quadVertices = new VertexPositionTexture[4]; quadVertices[0] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1)); quadVertices[1] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0)); quadVertices[2] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0)); quadVertices[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1)); quadIndices = new int[] { 0, 1, 2, 2, 3, 0 }; }