Ejemplo n.º 1
0
 public Mesh()
     : base()
 {
     Diffuse = new Ratio() { X = 1, Y = 1, Z = 1 };
     Lighting = true;
     Vertices = new i3DMLCollection<Vertex>();
     TextureResource = new Resource();
     TextureResource.ResourceType = ResourceType.Texture;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Downloads the resource.
 /// </summary>
 /// <param name="res">The resource</param>
 public static void Download(Resource res)
 {
     if (Resources[res.ResourceType].ContainsKey(res.Url))
     {
         if (Resources[res.ResourceType][res.Url] != null)
         {
             res.Data = Resources[res.ResourceType][res.Url];
             Downloaded(res);
         }
         else
         {
             NotDownloaded.Add(res);
         }
         return;
     }
     Resources[res.ResourceType].Add(res.Url, null);
     ResourceConverter conv =ResourceConverters[res.ResourceType];
     Task download = new Task((obj) =>
         {
             i3DML.ObjectModel.Resource resource = obj as i3DML.ObjectModel.Resource;
             while (true)
             {
                 try
                 {
                     Stream dat = UrlManager.GetStream(resource.Url);
                     object converted = conv(dat);
                     Resources[res.ResourceType][resource.Url] = converted;
                     resource.Data = converted;
                     Downloaded(resource);
                     break;
                 }
                 catch { System.Threading.Thread.Sleep(Timeout); }
             }
         }, res);
     download.Start();
 }
Ejemplo n.º 3
0
 public HeightMap()
 {
     HeightMapResource = new Resource();
     HeightMapResource.ResourceType = ResourceType.HeightMap;
     HeightMapResource.Downloaded += new EventHandler((o, e) => { Build(); });
 }
Ejemplo n.º 4
0
 public Model()
 {
     ModelResource = new Resource();
     ModelResource.ResourceType = ResourceType.Model;
 }
Ejemplo n.º 5
0
 private static void Downloaded(Resource r)
 {
     r.AlertDownloaded();
     List<Resource> rc=NotDownloaded.Where(res => res.Url == r.Url&&res.ResourceType==r.ResourceType).ToList();
     foreach(Resource re in rc)
     {
         re.Data=r.Data;
         re.AlertDownloaded();
         NotDownloaded.Remove(re);
     }
 }