示例#1
0
        public Game1()
        {
            //Map.MAPSIZE = 513;
            //  ParticleSimple ps;
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            //camera =  new Camera(this);

            ls.Add(Sens.Droite);
            ls.Add(Sens.Gauche);
            camera.actucamera(ls);
            //graphics.ToggleFullScreen();
            graphics.PreferredBackBufferWidth = Tools.Quick.screen.Bounds.Width;
            graphics.PreferredBackBufferHeight = Tools.Quick.screen.Bounds.Height;
            Tools.Quick.bounds.X = graphics.PreferredBackBufferWidth;
            Tools.Quick.bounds.Y = graphics.PreferredBackBufferHeight;
            particleManager = new ParticleManager(this);
            Tools.Quick.game = this;
            mousy = new ActionMouse(this, camera);
            Tools.Quick.actmouse = mousy;
            water = new Water(this);
            skybox = new SkyBox(this);
            trees = new Trees(this);
            d = new Dungeon(25, this);

            Map map = new Map();
            actualGround = new Ground(this, map);

            world = new WorldSpace(this);
            dungeon = new WorldSpace(this);
        }
示例#2
0
        public void DrawReflectionMap(Camera c, SkyBox d)
        {
            reflectionCamera.position = c.position;
            reflectionCamera.position.Y = -c.position.Y + waterHeight * 2;
            reflectionCamera.lookat = c.lookat;
            reflectionCamera.lookat.Y = -c.lookat.Y + waterHeight * 2;

            reflectionViewMatrix = reflectionCamera.getview();

            Plane reflectionPlane = CreatePlane(waterHeight, new Vector3(0, -1, 0), viewMatrix, reflectionViewMatrix, true);
            effect.CurrentTechnique = effect.Techniques["Textured"];
            effect.Parameters["xClipPlane0"].SetValue(new Vector4(reflectionPlane.Normal, reflectionPlane.D));
            effect.Parameters["xClipping"].SetValue(true);

            device.SetRenderTarget(reflectionRenderTarget);

            device.DepthStencilState = new DepthStencilState();
            device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.CornflowerBlue, 5.0f, 0);

            d.DrawClippedSky(device, effect, reflectionCamera);
            ground.DrawClippedGround(device, effect, reflectionCamera);

            effect.Parameters["xClipping"].SetValue(false);

            device.SetRenderTarget(null);

            reflectionMap = (Texture2D)reflectionRenderTarget;
        }