예제 #1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.GraphicsProfile = GraphicsProfile.HiDef;
            Content.RootDirectory    = "Content";
            IsMouseVisible           = true;

            camera = new Base3DCamera(this, .1f, 2000f);

            ppManager = new PostProcessingManager(this);
            GodRays   = new CrepuscularRays(this, sunPosition, "Textures/flare", 100, .99f, .99f, .5f, .12f, .25f);
            ppManager.AddEffect(GodRays);


            int sqr = 50;

            //for (int a = 0; a < 100; a++)
            //{
            //    float x = MathHelper.Lerp(-sqr, sqr, (float)rnd.NextDouble());
            //    float y = MathHelper.Lerp(-sqr, sqr, (float)rnd.NextDouble());
            //    float z = MathHelper.Lerp(-sqr, -sqr * 2, (float)rnd.NextDouble());
            //    float s = MathHelper.Lerp(.01f, 2, (float)rnd.NextDouble());

            //    //asteroids.Add(new Base3DModel(this, "Models/asteroid1", "Shaders/ColorDepthRender", "Textures/stone"));
            //    if (rnd.NextDouble() >= .5f)
            //        objects.Add(new Base3DModel(this, "Models/tank", "Shaders/ColorDepthRender"));
            //    else
            //        objects.Add(new Base3DModel(this, "Models/LandShark", "Shaders/ColorDepthRender"));
            //    objects[objects.Count - 1].Position = new Vector3(x, y, z);
            //    objects[objects.Count - 1].Scale = Vector3.One * s;
            //    Components.Add(objects[objects.Count - 1]);

            //    //asteroidsRotDir.Add(asteroidsRotDir.Count, Vector3.Normalize(asteroids[asteroids.Count - 1].Position));
            //}
            objects.Add(new Base3DModel(this, "Models/LandShark", "Shaders/ColorDepthRender"));
            objects[0].Position = new Vector3(0, 0, -100);
            objects[0].Scale    = Vector3.One;
            Components.Add(objects[0]);
        }
