Exemplo n.º 1
0
        void game_InitializeEvent(object sender, EventArgs e)
        {
            Matrix mWaterWorld = Matrix.Identity;// r* t;

            /*--------------------------------------------------------------------------
             * Create the water and fill in the info structure
             *--------------------------------------------------------------------------*/
            WaterInfoTest info = new WaterInfoTest();

            info.fxFilename = System.Windows.Forms.Application.StartupPath + @"\Shaders\Water.fx";
            info.vertRows   = 513;
            info.vertCols   = 513;
            info.dx         = 5.25f; //spaccing of grid lines - big distance
            info.dz         = 5.25f;
            //info.dx = 0.5f; // small distance
            //info.dz = 0.5f;
            info.waveMapFileName0  = System.Windows.Forms.Application.StartupPath + @"\Content\wave0.dds";
            info.waveMapFileName1  = System.Windows.Forms.Application.StartupPath + @"\Content\wave1.dds";
            info.waveNMapVelocity0 = new Vector2(0.03f, 0.05f);
            info.waveNMapVelocity1 = new Vector2(-0.01f, 0.03f);
            info.texScale          = 24.0f;
            info.toWorld           = mWaterWorld;

            TextureCube mEnvMap = TextureCube.FromFile(game.GraphicsDevice, System.Windows.Forms.Application.StartupPath + @"\Content\EnvMap.dds");

            water = new Water(game, info, mEnvMap);

            //mWaterColor = new ColorValue( ( 255 * .13f ), ( 255 * .19f ), ( 255 * .22f ) );

            //use a sky model with a Hoffman-Preethem scattering method
            //mSkyModel = new SkyModel( 2000, mGDevice, typeof( Hoffman_Preethem ), mTerrain.Textures );

            //mGlarePostProcess = new GlarePostProcess( mGDevice, mGDevice.Viewport.Width, mGDevice.Viewport.Height );
            //mEnablePostProcess = true;
        }