Exemple #1
0
 public Patch(Landscape land)
 {
     Land = land;
 }
        void OnInitComplete()
        {
            engine.CameraInput.Camera.FarZ = 12000;

            heightMap = ReadHgtFile(hgtFile, MapSize);

            landscape = new Landscape();
            //landscape.SplitFunction = SplitFromHeight;
            landscape.VisibleFunction = IsTriVisible;
            landscape.FetchFunction = MapFetchFunction;
            landscape.MAP_SIZE = heightMap.GetLength(0)-1;
            landscape.NUM_PATCHES_PER_SIDE = NumPatches;
            landscape.Init();
            landscape.Scale = new Vector3(1, 0.0005f, 1);
            landscape.BindToPass(engine.D3DDevice, engine.Effect, "Terrain");
            engine.Geometry.Add(landscape);

            using (MeshFactory fact = new MeshFactory())
                person = fact.CreateSphere(0.5f, 20, 20);

            float h = GetHeightAtPoint(2.5f,2.5f);

            person.Translation = new Vector3(2.5f, h+1, 2.5f);
            person.BindToPass(engine.D3DDevice, engine.Effect, 2);
            engine.Geometry.Add(person);

            engine.D3DDevice.FillMode = SlimDX.Direct3D10.FillMode.Wireframe;

            engine.CameraInput.LookAt(new Vector3(MapSize/2, 100, 0), new Vector3(MapSize/2, 0, MapSize/2));
        }
 public void SetUp()
 {
     landscape = new Landscape();
 }