private TexFile GetTexFile(ParamTex tex) { if(null == tex) return null; var name = Path.GetFileName(tex.TexAsset); name = Path.ChangeExtension(name, ".tex"); var texinfo = DataManager.Instance.FindItem(name); var texfile = TexFile.FromFile(((TexSummary)texinfo).FileName); return texfile; }
private BitmapTexture CreateBitmapTexture(ParamTex tex) { if(null == tex) return null; BitmapTexture bmptex; if(Bitmaps.TryGetValue(tex.TexAsset, out bmptex)) return bmptex; var name = Path.GetFileName(tex.TexAsset); var texname = Path.ChangeExtension(name, ".tex"); var texinfo = DataManager.Instance.FindItem(texname) as TexSummary; if(null == texinfo) return null; var texdata = TexFile.FromFile(texinfo.FileName); var texfile = Path.Combine(Directory, name); File.WriteAllBytes(texfile, texdata.ImageData); bmptex = new BitmapTexture(); bmptex.ID = "Bitmap-"+Path.GetFileNameWithoutExtension(name); bmptex.Name = "Bitmap-"+Path.GetFileNameWithoutExtension(name); bmptex.FileName= texfile; Root.Instances.Add(bmptex); Bitmaps.Add(tex.TexAsset, bmptex); return bmptex; }