Ejemplo n.º 1
0
 public void loadNewHeightMap(string fileName)
 {
     lock (loadLock)
     {
         map      = loadVectorTexture(fileName, true);                                                           //loadVectorTexture(fileName,true);
         renderer = new HeightMapRenderer(Matrix.Identity, map, Content.Load <Texture2D>("720"), 512, 512, 1, 16, rendererEffect, graphics.GraphicsDevice);
         animator = new HeightMapAnimator(graphics, spriteBatch, 512, 512, renderer, new Vector3(3.732f, 1, 0)); //2.639f, 1, 2.639f));//3.732f, 1, 0));//
         first    = true;
         start    = false;
         animator.setWind(new Vector2(4, 0));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            camera         = new Camera(new Vector3(0, 0, 0), Vector3.Forward, Vector3.Up, (float)Math.PI / 2, 800.0f / 600.0f);
            rendererEffect = Content.Load <Effect>("HeightMapRendererEffect");
            animatorEffect = Content.Load <Effect>("HeightMapAnimatorEffect");
            map            = loadVectorTexture("hm4");
            renderer       = new HeightMapRenderer(Matrix.Identity, map, Content.Load <Texture2D>("720"), 512, 512, 1, 16, rendererEffect, graphics.GraphicsDevice);
            animator       = new HeightMapAnimator(graphics, spriteBatch, 512, 512, renderer, new Vector3(3.732f, 1, 0));//2.639f, 1, 2.639f));//3.732f, 1, 0));//
            animator.setWind(new Vector2(4, 0));

            // TODO: use this.Content to load your game content here
        }
 public HeightMapAnimator(GraphicsDeviceManager graphics, SpriteBatch sprite, int width, int height, HeightMapRenderer renderer, Vector3 windShadowDir)
 {
     sandheight = 8;
     avalancheconditionheight = 2;
     windVector       = windShadowDir;
     parity           = 0;
     this.width       = width;
     this.height      = height;
     this.graphics    = graphics;
     this.spriteBatch = sprite;
     translateTarget  = new RenderTarget2D(graphics.GraphicsDevice, width, height, false, SurfaceFormat.Vector4, DepthFormat.None);
     tempTarget       = new RenderTarget2D(graphics.GraphicsDevice, width, height, false, SurfaceFormat.Vector4, DepthFormat.None);
     shadowTarget     = new RenderTarget2D(graphics.GraphicsDevice, (int)(width * 1.25), (int)(height * 1.25), false, SurfaceFormat.Color, DepthFormat.None);
     shadowTarget2    = new RenderTarget2D(graphics.GraphicsDevice, width, height, false, SurfaceFormat.Vector4, DepthFormat.None);
     endTarget        = new RenderTarget2D(graphics.GraphicsDevice, width, height, false, SurfaceFormat.Vector4, DepthFormat.None);
     avalanche1target = new RenderTarget2D(graphics.GraphicsDevice, width, height, false, SurfaceFormat.Vector4, DepthFormat.None);
     avalanche2target = new RenderTarget2D(graphics.GraphicsDevice, width, height, false, SurfaceFormat.Vector4, DepthFormat.None);
     this.renderer    = renderer;
     aOrder           = CreateAvalancheOrder();
 }