} // PostScreenGlowShader /* /// <summary> /// Sky cube map texture /// </summary> /// <returns>Texture cube</returns> public TextureCube SkyCubeMapTexture { get { return skyCube.SkyCubeMapTexture; } // get } // SkyCubeMapTexture */ #endregion #region Constructor /// <summary> /// Create user interface renderer /// </summary> public UIRenderer() { //splashLogos[0] = new Texture("logoonly_xna"); //splashLogos[1] = new Texture("logoonly_exdream"); //splashLogos[2] = new Texture("logoonly_microsoft"); background = new Texture("background.png"); buttons = new Texture("buttons.png"); //logos = new Texture("logos.png"); //helpScreen = new Texture("HelpScreen.png"); optionsScreen = new Texture("OptionsScreen.png"); //creditsScreen = new Texture("CreditsScreen.png"); mouseCursor = new Texture("MouseCursor.png"); //ingame = new Texture("Ingame.png"); //trophy = new Texture("pokal1"); font = new TextureFont(); postScreenMenuShader = new PostScreenMenu(); postScreenGameShader = new PostScreenGlow(); //skyCube = new PreScreenSkyCubeMapping(); //lensFlare = new LensFlare(LensFlare.DefaultSunPos); //BaseGame.LightDirection = LensFlare.DefaultLightPos; } // UIRenderer()
/// <summary> /// Initialize /// </summary> protected override void Initialize() { #if !XBOX360 // Add screenshot capturer. Works only on windows platform. // Note: Don't do this in constructor, // we need the correct window name for screenshots! this.Components.Add(new ScreenshotCapturer(this)); #endif // Remember device device = graphics.GraphicsDevice; // Remember resolution width = graphics.GraphicsDevice.Viewport.Width; height = graphics.GraphicsDevice.Viewport.Height; backBufferDepthFormat = graphics.PreferredDepthStencilFormat; remMultiSampleType = device.PresentationParameters.MultiSampleType; //if (remMultiSampleType == MultiSampleType.NonMaskable) // remMultiSampleType = MultiSampleType.None; remMultiSampleQuality = device.PresentationParameters.MultiSampleQuality; remDepthBuffer = device.DepthStencilBuffer; // Update resolution if it changes and restore device after it was lost Window.ClientSizeChanged += new EventHandler(Window_ClientSizeChanged); graphics.DeviceReset += new EventHandler(graphics_DeviceReset); graphics_DeviceReset(null, EventArgs.Empty); // Create matrices for our shaders, this makes it much easier to manage // all the required matrices and we have to do this ourselfs since there // is no fixed function support and theirfore no Device.Transform class. WorldMatrix = Matrix.Identity; aspectRatio = (float)width / (float)height; ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView( FieldOfView, aspectRatio, NearPlane, FarPlane); // ViewMatrix is updated in camera class ViewMatrix = Matrix.CreateLookAt( new Vector3(0, 0, 15), Vector3.Zero, Vector3.Up); // Init global manager classes, which will be used all over the place ^^ lineManager2D = new LineManager2D(); //lineManager3D = new LineManager3D(); ui = new UIRenderer(); // Create font and numbers font font = new TextureFont(); // Make sure we can use PS1 or PS2, see UsePS and UsePS20 if (device.GraphicsDeviceCapabilities.PixelShaderVersion.Major >= 2 && GameSettings.Default.PerformanceSettings < 2) GameSettings.Default.PerformanceSettings = 2; else if ( device.GraphicsDeviceCapabilities.PixelShaderVersion.Major >= 1 && GameSettings.Default.PerformanceSettings < 1) GameSettings.Default.PerformanceSettings = 1; // Init post screen glow glowShader = //new PostScreenMenu(); new PostScreenGlow(); // Init effect manager effectManager = new EffectManager(); // Init light position LightDirection = new Vector3(2, -7, 5); base.Initialize(); device.RenderState.DepthBufferEnable = true; // Always create depth buffer from now on RenderToTexture.alwaysCreateRenderTargetDepthBuffer = true; } // Initialize()