Compare commits
5 Commits
6bb2421e1f
...
v0.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
| af6a50c2f9 | |||
| 0bf0519c4c | |||
| c18ff8f2e3 | |||
| fe4a58e864 | |||
| eaeaf956b5 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -5,6 +5,9 @@
|
||||
*.nms
|
||||
*.vmo
|
||||
|
||||
# Ignore CMake generated version header
|
||||
LibCmo/VTVersion.hpp
|
||||
|
||||
# Ignore temporary Visual Studio files and folders
|
||||
temp/
|
||||
out/
|
||||
|
||||
@@ -42,8 +42,8 @@ _Ty CheckGeneralObject(BMap::BMFile* possible_bmfile, LibCmo::CK2::CK_ID possibl
|
||||
|
||||
#define CheckCKObject(bmfile, objid) CheckGeneralObject<LibCmo::CK2::ObjImpls::CKObject*>(bmfile, objid, LibCmo::CK2::CK_CLASSID::CKCID_OBJECT)
|
||||
#define CheckCKGroup(bmfile, objid) CheckGeneralObject<LibCmo::CK2::ObjImpls::CKGroup*>(bmfile, objid, LibCmo::CK2::CK_CLASSID::CKCID_GROUP)
|
||||
#define CheckCK3dEntity(bmfile, objid) CheckGeneralObject<LibCmo::CK2::ObjImpls::CK3dObject*>(bmfile, objid, LibCmo::CK2::CK_CLASSID::CKCID_3DENTITY)
|
||||
#define CheckCK3dObject(bmfile, objid) CheckGeneralObject<LibCmo::CK2::ObjImpls::CK3dEntity*>(bmfile, objid, LibCmo::CK2::CK_CLASSID::CKCID_3DOBJECT)
|
||||
#define CheckCK3dEntity(bmfile, objid) CheckGeneralObject<LibCmo::CK2::ObjImpls::CK3dEntity*>(bmfile, objid, LibCmo::CK2::CK_CLASSID::CKCID_3DENTITY)
|
||||
#define CheckCK3dObject(bmfile, objid) CheckGeneralObject<LibCmo::CK2::ObjImpls::CK3dObject*>(bmfile, objid, LibCmo::CK2::CK_CLASSID::CKCID_3DOBJECT)
|
||||
#define CheckCKMesh(bmfile, objid) CheckGeneralObject<LibCmo::CK2::ObjImpls::CKMesh*>(bmfile, objid, LibCmo::CK2::CK_CLASSID::CKCID_MESH)
|
||||
#define CheckCKMaterial(bmfile, objid) CheckGeneralObject<LibCmo::CK2::ObjImpls::CKMaterial*>(bmfile, objid, LibCmo::CK2::CK_CLASSID::CKCID_MATERIAL)
|
||||
#define CheckCKTexture(bmfile, objid) CheckGeneralObject<LibCmo::CK2::ObjImpls::CKTexture*>(bmfile, objid, LibCmo::CK2::CK_CLASSID::CKCID_TEXTURE)
|
||||
|
||||
@@ -453,6 +453,28 @@ namespace BMapSharp {
|
||||
[DllImport(g_DllName, EntryPoint = "BMFile_CreateTexture", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMFile_CreateTexture([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [Out, MarshalAs(UnmanagedType.U4)] out uint out_id);
|
||||
/// <summary>BMFile_GetTargetLightCount</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="out_count">Type: LibCmo::CKDWORD. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMFile_GetTargetLightCount", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMFile_GetTargetLightCount([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [Out, MarshalAs(UnmanagedType.U4)] out uint out_count);
|
||||
/// <summary>BMFile_GetTargetLight</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="idx">Type: LibCmo::CKDWORD. </param>
|
||||
/// <param name="out_id">Type: LibCmo::CK2::CK_ID. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMFile_GetTargetLight", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMFile_GetTargetLight([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint idx, [Out, MarshalAs(UnmanagedType.U4)] out uint out_id);
|
||||
/// <summary>BMFile_CreateTargetLight</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="out_id">Type: LibCmo::CK2::CK_ID. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMFile_CreateTargetLight", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMFile_CreateTargetLight([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [Out, MarshalAs(UnmanagedType.U4)] out uint out_id);
|
||||
/// <summary>BMMeshTrans_New</summary>
|
||||
/// <param name="out_trans">Type: BMap::BMMeshTransition*. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
@@ -1151,54 +1173,198 @@ namespace BMapSharp {
|
||||
[DllImport(g_DllName, EntryPoint = "BMMesh_SetMaterialSlot", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMMesh_SetMaterialSlot([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.U4)] uint index, [In, MarshalAs(UnmanagedType.U4)] uint mtlid);
|
||||
/// <summary>BM3dObject_GetWorldMatrix</summary>
|
||||
/// <summary>BM3dEntity_GetWorldMatrix</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_mat">Type: LibCmo::VxMath::VxMatrix. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dObject_GetWorldMatrix", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dEntity_GetWorldMatrix", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BM3dObject_GetWorldMatrix([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.Struct)] out VxMatrix out_mat);
|
||||
/// <summary>BM3dObject_SetWorldMatrix</summary>
|
||||
internal static extern bool BM3dEntity_GetWorldMatrix([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.Struct)] out VxMatrix out_mat);
|
||||
/// <summary>BM3dEntity_SetWorldMatrix</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="mat">Type: LibCmo::VxMath::VxMatrix. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dObject_SetWorldMatrix", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dEntity_SetWorldMatrix", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BM3dObject_SetWorldMatrix([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.Struct)] VxMatrix mat);
|
||||
/// <summary>BM3dObject_GetCurrentMesh</summary>
|
||||
internal static extern bool BM3dEntity_SetWorldMatrix([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.Struct)] VxMatrix mat);
|
||||
/// <summary>BM3dEntity_GetCurrentMesh</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_meshid">Type: LibCmo::CK2::CK_ID. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dObject_GetCurrentMesh", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dEntity_GetCurrentMesh", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BM3dObject_GetCurrentMesh([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.U4)] out uint out_meshid);
|
||||
/// <summary>BM3dObject_SetCurrentMesh</summary>
|
||||
internal static extern bool BM3dEntity_GetCurrentMesh([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.U4)] out uint out_meshid);
|
||||
/// <summary>BM3dEntity_SetCurrentMesh</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="meshid">Type: LibCmo::CK2::CK_ID. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dObject_SetCurrentMesh", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dEntity_SetCurrentMesh", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BM3dObject_SetCurrentMesh([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.U4)] uint meshid);
|
||||
/// <summary>BM3dObject_GetVisibility</summary>
|
||||
internal static extern bool BM3dEntity_SetCurrentMesh([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.U4)] uint meshid);
|
||||
/// <summary>BM3dEntity_GetVisibility</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_isVisible">Type: bool. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dObject_GetVisibility", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dEntity_GetVisibility", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BM3dObject_GetVisibility([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.U1)] out bool out_isVisible);
|
||||
/// <summary>BM3dObject_SetVisibility</summary>
|
||||
internal static extern bool BM3dEntity_GetVisibility([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.U1)] out bool out_isVisible);
|
||||
/// <summary>BM3dEntity_SetVisibility</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="is_visible">Type: bool. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dObject_SetVisibility", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[DllImport(g_DllName, EntryPoint = "BM3dEntity_SetVisibility", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BM3dObject_SetVisibility([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.U1)] bool is_visible);
|
||||
internal static extern bool BM3dEntity_SetVisibility([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.U1)] bool is_visible);
|
||||
/// <summary>BMLight_GetType</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_val">Type: LibCmo::VxMath::VXLIGHT_TYPE. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_GetType", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_GetType([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.U4)] out VXLIGHT_TYPE out_val);
|
||||
/// <summary>BMLight_SetType</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="val">Type: LibCmo::VxMath::VXLIGHT_TYPE. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_SetType", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_SetType([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.U4)] VXLIGHT_TYPE val);
|
||||
/// <summary>BMLight_GetColor</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_val">Type: LibCmo::VxMath::VxColor. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_GetColor", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_GetColor([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.Struct)] out VxColor out_val);
|
||||
/// <summary>BMLight_SetColor</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="col">Type: LibCmo::VxMath::VxColor. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_SetColor", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_SetColor([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.Struct)] VxColor col);
|
||||
/// <summary>BMLight_GetConstantAttenuation</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_val">Type: LibCmo::CKFLOAT. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_GetConstantAttenuation", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_GetConstantAttenuation([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.R4)] out float out_val);
|
||||
/// <summary>BMLight_SetConstantAttenuation</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="val">Type: LibCmo::CKFLOAT. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_SetConstantAttenuation", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_SetConstantAttenuation([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.R4)] float val);
|
||||
/// <summary>BMLight_GetLinearAttenuation</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_val">Type: LibCmo::CKFLOAT. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_GetLinearAttenuation", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_GetLinearAttenuation([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.R4)] out float out_val);
|
||||
/// <summary>BMLight_SetLinearAttenuation</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="val">Type: LibCmo::CKFLOAT. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_SetLinearAttenuation", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_SetLinearAttenuation([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.R4)] float val);
|
||||
/// <summary>BMLight_GetQuadraticAttenuation</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_val">Type: LibCmo::CKFLOAT. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_GetQuadraticAttenuation", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_GetQuadraticAttenuation([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.R4)] out float out_val);
|
||||
/// <summary>BMLight_SetQuadraticAttenuation</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="val">Type: LibCmo::CKFLOAT. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_SetQuadraticAttenuation", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_SetQuadraticAttenuation([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.R4)] float val);
|
||||
/// <summary>BMLight_GetRange</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_val">Type: LibCmo::CKFLOAT. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_GetRange", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_GetRange([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.R4)] out float out_val);
|
||||
/// <summary>BMLight_SetRange</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="val">Type: LibCmo::CKFLOAT. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_SetRange", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_SetRange([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.R4)] float val);
|
||||
/// <summary>BMLight_GetHotSpot</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_val">Type: LibCmo::CKFLOAT. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_GetHotSpot", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_GetHotSpot([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.R4)] out float out_val);
|
||||
/// <summary>BMLight_SetHotSpot</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="val">Type: LibCmo::CKFLOAT. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_SetHotSpot", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_SetHotSpot([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.R4)] float val);
|
||||
/// <summary>BMLight_GetFalloff</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_val">Type: LibCmo::CKFLOAT. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_GetFalloff", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_GetFalloff([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.R4)] out float out_val);
|
||||
/// <summary>BMLight_SetFalloff</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="val">Type: LibCmo::CKFLOAT. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_SetFalloff", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_SetFalloff([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.R4)] float val);
|
||||
/// <summary>BMLight_GetFalloffShape</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="out_val">Type: LibCmo::CKFLOAT. This is OUT parameter. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_GetFalloffShape", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_GetFalloffShape([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [Out, MarshalAs(UnmanagedType.R4)] out float out_val);
|
||||
/// <summary>BMLight_SetFalloffShape</summary>
|
||||
/// <param name="bmfile">Type: BMap::BMFile*. The pointer to corresponding BMFile.</param>
|
||||
/// <param name="objid">Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.</param>
|
||||
/// <param name="val">Type: LibCmo::CKFLOAT. </param>
|
||||
/// <returns>True if no error, otherwise False.</returns>
|
||||
[DllImport(g_DllName, EntryPoint = "BMLight_SetFalloffShape", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static extern bool BMLight_SetFalloffShape([In, MarshalAs(UnmanagedType.SysInt)] IntPtr bmfile, [In, MarshalAs(UnmanagedType.U4)] uint objid, [In, MarshalAs(UnmanagedType.R4)] float val);
|
||||
|
||||
// ##### GENERATED FUNCTIONS END #####
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ namespace BMapSharp.BMapWrapper {
|
||||
BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceMaterialSlotIndexs(getPointer(), getCKID(), out IntPtr out_mem));
|
||||
Utils.ShortAssigner(out_mem, GetFaceCount(), iem);
|
||||
}
|
||||
|
||||
|
||||
public uint GetMaterialSlotCount() => getGenericValue<uint>(BMap.BMMesh_GetMaterialSlotCount);
|
||||
public void SetMaterialSlotCount(uint count) => setGenericValue<uint>(BMap.BMMesh_SetMaterialSlotCount, count);
|
||||
public IEnumerable<BMMaterial> GetMaterialSlots() {
|
||||
@@ -375,24 +375,61 @@ namespace BMapSharp.BMapWrapper {
|
||||
|
||||
}
|
||||
|
||||
public class BM3dObject : BMObject {
|
||||
internal BM3dObject(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
public class BM3dEntity : BMObject {
|
||||
internal BM3dEntity(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
|
||||
public VxMatrix GetWorldMatrix() => getGenericValue<VxMatrix>(BMap.BM3dObject_GetWorldMatrix);
|
||||
public void SetWorldMatrix(VxMatrix mat) => setGenericValue<VxMatrix>(BMap.BM3dObject_SetWorldMatrix, mat);
|
||||
public VxMatrix GetWorldMatrix() => getGenericValue<VxMatrix>(BMap.BM3dEntity_GetWorldMatrix);
|
||||
public void SetWorldMatrix(VxMatrix mat) => setGenericValue<VxMatrix>(BMap.BM3dEntity_SetWorldMatrix, mat);
|
||||
|
||||
public BMMesh GetCurrentMesh() {
|
||||
BMapException.ThrowIfFailed(BMap.BM3dObject_GetCurrentMesh(getPointer(), getCKID(), out uint out_meshid));
|
||||
BMapException.ThrowIfFailed(BMap.BM3dEntity_GetCurrentMesh(getPointer(), getCKID(), out uint out_meshid));
|
||||
if (out_meshid == Utils.INVALID_CKID) return null;
|
||||
else return new BMMesh(getPointer(), out_meshid);
|
||||
}
|
||||
public void SetCurrentMesh(BMMesh mesh) {
|
||||
uint meshid = (mesh is null) ? Utils.INVALID_CKID : mesh.getCKID();
|
||||
BMapException.ThrowIfFailed(BMap.BM3dObject_SetCurrentMesh(getPointer(), getCKID(), meshid));
|
||||
BMapException.ThrowIfFailed(BMap.BM3dEntity_SetCurrentMesh(getPointer(), getCKID(), meshid));
|
||||
}
|
||||
|
||||
public bool GetVisibility() => getGenericValue<bool>(BMap.BM3dObject_GetVisibility);
|
||||
public void SetVisibility(bool visb) => setGenericValue<bool>(BMap.BM3dObject_SetVisibility, visb);
|
||||
public bool GetVisibility() => getGenericValue<bool>(BMap.BM3dEntity_GetVisibility);
|
||||
public void SetVisibility(bool visb) => setGenericValue<bool>(BMap.BM3dEntity_SetVisibility, visb);
|
||||
}
|
||||
|
||||
public class BM3dObject : BM3dEntity {
|
||||
internal BM3dObject(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
}
|
||||
|
||||
public class BMLight : BM3dEntity {
|
||||
internal BMLight(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
|
||||
// Name `GetType` is conflict with C# base class function name.
|
||||
// So we add a `Light` prefix for it.
|
||||
public VXLIGHT_TYPE GetLightType() => getGenericValue<VXLIGHT_TYPE>(BMap.BMLight_GetType);
|
||||
public void SetLightType(VXLIGHT_TYPE val) => setGenericValue<VXLIGHT_TYPE>(BMap.BMLight_SetType, val);
|
||||
|
||||
public VxColor GetColor() => getGenericValue<VxColor>(BMap.BMLight_GetColor);
|
||||
public void SetColor(VxColor col) => setGenericValue<VxColor>(BMap.BMLight_SetColor, col);
|
||||
|
||||
public float GetConstantAttenuation() => getGenericValue<float>(BMap.BMLight_GetConstantAttenuation);
|
||||
public void SetConstantAttenuation(float val) => setGenericValue<float>(BMap.BMLight_SetConstantAttenuation, val);
|
||||
public float GetLinearAttenuation() => getGenericValue<float>(BMap.BMLight_GetLinearAttenuation);
|
||||
public void SetLinearAttenuation(float val) => setGenericValue<float>(BMap.BMLight_SetLinearAttenuation, val);
|
||||
public float GetQuadraticAttenuation() => getGenericValue<float>(BMap.BMLight_GetQuadraticAttenuation);
|
||||
public void SetQuadraticAttenuation(float val) => setGenericValue<float>(BMap.BMLight_SetQuadraticAttenuation, val);
|
||||
|
||||
public float GetRange() => getGenericValue<float>(BMap.BMLight_GetRange);
|
||||
public void SetRange(float val) => setGenericValue<float>(BMap.BMLight_SetRange, val);
|
||||
|
||||
public float GetHotSpot() => getGenericValue<float>(BMap.BMLight_GetHotSpot);
|
||||
public void SetHotSpot(float val) => setGenericValue<float>(BMap.BMLight_SetHotSpot, val);
|
||||
public float GetFalloff() => getGenericValue<float>(BMap.BMLight_GetFalloff);
|
||||
public void SetFalloff(float val) => setGenericValue<float>(BMap.BMLight_SetFalloff, val);
|
||||
public float GetFalloffShape() => getGenericValue<float>(BMap.BMLight_GetFalloffShape);
|
||||
public void SetFalloffShape(float val) => setGenericValue<float>(BMap.BMLight_SetFalloffShape, val);
|
||||
}
|
||||
|
||||
public class BMTargetLight : BMLight {
|
||||
internal BMTargetLight(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
|
||||
}
|
||||
|
||||
public class BMGroup : BMObject {
|
||||
@@ -463,6 +500,10 @@ namespace BMapSharp.BMapWrapper {
|
||||
getCKObjectCount(BMap.BMFile_GetGroupCount);
|
||||
public IEnumerable<BMGroup> GetGroups() =>
|
||||
getCKObjects<BMGroup>(BMap.BMFile_GetGroupCount, BMap.BMFile_GetGroup, (bmf, id) => new BMGroup(bmf, id));
|
||||
public uint GetTargetLightCount() =>
|
||||
getCKObjectCount(BMap.BMFile_GetTargetLightCount);
|
||||
public IEnumerable<BMTargetLight> GetTargetLights() =>
|
||||
getCKObjects<BMTargetLight>(BMap.BMFile_GetTargetLightCount, BMap.BMFile_GetTargetLight, (bmf, id) => new BMTargetLight(bmf, id));
|
||||
|
||||
}
|
||||
|
||||
@@ -504,6 +545,7 @@ namespace BMapSharp.BMapWrapper {
|
||||
public BMMesh CreateMesh() => createCKObject<BMMesh>(BMap.BMFile_CreateMesh, (bmf, id) => new BMMesh(bmf, id));
|
||||
public BM3dObject Create3dObject() => createCKObject<BM3dObject>(BMap.BMFile_Create3dObject, (bmf, id) => new BM3dObject(bmf, id));
|
||||
public BMGroup CreateGroup() => createCKObject<BMGroup>(BMap.BMFile_CreateGroup, (bmf, id) => new BMGroup(bmf, id));
|
||||
public BMTargetLight CreateTargetLight() => createCKObject<BMTargetLight>(BMap.BMFile_CreateTargetLight, (bmf, id) => new BMTargetLight(bmf, id));
|
||||
}
|
||||
|
||||
public sealed class BMMeshTrans : AbstractPointer {
|
||||
|
||||
@@ -226,6 +226,13 @@ namespace BMapSharp.VirtoolsTypes {
|
||||
_4_ARGB8888_CLUT = 31, /**< 4 bits indexed CLUT (ARGB) */
|
||||
}
|
||||
|
||||
public enum VXLIGHT_TYPE : uint {
|
||||
VX_LIGHTPOINT = 1, /**< The Light is a point of light */
|
||||
VX_LIGHTSPOT = 2, /**< The light is a spotlight */
|
||||
VX_LIGHTDIREC = 3, /**< The light is directional light : Lights comes from an infinite point so only direction of light can be given */
|
||||
// VX_LIGHTPARA = 4UL, /**< Obsolete, do not use */
|
||||
}
|
||||
|
||||
public enum VXTEXTURE_BLENDMODE : uint {
|
||||
VXTEXTUREBLEND_DECAL = 1, /**< Texture replace any material information */
|
||||
VXTEXTUREBLEND_MODULATE = 2, /**< Texture and material are combine. Alpha information of the texture replace material alpha component. */
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
<ProjectReference Include="..\BMapSharp\BMapSharp.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
||||
@@ -3,11 +3,19 @@ using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.CommandLine;
|
||||
|
||||
namespace BMapSharpTestbench {
|
||||
internal class Program {
|
||||
|
||||
static void Main(string[] args) {
|
||||
// Parse arguments
|
||||
var resolved_args = ResolveArguments(args);
|
||||
if (resolved_args is null) {
|
||||
// just silent quit
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
// Check environment
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
if (!BMapSharp.BMapWrapper.Utils.IsBMapAvailable()) {
|
||||
@@ -21,10 +29,10 @@ namespace BMapSharpTestbench {
|
||||
Console.ReadKey(true);
|
||||
|
||||
// Start testbench
|
||||
string file_name = "Level_02.NMO";
|
||||
string temp_folder = "Temp";
|
||||
string texture_folder = "F:\\Ballance\\Ballance\\Textures";
|
||||
string[] encodings = ["cp1252", "gb2312"];
|
||||
string file_name = resolved_args.mFileName; // "LightCameraTest.nmo";
|
||||
string temp_folder = resolved_args.mTempFolder; // "Temp";
|
||||
string texture_folder = resolved_args.mTextureFolder; // "F:\\Ballance\\Ballance\\Textures";
|
||||
string[] encodings = resolved_args.mEncodings; // ["cp1252", "gb2312"];
|
||||
|
||||
using (var reader = new BMapSharp.BMapWrapper.BMFileReader(file_name, temp_folder, texture_folder, encodings)) {
|
||||
TestCommon(reader);
|
||||
@@ -36,6 +44,53 @@ namespace BMapSharpTestbench {
|
||||
|
||||
}
|
||||
|
||||
class BMapSharpArguments {
|
||||
public string mFileName;
|
||||
public string mTempFolder;
|
||||
public string mTextureFolder;
|
||||
public string[] mEncodings;
|
||||
}
|
||||
|
||||
static BMapSharpArguments ResolveArguments(string[] args) {
|
||||
// define arguments
|
||||
var fileNameOpt = new Option<string>
|
||||
("--file-path", "The path to input Virtools file.");
|
||||
fileNameOpt.IsRequired = true;
|
||||
var tempFolderOpt = new Option<string>
|
||||
("--temp-dir", "The temp folder used by BMap.");
|
||||
tempFolderOpt.IsRequired = true;
|
||||
var textureFolderOpt = new Option<string>
|
||||
("--texture-dir", "The texture folder containing Ballance texture resources.");
|
||||
textureFolderOpt.IsRequired = true;
|
||||
var encodingsOpt = new Option<IEnumerable<string>>
|
||||
("--encodings", "The encodings used to parse the names stroed in input Virtools file.");
|
||||
encodingsOpt.IsRequired = true;
|
||||
encodingsOpt.Arity = ArgumentArity.OneOrMore;
|
||||
encodingsOpt.AllowMultipleArgumentsPerToken = true;
|
||||
|
||||
// init root command
|
||||
var rootCommand = new RootCommand("The testbench of BMapSharp.");
|
||||
rootCommand.Add(fileNameOpt);
|
||||
rootCommand.Add(tempFolderOpt);
|
||||
rootCommand.Add(textureFolderOpt);
|
||||
rootCommand.Add(encodingsOpt);
|
||||
|
||||
// init result container
|
||||
BMapSharpArguments ret = new BMapSharpArguments();
|
||||
// set handler
|
||||
rootCommand.SetHandler((context) => {
|
||||
ret.mFileName = context.ParseResult.GetValueForOption(fileNameOpt);
|
||||
ret.mTempFolder = context.ParseResult.GetValueForOption(tempFolderOpt);
|
||||
ret.mTextureFolder = context.ParseResult.GetValueForOption(textureFolderOpt);
|
||||
ret.mEncodings = context.ParseResult.GetValueForOption(encodingsOpt).ToArray();
|
||||
context.ExitCode = 61;
|
||||
});
|
||||
|
||||
// execute root command and return value.
|
||||
if (rootCommand.Invoke(args) != 61) return null;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void TestCommon(BMapSharp.BMapWrapper.BMFileReader reader) {
|
||||
// Console.WriteLine("===== Groups =====");
|
||||
// foreach (var gp in reader.GetGroups()) {
|
||||
@@ -66,38 +121,38 @@ namespace BMapSharpTestbench {
|
||||
// Console.WriteLine($"\tMaterial Slot Count: {mesh.GetMaterialSlotCount()}");
|
||||
// }
|
||||
|
||||
Console.WriteLine("===== Materials =====");
|
||||
foreach (var mtl in reader.GetMaterials()) {
|
||||
Console.WriteLine(mtl.GetName());
|
||||
// Console.WriteLine("===== Materials =====");
|
||||
// foreach (var mtl in reader.GetMaterials()) {
|
||||
// Console.WriteLine(mtl.GetName());
|
||||
|
||||
Console.WriteLine($"\tDiffuse: {mtl.GetDiffuse().ToManagedRGBA()}");
|
||||
Console.WriteLine($"\tAmbient: {mtl.GetAmbient().ToManagedRGBA()}");
|
||||
Console.WriteLine($"\tSpecular: {mtl.GetSpecular().ToManagedRGBA()}");
|
||||
Console.WriteLine($"\tEmissive: {mtl.GetEmissive().ToManagedRGBA()}");
|
||||
// Console.WriteLine($"\tDiffuse: {mtl.GetDiffuse().ToManagedRGBA()}");
|
||||
// Console.WriteLine($"\tAmbient: {mtl.GetAmbient().ToManagedRGBA()}");
|
||||
// Console.WriteLine($"\tSpecular: {mtl.GetSpecular().ToManagedRGBA()}");
|
||||
// Console.WriteLine($"\tEmissive: {mtl.GetEmissive().ToManagedRGBA()}");
|
||||
|
||||
Console.WriteLine($"\tSpecular Power: {mtl.GetSpecularPower()}");
|
||||
// Console.WriteLine($"\tSpecular Power: {mtl.GetSpecularPower()}");
|
||||
|
||||
Console.WriteLine($"\tTexture Border Color: {mtl.GetTextureBorderColor().ToManagedRGBA()}");
|
||||
// Console.WriteLine($"\tTexture Border Color: {mtl.GetTextureBorderColor().ToManagedRGBA()}");
|
||||
|
||||
Console.WriteLine($"\tTexture Blend Mode: {mtl.GetTextureBlendMode()}");
|
||||
Console.WriteLine($"\tTexture Min Mode: {mtl.GetTextureMinMode()}");
|
||||
Console.WriteLine($"\tTexture Mag Mode: {mtl.GetTextureMagMode()}");
|
||||
Console.WriteLine($"\tSource Blend: {mtl.GetSourceBlend()}");
|
||||
Console.WriteLine($"\tDest Blend: {mtl.GetDestBlend()}");
|
||||
Console.WriteLine($"\tFill Mode: {mtl.GetFillMode()}");
|
||||
Console.WriteLine($"\tShade Mode: {mtl.GetShadeMode()}");
|
||||
// Console.WriteLine($"\tTexture Blend Mode: {mtl.GetTextureBlendMode()}");
|
||||
// Console.WriteLine($"\tTexture Min Mode: {mtl.GetTextureMinMode()}");
|
||||
// Console.WriteLine($"\tTexture Mag Mode: {mtl.GetTextureMagMode()}");
|
||||
// Console.WriteLine($"\tSource Blend: {mtl.GetSourceBlend()}");
|
||||
// Console.WriteLine($"\tDest Blend: {mtl.GetDestBlend()}");
|
||||
// Console.WriteLine($"\tFill Mode: {mtl.GetFillMode()}");
|
||||
// Console.WriteLine($"\tShade Mode: {mtl.GetShadeMode()}");
|
||||
|
||||
Console.WriteLine($"\tAlpha Test Enabled: {mtl.GetAlphaTestEnabled()}");
|
||||
Console.WriteLine($"\tAlpha Blend Enabled: {mtl.GetAlphaBlendEnabled()}");
|
||||
Console.WriteLine($"\tPerspective Correction Enabled: {mtl.GetPerspectiveCorrectionEnabled()}");
|
||||
Console.WriteLine($"\tZ Write Enabled: {mtl.GetZWriteEnabled()}");
|
||||
Console.WriteLine($"\tTwo Sided Enabled: {mtl.GetTwoSidedEnabled()}");
|
||||
// Console.WriteLine($"\tAlpha Test Enabled: {mtl.GetAlphaTestEnabled()}");
|
||||
// Console.WriteLine($"\tAlpha Blend Enabled: {mtl.GetAlphaBlendEnabled()}");
|
||||
// Console.WriteLine($"\tPerspective Correction Enabled: {mtl.GetPerspectiveCorrectionEnabled()}");
|
||||
// Console.WriteLine($"\tZ Write Enabled: {mtl.GetZWriteEnabled()}");
|
||||
// Console.WriteLine($"\tTwo Sided Enabled: {mtl.GetTwoSidedEnabled()}");
|
||||
|
||||
Console.WriteLine($"\tAlpha Ref: {mtl.GetAlphaRef()}");
|
||||
// Console.WriteLine($"\tAlpha Ref: {mtl.GetAlphaRef()}");
|
||||
|
||||
Console.WriteLine($"\tAlpha Func: {mtl.GetAlphaFunc()}");
|
||||
Console.WriteLine($"\tZ Func: {mtl.GetZFunc()}");
|
||||
}
|
||||
// Console.WriteLine($"\tAlpha Func: {mtl.GetAlphaFunc()}");
|
||||
// Console.WriteLine($"\tZ Func: {mtl.GetZFunc()}");
|
||||
// }
|
||||
|
||||
// Console.WriteLine("===== Textures =====");
|
||||
// foreach (var tex in reader.GetTextures()) {
|
||||
@@ -108,6 +163,24 @@ namespace BMapSharpTestbench {
|
||||
// Console.WriteLine($"\tVideo Format: {tex.GetVideoFormat()}");
|
||||
// }
|
||||
|
||||
Console.WriteLine("===== Target Lights =====");
|
||||
foreach (var lit in reader.GetTargetLights()) {
|
||||
Console.WriteLine(lit.GetName());
|
||||
|
||||
Console.WriteLine($"\tVisibility: {lit.GetVisibility()}");
|
||||
Console.WriteLine($"\tMatrix: {lit.GetWorldMatrix().ToManaged()}");
|
||||
|
||||
Console.WriteLine($"Type: {lit.GetLightType()}");
|
||||
Console.WriteLine($"Color: {lit.GetColor().ToManagedRGBA()}");
|
||||
Console.WriteLine($"Constant Attenuation: {lit.GetConstantAttenuation()}");
|
||||
Console.WriteLine($"Linear Attenuation: {lit.GetLinearAttenuation()}");
|
||||
Console.WriteLine($"Quadratic Attenuation: {lit.GetQuadraticAttenuation()}");
|
||||
Console.WriteLine($"Range: {lit.GetRange()}");
|
||||
Console.WriteLine($"Hot Spot: {lit.GetHotSpot()}");
|
||||
Console.WriteLine($"Falloff: {lit.GetFalloff()}");
|
||||
Console.WriteLine($"Falloff Shape: {lit.GetFalloffShape()}");
|
||||
}
|
||||
|
||||
Console.WriteLine("===== END =====");
|
||||
}
|
||||
|
||||
@@ -119,7 +192,7 @@ namespace BMapSharpTestbench {
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Prepare test variables
|
||||
var all_3dobjects = new List<BM3dObject>(reader.Get3dObjects());
|
||||
var first_3dobj = all_3dobjects[0];
|
||||
|
||||
@@ -5,3 +5,5 @@ The core of BMapSharp project is placed within `BMapSharp` subdirectory. This di
|
||||
The native BMap library should be placed together with managed `BMapSharp` dynamic library. I use gitignore file to filter all native binary so you need put them manually. The native BMap library must be named as `BMap.dll` (in Windows), `BMap.so` (in Linux or BSD), or `BMap.dylib` (in macOS). If you still can not load BMap or your system is not listed above, you should name it as `BMap.bin`.
|
||||
|
||||
The most content of `VirtoolsTypes.cs` is generated by EnumsMigration, and the most content of `BMap.cs` is generated by BMapBindings. You should watch these file changes if corresponding C++ code or structures are changed.
|
||||
|
||||
Since BMap 0.3.0, testbench use command line arguments, instead of hardcode variables in code, as the arguments of BMap. It is convenient that debug BMapSharp without any modification of source code. For a brief instruction, you may need to launch BMapSharpTestbench in following command (just an example. you can modify it as you wished): `dotnet run -- --file-path "LightCameraTest.nmo" --temp-dir "Temp" --texture-dir "F:/Ballance/Ballance/Textures" --encodings cp1252 gb2312`.
|
||||
|
||||
@@ -227,6 +227,22 @@ BMFile_GetTexture = _create_bmap_func('BMFile_GetTexture', [bm_void_p, bm_CKDWOR
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_CreateTexture = _create_bmap_func('BMFile_CreateTexture', [bm_void_p, bm_CKID_p])
|
||||
## BMFile_GetTargetLightCount
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_count[out] Type: LibCmo::CKDWORD. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetTargetLightCount = _create_bmap_func('BMFile_GetTargetLightCount', [bm_void_p, bm_CKDWORD_p])
|
||||
## BMFile_GetTargetLight
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param idx[in] Type: LibCmo::CKDWORD.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_GetTargetLight = _create_bmap_func('BMFile_GetTargetLight', [bm_void_p, bm_CKDWORD, bm_CKID_p])
|
||||
## BMFile_CreateTargetLight
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param out_id[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMFile_CreateTargetLight = _create_bmap_func('BMFile_CreateTargetLight', [bm_void_p, bm_CKID_p])
|
||||
## BMMeshTrans_New
|
||||
# @param out_trans[out] Type: BMap::BMMeshTransition*. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
@@ -747,42 +763,150 @@ BMMesh_GetMaterialSlot = _create_bmap_func('BMMesh_GetMaterialSlot', [bm_void_p,
|
||||
# @param mtlid[in] Type: LibCmo::CK2::CK_ID.
|
||||
# @return True if no error, otherwise False.
|
||||
BMMesh_SetMaterialSlot = _create_bmap_func('BMMesh_SetMaterialSlot', [bm_void_p, bm_CKID, bm_CKDWORD, bm_CKID])
|
||||
## BM3dObject_GetWorldMatrix
|
||||
## BM3dEntity_GetWorldMatrix
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_mat[out] Type: LibCmo::VxMath::VxMatrix. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dObject_GetWorldMatrix = _create_bmap_func('BM3dObject_GetWorldMatrix', [bm_void_p, bm_CKID, bm_VxMatrix_p])
|
||||
## BM3dObject_SetWorldMatrix
|
||||
BM3dEntity_GetWorldMatrix = _create_bmap_func('BM3dEntity_GetWorldMatrix', [bm_void_p, bm_CKID, bm_VxMatrix_p])
|
||||
## BM3dEntity_SetWorldMatrix
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param mat[in] Type: LibCmo::VxMath::VxMatrix.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dObject_SetWorldMatrix = _create_bmap_func('BM3dObject_SetWorldMatrix', [bm_void_p, bm_CKID, bm_VxMatrix])
|
||||
## BM3dObject_GetCurrentMesh
|
||||
BM3dEntity_SetWorldMatrix = _create_bmap_func('BM3dEntity_SetWorldMatrix', [bm_void_p, bm_CKID, bm_VxMatrix])
|
||||
## BM3dEntity_GetCurrentMesh
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_meshid[out] Type: LibCmo::CK2::CK_ID. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dObject_GetCurrentMesh = _create_bmap_func('BM3dObject_GetCurrentMesh', [bm_void_p, bm_CKID, bm_CKID_p])
|
||||
## BM3dObject_SetCurrentMesh
|
||||
BM3dEntity_GetCurrentMesh = _create_bmap_func('BM3dEntity_GetCurrentMesh', [bm_void_p, bm_CKID, bm_CKID_p])
|
||||
## BM3dEntity_SetCurrentMesh
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param meshid[in] Type: LibCmo::CK2::CK_ID.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dObject_SetCurrentMesh = _create_bmap_func('BM3dObject_SetCurrentMesh', [bm_void_p, bm_CKID, bm_CKID])
|
||||
## BM3dObject_GetVisibility
|
||||
BM3dEntity_SetCurrentMesh = _create_bmap_func('BM3dEntity_SetCurrentMesh', [bm_void_p, bm_CKID, bm_CKID])
|
||||
## BM3dEntity_GetVisibility
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_isVisible[out] Type: bool. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dObject_GetVisibility = _create_bmap_func('BM3dObject_GetVisibility', [bm_void_p, bm_CKID, bm_bool_p])
|
||||
## BM3dObject_SetVisibility
|
||||
BM3dEntity_GetVisibility = _create_bmap_func('BM3dEntity_GetVisibility', [bm_void_p, bm_CKID, bm_bool_p])
|
||||
## BM3dEntity_SetVisibility
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param is_visible[in] Type: bool.
|
||||
# @return True if no error, otherwise False.
|
||||
BM3dObject_SetVisibility = _create_bmap_func('BM3dObject_SetVisibility', [bm_void_p, bm_CKID, bm_bool])
|
||||
BM3dEntity_SetVisibility = _create_bmap_func('BM3dEntity_SetVisibility', [bm_void_p, bm_CKID, bm_bool])
|
||||
## BMLight_GetType
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VXLIGHT_TYPE. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetType = _create_bmap_func('BMLight_GetType', [bm_void_p, bm_CKID, bm_enum_p])
|
||||
## BMLight_SetType
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::VxMath::VXLIGHT_TYPE.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetType = _create_bmap_func('BMLight_SetType', [bm_void_p, bm_CKID, bm_enum])
|
||||
## BMLight_GetColor
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::VxMath::VxColor. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetColor = _create_bmap_func('BMLight_GetColor', [bm_void_p, bm_CKID, bm_VxColor_p])
|
||||
## BMLight_SetColor
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param col[in] Type: LibCmo::VxMath::VxColor.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetColor = _create_bmap_func('BMLight_SetColor', [bm_void_p, bm_CKID, bm_VxColor])
|
||||
## BMLight_GetConstantAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetConstantAttenuation = _create_bmap_func('BMLight_GetConstantAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetConstantAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetConstantAttenuation = _create_bmap_func('BMLight_SetConstantAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetLinearAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetLinearAttenuation = _create_bmap_func('BMLight_GetLinearAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetLinearAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetLinearAttenuation = _create_bmap_func('BMLight_SetLinearAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetQuadraticAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetQuadraticAttenuation = _create_bmap_func('BMLight_GetQuadraticAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetQuadraticAttenuation
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetQuadraticAttenuation = _create_bmap_func('BMLight_SetQuadraticAttenuation', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetRange
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetRange = _create_bmap_func('BMLight_GetRange', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetRange
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetRange = _create_bmap_func('BMLight_SetRange', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetHotSpot
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetHotSpot = _create_bmap_func('BMLight_GetHotSpot', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetHotSpot
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetHotSpot = _create_bmap_func('BMLight_SetHotSpot', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetFalloff
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetFalloff = _create_bmap_func('BMLight_GetFalloff', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetFalloff
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetFalloff = _create_bmap_func('BMLight_SetFalloff', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
## BMLight_GetFalloffShape
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param out_val[out] Type: LibCmo::CKFLOAT. Use ctypes.byref(data) pass it.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_GetFalloffShape = _create_bmap_func('BMLight_GetFalloffShape', [bm_void_p, bm_CKID, bm_CKFLOAT_p])
|
||||
## BMLight_SetFalloffShape
|
||||
# @param bmfile[in] Type: BMap::BMFile*. The pointer to corresponding BMFile.
|
||||
# @param objid[in] Type: LibCmo::CK2::CK_ID. The CKID of object you accessing.
|
||||
# @param val[in] Type: LibCmo::CKFLOAT.
|
||||
# @return True if no error, otherwise False.
|
||||
BMLight_SetFalloffShape = _create_bmap_func('BMLight_SetFalloffShape', [bm_void_p, bm_CKID, bm_CKFLOAT])
|
||||
|
||||
##### GENERATED FUNCTIONS END #####
|
||||
|
||||
|
||||
@@ -476,10 +476,10 @@ class BMMesh(BMObject):
|
||||
except StopIteration:
|
||||
_Utils.raise_out_of_length_exception()
|
||||
|
||||
class BM3dObject(BMObject):
|
||||
class BM3dEntity(BMObject):
|
||||
def get_world_matrix(self) -> virtools_types.VxMatrix:
|
||||
mat: bmap.bm_VxMatrix = bmap.bm_VxMatrix()
|
||||
bmap.BM3dObject_GetWorldMatrix(self._get_pointer(), self._get_ckid(), ctypes.byref(mat))
|
||||
bmap.BM3dEntity_GetWorldMatrix(self._get_pointer(), self._get_ckid(), ctypes.byref(mat))
|
||||
# use cast & pointer to get matrix data conveniently
|
||||
flat: bmap.bm_CKFLOAT_p = ctypes.cast(ctypes.byref(mat), bmap.bm_CKFLOAT_p)
|
||||
ret: virtools_types.VxMatrix = virtools_types.VxMatrix()
|
||||
@@ -489,11 +489,11 @@ class BM3dObject(BMObject):
|
||||
def set_world_matrix(self, mat_: virtools_types.VxMatrix) -> None:
|
||||
# star syntax expand the tuple as the argument.
|
||||
mat: bmap.bm_VxMatrix = bmap.bm_VxMatrix(*(mat_.to_const()))
|
||||
bmap.BM3dObject_SetWorldMatrix(self._get_pointer(), self._get_ckid(), mat)
|
||||
bmap.BM3dEntity_SetWorldMatrix(self._get_pointer(), self._get_ckid(), mat)
|
||||
|
||||
def get_current_mesh(self) -> BMMesh | None:
|
||||
ckid: bmap.bm_CKID = bmap.bm_CKID()
|
||||
bmap.BM3dObject_GetCurrentMesh(self._get_pointer(), self._get_ckid(), ctypes.byref(ckid))
|
||||
bmap.BM3dEntity_GetCurrentMesh(self._get_pointer(), self._get_ckid(), ctypes.byref(ckid))
|
||||
if ckid.value == g_InvalidCKID:
|
||||
return None
|
||||
else:
|
||||
@@ -503,12 +503,60 @@ class BM3dObject(BMObject):
|
||||
ckid: bmap.bm_CKID = bmap.bm_CKID(g_InvalidCKID)
|
||||
if mesh is not None:
|
||||
ckid = mesh._get_ckid()
|
||||
bmap.BM3dObject_SetCurrentMesh(self._get_pointer(), self._get_ckid(), ckid)
|
||||
bmap.BM3dEntity_SetCurrentMesh(self._get_pointer(), self._get_ckid(), ckid)
|
||||
|
||||
def get_visibility(self) -> bool:
|
||||
return self._get_bool_value(bmap.BM3dObject_GetVisibility)
|
||||
return self._get_bool_value(bmap.BM3dEntity_GetVisibility)
|
||||
def set_visibility(self, visb_: bool) -> None:
|
||||
self._set_bool_value(bmap.BM3dObject_SetVisibility, visb_)
|
||||
self._set_bool_value(bmap.BM3dEntity_SetVisibility, visb_)
|
||||
|
||||
class BM3dObject(BM3dEntity):
|
||||
pass
|
||||
|
||||
class BMLight(BM3dEntity):
|
||||
def get_type(self) -> virtools_types.VXLIGHT_TYPE:
|
||||
return self._get_enum_value(virtools_types.VXLIGHT_TYPE, bmap.BMLight_GetType)
|
||||
def set_type(self, data_: virtools_types.VXLIGHT_TYPE) -> None:
|
||||
self._set_enum_value(bmap.BMLight_SetType, data_)
|
||||
|
||||
def get_color(self) -> virtools_types.VxColor:
|
||||
return self._get_vxcolor_value(bmap.BMLight_GetColor)
|
||||
def set_color(self, col: virtools_types.VxColor) -> None:
|
||||
self._set_vxcolor_value(bmap.BMLight_SetColor, col)
|
||||
|
||||
def get_constant_attenuation(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetConstantAttenuation)
|
||||
def set_constant_attenuation(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetConstantAttenuation, val_)
|
||||
def get_linear_attenuation(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetLinearAttenuation)
|
||||
def set_linear_attenuation(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetLinearAttenuation, val_)
|
||||
def get_quadratic_attenuation(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetQuadraticAttenuation)
|
||||
def set_quadratic_attenuation(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetQuadraticAttenuation, val_)
|
||||
|
||||
def get_range(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetRange)
|
||||
def set_range(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetRange, val_)
|
||||
|
||||
def get_hot_spot(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetHotSpot)
|
||||
def set_hot_spot(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetHotSpot, val_)
|
||||
def get_falloff(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetFalloff)
|
||||
def set_falloff(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetFalloff, val_)
|
||||
def get_falloff_shape(self) -> float:
|
||||
return self._get_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_GetFalloffShape)
|
||||
def set_falloff_shape(self, val_: float) -> None:
|
||||
self._set_float_point_value(bmap.bm_CKFLOAT, bmap.BMLight_SetFalloffShape, val_)
|
||||
|
||||
class BMTargetLight(BMLight):
|
||||
pass
|
||||
|
||||
class BMGroup(BMObject):
|
||||
def add_object(self, member: BM3dObject) -> None:
|
||||
@@ -603,6 +651,10 @@ class BMFileReader(_AbstractPointer):
|
||||
return self.__get_ckobject_count(bmap.BMFile_GetGroupCount)
|
||||
def get_groups(self) -> typing.Iterator[BMGroup]:
|
||||
return self.__get_ckobjects(BMGroup, bmap.BMFile_GetGroupCount, bmap.BMFile_GetGroup)
|
||||
def get_target_light_count(self) -> int:
|
||||
return self.__get_ckobject_count(bmap.BMFile_GetTargetLightCount)
|
||||
def get_target_lights(self) -> typing.Iterator[BMTargetLight]:
|
||||
return self.__get_ckobjects(BMTargetLight, bmap.BMFile_GetTargetLightCount, bmap.BMFile_GetTargetLight)
|
||||
|
||||
class BMFileWriter(_AbstractPointer):
|
||||
def __init__(self, temp_folder_: str, texture_folder_: str, encodings_: tuple[str]):
|
||||
@@ -663,6 +715,8 @@ class BMFileWriter(_AbstractPointer):
|
||||
return self.__create_ckobject(BM3dObject, bmap.BMFile_Create3dObject)
|
||||
def create_group(self) -> BMGroup:
|
||||
return self.__create_ckobject(BMGroup, bmap.BMFile_CreateGroup)
|
||||
def create_target_light(self) -> BMTargetLight:
|
||||
return self.__create_ckobject(BMTargetLight, bmap.BMFile_CreateTargetLight)
|
||||
|
||||
class BMMeshTrans(_AbstractPointer):
|
||||
def __init__(self):
|
||||
|
||||
@@ -221,6 +221,15 @@ class VX_PIXELFORMAT(enum.IntEnum):
|
||||
_4_ABGR8888_CLUT = 30 ##< 4 bits indexed CLUT (ABGR)
|
||||
_4_ARGB8888_CLUT = 31 ##< 4 bits indexed CLUT (ARGB)
|
||||
|
||||
class VXLIGHT_TYPE(enum.IntEnum):
|
||||
"""!
|
||||
Light type
|
||||
"""
|
||||
VX_LIGHTPOINT = 1 ##< The Light is a point of light
|
||||
VX_LIGHTSPOT = 2 ##< The light is a spotlight
|
||||
VX_LIGHTDIREC = 3 ##< The light is directional light : Lights comes from an infinite point so only direction of light can be given
|
||||
#VX_LIGHTPARA = 4 ##< Obsolete, do not use
|
||||
|
||||
class VXTEXTURE_BLENDMODE(enum.IntEnum):
|
||||
"""!
|
||||
Blend Mode Flags
|
||||
|
||||
@@ -5,3 +5,5 @@ The real scripts are placed in sub PyBMap folder. This folder is served for test
|
||||
The native BMap library should be placed in sub PyBMap folder, and I have used gitignore file to filter them. The native BMap library must be named as `BMap.dll` (in Windows), `BMap.so` (in Linux or BSD), or `BMap.dylib` (in macOS). If you still can not load BMap or your system is not listed above, you should name it as `BMap.bin`.
|
||||
|
||||
Please note the most content of `virtools_types.py` are generated by EnumsMigration sub-project. Additionally the most content of `bmap.py` is generated by BMapBindings. So if some structs are updated, do not forget checking these files.
|
||||
|
||||
Since BMap 0.3.0, testbench use command line arguments, instead of hardcode variables in code, as the arguments of BMap. It is convenient that debug BMapSharp without any modification of source code. For a brief instruction, you may need to launch BMapSharpTestbench in following command (just an example. you can modify it as you wished): `py testbench.py --file-path "LightCameraTest.nmo" --temp-dir "Temp" --texture-dir "F:/Ballance/Ballance/Textures" --encodings cp1252 gb2312`.
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import os
|
||||
import argparse
|
||||
import PyBMap.bmap_wrapper as bmap
|
||||
|
||||
def main() -> None:
|
||||
def main(file_name: str, temp_folder: str, texture_folder: str, encodings: tuple[str, ...]) -> None:
|
||||
input(f'Python PID is {os.getpid()}. Waiting for debugger, press any key to continue...')
|
||||
|
||||
file_name: str = 'Level_02.NMO'
|
||||
temp_folder: str = 'Temp'
|
||||
texture_folder: str = 'F:\\Ballance\\Ballance\\Textures'
|
||||
encodings: tuple[str, ...] = ('cp1252', )
|
||||
# file_name: str = 'LightCameraTest.nmo'
|
||||
# temp_folder: str = 'Temp'
|
||||
# texture_folder: str = 'F:\\Ballance\\Ballance\\Textures'
|
||||
# encodings: tuple[str, ...] = ('cp1252', )
|
||||
with bmap.BMFileReader(file_name, temp_folder, texture_folder, encodings) as reader:
|
||||
test_common(reader)
|
||||
test_equatable(reader)
|
||||
@@ -38,37 +39,37 @@ def test_common(reader: bmap.BMFileReader):
|
||||
# print(f'\tFace Count: {mesh.get_face_count()}')
|
||||
# print(f'\tMaterial Slot Count: {mesh.get_material_slot_count()}')
|
||||
|
||||
print('===== Materials =====')
|
||||
for mtl in reader.get_materials():
|
||||
print(mtl.get_name())
|
||||
# print('===== Materials =====')
|
||||
# for mtl in reader.get_materials():
|
||||
# print(mtl.get_name())
|
||||
|
||||
print(f'\tDiffuse: {mtl.get_diffuse().to_const_rgba()}')
|
||||
print(f'\tAmbient: {mtl.get_ambient().to_const_rgba()}')
|
||||
print(f'\tSpecular: {mtl.get_specular().to_const_rgba()}')
|
||||
print(f'\tEmissive: {mtl.get_emissive().to_const_rgba()}')
|
||||
# print(f'\tDiffuse: {mtl.get_diffuse().to_const_rgba()}')
|
||||
# print(f'\tAmbient: {mtl.get_ambient().to_const_rgba()}')
|
||||
# print(f'\tSpecular: {mtl.get_specular().to_const_rgba()}')
|
||||
# print(f'\tEmissive: {mtl.get_emissive().to_const_rgba()}')
|
||||
|
||||
print(f'\tSpecular Power: {mtl.get_specular_power()}')
|
||||
# print(f'\tSpecular Power: {mtl.get_specular_power()}')
|
||||
|
||||
print(f'\tTexture Border Color: {mtl.get_texture_border_color().to_const_rgba()}')
|
||||
# print(f'\tTexture Border Color: {mtl.get_texture_border_color().to_const_rgba()}')
|
||||
|
||||
print(f'\tTexture Blend Mode: {mtl.get_texture_blend_mode()}')
|
||||
print(f'\tTexture Min Mode: {mtl.get_texture_min_mode()}')
|
||||
print(f'\tTexture Mag Mode: {mtl.get_texture_mag_mode()}')
|
||||
print(f'\tSource Blend: {mtl.get_source_blend()}')
|
||||
print(f'\tDest Blend: {mtl.get_dest_blend()}')
|
||||
print(f'\tFill Mode: {mtl.get_fill_mode()}')
|
||||
print(f'\tShade Mode: {mtl.get_shade_mode()}')
|
||||
# print(f'\tTexture Blend Mode: {mtl.get_texture_blend_mode()}')
|
||||
# print(f'\tTexture Min Mode: {mtl.get_texture_min_mode()}')
|
||||
# print(f'\tTexture Mag Mode: {mtl.get_texture_mag_mode()}')
|
||||
# print(f'\tSource Blend: {mtl.get_source_blend()}')
|
||||
# print(f'\tDest Blend: {mtl.get_dest_blend()}')
|
||||
# print(f'\tFill Mode: {mtl.get_fill_mode()}')
|
||||
# print(f'\tShade Mode: {mtl.get_shade_mode()}')
|
||||
|
||||
print(f'\tAlpha Test Enabled: {mtl.get_alpha_test_enabled()}')
|
||||
print(f'\tAlpha Blend Enabled: {mtl.get_alpha_blend_enabled()}')
|
||||
print(f'\tPerspective Correction Enabled: {mtl.get_perspective_correction_enabled()}')
|
||||
print(f'\tZ Write Enabled: {mtl.get_z_write_enabled()}')
|
||||
print(f'\tTwo Sided Enabled: {mtl.get_two_sided_enabled()}')
|
||||
# print(f'\tAlpha Test Enabled: {mtl.get_alpha_test_enabled()}')
|
||||
# print(f'\tAlpha Blend Enabled: {mtl.get_alpha_blend_enabled()}')
|
||||
# print(f'\tPerspective Correction Enabled: {mtl.get_perspective_correction_enabled()}')
|
||||
# print(f'\tZ Write Enabled: {mtl.get_z_write_enabled()}')
|
||||
# print(f'\tTwo Sided Enabled: {mtl.get_two_sided_enabled()}')
|
||||
|
||||
print(f'\tAlpha Ref: {mtl.get_alpha_ref()}')
|
||||
# print(f'\tAlpha Ref: {mtl.get_alpha_ref()}')
|
||||
|
||||
print(f'\tAlpha Func: {mtl.get_alpha_func()}')
|
||||
print(f'\tZ Func: {mtl.get_z_func()}')
|
||||
# print(f'\tAlpha Func: {mtl.get_alpha_func()}')
|
||||
# print(f'\tZ Func: {mtl.get_z_func()}')
|
||||
|
||||
# print('===== Textures =====')
|
||||
# for tex in reader.get_textures():
|
||||
@@ -78,6 +79,23 @@ def test_common(reader: bmap.BMFileReader):
|
||||
# print(f'\tSave Options: {tex.get_save_options()}')
|
||||
# print(f'\tVideo Format: {tex.get_video_format()}')
|
||||
|
||||
print('===== Target Lights =====')
|
||||
for lit in reader.get_target_lights():
|
||||
print(lit.get_name())
|
||||
|
||||
print(f'\tVisibility: {lit.get_visibility()}')
|
||||
print(f'\tMatrix: {lit.get_world_matrix().to_const()}')
|
||||
|
||||
print(f'\tType: {lit.get_type()}')
|
||||
print(f'\tColor: {lit.get_color().to_const_rgba()}')
|
||||
print(f'\tConstant Attenuation: {lit.get_constant_attenuation()}')
|
||||
print(f'\tLinear Attenuation: {lit.get_linear_attenuation()}')
|
||||
print(f'\tQuadratic Attenuation: {lit.get_quadratic_attenuation()}')
|
||||
print(f'\tRange: {lit.get_range()}')
|
||||
print(f'\tHot Spot: {lit.get_hot_spot()}')
|
||||
print(f'\tFalloff: {lit.get_falloff()}')
|
||||
print(f'\tFalloff Shape: {lit.get_falloff_shape()}')
|
||||
|
||||
print('===== END =====')
|
||||
|
||||
def test_equatable(reader: bmap.BMFileReader):
|
||||
@@ -129,4 +147,32 @@ def test_equatable(reader: bmap.BMFileReader):
|
||||
assert second_3dobj in test_dict
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
# parse argument
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='PyBMap Testbench',
|
||||
description='The testbench of PyBMap.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--file-path',
|
||||
action='store', dest='file_path', required=True,
|
||||
help='The path to input Virtools file.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--temp-dir',
|
||||
action='store', dest='temp_dir', required=True,
|
||||
help='The temp folder used by BMap.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--texture-dir',
|
||||
action='store', dest='texture_dir', required=True,
|
||||
help='The texture folder containing Ballance texture resources.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--encodings',
|
||||
action='extend', nargs='+', dest='encodings', required=True,
|
||||
help='The encodings used to parse the names stroed in input Virtools file.'
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# run main function
|
||||
main(args.file_path, args.temp_dir, args.texture_dir, tuple(args.encodings))
|
||||
|
||||
6
CMake/VTVersion.hpp.in
Normal file
6
CMake/VTVersion.hpp.in
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define LIBCMO_VER_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define LIBCMO_VER_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define LIBCMO_VER_PATCH @PROJECT_VERSION_PATCH@
|
||||
#define LIBCMO_VER_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"
|
||||
@@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.23)
|
||||
project(NeMo
|
||||
VERSION 0.2.0
|
||||
VERSION 0.3.0
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
|
||||
@@ -188,6 +188,7 @@ public class CSharpWriter {
|
||||
break;
|
||||
case "CK_TEXTURE_SAVEOPTIONS":
|
||||
case "VX_PIXELFORMAT":
|
||||
case "VXLIGHT_TYPE":
|
||||
case "VXTEXTURE_BLENDMODE":
|
||||
case "VXTEXTURE_FILTERMODE":
|
||||
case "VXTEXTURE_ADDRESSMODE":
|
||||
|
||||
@@ -28,6 +28,7 @@ public class PythonWriter {
|
||||
cache.put("VxMatrix", "VxMatrix");
|
||||
cache.put("CK_TEXTURE_SAVEOPTIONS", "enum");
|
||||
cache.put("VX_PIXELFORMAT", "enum");
|
||||
cache.put("VXLIGHT_TYPE", "enum");
|
||||
cache.put("VXTEXTURE_BLENDMODE", "enum");
|
||||
cache.put("VXTEXTURE_FILTERMODE", "enum");
|
||||
cache.put("VXTEXTURE_ADDRESSMODE", "enum");
|
||||
|
||||
@@ -102,24 +102,27 @@ namespace LibCmo::CK2 {
|
||||
// This is a patch for Dassault stupid programmer.
|
||||
//
|
||||
// After Virtools 4.0, Dassault use a new way to compute the CRC of file.
|
||||
// Dassault introduce a new class called CKMemoryBufferWriter which use file and memory map to handle big file properly.
|
||||
// Dassault introduces a new class called CKMemoryBufferWriter which use file and memory map to handle big file properly.
|
||||
// This algorithm splits the whole data body into 8 MB chunks and calculate them one by one to avoid instantaneous memory occupation.
|
||||
// However, there is a bug in virtual function CKMemoryBufferWriter::ComputeCRC.
|
||||
// It takes `PreviousCRC` as argument but never use it in function. In this function, the start value of CRC compution is hardcoded 0.
|
||||
// It takes `PreviousCRC` as argument but never use it in function.
|
||||
// In this function, the start value of CRC compution is hardcoded 0.
|
||||
// So, although Dassault programmer try to compute CRC for file header, header part and daat part in code, it actually only compute CRC for data part!
|
||||
// I 100% sure this is the mistake of Dassault stupid programmer and this bug cause horrible result.
|
||||
// I 100% sure this is the mistake of Dassault stupid programmer and this bug cause more horrible result.
|
||||
//
|
||||
// In Virtools 2.1, engine will check CRC of file first. If no matched CRC, engine will reject loading file.
|
||||
// So the obvious result is that we can not load file saved by Virtools 4.0 in Virtools 2.1.
|
||||
// But this is not the point which makes me indignant.
|
||||
// The real weird point is that we can use Virtools 3.5 to open file saved by Virtools 4.0 but why?
|
||||
// After some research, I found that the programmer of Dassault totally removed CRC check when loading file since some version which I don't know!
|
||||
// The real weird point is that we can use Virtools 3.5 to open file saved by Virtools 4.0, but why?
|
||||
// After some researches, I found that the programmer of Dassault totally removed CRC check when loading file, since some version which I don't know, to suppress this bug!
|
||||
// This is totally cheat and commercial-oriented behavior!
|
||||
// I guess Dassault programmer also find that they can not load new created file in old Virtools.
|
||||
// But they entirely don't know how to resolve it. So they just directly remove the whole of CRC checker!
|
||||
// That's the point which makes me indignant.
|
||||
// I guess Dassault programmer also found that they can not load new created file in old Virtools.
|
||||
// But they didn't find out what cause this bug, and just directly remove the whole of CRC checker to resolve this bug!
|
||||
// I can't believe that this thing happens on such official software.
|
||||
// This is the point which makes me indignant.
|
||||
gotten_crc = CKComputeDataCRC(parser->GetPtr(), this->m_FileInfo.DataPackSize, 0u);
|
||||
|
||||
// Both CRC compute methods are failed, this file may be really broken.
|
||||
// Both CRC compute methods are failed. This file may be really broken.
|
||||
// Report exception directly.
|
||||
if (gotten_crc != this->m_FileInfo.Crc) {
|
||||
this->m_Ctx->OutputToConsole(u8"Virtools file CRC error.");
|
||||
|
||||
@@ -128,7 +128,7 @@ SetObjectFlags(obj_flags); \
|
||||
}
|
||||
|
||||
void CKCamera::ComputeProjectionMatrix(VxMath::VxMatrix& mat) const {
|
||||
CKFLOAT aspect = m_Width / m_Height;
|
||||
CKFLOAT aspect = static_cast<CKFLOAT>(m_Width) / m_Height;
|
||||
if (m_ProjectType == CK_CAMERA_PROJECTION::CK_PERSPECTIVEPROJECTION) {
|
||||
mat.Perspective(m_Fov, aspect, m_FrontPlane, m_BackPlane);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "CKLight.hpp"
|
||||
#include "../CKStateChunk.hpp"
|
||||
#include <numbers>
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
@@ -16,8 +17,8 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
m_LightData.m_Attenuation0 = 1.0f;
|
||||
m_LightData.m_Attenuation1 = 0.0f;
|
||||
m_LightData.m_Attenuation2 = 0.0f;
|
||||
m_LightData.m_InnerSpotCone = 0.69813174f; // MARK: Perhaps 40 deg in rad.
|
||||
m_LightData.m_OuterSpotCone = 0.78539819f; // MARK: Perhaps 45 deg in rad.
|
||||
m_LightData.m_InnerSpotCone = 40.0f / 180.0f * std::numbers::pi_v<float>; // MARK: Original value is 0.69813174f. Perhaps 40 deg in rad.
|
||||
m_LightData.m_OuterSpotCone = 45.0f / 180.0f * std::numbers::pi_v<float>; // MARK: Original value is 0.78539819f. Perhaps 45 deg in rad.
|
||||
}
|
||||
|
||||
CKLight::~CKLight() {}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Configure version file
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/../CMake/VTVersion.hpp.in
|
||||
${CMAKE_CURRENT_LIST_DIR}/VTVersion.hpp
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# Create static library
|
||||
add_library(LibCmo STATIC "")
|
||||
# Setup static library sources
|
||||
@@ -47,6 +54,7 @@ PUBLIC
|
||||
FILE_SET HEADERS
|
||||
FILES
|
||||
# Asststant header files
|
||||
VTVersion.hpp
|
||||
VTInternal.hpp
|
||||
VTEncoding.hpp
|
||||
VTUtils.hpp
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
* They should use Virtools type anywhere, except that Virtools type can not fulfill their requirements.
|
||||
*/
|
||||
|
||||
// The version info header of LibCmo
|
||||
#include "VTVersion.hpp"
|
||||
// The base header of LibCmo.
|
||||
// It provides various convenient stuff, for example:
|
||||
// - General LibCmo specific custom exception.
|
||||
|
||||
@@ -444,7 +444,7 @@ namespace LibCmo::VxMath {
|
||||
}
|
||||
void VxMatrix::Perspective(CKFLOAT Fov, CKFLOAT Aspect, CKFLOAT Near_plane, CKFLOAT Far_plane) {
|
||||
Clear();
|
||||
m_Data[0][0] = std::cosf(Fov * 0.5f) / std::sinf(Fov * 0.5f);
|
||||
m_Data[0][0] = std::cos(Fov * 0.5f) / std::sin(Fov * 0.5f);
|
||||
m_Data[1][1] = m_Data[0][0] * Aspect;
|
||||
m_Data[2][2] = Far_plane / (Far_plane - Near_plane);
|
||||
m_Data[3][2] = -m_Data[2][2] * Near_plane;
|
||||
|
||||
@@ -362,8 +362,8 @@ namespace Unvirt::CmdHelper {
|
||||
throw std::invalid_argument("root node should not be inserted as child node.");
|
||||
// check conflict
|
||||
const auto& new_node_set = new_node_ptr->GetConflictSet();
|
||||
for (auto& node : m_Nodes) {
|
||||
const auto& node_set = node->GetConflictSet();
|
||||
for (auto& child_node : m_Nodes) {
|
||||
const auto& node_set = child_node->GetConflictSet();
|
||||
if (new_node_set.IsConflictWith(node_set))
|
||||
throw std::invalid_argument("try to add a conflict node. please check your code.");
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ namespace Unvirt::Context {
|
||||
YYCC::ConsoleHelper::EnableColorfulConsole();
|
||||
|
||||
// Show banner
|
||||
YYCC::ConsoleHelper::WriteLine(YYCC_COLOR_LIGHT_YELLOW(u8"Unvirt 0.2.0") " built at " __DATE__ " " __TIME__);
|
||||
YYCC::ConsoleHelper::WriteLine(YYCC_COLOR_LIGHT_YELLOW(u8"Unvirt") " (based on LibCmo " LIBCMO_VER_STR ") built at " __DATE__ " " __TIME__);
|
||||
YYCC::ConsoleHelper::WriteLine(u8"Type 'help' for more infomation. Type 'exit' to quit.");
|
||||
|
||||
// start process loop
|
||||
|
||||
Reference in New Issue
Block a user