Пример #1
0
        public Game1() : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

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

            DeferredSkyBox sb = new DeferredSkyBox(this, "Textures/SkyBox/cubeMap");
            Components.Add(sb);

            // Three terrains for you to play with, or create your own :D
            //terrain = new GeoClipMap(this, 255, "Textures/Terrain/Maps/bumpyMap");
            //terrain = new GeoClipMap(this, 255, "Textures/Terrain/Maps/flatMap");
            terrain = new GeoClipMap(this, 255, "Textures/Terrain/Maps/largeMap");
            terrain.Position = new Vector3(0, -31, 0);
            Components.Add(terrain);

            SunPosition = new Vector3(225, 220, -400);

            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, 1, false));

            renderer.ClearColor = Color.Black;

            //Water.Enabled = true;
            Water.maxAmplitude = .1f;
            Water.waterHeight = -7f;
            Water.refractionScale = 0.0001f;
            Water.foamExistance = new Vector3(0.0f, .35f, 0.5f);
            Water.seaFloor = -8;
            CreateWaterReflectionMap = true;
        }
Пример #2
0
        public Game1()
            : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

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

            floor = new BaseDeferredObject(this, "Models/plane");
            floor.TextureMaterials.Add("Textures/FloorColor");
            floor.NormalMaterials.Add("Textures/FloorNormal");
            floor.Position = new Vector3(0, -.75f, -10);
            Components.Add(floor);

            box = new BaseDeferredObject(this, "Models/Box");
            box.TextureMaterials.Add("Textures/BoxColor");
            box.NormalMaterials.Add("Textures/BoxNormal");
            box.Position = new Vector3(0, 0, -10);
            Components.Add(box);

            box1 = new BaseDeferredObject(this, "Models/Box");
            box1.TextureMaterials.Add("Textures/BoxColor01");
            box1.NormalMaterials.Add("Textures/BoxNormal01");
            box1.Position = new Vector3(0, 2.25f, -10);
            Components.Add(box1);

            box2= new BaseDeferredObject(this, "Models/Box");
            box2.TextureMaterials.Add("Textures/BoxColor02");
            box2.NormalMaterials.Add("Textures/BoxNormal02");
            box2.Position = new Vector3(0, 4.5f, -10);
            Components.Add(box2);

            SunPosition = new Vector3(0, 300, 200);
            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, 1, true));            
        }
Пример #3
0
        public Game1()
            : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

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

            floor = new BaseDeferredObject(this, "Models/plane");
            floor.TextureMaterials.Add("Textures/FloorColor");
            floor.NormalMaterials.Add("Textures/FloorNormal");
            floor.Position = new Vector3(0, -1f, -10);
            Components.Add(floor);

            dude = new BaseDeferredSkinnedObject(this);
            dude.Position = new Vector3(0, -1, -10);
            dude.RotateAA(Vector3.Up, MathHelper.PiOver2);
            dude.Scale = Vector3.One * .05f;
            dude.AnimationClip = "Take 001";
            dude.Mesh = "Models/dude";
            Components.Add(dude);

            SunPosition = new Vector3(110, 110, 200);

            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, 1, true));
        }
Пример #4
0
        public Game1()
            : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

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

            DeferredSkyBox sb = new DeferredSkyBox(this, "Textures/SkyBox/cubeMap");
            Components.Add(sb);

            terrain = new BruteForceTerrain(this, "Textures/Terrain/Maps/heightMap3");
            terrain.Position = new Vector3(-128,-30,-128);
            Components.Add(terrain);
          
            SunPosition = new Vector3(225, 220, -400);

            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, 1, true));

            GodRays.Enabled = true;
            GodRays.LightSourceSize = 1500;
            GodRays.bp.Enabled = false;
            GodRays.lightSourceasset = "Textures/flare2";
            SunPosition *= 2.5f;
            GodRays.Decay = .96f;
            GodRays.Density = 1f;
            GodRays.Exposure = .04f;
            GodRays.Weight = 1;

            renderer.ClearColor = Color.Red;

            UseBulletPhysics = true;  
        }
Пример #5
0
        public Game1()
            : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

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

            terrain = new BruteForceTerrain(this, "Textures/heightMap3");
            terrain.Position = new Vector3(-128, -30, -128);
            Components.Add(terrain);

            SunPosition = new Vector3(220, 225, 400);

            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, 1, true));

            Water.Enabled = true;
            
        }
