From b9d42c73f7451d06fe953e5e5242e93366ffcb22 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sat, 7 Feb 2026 22:23:17 +0800 Subject: [PATCH] fix: fix BMap export function implementation bug --- Assets/BMapBindings/BMapSharp/.gitignore | 5 +++++ .../BMapSharp/BMapSharpTest/TestSuits.cs | 22 +++++++++---------- Ballance/BMap/BMap/BMExports.cpp | 4 ++-- Ballance/BMap/BMap/BMap.cpp | 14 +++++++----- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Assets/BMapBindings/BMapSharp/.gitignore b/Assets/BMapBindings/BMapSharp/.gitignore index 8a30d25..4aa6b8a 100644 --- a/Assets/BMapBindings/BMapSharp/.gitignore +++ b/Assets/BMapBindings/BMapSharp/.gitignore @@ -1,3 +1,8 @@ +## ======== Personal ======== +# Remove I set environment variables for personal testing. +launchSettings.json + +## ======== Visual Studio ======== ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## diff --git a/Assets/BMapBindings/BMapSharp/BMapSharpTest/TestSuits.cs b/Assets/BMapBindings/BMapSharp/BMapSharpTest/TestSuits.cs index 4bb1b12..2dcf3a1 100644 --- a/Assets/BMapBindings/BMapSharp/BMapSharpTest/TestSuits.cs +++ b/Assets/BMapBindings/BMapSharp/BMapSharpTest/TestSuits.cs @@ -10,16 +10,16 @@ namespace BMapSharpTest.TestSuits { public static void Test(BMFileReader reader) { Console.WriteLine("===== Groups ====="); TestGroup(reader); - //Console.WriteLine("===== 3dObjects ====="); - //Test3dObject(reader); - //Console.WriteLine("===== Meshes ====="); - //TestMesh(reader); - //Console.WriteLine("===== Materials ====="); - //TestMaterial(reader); - //Console.WriteLine("===== Textures ====="); - //TestTexture(reader); - //Console.WriteLine("===== Target Lights ====="); - //TestTargetLight(reader); + Console.WriteLine("===== 3dObjects ====="); + Test3dObject(reader); + Console.WriteLine("===== Meshes ====="); + TestMesh(reader); + Console.WriteLine("===== Materials ====="); + TestMaterial(reader); + Console.WriteLine("===== Textures ====="); + TestTexture(reader); + Console.WriteLine("===== Target Lights ====="); + TestTargetLight(reader); Console.WriteLine("===== Target Cameras ====="); TestTargetCamera(reader); Console.WriteLine("===== END ====="); @@ -134,7 +134,7 @@ namespace BMapSharpTest.TestSuits { Console.WriteLine($"Fov: {cam.GetFov()}"); cam.GetAspectRatio(out var width, out var height); - Console.WriteLine($"Aspect Ratio: {width} x {height}"); + Console.WriteLine($"Aspect Ratio: {width}:{height}"); } } } diff --git a/Ballance/BMap/BMap/BMExports.cpp b/Ballance/BMap/BMap/BMExports.cpp index db8464b..e8e5577 100644 --- a/Ballance/BMap/BMap/BMExports.cpp +++ b/Ballance/BMap/BMap/BMExports.cpp @@ -1107,7 +1107,7 @@ bool BMCamera_SetFrontPlane(BMPARAM_OBJECT_DECL(bmfile, objid), BMPARAM_IN(LibCm bool BMCamera_GetBackPlane(BMPARAM_OBJECT_DECL(bmfile, objid), BMPARAM_OUT(LibCmo::CKFLOAT, out_val)) { auto obj = CheckCKCamera(bmfile, objid); if (obj == nullptr) return false; - BMPARAM_OUT_ASSIGN(out_val, obj->GetFrontPlane()); + BMPARAM_OUT_ASSIGN(out_val, obj->GetBackPlane()); return true; } bool BMCamera_SetBackPlane(BMPARAM_OBJECT_DECL(bmfile, objid), BMPARAM_IN(LibCmo::CKFLOAT, val)) { @@ -1119,7 +1119,7 @@ bool BMCamera_SetBackPlane(BMPARAM_OBJECT_DECL(bmfile, objid), BMPARAM_IN(LibCmo bool BMCamera_GetFov(BMPARAM_OBJECT_DECL(bmfile, objid), BMPARAM_OUT(LibCmo::CKFLOAT, out_val)) { auto obj = CheckCKCamera(bmfile, objid); if (obj == nullptr) return false; - BMPARAM_OUT_ASSIGN(out_val, obj->GetFrontPlane()); + BMPARAM_OUT_ASSIGN(out_val, obj->GetFov()); return true; } bool BMCamera_SetFov(BMPARAM_OBJECT_DECL(bmfile, objid), BMPARAM_IN(LibCmo::CKFLOAT, val)) { diff --git a/Ballance/BMap/BMap/BMap.cpp b/Ballance/BMap/BMap/BMap.cpp index 95eaa37..b5a2a51 100644 --- a/Ballance/BMap/BMap/BMap.cpp +++ b/Ballance/BMap/BMap/BMap.cpp @@ -178,13 +178,15 @@ namespace BMap { // BMFile only provide limited type visiting, we must make sure it provided ID also is existed in out stored list. // so we check its type here. if type is not matched, we reset it to nullptr. if (obj != nullptr) { + using LibCmo::CK2::CK_CLASSID; switch (obj->GetClassID()) { - case LibCmo::CK2::CK_CLASSID::CKCID_GROUP: - case LibCmo::CK2::CK_CLASSID::CKCID_3DOBJECT: - case LibCmo::CK2::CK_CLASSID::CKCID_MESH: - case LibCmo::CK2::CK_CLASSID::CKCID_MATERIAL: - case LibCmo::CK2::CK_CLASSID::CKCID_TEXTURE: - case LibCmo::CK2::CK_CLASSID::CKCID_TARGETLIGHT: + case CK_CLASSID::CKCID_GROUP: + case CK_CLASSID::CKCID_3DOBJECT: + case CK_CLASSID::CKCID_MESH: + case CK_CLASSID::CKCID_MATERIAL: + case CK_CLASSID::CKCID_TEXTURE: + case CK_CLASSID::CKCID_TARGETLIGHT: + case CK_CLASSID::CKCID_TARGETCAMERA: break; // okey. do nothing default: // this object should not be exposed to outside, reset it to nullptr