예제 #1
0
파일: Mesh.cs 프로젝트: keyvank/i3dml
 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;
 }
예제 #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();
 }
예제 #3
0
파일: HeightMap.cs 프로젝트: keyvank/i3dml
 public HeightMap()
 {
     HeightMapResource = new Resource();
     HeightMapResource.ResourceType = ResourceType.HeightMap;
     HeightMapResource.Downloaded += new EventHandler((o, e) => { Build(); });
 }
예제 #4
0
파일: Model.cs 프로젝트: keyvank/i3dml
 public Model()
 {
     ModelResource = new Resource();
     ModelResource.ResourceType = ResourceType.Model;
 }
예제 #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);
     }
 }