예제 #2
0
파일: Game1.cs 프로젝트: procfxgen/FxGodRay
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            IsMouseVisible = true;

            //graphics.IsFullScreen = true;

            //graphics.PreferredBackBufferHeight = 900;
            //graphics.PreferredBackBufferWidth = 1440;

            //graphics.PreferredBackBufferHeight = 900;
            //graphics.PreferredBackBufferWidth = 1600;

            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth  = 800;

            ppm = new PostProcessingManager(this);

            rays = new CrepuscularRays(this, Vector2.One * .5f, "Textures/flare", 1, .97f, .97f, .5f, .25f);

            ppm.AddEffect(rays);
        }
        public override void LoadContent()
        {
            if (content == null)
                content = ScreenManager.Game.Content;

            sky = content.Load<Texture2D>("sky_bg");

            ppm = new PostProcessingManager(ScreenManager.Game);

            rays = new CrepuscularRays(ScreenManager.Game, Vector2.One * .5f, "flare4", 0.35f, .87f, .97f, .3f, .20f);

            ppm.AddEffect(rays);

            ScreenManager.Game.Services.AddService(ScreenManager.SpriteBatch.GetType(), ScreenManager.SpriteBatch);

            UpdateLightSource();

            scene = new RenderTarget2D(ScreenManager.Game.GraphicsDevice,
                ScreenManager.Game.GraphicsDevice.Viewport.Width,
                ScreenManager.Game.GraphicsDevice.Viewport.Height,
                false,
                SurfaceFormat.Color,
                DepthFormat.None);

            AddBackground("cloud1", 0.5f);
            AddBackground("midground_grasshill", 0.0f);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
0
 public override void LoadContent()
 {
     m_ppm    = new PostProcessingManager(ScreenManager.Game, ScreenManager.Camera);
     m_godRay = new CrepuscularRays(ScreenManager.Game, Vector2.One * 0.5f, "GameSpritesheets/flare3", 2f, 0.97f,
                                    0.97f, 0.5f, 1.25f);
     m_ppm.AddEffect(m_godRay);
     m_godRayTexture = new RenderTarget2D(Camera.GraphicsDevice, 1320, 720, false, SurfaceFormat.Color,
                                          DepthFormat.None);
     m_godRay.lightSource = new Vector2(0.495f, 0.3f);
     m_bg                     = new SpriteObj("TitleBG_Sprite");
     m_bg.Scale               = new Vector2(1320f / m_bg.Width, 720f / m_bg.Height);
     m_bg.TextureColor        = Color.Red;
     m_hardCoreModeOpacity    = 0f;
     m_logo                   = new SpriteObj("TitleLogo_Sprite");
     m_logo.Position          = new Vector2(660f, 360f);
     m_logo.DropShadow        = new Vector2(0f, 5f);
     m_castle                 = new SpriteObj("TitleCastle_Sprite");
     m_castle.Scale           = new Vector2(2f, 2f);
     m_castle.Position        = new Vector2(630f, 720 - m_castle.Height / 2);
     m_smallCloud1            = new SpriteObj("TitleSmallCloud1_Sprite");
     m_smallCloud1.Position   = new Vector2(660f, 0f);
     m_smallCloud2            = new SpriteObj("TitleSmallCloud2_Sprite");
     m_smallCloud2.Position   = m_smallCloud1.Position;
     m_smallCloud3            = new SpriteObj("TitleSmallCloud3_Sprite");
     m_smallCloud3.Position   = m_smallCloud1.Position;
     m_smallCloud4            = new SpriteObj("TitleSmallCloud4_Sprite");
     m_smallCloud4.Position   = m_smallCloud1.Position;
     m_smallCloud5            = new SpriteObj("TitleSmallCloud5_Sprite");
     m_smallCloud5.Position   = m_smallCloud1.Position;
     m_largeCloud1            = new SpriteObj("TitleLargeCloud1_Sprite");
     m_largeCloud1.Position   = new Vector2(0f, 720 - m_largeCloud1.Height);
     m_largeCloud2            = new SpriteObj("TitleLargeCloud2_Sprite");
     m_largeCloud2.Position   = new Vector2(440f, 720 - m_largeCloud2.Height + 130);
     m_largeCloud3            = new SpriteObj("TitleLargeCloud1_Sprite");
     m_largeCloud3.Position   = new Vector2(880f, 720 - m_largeCloud3.Height + 50);
     m_largeCloud3.Flip       = SpriteEffects.FlipHorizontally;
     m_largeCloud4            = new SpriteObj("TitleLargeCloud2_Sprite");
     m_largeCloud4.Position   = new Vector2(1320f, 720 - m_largeCloud4.Height);
     m_largeCloud4.Flip       = SpriteEffects.FlipHorizontally;
     m_titleText              = new TextObj();
     m_titleText.Font         = Game.JunicodeFont;
     m_titleText.FontSize     = 45f;
     m_titleText.Text         = "ROGUE CASTLE";
     m_titleText.Position     = new Vector2(660f, 60f);
     m_titleText.Align        = Types.TextAlign.Centre;
     m_copyrightText          = new TextObj(Game.JunicodeFont);
     m_copyrightText.FontSize = 8f;
     m_copyrightText.Text     =
         "Copyright(C) 2011-2015, Cellar Door Games Inc. Rogue Legacy(TM) is a trademark or registered trademark of Cellar Door Games Inc. All Rights Reserved.";
     m_copyrightText.Align        = Types.TextAlign.Centre;
     m_copyrightText.Position     = new Vector2(660f, 720 - m_copyrightText.Height - 10);
     m_copyrightText.DropShadow   = new Vector2(1f, 2f);
     m_versionNumber              = (m_copyrightText.Clone() as TextObj);
     m_versionNumber.Align        = Types.TextAlign.Right;
     m_versionNumber.FontSize     = 8f;
     m_versionNumber.Position     = new Vector2(1305f, 5f);
     m_versionNumber.Text         = "v1.2.0c";
     m_pressStartText             = new KeyIconTextObj(Game.JunicodeFont);
     m_pressStartText.FontSize    = 20f;
     m_pressStartText.Text        = "Press Enter to begin";
     m_pressStartText.Align       = Types.TextAlign.Centre;
     m_pressStartText.Position    = new Vector2(660f, 560f);
     m_pressStartText.DropShadow  = new Vector2(2f, 2f);
     m_pressStartText2            = new TextObj(Game.JunicodeFont);
     m_pressStartText2.FontSize   = 20f;
     m_pressStartText2.Text       = "Press Enter to begin";
     m_pressStartText2.Align      = Types.TextAlign.Centre;
     m_pressStartText2.Position   = m_pressStartText.Position;
     m_pressStartText2.Y         -= m_pressStartText.Height - 5;
     m_pressStartText2.DropShadow = new Vector2(2f, 2f);
     m_profileCard = new SpriteObj("TitleProfileCard_Sprite");
     m_profileCard.OutlineWidth = 2;
     m_profileCard.Scale        = new Vector2(2f, 2f);
     m_profileCard.Position     = new Vector2(m_profileCard.Width, 720 - m_profileCard.Height);
     m_profileCard.ForceDraw    = true;
     m_optionsIcon              = new SpriteObj("TitleOptionsIcon_Sprite");
     m_optionsIcon.Scale        = new Vector2(2f, 2f);
     m_optionsIcon.OutlineWidth = m_profileCard.OutlineWidth;
     m_optionsIcon.Position     = new Vector2(1320 - m_optionsIcon.Width * 2, m_profileCard.Y);
     m_optionsIcon.ForceDraw    = true;
     m_creditsIcon              = new SpriteObj("TitleCreditsIcon_Sprite");
     m_creditsIcon.Scale        = new Vector2(2f, 2f);
     m_creditsIcon.OutlineWidth = m_profileCard.OutlineWidth;
     m_creditsIcon.Position     = new Vector2(m_optionsIcon.X + 120f, m_profileCard.Y);
     m_creditsIcon.ForceDraw    = true;
     m_profileCardKey           = new KeyIconTextObj(Game.JunicodeFont);
     m_profileCardKey.Align     = Types.TextAlign.Centre;
     m_profileCardKey.FontSize  = 12f;
     m_profileCardKey.Text      = "[Input:" + 7 + "]";
     m_profileCardKey.Position  = new Vector2(m_profileCard.X,
                                              m_profileCard.Bounds.Top - m_profileCardKey.Height - 10);
     m_profileCardKey.ForceDraw = true;
     m_optionsKey                = new KeyIconTextObj(Game.JunicodeFont);
     m_optionsKey.Align          = Types.TextAlign.Centre;
     m_optionsKey.FontSize       = 12f;
     m_optionsKey.Text           = "[Input:" + 4 + "]";
     m_optionsKey.Position       = new Vector2(m_optionsIcon.X, m_optionsIcon.Bounds.Top - m_optionsKey.Height - 10);
     m_optionsKey.ForceDraw      = true;
     m_creditsKey                = new KeyIconTextObj(Game.JunicodeFont);
     m_creditsKey.Align          = Types.TextAlign.Centre;
     m_creditsKey.FontSize       = 12f;
     m_creditsKey.Text           = "[Input:" + 6 + "]";
     m_creditsKey.Position       = new Vector2(m_creditsIcon.X, m_creditsIcon.Bounds.Top - m_creditsKey.Height - 10);
     m_creditsKey.ForceDraw      = true;
     m_profileSelectKey          = new KeyIconTextObj(Game.JunicodeFont);
     m_profileSelectKey.Align    = Types.TextAlign.Left;
     m_profileSelectKey.FontSize = 10f;
     m_profileSelectKey.Text     = string.Concat("[Input:", 25, "] to Change Profile (", Game.GameConfig.ProfileSlot,
                                                 ")");
     m_profileSelectKey.Position   = new Vector2(30f, 15f);
     m_profileSelectKey.ForceDraw  = true;
     m_profileSelectKey.DropShadow = new Vector2(2f, 2f);
     m_crown                = new SpriteObj("Crown_Sprite");
     m_crown.ForceDraw      = true;
     m_crown.Scale          = new Vector2(0.7f, 0.7f);
     m_crown.Rotation       = -30f;
     m_crown.OutlineWidth   = 2;
     m_dlcIcon              = new SpriteObj("MedallionPiece5_Sprite");
     m_dlcIcon.Position     = new Vector2(950f, 310f);
     m_dlcIcon.ForceDraw    = true;
     m_dlcIcon.TextureColor = Color.Yellow;
     base.LoadContent();
 }