From b477c468cdb2a013a3aea2e21fbb20cc019e02d2 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Mon, 2 Oct 2023 17:45:59 +0800 Subject: [PATCH] fix some saving result issue --- LibCmo/CK2/CKBitmapData.cpp | 10 ++++++++-- Unvirt/UnvirtContext.cpp | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/LibCmo/CK2/CKBitmapData.cpp b/LibCmo/CK2/CKBitmapData.cpp index 876c3b9..22502a2 100644 --- a/LibCmo/CK2/CKBitmapData.cpp +++ b/LibCmo/CK2/CKBitmapData.cpp @@ -653,8 +653,10 @@ namespace LibCmo::CK2 { } void CKBitmapData::SetCubeMap(bool is_cube) { + // MARK: originally we should resize solot to 6 exactly. + // but we decide split the flag settings and slot. + // User should set slot count manually. if (is_cube) { - SetSlotCount(6); EnumsHelper::Add(m_BitmapFlags, CK_BITMAPDATA_FLAGS::CKBITMAPDATA_CUBEMAP); } else { EnumsHelper::Rm(m_BitmapFlags, CK_BITMAPDATA_FLAGS::CKBITMAPDATA_CUBEMAP); @@ -694,7 +696,11 @@ namespace LibCmo::CK2 { } void CKBitmapData::SetTransparentColor(CKDWORD col) { - SetTransparent(true); + // MARK: originally, we should set CK_BITMAPDATA_FLAGS::CKBITMAPDATA_TRANSPARENT for m_BitmapFlags. + // but in CKTexture::Read(), I don't know why Virtools use this fucking design. Virtools split the enable and color data self, + // and always write Transparent Color no matter whether Transparent enabled. + // so i split transparent enable function and transparent color. User should manually enable transparent if they needed. + // Just set transparent color will not enable transparent automatically. m_TransColor = col; } diff --git a/Unvirt/UnvirtContext.cpp b/Unvirt/UnvirtContext.cpp index 4d980c0..9d33350 100644 --- a/Unvirt/UnvirtContext.cpp +++ b/Unvirt/UnvirtContext.cpp @@ -154,6 +154,7 @@ namespace Unvirt::Context { LibCmo::CK2::CKStartUp(); m_Ctx = new LibCmo::CK2::CKContext(); m_Ctx->SetOutputCallback(std::bind(&UnvirtContext::PrintContextMsg, this, std::placeholders::_1)); + m_Ctx->SetGlobalImagesSaveOptions(LibCmo::CK2::CK_TEXTURE_SAVEOPTIONS::CKTEXTURE_EXTERNAL); } UnvirtContext::~UnvirtContext() {