public WaterSystem(ContentManager content, GraphicsDevice graphics,
            Vector3 position, Vector2 size, float WaveLength, float WaveHeight, float WaveSpeed, Vector3 LightDirection, Vector3 LightColor, float SunFactor)
        {
            this.content = content;
            this.graphics = graphics;

            waterMesh = new Models(content, content.Load<Model>("models//plane"), position, new Vector3(0, -MathHelper.PiOver2, 0), new Vector3(size.X, 1, size.Y), graphics);
            waterEffect = content.Load<Effect>("Effects//water");

            waterMesh.SetModelEffect(waterEffect, false);
            waterEffect.Parameters["viewportWidth"].SetValue(graphics.Viewport.Width);
            waterEffect.Parameters["viewportHeight"].SetValue(graphics.Viewport.Height);
            waterEffect.Parameters["WaterNormalMap"].SetValue(content.Load<Texture2D>("textures//Water//wave0"));
            waterEffect.Parameters["WaterNormalMap1"].SetValue(content.Load<Texture2D>("textures//Water//wave1"));
            waterEffect.Parameters["WaveLength"].SetValue(WaveLength);
            waterEffect.Parameters["WaveHeight"].SetValue(WaveHeight);
            waterEffect.Parameters["WaveSpeed"].SetValue(WaveSpeed);
            waterEffect.Parameters["LightDirection"].SetValue(LightDirection);
            waterEffect.Parameters["LightColor"].SetValue(LightColor);
            waterEffect.Parameters["SunFactor"].SetValue(SunFactor);
            waterEffect.Parameters["WaterHeight"].SetValue(waterMesh.Position.Y);
            refractionTarg = new RenderTarget2D(graphics, graphics.Viewport.Width, graphics.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24);

            reflectionTarg = new RenderTarget2D(graphics, graphics.Viewport.Width, graphics.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24);
        }
Beispiel #2
0
        public SkySphere(ContentManager Content, GraphicsDevice graphicsDevice, TextureCube Texture)
        {
            model = new Models(Content, Content.Load<Model>("models//skySphere"), Vector3.Zero, Vector3.Zero, new Vector3(-100000), graphicsDevice);
            effect = Content.Load<Effect>("shaders//SkyBox");
            effect.Parameters["CubeMap"].SetValue(Texture);
            model.SetModelEffect(effect, false);

            this.graphics = graphicsDevice;
        }