public MeshRenderer( GraphicsDevice graphicsDevice, GameSettingsComponent settings, ContentManager contentManager, Model scene) { _graphicsDevice = graphicsDevice; _settings = settings; _scene = scene; _sceneTransforms = new Matrix[_scene.Bones.Count]; _scene.CopyAbsoluteBoneTransformsTo(_sceneTransforms); _cascadeSplits = new float[4]; _frustumCorners = new Vector3[8]; _shadowMapEffect = new ShadowMapEffect(graphicsDevice, contentManager.Load<Effect>("effects/ShadowMap")); _meshEffect = new MeshEffect(graphicsDevice, contentManager.Load<Effect>("effects/Mesh")); _boundingFrustum = new BoundingFrustum(Matrix.Identity); CreateShadowMaps(); }
protected override void Initialize() { _camera = new FirstPersonCamera(MathHelper.PiOver4 * 0.75f, Window.ClientBounds.Width / (float) Window.ClientBounds.Height, 0.25f, 250.0f); _camera.Position = new Vector3(20.0f, 5.0f, 65.0f); _camera.YRotation = MathHelper.PiOver4; _camera.XRotation = 0; Mouse.SetPosition(Window.ClientBounds.Width / 2, Window.ClientBounds.Height / 2); Components.Add(new FramesPerSecondComponent(this)); Components.Add(_gameSettings = new GameSettingsComponent(this)); var guiService = new GuiComponent(this); Components.Add(guiService); Services.AddService<IGuiService>(guiService); base.Initialize(); }