Exemplo n.º 1
0
        public void DrawGround(Camera camera, bool mirror)
        {
            camera.Reflecting = mirror;
            camera.Snap();
            camera.SetTechnique("MultiTextured");
            camera.SetParam("xTexture0", Textures[0]);
            camera.SetParam("xTexture1", Textures[1]);
            camera.SetParam("xTexture2", Textures[2]);
            camera.SetParam("xTexture3", Textures[3]);
            camera.SetParam("xWorld", Matrix.Identity);

            foreach (EffectPass pass in camera.Technique.Passes) {
                pass.Apply();
                camera.device.Indices = terrainIndexBuffer;
                camera.device.SetVertexBuffer(terrainVertexBuffer);
                camera.device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertices.Length, 0, indices.Length / 3);
            }
        }
Exemplo n.º 2
0
 public void DrawWater(Camera camera, float time)
 {
     camera.SetTechnique("Water");
     camera.SetParam("xWorld", Matrix.Identity);
     camera.SetParam("xView", camera.View);
     camera.SetParam("xProjection", camera.Projection);
     camera.SetParam("xReflectionView", camera.Mirror);
     camera.SetParam("xReflectionMap", reflectionMap);
     camera.SetParam("xRefractionMap", refractionMap);
     camera.SetParam("xWaterBumpMap", rippleMap);
     camera.SetParam("xWaveLength", 0.1f);
     camera.SetParam("xWaveHeight", 0.3f);
     camera.SetParam("xCamPos", camera.location);
     camera.SetParam("xTime", time);
     camera.SetParam("xWindForce", 0.001f);
     camera.SetParam("xWindDirection", wind);
     camera.Effect.CurrentTechnique.Passes[0].Apply();
     camera.device.SetVertexBuffer(waterVertexBuffer);
     camera.device.DrawPrimitives(PrimitiveType.TriangleList, 0, waterVertexBuffer.VertexCount / 3);
 }