public static int ReadDeferred(IntPtr dst, int dst_num, twPixelFormat dst_fmt, Texture src_tex, int id) { if (IsCompressed(src_tex)) { Debug.LogError("TextureWriter: texture format must be uncompressed"); return(0); } return(twReadTextureDeferred( dst, dst_num, dst_fmt, src_tex.GetNativeTexturePtr(), src_tex.width, src_tex.height, twGetPixelFormat(src_tex), id)); }
public static int WriteDeferred(Texture dst_tex, IntPtr src, int src_num, twPixelFormat src_fmt, int id) { if (IsCompressed(dst_tex)) { Debug.LogError("TextureWriter: texture format must be uncompressed"); return(0); } return(twWriteTextureDeferred( dst_tex.GetNativeTexturePtr(), dst_tex.width, dst_tex.height, twGetPixelFormat(dst_tex), src, src_num, src_fmt, id)); }
public static int twGetPixelSize(twPixelFormat format) { switch (format) { case twPixelFormat.RGBAu8: return(4); case twPixelFormat.RGBu8: return(3); case twPixelFormat.RGu8: return(2); case twPixelFormat.Ru8: return(1); case twPixelFormat.RGBAf16: case twPixelFormat.RGBAi16: return(8); case twPixelFormat.RGBf16: case twPixelFormat.RGBi16: return(6); case twPixelFormat.RGf16: case twPixelFormat.RGi16: return(4); case twPixelFormat.Rf16: case twPixelFormat.Ri16: return(2); case twPixelFormat.RGBAf32: case twPixelFormat.RGBAi32: return(16); case twPixelFormat.RGBf32: case twPixelFormat.RGBi32: return(12); case twPixelFormat.RGf32: case twPixelFormat.RGi32: return(8); case twPixelFormat.Rf32: case twPixelFormat.Ri32: return(4); } return(0); }
private static extern int twReadTextureDeferred( IntPtr dst, int dst_num, twPixelFormat dst_fmt, IntPtr src_tex, int src_width, int src_height, twPixelFormat src_fmt, int id);
private static extern Bool twReadTexture( IntPtr dst, int dst_num, twPixelFormat dst_fmt, IntPtr src_tex, int src_width, int src_height, twPixelFormat src_fmt);
private static extern Bool twWriteTexture( IntPtr dst_tex, int dst_width, int dst_height, twPixelFormat dst_fmt, IntPtr src, int src_num, twPixelFormat src_fmt);