示例#1
0
        public void MapClouds(Camera cam, float time)
        {
            cam.SetTarget(cloudsRenderTarget);
            cam.SetTechnique("PerlinNoise");
            cam.SetParam("xTexture", perlin.Map);
            cam.SetParam("xOvercast", 1.5f);
            cam.SetParam("xTime", time * 0.0005f);

            cam.Begin();
            foreach (EffectPass pass in cam.Technique.Passes)
            {
                pass.Begin();

                cam.device.VertexDeclaration = vDeclaration;
                cam.device.DrawUserPrimitives(PrimitiveType.TriangleStrip, perlin.Vertices, 0, 2);

                pass.End();
            }
            cam.End();
            cam.RevertTarget();
            clouds = cloudsRenderTarget.GetTexture();
        }
示例#2
0
        public void DrawBase(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);

            camera.Begin();
            foreach (EffectPass pass in camera.Technique.Passes)
            {
                pass.Begin();

                camera.device.Vertices[0].SetSource(vBuffer, 0, VertexMultitextured.SizeInBytes);
                camera.device.Indices = iBuffer;
                camera.device.VertexDeclaration = vDeclaration;

                int noVertices = vBuffer.SizeInBytes / VertexMultitextured.SizeInBytes;
                int noTriangles = iBuffer.SizeInBytes / sizeof(int) / 3;
                camera.device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, noVertices, 0, noTriangles);

                pass.End();
            }
            camera.End();
        }
示例#3
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", mirrorMap);
            camera.SetParam("xRefractionMap", waterMap);
            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", windPower);
            camera.SetParam("xWindDirection", wind);

            camera.Begin();
            foreach (EffectPass pass in camera.Technique.Passes)
            {
                pass.Begin();

                camera.device.Vertices[0].SetSource(seaBuffer, 0, VertexPositionTexture.SizeInBytes);
                camera.device.Indices = iBuffer;
                camera.device.VertexDeclaration = seaDeclaration;

                int noVertices = seaBuffer.SizeInBytes / VertexPositionTexture.SizeInBytes;
                camera.device.DrawPrimitives(PrimitiveType.TriangleList, 0, noVertices / 3);

                pass.End();
            }
            camera.End();
        }