protected override bool Load(DX11RenderContext context, string path, out DX11Texture2D result) { try { if (Path.GetExtension(path).ToLower() == ".tga") { result = null; return(false); } else { ImageLoadInformation info = ImageLoadInformation.FromDefaults(); if (this.FInNoMips[0]) { info.MipLevels = 1; } result = DX11Texture2D.FromFile(context, path, info); } #if DEBUG result.Resource.DebugName = "FileTexture"; #endif return(true); } catch { result = new DX11Texture2D(); return(false); } }
public DX11FileTexturePoolElement(DX11RenderContext context, string path, bool mips, bool async = false) { this.FileName = path; this.DoMips = mips; this.refcount = 1; if (async) { this.m_task = new FileTexture2dLoadTask(context, path, mips); m_task.StatusChanged += task_StatusChanged; context.ResourceScheduler.AddTask(m_task); } else { try { ImageLoadInformation info = ImageLoadInformation.FromDefaults(); if (!this.DoMips) { info.MipLevels = 1; } this.Texture = DX11Texture2D.FromFile(context, path, info); this.Status = eDX11SheduleTaskStatus.Completed; } catch { this.Status = eDX11SheduleTaskStatus.Error; } } }
public GPUDecoder() { ilf = ImageLoadInformation.FromDefaults(); ilf.BindFlags = BindFlags.ShaderResource; ilf.CpuAccessFlags = CpuAccessFlags.None; ilf.FirstMipLevel = 0; ilf.MipLevels = 1; ilf.Usage = ResourceUsage.Default; }
public WICDecoder(MemoryPool mempool) { mp = mempool; ilf = ImageLoadInformation.FromDefaults(); ilf.BindFlags = BindFlags.ShaderResource; ilf.CpuAccessFlags = CpuAccessFlags.None; ilf.FirstMipLevel = 0; ilf.MipLevels = 1; ilf.Usage = ResourceUsage.Default; }
protected override void DoProcess() { ImageLoadInformation info = ImageLoadInformation.FromDefaults(); if (!this.domips) { info.MipLevels = 1; } this.Resource = DX11Texture2D.FromFile(this.Context, path, info); }
public void SetPosition(DX11RenderContext ctx, int frame) { int frameindex = frame - this.CurrentFrame; frameindex = frameindex < 0 ? 0 : frameindex; frameindex = frameindex > Data.FileCount - 1 ? Data.FileCount - 1 : frameindex; if (frameindex != CurrentFrame) { if (this.Texture == null) { this.Texture.Dispose(); } ImageLoadInformation info = ImageLoadInformation.FromDefaults(); info.MipLevels = 1; this.Texture = DX11Texture2D.FromFile(ctx, Data.FilePath[frameindex], info); CurrentFrame = frameindex; } }
public static DX11Texture2D FromFile(DX11RenderContext context, string path) { return(DX11Texture2D.FromFile(context, path, ImageLoadInformation.FromDefaults())); }
public static DX11Texture2D FromMemory(DX11RenderContext context, byte[] data) { return(FromMemory(context, data, ImageLoadInformation.FromDefaults())); }