private bool TryRefreshEncode(EASTCENCODE t, out Texture image) { image = null; if (m_sourceTexture == null || !m_previewDirty) { return(false); } int sw_alpha = 4; bool need_pack = false; switch (t) { case EASTCENCODE.None: //show the source need_pack = false; break; case EASTCENCODE.E4x4: case EASTCENCODE.E5x5: case EASTCENCODE.E6x6: case EASTCENCODE.E8x8: case EASTCENCODE.E10x10: case EASTCENCODE.E12x12: need_pack = true; break; default: EditorUtility.DisplayDialog("提示", "暂不支持该格式", "确定"); break; } if (need_pack) { string file_path = GetSourceTextureFullPath(); var ptr = ASTCWrap.pack_and_unpack_image(file_path, (int)t, 0, sw_alpha, 0); image = DecodeImageData(ptr); } return(need_pack); }
static void OpenAstcPreView() { ASTCWrap.SetUnityError(LogError); EditorWindow.GetWindow <ASTCTool>("ASTC Preview"); }