private void DoWork() { if (this.cache) { AsyncTextureLoad.LoadTextureFromCache(this.filename, ref this.buffer, ref this.size, ref this.width, ref this.height, ref this.format); return; } int num = 0; AsyncTextureLoad.LoadTextureFromFile(this.filename, ref this.buffer, ref this.size, ref this.width, ref this.height, ref num, this.normal, this.dither, this.hqmode); this.format = (num > 3 ? 12 : 10); }
public void LoadIntoTexture(Texture2D tex) { if (!this.isValid) { return; } if (tex.width != this.width || tex.height != this.height || (int)tex.format != this.format) { return; } TimeWarning.BeginSample("Texture2D.LoadRawTextureData"); tex.LoadRawTextureData(this.buffer, this.size); TimeWarning.EndSample(); TimeWarning.BeginSample("Texture2D.Apply"); tex.Apply(false); TimeWarning.EndSample(); TimeWarning.BeginSample("Native.FreeTexture"); AsyncTextureLoad.FreeTexture(ref this.buffer); TimeWarning.EndSample(); }
public void WriteToCache(string cachename) { AsyncTextureLoad.SaveTextureToCache(cachename, this.buffer, this.size, this.width, this.height, this.format); }