add feature
- add exmaple cmake configure command in README. - change BMap::Save interface to support compression and texture save opt switches. - update PyBMap due to the change of BMap.
This commit is contained in:
@ -137,10 +137,12 @@ bool BMFile_Create(
|
||||
bool BMFile_Save(
|
||||
BMPARAM_IN(BMap::BMFile*, map_file),
|
||||
BMPARAM_IN(LibCmo::CKSTRING, file_name),
|
||||
BMPARAM_IN(LibCmo::CK2::CK_TEXTURE_SAVEOPTIONS, texture_save_opt),
|
||||
BMPARAM_IN(bool, use_compress),
|
||||
BMPARAM_IN(LibCmo::CKINT, compreess_level)) {
|
||||
if (!CheckBMFile(map_file)) return false;
|
||||
|
||||
return map_file->Save(file_name, compreess_level);
|
||||
return map_file->Save(file_name, texture_save_opt, use_compress, compreess_level);
|
||||
}
|
||||
|
||||
bool BMFile_Free(BMPARAM_IN(BMap::BMFile*, map_file)) {
|
||||
|
@ -90,6 +90,8 @@ LIBCMO_EXPORT bool BMFile_Create(
|
||||
LIBCMO_EXPORT bool BMFile_Save(
|
||||
BMPARAM_IN(BMap::BMFile*, map_file),
|
||||
BMPARAM_IN(LibCmo::CKSTRING, file_name),
|
||||
BMPARAM_IN(LibCmo::CK2::CK_TEXTURE_SAVEOPTIONS, texture_save_opt),
|
||||
BMPARAM_IN(bool, use_compress),
|
||||
BMPARAM_IN(LibCmo::CKINT, compreess_level)
|
||||
);
|
||||
LIBCMO_EXPORT bool BMFile_Free(
|
||||
|
@ -28,7 +28,7 @@ namespace BMap {
|
||||
m_ProcVertexs(), m_ProcFaces(), m_ProcDupRemover() {}
|
||||
|
||||
BMMeshTransition::~BMMeshTransition() {}
|
||||
|
||||
|
||||
bool BMMeshTransition::PrepareVertexCount(LibCmo::CKDWORD count) {
|
||||
if (m_IsParsed) return false;
|
||||
m_Vertexs.resize(count);
|
||||
@ -240,7 +240,7 @@ namespace BMap {
|
||||
if (raw_callback != nullptr) {
|
||||
m_Context->SetOutputCallback([raw_callback](LibCmo::CKSTRING strl) -> void {
|
||||
raw_callback(strl);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// set temp folder and texture folder
|
||||
@ -268,7 +268,7 @@ namespace BMap {
|
||||
|
||||
bool BMFile::Load(LibCmo::CKSTRING filename) {
|
||||
if (!CanExecLoad()) return false;
|
||||
|
||||
|
||||
// create temp ckfile and load
|
||||
LibCmo::CK2::CKFileReader reader(m_Context);
|
||||
LibCmo::CK2::CKERROR err = reader.DeepLoad(filename);
|
||||
@ -312,7 +312,7 @@ namespace BMap {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BMFile::Save(LibCmo::CKSTRING filename, LibCmo::CKINT compress_level) {
|
||||
bool BMFile::Save(LibCmo::CKSTRING filename, LibCmo::CK2::CK_TEXTURE_SAVEOPTIONS texture_save_opt, bool use_compress, LibCmo::CKINT compress_level) {
|
||||
if (!CanExecSave()) return false;
|
||||
|
||||
// create temp writer
|
||||
@ -335,8 +335,15 @@ namespace BMap {
|
||||
writer.AddSavedObject(m_Context->GetObject(id));
|
||||
}
|
||||
|
||||
// set global texture save mode
|
||||
m_Context->SetGlobalImagesSaveOptions(texture_save_opt);
|
||||
// set compress level
|
||||
m_Context->SetCompressionLevel(compress_level);
|
||||
if (use_compress) {
|
||||
m_Context->SetFileWriteMode(LibCmo::CK2::CK_FILE_WRITEMODE::CKFILE_WHOLECOMPRESSED);
|
||||
m_Context->SetCompressionLevel(compress_level);
|
||||
} else {
|
||||
m_Context->SetFileWriteMode(LibCmo::CK2::CK_FILE_WRITEMODE::CKFILE_UNCOMPRESSED);
|
||||
}
|
||||
|
||||
// save to file and detect error
|
||||
LibCmo::CK2::CKERROR err = writer.Save(filename);
|
||||
|
@ -70,7 +70,7 @@ namespace BMap {
|
||||
|
||||
public:
|
||||
bool Load(LibCmo::CKSTRING filename);
|
||||
bool Save(LibCmo::CKSTRING filename, LibCmo::CKINT compress_level);
|
||||
bool Save(LibCmo::CKSTRING filename, LibCmo::CK2::CK_TEXTURE_SAVEOPTIONS texture_save_opt, bool use_compress, LibCmo::CKINT compress_level);
|
||||
|
||||
LibCmo::CK2::ObjImpls::CKObject* GetObjectPtr(LibCmo::CK2::CK_ID objid) {
|
||||
return m_Context->GetObject(objid);;
|
||||
|
Reference in New Issue
Block a user