Пример #6
0
        public Game1()
            : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

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

            floor = new BaseDeferredObject(this, "Models/plane");
            floor.TextureMaterials.Add("Textures/FloorColor");
            floor.NormalMaterials.Add("Textures/FloorNormal");
            floor.Position = new Vector3(0, -1f, -10);
            Components.Add(floor);

            skinnedInstancer = new Base3DDeferredSkinnedObjectInstancer(this, "Models/dude");
            skinnedInstancer.AnimationClip = "Take 001";
            Components.Add(skinnedInstancer);

            skinnedInstancerOffset = new Base3DDeferredSkinnedObjectInstancer(this, "Models/dude");
            skinnedInstancerOffset.AnimationOffSet = new TimeSpan(0, 0, 0, 0, 500);
            skinnedInstancerOffset.AnimationClip = "Take 001";
            Components.Add(skinnedInstancerOffset);

            
            for (int d = 0; d < 10; d++)
            {
                float x = MathHelper.Lerp(-sqr, sqr, (float)rnd.NextDouble());
                float y = -1;
                float z = MathHelper.Lerp(-sqr , sqr /2, (float)rnd.NextDouble());

                if(((d+1) % 2) == 0) // Split them in two.
                    dudes.Add(dudes.Count, new Base3DDeferredSkinnedInstance(this, new Vector3(x, y, z - 5), Vector3.One * .05f, Quaternion.CreateFromAxisAngle(Vector3.Up, MathHelper.PiOver2), new Vector4((float)rnd.NextDouble(), (float)rnd.NextDouble(), (float)rnd.NextDouble(), 1), ref skinnedInstancer));
                else
                    dudes.Add(dudes.Count, new Base3DDeferredSkinnedInstance(this, new Vector3(x, y, z - 5), Vector3.One * .05f, Quaternion.CreateFromAxisAngle(Vector3.Up, MathHelper.PiOver2), Color.White.ToVector4(), ref skinnedInstancerOffset));
            }


            SunPosition = new Vector3(110, 110, 200);

            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, 1, true));
        }
Пример #7
0
        public Game1()
            : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

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

            BasicColumnScene = new BaseDeferredObject(this);
            BasicColumnScene.Position = new Vector3(0, -1, 0);
            BasicColumnScene.Scale = new Vector3(.5f, 1, .5f);
            BasicColumnScene.Mesh = "Models/BasicColumnScene";
            BasicColumnScene.TextureMaterials.Add("Textures/floor_color");
            BasicColumnScene.TextureMaterials.Add("Textures/bricks_color");
            BasicColumnScene.NormalMaterials.Add("Textures/floor_normal");
            BasicColumnScene.NormalMaterials.Add("Textures/bricks_normal");
            Components.Add(BasicColumnScene);

            dude = new BaseDeferredSkinnedObject(this);
            dude.Position = new Vector3(0, -1, -5);
            dude.AnimationClip = "Take 001";
            dude.Scale = Vector3.One * .05f;
            dude.Mesh = "Models/dude";
            Components.Add(dude);

            SunPosition = new Vector3(100, 300, -200);

            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, directionalIntensity, true));

            renderer.ConeLights.Add(new DeferredConeLight(this, Vector3.Zero + Vector3.Up * 5, new Vector3(0, 0, -20), Color.White, 1.5f, coneAngle, codeDecay, true));
            renderer.ConeLights.Add(new DeferredConeLight(this, Vector3.Zero + Vector3.Up * 5, new Vector3(0, 0, 20), Color.White, 1.5f, coneAngle, codeDecay, true));
            renderer.ConeLights.Add(new DeferredConeLight(this, Vector3.Zero + Vector3.Up * 5, new Vector3(20, 0, 0), Color.White, 1.5f, coneAngle, codeDecay, true));
            renderer.ConeLights.Add(new DeferredConeLight(this, Vector3.Zero + Vector3.Up * 5, new Vector3(-20, 0, 0), Color.White, 1.5f, coneAngle, codeDecay, true));

            renderer.PointLights.Add(new DeferredPointLight(new Vector3(-10, 5, -10), Color.White, 10, 2, false));
            renderer.PointLights.Add(new DeferredPointLight(new Vector3(10, 5, -10), Color.Red, 10, 2, false));
            renderer.PointLights.Add(new DeferredPointLight(new Vector3(0, 5, 0), Color.Green, 11, 2, false));
            renderer.PointLights.Add(new DeferredPointLight(new Vector3(-10, 5, 10), Color.Blue, 10, 2, false));
            renderer.PointLights.Add(new DeferredPointLight(new Vector3(10, 5, 10), Color.Gold, 10, 2, false));
        }
