Beispiel #1
0
        public SkyBox(Model model, GraphicsDevice graphicsDevice,
                      TextureCube texture)
        {
            _model = new CModel(Vector3.Zero, Vector3.Zero, Vector3.One, model, graphicsDevice);

            _effect = EffectManager.Content.Load <Effect>("skysphere_effect");
            _effect.Parameters["CubeMap"].SetValue(texture);

            _model.SetModelEffect(_effect, false);

            graphics = graphicsDevice;
        }
Beispiel #2
0
        public Water(Model model, GraphicsDevice graphics,
                     Vector3 position, Vector2 size, Texture2D normalMap)
        {
            this.graphics = graphics;

            waterMesh = new CModel(position,
                                   Vector3.Zero, new Vector3(size.X, 1, size.Y), model, graphics);

            waterEffect = EffectManager.Content.Load <Effect>("WaterEffect");
            waterMesh.SetModelEffect(waterEffect, false);

            waterEffect.Parameters["viewportWidth"].SetValue(
                graphics.Viewport.Width);

            waterEffect.Parameters["viewportHeight"].SetValue(
                graphics.Viewport.Height);

            waterEffect.Parameters["WaterNormalMap"].SetValue(normalMap);

            reflectionTarg = new RenderTarget2D(graphics, graphics.Viewport.Width,
                                                graphics.Viewport.Height, false, SurfaceFormat.Color,
                                                DepthFormat.Depth24);
        }