Exemplo n.º 1
0
        public BaseDeferredRenderGame() : base()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            Content.RootDirectory             = "Content";

            inputHandler = new InputHandlerService(this);

            assetManager = new AssetManager(this);

            renderer = new DeferredRender(this);

            rnd = new Random(DateTime.Now.Millisecond);

            //ggr = new GeographicGridRegistrationSystem(this, new Vector3(10, 5, 20), new BoundingBox(-Vector3.One * 2f, Vector3.One * 2f));

            ppManager = new PostProcessingManager(this);

            test         = new TesterEffect(this);
            test.Enabled = false;
            ppManager.AddEffect(test);

            SSAO         = new SSAOEffect(this, .1f, 1f, .5f, 1f);
            SSAO.Enabled = false;
            ppManager.AddEffect(SSAO);

            //stHPe = new STHardPointEffect(this, 25, 30, new Color(48, 89, 122));
            stHPe         = new STHardPointEffect(this, 25, 30, new Color(41, 77, 107), new Color(.125f, .125f, .125f, 1.0f));
            stHPe.Enabled = false;
            ppManager.AddEffect(stHPe);

            sun         = new SunEffect(this, SunPosition);
            sun.Enabled = false;
            ppManager.AddEffect(sun);

            water             = new WaterEffect(this);
            water.waterHeight = -25f;
            water.Enabled     = false;
            ppManager.AddEffect(water);

            dof         = new DepthOfFieldEffect(this, 5, 30);
            dof.Enabled = false;
            ppManager.AddEffect(dof);

            bloom         = new BloomEffect(this, 1.25f, 1f, 1f, 1f, .25f, 4f);
            bloom.Enabled = false;
            ppManager.AddEffect(bloom);

            haze         = new HeatHazeEffect(this, "Textures/bumpmap", false);
            haze.Enabled = false;
            ppManager.AddEffect(haze);

            radialBlur         = new RadialBlurEffect(this, 0.009f);
            radialBlur.Enabled = false;
            ppManager.AddEffect(radialBlur);

            ripple         = new RippleEffect(this);
            ripple.Enabled = false;
            ppManager.AddEffect(ripple);

            fog         = new FogEffect(this, 50, 100, Color.DarkSlateGray);
            fog.Enabled = false;
            ppManager.AddEffect(fog);

            godRays = new CrepuscularRays(this, SunPosition, "Textures/flare", 1500, 1f, .99f, 1f, .15f, .25f);
            //godRays = new CrepuscularRays(this, SunPosition, "Textures/flare", 1500, 1f, .99f, .1f, 0.12f, .25f);
            godRays.Enabled = false;
            ppManager.AddEffect(godRays);
        }
Exemplo n.º 2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.GraphicsProfile = GraphicsProfile.HiDef;

            graphics.PreferredBackBufferWidth  = 1920;
            graphics.PreferredBackBufferHeight = 1080;

            IsMouseVisible = true;

            kbm = new KeyboardStateManager(this);

            camera          = new Base3DCamera(this, .5f, 20000);
            camera.Position = new Vector3(0, 0, 0);
            Components.Add(camera);
            Services.AddService(typeof(Base3DCamera), camera);

            skyBox = new BaseSkyBox(this, "Textures/SkyBox/NebulaBlue");
            Components.Add(skyBox);

            bunny               = new Base3DObject(this, "Models/bunny", "Shaders/RenderObjectNotTangentsOrTexCoords");
            bunny.Position      = new Vector3(2, -1.5f, -20);
            bunny.LightPosition = LightPosition;
            Components.Add(bunny);

            cube               = new Base3DObject(this, "Models/cube");
            cube.Position      = new Vector3(0, 0, -10);
            cube.ColorAsset    = "Textures/h2mcpCube";
            cube.BumpAsset     = "Textures/h2mcpCubeNormal";
            cube.LightPosition = LightPosition;
            Components.Add(cube);

            bunnies = new Base3DObject[10];
            for (int s = 0; s < 10; s++)
            {
                bunnies[s]               = new Base3DObject(this, "Models/Bunny");
                bunnies[s].Position      = new Vector3(20 + (s * 12), -1.5f, -10 - (s * 12));
                bunnies[s].ColorAsset    = "Textures/WindmillTopColor";
                bunnies[s].BumpAsset     = "Textures/WindmillTopNormal";
                bunnies[s].LightPosition = LightPosition;
                Components.Add(bunnies[s]);
            }

            landShark          = new Base3DObject(this, "Models/landShark");
            landShark.Position = new Vector3(-20, 0, -10);

            landShark.ColorAsset    = "Textures/Speeder_diff";
            landShark.BumpAsset     = "Textures/Speeder_bump";
            landShark.LightPosition = LightPosition;
            Components.Add(landShark);

            earth               = new Base3DObject(this, "Models/sphere");
            earth.Position      = new Vector3(0, 0, -200);
            earth.ColorAsset    = "Textures/Earth_Diffuse";
            earth.BumpAsset     = "Textures/Earth_NormalMap";
            earth.LightPosition = LightPosition;
            Components.Add(earth);

            ppManager = new PostProcessingManager(this);

            fog         = new FogEffect(this, 50, 100, Color.DarkSlateGray);
            fog.Enabled = false;
            ppManager.AddEffect(fog);

            GodRays         = new CrepuscularRays(this, LightPosition, "Textures/flare", 1500, .99f, .99f, .5f, .12f, .25f);
            GodRays.Enabled = false;
            ppManager.AddEffect(GodRays);

            sun         = new SunEffect(this, LightPosition);
            sun.Enabled = false;
            ppManager.AddEffect(sun);

            bloom         = new BloomEffect(this, 1.25f, 1f, 1f, 1f, .25f, 4f);
            bloom.Enabled = false;
            ppManager.AddEffect(bloom);

            dof         = new DepthOfFieldEffect(this, 5, 30);
            dof.Enabled = false;
            ppManager.AddEffect(dof);

            haze         = new HeatHazeEffect(this, "Textures/bumpmap", false);
            haze.Enabled = false;
            ppManager.AddEffect(haze);

            radialBlur         = new RadialBlurEffect(this, 0.009f);
            radialBlur.Enabled = false;
            ppManager.AddEffect(radialBlur);

            ripple         = new RippleEffect(this);
            ripple.Enabled = false;
            ppManager.AddEffect(ripple);

            sepia         = new SepiaEffect(this);
            sepia.Enabled = false;
            ppManager.AddEffect(sepia);

            greyScale         = new GreyScaleEffect(this);
            greyScale.Enabled = false;
            ppManager.AddEffect(greyScale);

            invert         = new InvertColorEffect(this);
            invert.Enabled = false;
            ppManager.AddEffect(invert);

            colorFilter         = new ColorFilterEffect(this, Color.White, .5f, .5f, .5f);
            colorFilter.Enabled = false;
            ppManager.AddEffect(colorFilter);

            bleach         = new BleachEffect(this, 1);
            bleach.Enabled = false;
            ppManager.AddEffect(bleach);

            scanLines         = new ScanLinesEffect(this, .001f, .001f, 128);
            scanLines.Enabled = false;
            ppManager.AddEffect(scanLines);

            deRezed         = new DeRezedEffect(this, 128);
            deRezed.Enabled = false;
            ppManager.AddEffect(deRezed);
        }