void UpdateModel()
 {
     var r = new TerrainModel();
     r.Load(Source);
     //r.Texture = new SlopeDirectionTexture(0);
     r.Texture = new SlopeTexture(8);
     // r.Texture = new MapTexture(@"D:\tmp\CraterLake.png") { Left = r.Left, Right = r.Right, Top = r.Top, Bottom = r.Bottom };
     visualChild.Content = r.CreateModel(2);
 }
Example #2
0
        void UpdateModel()
        {
            var r = new TerrainModel();

            r.Load(Source);
            //r.Texture = new SlopeDirectionTexture(0);
            r.Texture = new SlopeTexture(8);
            // r.Texture = new MapTexture(@"D:\tmp\CraterLake.png") { Left = r.Left, Right = r.Right, Top = r.Top, Bottom = r.Bottom };
            visualChild.Content = r.CreateModel(2);
        }
 public override void Calculate(TerrainModel model, MeshGeometry3D mesh)
 {
     var texcoords = new PointCollection();
     foreach (var p in mesh.Positions)
     {
         double x = p.X + model.Offset.X;
         double y = p.Y + model.Offset.Y;
         double u = (x - Left) / (Right - Left);
         double v = (y - Top) / (Bottom - Top);
         texcoords.Add(new Point(u, v));
     }
     TextureCoordinates = texcoords;
 }
Example #4
0
        public override void Calculate(TerrainModel model, MeshGeometry3D mesh)
        {
            var texcoords = new PointCollection();

            foreach (var p in mesh.Positions)
            {
                double x = p.X + model.Offset.X;
                double y = p.Y + model.Offset.Y;
                double u = (x - Left) / (Right - Left);
                double v = (y - Top) / (Bottom - Top);
                texcoords.Add(new Point(u, v));
            }
            TextureCoordinates = texcoords;
        }
Example #5
0
        public override void Calculate(TerrainModel model, MeshGeometry3D mesh)
        {
            var normals   = MeshGeometryHelper.CalculateNormals(mesh);
            var texcoords = new PointCollection();

            for (int i = 0; i < normals.Count; i++)
            {
                double slopedir = Math.Atan2(normals[i].Y, normals[i].X) * 180 / Math.PI;
                if (slopedir < 0)
                {
                    slopedir += 360;
                }
                double u = slopedir / 360;
                texcoords.Add(new Point(u, u));
            }
            TextureCoordinates = texcoords;
            Material           = MaterialHelper.CreateMaterial(Brush);
        }
Example #6
0
        public override void Calculate(TerrainModel model, MeshGeometry3D mesh)
        {
            var normals   = MeshGeometryHelper.CalculateNormals(mesh);
            var texcoords = new PointCollection();
            var up        = new Vector3D(0, 0, 1);

            for (int i = 0; i < normals.Count; i++)
            {
                double slope = Math.Acos(Vector3D.DotProduct(normals[i], up)) * 180 / Math.PI;
                double u     = slope / 40;
                if (u > 1)
                {
                    u = 1;
                }
                if (u < 0)
                {
                    u = 0;
                }
                texcoords.Add(new Point(u, u));
            }
            TextureCoordinates = texcoords;
            Material           = MaterialHelper.CreateMaterial(Brush);
        }
 public virtual void Calculate(TerrainModel model, MeshGeometry3D mesh)
 {
 }
 public override void Calculate(TerrainModel model, MeshGeometry3D mesh)
 {
     var normals = MeshGeometryHelper.CalculateNormals(mesh);
     var texcoords = new PointCollection();
     for (int i = 0; i < normals.Count; i++)
     {
         double slopedir = Math.Atan2(normals[i].Y, normals[i].X) * 180 / Math.PI;
         if (slopedir < 0) slopedir += 360;
         double u = slopedir / 360;
         texcoords.Add(new Point(u, u));
     }
     TextureCoordinates = texcoords;
     Material = MaterialHelper.CreateMaterial(Brush);
 }
 public override void Calculate(TerrainModel model, MeshGeometry3D mesh)
 {
     var normals = MeshGeometryHelper.CalculateNormals(mesh);
     var texcoords = new PointCollection();
     var up = new Vector3D(0, 0, 1);
     for (int i = 0; i < normals.Count; i++)
     {
         double slope = Math.Acos(Vector3D.DotProduct(normals[i], up)) * 180 / Math.PI;
         double u = slope / 40;
         if (u > 1) u = 1;
         if (u < 0) u = 0;
         texcoords.Add(new Point(u, u));
     }
     TextureCoordinates = texcoords;
     Material = MaterialHelper.CreateMaterial(Brush);
 }
Example #10
0
 public virtual void Calculate(TerrainModel model, MeshGeometry3D mesh)
 {
 }