Пример #8
0
        public Game1()
            : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

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

            floor = new BaseDeferredObject(this, "Models/plane");
            floor.TextureMaterials.Add("Textures/FloorColor");
            floor.NormalMaterials.Add("Textures/FloorNormal");
            floor.Position = new Vector3(0, -.75f, -10);
            Components.Add(floor);

            int size = 50;
            float x, z, y;

            for (int b = 0; b < 100; b++)
            {

                Boxs.Add(new BaseDeferredObject(this, "Models/box"));
                Boxs[Boxs.Count - 1].TextureMaterials.Add("Textures/BoxColor");
                Boxs[Boxs.Count - 1].NormalMaterials.Add("Textures/BoxNormal");

                x = MathHelper.Lerp(-size, size, (float)rnd.NextDouble());
                z = MathHelper.Lerp(-size, size, (float)rnd.NextDouble());
                y = MathHelper.Lerp(2.1f, size/2, (float)rnd.NextDouble());
                Boxs[Boxs.Count - 1].Position = new Vector3(x, y, z);

                Components.Add(Boxs[Boxs.Count - 1]);
            }

            SunPosition = new Vector3(0, 400, 200);

            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, 1, true));
        }
Пример #9
0
        public Game1()
            : base()
        {
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;

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

            floor = new BaseDeferredObject(this, "Models/plane");
            floor.TextureMaterials.Add("Textures/FloorColor");
            floor.NormalMaterials.Add("Textures/FloorNormal");
            floor.Position = new Vector3(0, -.75f, -10);
            Components.Add(floor);

            box = new BaseDeferredObject(this, "Models/Box");
            box.TextureMaterials.Add("Textures/BoxColor");
            box.NormalMaterials.Add("Textures/BoxNormal");
            box.Position = new Vector3(0, 0, -10);
            Components.Add(box);

            box1 = new BaseDeferredObject(this, "Models/Box");
            box1.TextureMaterials.Add("Textures/BoxColor01");
            box1.NormalMaterials.Add("Textures/BoxNormal01");
            box1.Position = new Vector3(0, 2.25f, -10);
            Components.Add(box1);

            box2 = new BaseDeferredObject(this, "Models/Box");
            box2.TextureMaterials.Add("Textures/BoxColor02");
            box2.NormalMaterials.Add("Textures/BoxNormal02");
            box2.Position = new Vector3(0, 4.5f, -10);
            Components.Add(box2);

            snowInstancer = new Base3DParticleInstancer(this, "Shaders/Particles/FallingWeatherParticleInstance");
            snowInstancer.TextureMaterials.Add("Textures/Particles/snow");
            snowInstancer.Position = new Vector3(0, -1, 0);
            //instancer2.Size = Vector2.One * .1f;
            Components.Add(snowInstancer);

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

                particles.Add(new Base3DParticleInstance(this, new Vector3(x, y, z), Vector3.One, snowInstancer));
            }

            tailInstancer = new Base3DParticleInstancer(this, "Shaders/Particles/Trail");
            tailInstancer.TextureMaterials.Add("Textures/Particles/bling2");
            tailInstancer.Color = Color.White;
            tailInstancer.Rotate(Vector3.Forward, (float)Math.PI / 2);
            Components.Add(tailInstancer);

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

                System.Threading.Thread.Sleep(1);
                particles.Add(new Base3DParticleInstance(this, new Vector3(x, y, z), Vector3.One * 1f, tailInstancer));
            }

            smokeInstancer = new Base3DParticleInstancer(this, "Shaders/Particles/RisingSmokeInstanced");
            smokeInstancer.TextureMaterials.Add("Textures/Particles/smoke");
            Components.Add(smokeInstancer);

            for (int s = 0; s < 100; s++)
            {
                float x = MathHelper.Lerp(-sqr, sqr, (float)rnd.NextDouble());
                float z = MathHelper.Lerp(-sqr, sqr, (float)rnd.NextDouble());

                PlaceRisingsmoke(new Vector3(x, -.75f, z), 5);
            }

            SunPosition = new Vector3(0, 300, 200);

            renderer.DirectionalLights.Add(new DeferredDirectionalLight(this, SunPosition, Vector3.Zero, Color.White, 1, true));
        }