diff --git a/Assets/BMapBindings/BMapSharp/BMapSharp.slnx b/Assets/BMapBindings/BMapSharp/BMapSharp.slnx
index 2b97a88..dcbd806 100644
--- a/Assets/BMapBindings/BMapSharp/BMapSharp.slnx
+++ b/Assets/BMapBindings/BMapSharp/BMapSharp.slnx
@@ -1,4 +1,4 @@
-
+
diff --git a/Assets/BMapBindings/BMapSharp/BMapSharp/BMapWrapper.cs b/Assets/BMapBindings/BMapSharp/BMapSharp/BMapWrapper.cs
index 9fc22dc..bd05c98 100644
--- a/Assets/BMapBindings/BMapSharp/BMapSharp/BMapWrapper.cs
+++ b/Assets/BMapBindings/BMapSharp/BMapSharp/BMapWrapper.cs
@@ -125,8 +125,8 @@ namespace BMapSharp.BMapWrapper {
public override bool IsInvalid => this.handle == Utils.INVALID_PTR;
protected override bool ReleaseHandle() => throw new NotImplementedException();
- internal bool isValid() => this.handle != Utils.INVALID_PTR;
- internal IntPtr getPointer() => this.handle;
+ internal bool IsValid() => this.handle != Utils.INVALID_PTR;
+ internal IntPtr GetPointer() => this.handle;
#region IEquatable
@@ -174,9 +174,9 @@ namespace BMapSharp.BMapWrapper {
protected override bool ReleaseHandle() => throw new NotImplementedException();
private readonly uint m_CKID;
- internal bool isValid() => this.handle != Utils.INVALID_PTR && m_CKID != Utils.INVALID_CKID;
- internal IntPtr getPointer() => this.handle;
- internal uint getCKID() => m_CKID;
+ internal bool IsValid() => this.handle != Utils.INVALID_PTR && m_CKID != Utils.INVALID_CKID;
+ internal IntPtr GetPointer() => this.handle;
+ internal uint GetCKID() => m_CKID;
#region IEquatable
@@ -217,13 +217,13 @@ namespace BMapSharp.BMapWrapper {
protected delegate bool FctGenericValueGetter(IntPtr bmf, uint id, out T val);
protected delegate bool FctGenericValueSetter(IntPtr bmf, uint id, T val);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- protected T getGenericValue(FctGenericValueGetter fct) {
- BMapException.ThrowIfFailed(fct(getPointer(), getCKID(), out T out_val));
+ protected T GetGenericValue(FctGenericValueGetter fct) {
+ BMapException.ThrowIfFailed(fct(GetPointer(), GetCKID(), out T out_val));
return out_val;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- protected void setGenericValue(FctGenericValueSetter fct, T val) {
- BMapException.ThrowIfFailed(fct(getPointer(), getCKID(), val));
+ protected void SetGenericValue(FctGenericValueSetter fct, T val) {
+ BMapException.ThrowIfFailed(fct(GetPointer(), GetCKID(), val));
}
#endregion
@@ -232,149 +232,149 @@ namespace BMapSharp.BMapWrapper {
public class BMObject : AbstractCKObject {
internal BMObject(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
- public string GetName() => getGenericValue(BMap.BMObject_GetName);
- public void SetName(string name) => setGenericValue(BMap.BMObject_SetName, name);
+ public string GetName() => GetGenericValue(BMap.BMObject_GetName);
+ public void SetName(string name) => SetGenericValue(BMap.BMObject_SetName, name);
}
public class BMTexture : BMObject {
internal BMTexture(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
- public string GetFileName() => getGenericValue(BMap.BMTexture_GetFileName);
+ public string GetFileName() => GetGenericValue(BMap.BMTexture_GetFileName);
public void LoadImage(string filepath) {
- BMapException.ThrowIfFailed(BMap.BMTexture_LoadImage(getPointer(), getCKID(), filepath));
+ BMapException.ThrowIfFailed(BMap.BMTexture_LoadImage(GetPointer(), GetCKID(), filepath));
}
public void SaveImage(string filepath) {
- BMapException.ThrowIfFailed(BMap.BMTexture_SaveImage(getPointer(), getCKID(), filepath));
+ BMapException.ThrowIfFailed(BMap.BMTexture_SaveImage(GetPointer(), GetCKID(), filepath));
}
- public CK_TEXTURE_SAVEOPTIONS GetSaveOptions() => getGenericValue(BMap.BMTexture_GetSaveOptions);
- public void SetSaveOptions(CK_TEXTURE_SAVEOPTIONS opt) => setGenericValue(BMap.BMTexture_SetSaveOptions, opt);
- public VX_PIXELFORMAT GetVideoFormat() => getGenericValue(BMap.BMTexture_GetVideoFormat);
- public void SetVideoFormat(VX_PIXELFORMAT vfmt) => setGenericValue(BMap.BMTexture_SetVideoFormat, vfmt);
+ public CK_TEXTURE_SAVEOPTIONS GetSaveOptions() => GetGenericValue(BMap.BMTexture_GetSaveOptions);
+ public void SetSaveOptions(CK_TEXTURE_SAVEOPTIONS opt) => SetGenericValue(BMap.BMTexture_SetSaveOptions, opt);
+ public VX_PIXELFORMAT GetVideoFormat() => GetGenericValue(BMap.BMTexture_GetVideoFormat);
+ public void SetVideoFormat(VX_PIXELFORMAT vfmt) => SetGenericValue(BMap.BMTexture_SetVideoFormat, vfmt);
}
public class BMMaterial : BMObject {
internal BMMaterial(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
- public VxColor GetDiffuse() => getGenericValue(BMap.BMMaterial_GetDiffuse);
- public void SetDiffuse(VxColor col) => setGenericValue(BMap.BMMaterial_SetDiffuse, col);
- public VxColor GetAmbient() => getGenericValue(BMap.BMMaterial_GetAmbient);
- public void SetAmbient(VxColor col) => setGenericValue(BMap.BMMaterial_SetAmbient, col);
- public VxColor GetSpecular() => getGenericValue(BMap.BMMaterial_GetSpecular);
- public void SetSpecular(VxColor col) => setGenericValue(BMap.BMMaterial_SetSpecular, col);
- public VxColor GetEmissive() => getGenericValue(BMap.BMMaterial_GetEmissive);
- public void SetEmissive(VxColor col) => setGenericValue(BMap.BMMaterial_SetEmissive, col);
+ public VxColor GetDiffuse() => GetGenericValue(BMap.BMMaterial_GetDiffuse);
+ public void SetDiffuse(VxColor col) => SetGenericValue(BMap.BMMaterial_SetDiffuse, col);
+ public VxColor GetAmbient() => GetGenericValue(BMap.BMMaterial_GetAmbient);
+ public void SetAmbient(VxColor col) => SetGenericValue(BMap.BMMaterial_SetAmbient, col);
+ public VxColor GetSpecular() => GetGenericValue(BMap.BMMaterial_GetSpecular);
+ public void SetSpecular(VxColor col) => SetGenericValue(BMap.BMMaterial_SetSpecular, col);
+ public VxColor GetEmissive() => GetGenericValue(BMap.BMMaterial_GetEmissive);
+ public void SetEmissive(VxColor col) => SetGenericValue(BMap.BMMaterial_SetEmissive, col);
- public float GetSpecularPower() => getGenericValue(BMap.BMMaterial_GetSpecularPower);
- public void SetSpecularPower(float val) => setGenericValue(BMap.BMMaterial_SetSpecularPower, val);
+ public float GetSpecularPower() => GetGenericValue(BMap.BMMaterial_GetSpecularPower);
+ public void SetSpecularPower(float val) => SetGenericValue(BMap.BMMaterial_SetSpecularPower, val);
public VxColor GetTextureBorderColor() {
- BMapException.ThrowIfFailed(BMap.BMMaterial_GetTextureBorderColor(getPointer(), getCKID(), out uint out_val));
+ BMapException.ThrowIfFailed(BMap.BMMaterial_GetTextureBorderColor(GetPointer(), GetCKID(), out uint out_val));
return new VxColor(out_val);
}
public void SetTextureBorderColor(VxColor col) {
- BMapException.ThrowIfFailed(BMap.BMMaterial_SetTextureBorderColor(getPointer(), getCKID(), col.ToDword()));
+ BMapException.ThrowIfFailed(BMap.BMMaterial_SetTextureBorderColor(GetPointer(), GetCKID(), col.ToDword()));
}
- public VXTEXTURE_BLENDMODE GetTextureBlendMode() => getGenericValue(BMap.BMMaterial_GetTextureBlendMode);
- public void SetTextureBlendMode(VXTEXTURE_BLENDMODE val) => setGenericValue(BMap.BMMaterial_SetTextureBlendMode, val);
- public VXTEXTURE_FILTERMODE GetTextureMinMode() => getGenericValue(BMap.BMMaterial_GetTextureMinMode);
- public void SetTextureMinMode(VXTEXTURE_FILTERMODE val) => setGenericValue(BMap.BMMaterial_SetTextureMinMode, val);
- public VXTEXTURE_FILTERMODE GetTextureMagMode() => getGenericValue(BMap.BMMaterial_GetTextureMagMode);
- public void SetTextureMagMode(VXTEXTURE_FILTERMODE val) => setGenericValue(BMap.BMMaterial_SetTextureMagMode, val);
- public VXTEXTURE_ADDRESSMODE GetTextureAddressMode() => getGenericValue(BMap.BMMaterial_GetTextureAddressMode);
- public void SetTextureAddressMode(VXTEXTURE_ADDRESSMODE val) => setGenericValue(BMap.BMMaterial_SetTextureAddressMode, val);
- public VXBLEND_MODE GetSourceBlend() => getGenericValue(BMap.BMMaterial_GetSourceBlend);
- public void SetSourceBlend(VXBLEND_MODE val) => setGenericValue(BMap.BMMaterial_SetSourceBlend, val);
- public VXBLEND_MODE GetDestBlend() => getGenericValue(BMap.BMMaterial_GetDestBlend);
- public void SetDestBlend(VXBLEND_MODE val) => setGenericValue(BMap.BMMaterial_SetDestBlend, val);
- public VXFILL_MODE GetFillMode() => getGenericValue(BMap.BMMaterial_GetFillMode);
- public void SetFillMode(VXFILL_MODE val) => setGenericValue(BMap.BMMaterial_SetFillMode, val);
- public VXSHADE_MODE GetShadeMode() => getGenericValue(BMap.BMMaterial_GetShadeMode);
- public void SetShadeMode(VXSHADE_MODE val) => setGenericValue(BMap.BMMaterial_SetShadeMode, val);
+ public VXTEXTURE_BLENDMODE GetTextureBlendMode() => GetGenericValue(BMap.BMMaterial_GetTextureBlendMode);
+ public void SetTextureBlendMode(VXTEXTURE_BLENDMODE val) => SetGenericValue(BMap.BMMaterial_SetTextureBlendMode, val);
+ public VXTEXTURE_FILTERMODE GetTextureMinMode() => GetGenericValue(BMap.BMMaterial_GetTextureMinMode);
+ public void SetTextureMinMode(VXTEXTURE_FILTERMODE val) => SetGenericValue(BMap.BMMaterial_SetTextureMinMode, val);
+ public VXTEXTURE_FILTERMODE GetTextureMagMode() => GetGenericValue(BMap.BMMaterial_GetTextureMagMode);
+ public void SetTextureMagMode(VXTEXTURE_FILTERMODE val) => SetGenericValue(BMap.BMMaterial_SetTextureMagMode, val);
+ public VXTEXTURE_ADDRESSMODE GetTextureAddressMode() => GetGenericValue(BMap.BMMaterial_GetTextureAddressMode);
+ public void SetTextureAddressMode(VXTEXTURE_ADDRESSMODE val) => SetGenericValue(BMap.BMMaterial_SetTextureAddressMode, val);
+ public VXBLEND_MODE GetSourceBlend() => GetGenericValue(BMap.BMMaterial_GetSourceBlend);
+ public void SetSourceBlend(VXBLEND_MODE val) => SetGenericValue(BMap.BMMaterial_SetSourceBlend, val);
+ public VXBLEND_MODE GetDestBlend() => GetGenericValue(BMap.BMMaterial_GetDestBlend);
+ public void SetDestBlend(VXBLEND_MODE val) => SetGenericValue(BMap.BMMaterial_SetDestBlend, val);
+ public VXFILL_MODE GetFillMode() => GetGenericValue(BMap.BMMaterial_GetFillMode);
+ public void SetFillMode(VXFILL_MODE val) => SetGenericValue(BMap.BMMaterial_SetFillMode, val);
+ public VXSHADE_MODE GetShadeMode() => GetGenericValue(BMap.BMMaterial_GetShadeMode);
+ public void SetShadeMode(VXSHADE_MODE val) => SetGenericValue(BMap.BMMaterial_SetShadeMode, val);
- public bool GetAlphaTestEnabled() => getGenericValue(BMap.BMMaterial_GetAlphaTestEnabled);
- public void SetAlphaTestEnabled(bool val) => setGenericValue(BMap.BMMaterial_SetAlphaTestEnabled, val);
- public bool GetAlphaBlendEnabled() => getGenericValue(BMap.BMMaterial_GetAlphaBlendEnabled);
- public void SetAlphaBlendEnabled(bool val) => setGenericValue(BMap.BMMaterial_SetAlphaBlendEnabled, val);
- public bool GetPerspectiveCorrectionEnabled() => getGenericValue(BMap.BMMaterial_GetPerspectiveCorrectionEnabled);
- public void SetPerspectiveCorrectionEnabled(bool val) => setGenericValue(BMap.BMMaterial_SetPerspectiveCorrectionEnabled, val);
- public bool GetZWriteEnabled() => getGenericValue(BMap.BMMaterial_GetZWriteEnabled);
- public void SetZWriteEnabled(bool val) => setGenericValue(BMap.BMMaterial_SetZWriteEnabled, val);
- public bool GetTwoSidedEnabled() => getGenericValue(BMap.BMMaterial_GetTwoSidedEnabled);
- public void SetTwoSidedEnabled(bool val) => setGenericValue(BMap.BMMaterial_SetTwoSidedEnabled, val);
+ public bool GetAlphaTestEnabled() => GetGenericValue(BMap.BMMaterial_GetAlphaTestEnabled);
+ public void SetAlphaTestEnabled(bool val) => SetGenericValue(BMap.BMMaterial_SetAlphaTestEnabled, val);
+ public bool GetAlphaBlendEnabled() => GetGenericValue(BMap.BMMaterial_GetAlphaBlendEnabled);
+ public void SetAlphaBlendEnabled(bool val) => SetGenericValue(BMap.BMMaterial_SetAlphaBlendEnabled, val);
+ public bool GetPerspectiveCorrectionEnabled() => GetGenericValue(BMap.BMMaterial_GetPerspectiveCorrectionEnabled);
+ public void SetPerspectiveCorrectionEnabled(bool val) => SetGenericValue(BMap.BMMaterial_SetPerspectiveCorrectionEnabled, val);
+ public bool GetZWriteEnabled() => GetGenericValue(BMap.BMMaterial_GetZWriteEnabled);
+ public void SetZWriteEnabled(bool val) => SetGenericValue(BMap.BMMaterial_SetZWriteEnabled, val);
+ public bool GetTwoSidedEnabled() => GetGenericValue(BMap.BMMaterial_GetTwoSidedEnabled);
+ public void SetTwoSidedEnabled(bool val) => SetGenericValue(BMap.BMMaterial_SetTwoSidedEnabled, val);
- public byte GetAlphaRef() => getGenericValue(BMap.BMMaterial_GetAlphaRef);
- public void SetAlphaRef(byte val) => setGenericValue(BMap.BMMaterial_SetAlphaRef, val);
+ public byte GetAlphaRef() => GetGenericValue(BMap.BMMaterial_GetAlphaRef);
+ public void SetAlphaRef(byte val) => SetGenericValue(BMap.BMMaterial_SetAlphaRef, val);
- public VXCMPFUNC GetAlphaFunc() => getGenericValue(BMap.BMMaterial_GetAlphaFunc);
- public void SetAlphaFunc(VXCMPFUNC val) => setGenericValue(BMap.BMMaterial_SetAlphaFunc, val);
- public VXCMPFUNC GetZFunc() => getGenericValue(BMap.BMMaterial_GetZFunc);
- public void SetZFunc(VXCMPFUNC val) => setGenericValue(BMap.BMMaterial_SetZFunc, val);
+ public VXCMPFUNC GetAlphaFunc() => GetGenericValue(BMap.BMMaterial_GetAlphaFunc);
+ public void SetAlphaFunc(VXCMPFUNC val) => SetGenericValue(BMap.BMMaterial_SetAlphaFunc, val);
+ public VXCMPFUNC GetZFunc() => GetGenericValue(BMap.BMMaterial_GetZFunc);
+ public void SetZFunc(VXCMPFUNC val) => SetGenericValue(BMap.BMMaterial_SetZFunc, val);
}
public class BMMesh : BMObject {
internal BMMesh(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
- public VXMESH_LITMODE GetLitMode() => getGenericValue(BMap.BMMesh_GetLitMode);
- public void SetLitMode(VXMESH_LITMODE mode) => setGenericValue(BMap.BMMesh_SetLitMode, mode);
+ public VXMESH_LITMODE GetLitMode() => GetGenericValue(BMap.BMMesh_GetLitMode);
+ public void SetLitMode(VXMESH_LITMODE mode) => SetGenericValue(BMap.BMMesh_SetLitMode, mode);
- public uint GetVertexCount() => getGenericValue(BMap.BMMesh_GetVertexCount);
- public void SetVertexCount(uint count) => setGenericValue(BMap.BMMesh_SetVertexCount, count);
+ public uint GetVertexCount() => GetGenericValue(BMap.BMMesh_GetVertexCount);
+ public void SetVertexCount(uint count) => SetGenericValue(BMap.BMMesh_SetVertexCount, count);
public IEnumerable GetVertexPositions() {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexPositions(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexPositions(GetPointer(), GetCKID(), out IntPtr out_mem));
return Utils.VxVector3Iterator(out_mem, GetVertexCount());
}
public void SetVertexPositions(IEnumerable iem) {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexPositions(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexPositions(GetPointer(), GetCKID(), out IntPtr out_mem));
Utils.VxVector3Assigner(out_mem, GetVertexCount(), iem);
}
public IEnumerable GetVertexNormals() {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexNormals(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexNormals(GetPointer(), GetCKID(), out IntPtr out_mem));
return Utils.VxVector3Iterator(out_mem, GetVertexCount());
}
public void SetVertexNormals(IEnumerable iem) {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexNormals(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexNormals(GetPointer(), GetCKID(), out IntPtr out_mem));
Utils.VxVector3Assigner(out_mem, GetVertexCount(), iem);
}
public IEnumerable GetVertexUVs() {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexUVs(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexUVs(GetPointer(), GetCKID(), out IntPtr out_mem));
return Utils.VxVector2Iterator(out_mem, GetVertexCount());
}
public void SetVertexUVs(IEnumerable iem) {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexUVs(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetVertexUVs(GetPointer(), GetCKID(), out IntPtr out_mem));
Utils.VxVector2Assigner(out_mem, GetVertexCount(), iem);
}
- public uint GetFaceCount() => getGenericValue(BMap.BMMesh_GetFaceCount);
- public void SetFaceCount(uint count) => setGenericValue(BMap.BMMesh_SetFaceCount, count);
+ public uint GetFaceCount() => GetGenericValue(BMap.BMMesh_GetFaceCount);
+ public void SetFaceCount(uint count) => SetGenericValue(BMap.BMMesh_SetFaceCount, count);
public IEnumerable GetFaceIndices() {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceIndices(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceIndices(GetPointer(), GetCKID(), out IntPtr out_mem));
return Utils.CKShortFaceIndicesIterator(out_mem, GetFaceCount());
}
public void SetFaceIndices(IEnumerable iem) {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceIndices(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceIndices(GetPointer(), GetCKID(), out IntPtr out_mem));
Utils.CKShortFaceIndicesAssigner(out_mem, GetFaceCount(), iem);
}
public IEnumerable GetFaceMaterialSlotIndexs() {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceMaterialSlotIndexs(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceMaterialSlotIndexs(GetPointer(), GetCKID(), out IntPtr out_mem));
return Utils.ShortIterator(out_mem, GetFaceCount());
}
public void SetFaceMaterialSlotIndexs(IEnumerable iem) {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceMaterialSlotIndexs(getPointer(), getCKID(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetFaceMaterialSlotIndexs(GetPointer(), GetCKID(), out IntPtr out_mem));
Utils.ShortAssigner(out_mem, GetFaceCount(), iem);
}
- public uint GetMaterialSlotCount() => getGenericValue(BMap.BMMesh_GetMaterialSlotCount);
- public void SetMaterialSlotCount(uint count) => setGenericValue(BMap.BMMesh_SetMaterialSlotCount, count);
+ public uint GetMaterialSlotCount() => GetGenericValue(BMap.BMMesh_GetMaterialSlotCount);
+ public void SetMaterialSlotCount(uint count) => SetGenericValue(BMap.BMMesh_SetMaterialSlotCount, count);
public IEnumerable GetMaterialSlots() {
uint count = GetMaterialSlotCount();
for (uint i = 0; i < count; ++i) {
- BMapException.ThrowIfFailed(BMap.BMMesh_GetMaterialSlot(getPointer(), getCKID(), i, out uint out_mtlid));
+ BMapException.ThrowIfFailed(BMap.BMMesh_GetMaterialSlot(GetPointer(), GetCKID(), i, out uint out_mtlid));
if (out_mtlid == Utils.INVALID_CKID) yield return null;
- else yield return new BMMaterial(getPointer(), out_mtlid);
+ else yield return new BMMaterial(GetPointer(), out_mtlid);
}
}
public void SetMaterialSlots(IEnumerable iem) {
@@ -382,8 +382,8 @@ namespace BMapSharp.BMapWrapper {
var itor = iem.GetEnumerator();
for (uint i = 0; i < count; ++i) {
if (!itor.MoveNext()) throw new BMapException("The length of given material array is too short when assigning material slots.");
- uint mtlid = itor.Current is null ? Utils.INVALID_CKID : itor.Current.getCKID();
- BMapException.ThrowIfFailed(BMap.BMMesh_SetMaterialSlot(getPointer(), getCKID(), i, mtlid));
+ uint mtlid = itor.Current is null ? Utils.INVALID_CKID : itor.Current.GetCKID();
+ BMapException.ThrowIfFailed(BMap.BMMesh_SetMaterialSlot(GetPointer(), GetCKID(), i, mtlid));
}
}
@@ -392,21 +392,21 @@ namespace BMapSharp.BMapWrapper {
public class BM3dEntity : BMObject {
internal BM3dEntity(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
- public VxMatrix GetWorldMatrix() => getGenericValue(BMap.BM3dEntity_GetWorldMatrix);
- public void SetWorldMatrix(VxMatrix mat) => setGenericValue(BMap.BM3dEntity_SetWorldMatrix, mat);
+ public VxMatrix GetWorldMatrix() => GetGenericValue(BMap.BM3dEntity_GetWorldMatrix);
+ public void SetWorldMatrix(VxMatrix mat) => SetGenericValue(BMap.BM3dEntity_SetWorldMatrix, mat);
public BMMesh GetCurrentMesh() {
- BMapException.ThrowIfFailed(BMap.BM3dEntity_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);
+ 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.BM3dEntity_SetCurrentMesh(getPointer(), getCKID(), meshid));
+ uint meshid = (mesh is null) ? Utils.INVALID_CKID : mesh.GetCKID();
+ BMapException.ThrowIfFailed(BMap.BM3dEntity_SetCurrentMesh(GetPointer(), GetCKID(), meshid));
}
- public bool GetVisibility() => getGenericValue(BMap.BM3dEntity_GetVisibility);
- public void SetVisibility(bool visb) => setGenericValue(BMap.BM3dEntity_SetVisibility, visb);
+ public bool GetVisibility() => GetGenericValue(BMap.BM3dEntity_GetVisibility);
+ public void SetVisibility(bool visb) => SetGenericValue(BMap.BM3dEntity_SetVisibility, visb);
}
public class BM3dObject : BM3dEntity {
@@ -416,55 +416,84 @@ namespace BMapSharp.BMapWrapper {
public class BMLight : BM3dEntity {
internal BMLight(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
+ // YYC MARK:
// Name `GetType` is conflict with C# base class function name.
// So we add a `Light` prefix for it.
- public VXLIGHT_TYPE GetLightType() => getGenericValue(BMap.BMLight_GetType);
- public void SetLightType(VXLIGHT_TYPE val) => setGenericValue(BMap.BMLight_SetType, val);
+ public VXLIGHT_TYPE GetLightType() => GetGenericValue(BMap.BMLight_GetType);
+ public void SetLightType(VXLIGHT_TYPE val) => SetGenericValue(BMap.BMLight_SetType, val);
- public VxColor GetColor() => getGenericValue(BMap.BMLight_GetColor);
- public void SetColor(VxColor col) => setGenericValue(BMap.BMLight_SetColor, col);
+ public VxColor GetColor() => GetGenericValue(BMap.BMLight_GetColor);
+ public void SetColor(VxColor col) => SetGenericValue(BMap.BMLight_SetColor, col);
- public float GetConstantAttenuation() => getGenericValue(BMap.BMLight_GetConstantAttenuation);
- public void SetConstantAttenuation(float val) => setGenericValue(BMap.BMLight_SetConstantAttenuation, val);
- public float GetLinearAttenuation() => getGenericValue(BMap.BMLight_GetLinearAttenuation);
- public void SetLinearAttenuation(float val) => setGenericValue(BMap.BMLight_SetLinearAttenuation, val);
- public float GetQuadraticAttenuation() => getGenericValue(BMap.BMLight_GetQuadraticAttenuation);
- public void SetQuadraticAttenuation(float val) => setGenericValue(BMap.BMLight_SetQuadraticAttenuation, val);
+ public float GetConstantAttenuation() => GetGenericValue(BMap.BMLight_GetConstantAttenuation);
+ public void SetConstantAttenuation(float val) => SetGenericValue(BMap.BMLight_SetConstantAttenuation, val);
+ public float GetLinearAttenuation() => GetGenericValue(BMap.BMLight_GetLinearAttenuation);
+ public void SetLinearAttenuation(float val) => SetGenericValue(BMap.BMLight_SetLinearAttenuation, val);
+ public float GetQuadraticAttenuation() => GetGenericValue(BMap.BMLight_GetQuadraticAttenuation);
+ public void SetQuadraticAttenuation(float val) => SetGenericValue(BMap.BMLight_SetQuadraticAttenuation, val);
- public float GetRange() => getGenericValue(BMap.BMLight_GetRange);
- public void SetRange(float val) => setGenericValue(BMap.BMLight_SetRange, val);
+ public float GetRange() => GetGenericValue(BMap.BMLight_GetRange);
+ public void SetRange(float val) => SetGenericValue(BMap.BMLight_SetRange, val);
- public float GetHotSpot() => getGenericValue(BMap.BMLight_GetHotSpot);
- public void SetHotSpot(float val) => setGenericValue(BMap.BMLight_SetHotSpot, val);
- public float GetFalloff() => getGenericValue(BMap.BMLight_GetFalloff);
- public void SetFalloff(float val) => setGenericValue(BMap.BMLight_SetFalloff, val);
- public float GetFalloffShape() => getGenericValue(BMap.BMLight_GetFalloffShape);
- public void SetFalloffShape(float val) => setGenericValue(BMap.BMLight_SetFalloffShape, val);
+ public float GetHotSpot() => GetGenericValue(BMap.BMLight_GetHotSpot);
+ public void SetHotSpot(float val) => SetGenericValue(BMap.BMLight_SetHotSpot, val);
+ public float GetFalloff() => GetGenericValue(BMap.BMLight_GetFalloff);
+ public void SetFalloff(float val) => SetGenericValue(BMap.BMLight_SetFalloff, val);
+ public float GetFalloffShape() => GetGenericValue(BMap.BMLight_GetFalloffShape);
+ public void SetFalloffShape(float val) => SetGenericValue(BMap.BMLight_SetFalloffShape, val);
}
public class BMTargetLight : BMLight {
internal BMTargetLight(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
}
+ public class BMCamera : BM3dEntity {
+ internal BMCamera(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
+
+ public CK_CAMERA_PROJECTION GetProjectionType() => GetGenericValue(BMap.BMCamera_GetProjectionType);
+ public void SetProjectionType(CK_CAMERA_PROJECTION val) => SetGenericValue(BMap.BMCamera_SetProjectionType, val);
+
+ public float GetOrthographicZoom() => GetGenericValue(BMap.BMCamera_GetOrthographicZoom);
+ public void SetOrthographicZoom(float val) => SetGenericValue(BMap.BMCamera_SetOrthographicZoom, val);
+
+ public float GetFrontPlane() => GetGenericValue(BMap.BMCamera_GetFrontPlane);
+ public void SetFrontPlane(float val) => SetGenericValue(BMap.BMCamera_SetFrontPlane, val);
+ public float GetBackPlane() => GetGenericValue(BMap.BMCamera_GetBackPlane);
+ public void SetBackPlane(float val) => SetGenericValue(BMap.BMCamera_SetBackPlane, val);
+ public float GetFov() => GetGenericValue(BMap.BMCamera_GetFov);
+ public void SetFov(float val) => SetGenericValue(BMap.BMCamera_SetFov, val);
+
+ public void GetAspectRatio(out uint width, out uint height) {
+ BMapException.ThrowIfFailed(BMap.BMCamera_GetAspectRatio(GetPointer(), GetCKID(), out width, out height));
+ }
+ public void SetAspectRatio(uint width, uint height) {
+ BMapException.ThrowIfFailed(BMap.BMCamera_SetAspectRatio(GetPointer(), GetCKID(), width, height));
+ }
+ }
+
+ public class BMTargetCamera: BMCamera {
+ internal BMTargetCamera(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
+ }
+
public class BMGroup : BMObject {
internal BMGroup(IntPtr raw_pointer, uint ckid) : base(raw_pointer, ckid) { }
public void AddObject(BM3dObject member) {
- BMapException.ThrowIfFailed(BMap.BMGroup_AddObject(getPointer(), getCKID(), member.getCKID()));
+ BMapException.ThrowIfFailed(BMap.BMGroup_AddObject(GetPointer(), GetCKID(), member.GetCKID()));
}
- public uint GetObjectCount() => getGenericValue(BMap.BMGroup_GetObjectCount);
+ public uint GetObjectCount() => GetGenericValue(BMap.BMGroup_GetObjectCount);
public IEnumerable GetObjects() {
var size = GetObjectCount();
for (uint i = 0; i < size; ++i) {
- BMapException.ThrowIfFailed(BMap.BMGroup_GetObject(getPointer(), getCKID(), i, out uint out_objid));
- yield return new BM3dObject(getPointer(), out_objid);
+ BMapException.ThrowIfFailed(BMap.BMGroup_GetObject(GetPointer(), GetCKID(), i, out uint out_objid));
+ yield return new BM3dObject(GetPointer(), out_objid);
}
}
}
public sealed class BMFileReader : AbstractPointer {
- private static IntPtr allocateHandle(string file_name, string temp_folder, string texture_folder, string[] encodings) {
+ private static IntPtr AllocateHandle(string file_name, string temp_folder, string texture_folder, string[] encodings) {
BMapException.ThrowIfFailed(BMap.BMFile_Load(
file_name, temp_folder, texture_folder,
Utils.BMapSharpCallback,
@@ -474,55 +503,59 @@ namespace BMapSharp.BMapWrapper {
return out_file;
}
protected override bool ReleaseHandle() {
- return BMap.BMFile_Free(this.getPointer());
+ return BMap.BMFile_Free(this.GetPointer());
}
public BMFileReader(string file_name, string temp_folder, string texture_folder, string[] encodings)
- : base(allocateHandle(file_name, temp_folder, texture_folder, encodings)) { }
+ : base(AllocateHandle(file_name, temp_folder, texture_folder, encodings)) { }
private delegate bool FctProtoGetCount(IntPtr bmf, out uint cnt);
private delegate bool FctProtoGetObject(IntPtr bmf, uint idx, out uint id);
private delegate T FctProtoCreateInstance(IntPtr bmf, uint id);
- private uint getCKObjectCount(FctProtoGetCount fct_cnt) {
- BMapException.ThrowIfFailed(fct_cnt(this.getPointer(), out uint out_count));
+ private uint GetGenericObjectCount(FctProtoGetCount fct_cnt) {
+ BMapException.ThrowIfFailed(fct_cnt(this.GetPointer(), out uint out_count));
return out_count;
}
- private IEnumerable getCKObjects(FctProtoGetCount fct_cnt, FctProtoGetObject fct_obj, FctProtoCreateInstance fct_crt) {
- uint count = getCKObjectCount(fct_cnt);
+ private IEnumerable GetGenericObject(FctProtoGetCount fct_cnt, FctProtoGetObject fct_obj, FctProtoCreateInstance fct_crt) {
+ uint count = GetGenericObjectCount(fct_cnt);
for (uint i = 0; i < count; ++i) {
- BMapException.ThrowIfFailed(fct_obj(this.getPointer(), i, out uint out_id));
- yield return fct_crt(this.getPointer(), out_id);
+ BMapException.ThrowIfFailed(fct_obj(this.GetPointer(), i, out uint out_id));
+ yield return fct_crt(this.GetPointer(), out_id);
}
}
public uint GetTextureCount() =>
- getCKObjectCount(BMap.BMFile_GetTextureCount);
+ GetGenericObjectCount(BMap.BMFile_GetTextureCount);
public IEnumerable GetTextures() =>
- getCKObjects(BMap.BMFile_GetTextureCount, BMap.BMFile_GetTexture, (bmf, id) => new BMTexture(bmf, id));
+ GetGenericObject(BMap.BMFile_GetTextureCount, BMap.BMFile_GetTexture, (bmf, id) => new BMTexture(bmf, id));
public uint GetMaterialCount() =>
- getCKObjectCount(BMap.BMFile_GetMaterialCount);
+ GetGenericObjectCount(BMap.BMFile_GetMaterialCount);
public IEnumerable GetMaterials() =>
- getCKObjects(BMap.BMFile_GetMaterialCount, BMap.BMFile_GetMaterial, (bmf, id) => new BMMaterial(bmf, id));
+ GetGenericObject(BMap.BMFile_GetMaterialCount, BMap.BMFile_GetMaterial, (bmf, id) => new BMMaterial(bmf, id));
public uint GetMeshCount() =>
- getCKObjectCount(BMap.BMFile_GetMeshCount);
+ GetGenericObjectCount(BMap.BMFile_GetMeshCount);
public IEnumerable GetMeshes() =>
- getCKObjects(BMap.BMFile_GetMeshCount, BMap.BMFile_GetMesh, (bmf, id) => new BMMesh(bmf, id));
+ GetGenericObject(BMap.BMFile_GetMeshCount, BMap.BMFile_GetMesh, (bmf, id) => new BMMesh(bmf, id));
public uint Get3dObjectCount() =>
- getCKObjectCount(BMap.BMFile_Get3dObjectCount);
+ GetGenericObjectCount(BMap.BMFile_Get3dObjectCount);
public IEnumerable Get3dObjects() =>
- getCKObjects(BMap.BMFile_Get3dObjectCount, BMap.BMFile_Get3dObject, (bmf, id) => new BM3dObject(bmf, id));
+ GetGenericObject(BMap.BMFile_Get3dObjectCount, BMap.BMFile_Get3dObject, (bmf, id) => new BM3dObject(bmf, id));
public uint GetGroupCount() =>
- getCKObjectCount(BMap.BMFile_GetGroupCount);
+ GetGenericObjectCount(BMap.BMFile_GetGroupCount);
public IEnumerable GetGroups() =>
- getCKObjects(BMap.BMFile_GetGroupCount, BMap.BMFile_GetGroup, (bmf, id) => new BMGroup(bmf, id));
+ GetGenericObject(BMap.BMFile_GetGroupCount, BMap.BMFile_GetGroup, (bmf, id) => new BMGroup(bmf, id));
public uint GetTargetLightCount() =>
- getCKObjectCount(BMap.BMFile_GetTargetLightCount);
+ GetGenericObjectCount(BMap.BMFile_GetTargetLightCount);
public IEnumerable GetTargetLights() =>
- getCKObjects(BMap.BMFile_GetTargetLightCount, BMap.BMFile_GetTargetLight, (bmf, id) => new BMTargetLight(bmf, id));
+ GetGenericObject(BMap.BMFile_GetTargetLightCount, BMap.BMFile_GetTargetLight, (bmf, id) => new BMTargetLight(bmf, id));
+ public uint GetTargetCameraCount() =>
+ GetGenericObjectCount(BMap.BMFile_GetTargetCameraCount);
+ public IEnumerable GetTargetCameras() =>
+ GetGenericObject(BMap.BMFile_GetTargetCameraCount, BMap.BMFile_GetTargetCamera, (bmf, id) => new BMTargetCamera(bmf, id));
}
public sealed class BMFileWriter : AbstractPointer {
- private static IntPtr allocateHandle(string temp_folder, string texture_folder, string[] encodings) {
+ private static IntPtr AllocateHandle(string temp_folder, string texture_folder, string[] encodings) {
BMapException.ThrowIfFailed(BMap.BMFile_Create(
temp_folder, texture_folder,
Utils.BMapSharpCallback,
@@ -532,14 +565,14 @@ namespace BMapSharp.BMapWrapper {
return out_file;
}
protected override bool ReleaseHandle() {
- return BMap.BMFile_Free(this.getPointer());
+ return BMap.BMFile_Free(this.GetPointer());
}
public BMFileWriter(string temp_folder, string texture_folder, string[] encodings)
- : base(allocateHandle(temp_folder, texture_folder, encodings)) { }
+ : base(AllocateHandle(temp_folder, texture_folder, encodings)) { }
public void Save(string filename, CK_TEXTURE_SAVEOPTIONS texture_save_opt, bool use_compress, int compress_level) {
BMapException.ThrowIfFailed(BMap.BMFile_Save(
- getPointer(),
+ GetPointer(),
filename,
texture_save_opt,
use_compress,
@@ -549,76 +582,78 @@ namespace BMapSharp.BMapWrapper {
private delegate bool FctProtoCreateObject(IntPtr bmf, out uint id);
private delegate T FctProtoCreateInstance(IntPtr bmf, uint id);
- private T createCKObject(FctProtoCreateObject fct_crt, FctProtoCreateInstance fct_inst) {
- BMapException.ThrowIfFailed(fct_crt(this.getPointer(), out uint out_id));
- return fct_inst(this.getPointer(), out_id);
+ private T CreateGenericObject(FctProtoCreateObject fct_crt, FctProtoCreateInstance fct_inst) {
+ BMapException.ThrowIfFailed(fct_crt(this.GetPointer(), out uint out_id));
+ return fct_inst(this.GetPointer(), out_id);
}
- public BMTexture CreateTexture() => createCKObject(BMap.BMFile_CreateTexture, (bmf, id) => new BMTexture(bmf, id));
- public BMMaterial CreateMaterial() => createCKObject(BMap.BMFile_CreateMaterial, (bmf, id) => new BMMaterial(bmf, id));
- public BMMesh CreateMesh() => createCKObject(BMap.BMFile_CreateMesh, (bmf, id) => new BMMesh(bmf, id));
- public BM3dObject Create3dObject() => createCKObject(BMap.BMFile_Create3dObject, (bmf, id) => new BM3dObject(bmf, id));
- public BMGroup CreateGroup() => createCKObject(BMap.BMFile_CreateGroup, (bmf, id) => new BMGroup(bmf, id));
- public BMTargetLight CreateTargetLight() => createCKObject(BMap.BMFile_CreateTargetLight, (bmf, id) => new BMTargetLight(bmf, id));
+ public BMTexture CreateTexture() => CreateGenericObject(BMap.BMFile_CreateTexture, (bmf, id) => new BMTexture(bmf, id));
+ public BMMaterial CreateMaterial() => CreateGenericObject(BMap.BMFile_CreateMaterial, (bmf, id) => new BMMaterial(bmf, id));
+ public BMMesh CreateMesh() => CreateGenericObject(BMap.BMFile_CreateMesh, (bmf, id) => new BMMesh(bmf, id));
+ public BM3dObject Create3dObject() => CreateGenericObject(BMap.BMFile_Create3dObject, (bmf, id) => new BM3dObject(bmf, id));
+ public BMGroup CreateGroup() => CreateGenericObject(BMap.BMFile_CreateGroup, (bmf, id) => new BMGroup(bmf, id));
+ public BMTargetLight CreateTargetLight() => CreateGenericObject(BMap.BMFile_CreateTargetLight, (bmf, id) => new BMTargetLight(bmf, id));
+ public BMTargetCamera CreateTargetCamera() => CreateGenericObject(BMap.BMFile_CreateTargetCamera, (bmf, id) => new BMTargetCamera(bmf, id));
+
}
public sealed class BMMeshTrans : AbstractPointer {
- private static IntPtr allocateHandle() {
+ private static IntPtr AllocateHandle() {
BMapException.ThrowIfFailed(BMap.BMMeshTrans_New(out IntPtr out_trans));
return out_trans;
}
protected override bool ReleaseHandle() {
- return BMap.BMMeshTrans_Delete(this.getPointer());
+ return BMap.BMMeshTrans_Delete(this.GetPointer());
}
- public BMMeshTrans() : base(allocateHandle()) { }
+ public BMMeshTrans() : base(AllocateHandle()) { }
public void Parse(BMMesh objmesh) {
BMapException.ThrowIfFailed(BMap.BMMeshTrans_Parse(
- getPointer(),
- objmesh.getPointer(),
- objmesh.getCKID()
+ GetPointer(),
+ objmesh.GetPointer(),
+ objmesh.GetCKID()
));
}
public void PrepareVertex(uint count, IEnumerable iem) {
// Prepare count first
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareVertexCount(getPointer(), count));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareVertexCount(GetPointer(), count));
// Then put data
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareVertex(getPointer(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareVertex(GetPointer(), out IntPtr out_mem));
Utils.VxVector3Assigner(out_mem, count, iem);
}
public void PrepareNormal(uint count, IEnumerable iem) {
// Prepare count first
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareNormalCount(getPointer(), count));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareNormalCount(GetPointer(), count));
// Then put data
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareNormal(getPointer(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareNormal(GetPointer(), out IntPtr out_mem));
Utils.VxVector3Assigner(out_mem, count, iem);
}
public void PrepareUV(uint count, IEnumerable iem) {
// Prepare count first
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareUVCount(getPointer(), count));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareUVCount(GetPointer(), count));
// Then put data
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareUV(getPointer(), out IntPtr out_mem));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareUV(GetPointer(), out IntPtr out_mem));
Utils.VxVector2Assigner(out_mem, count, iem);
}
public void PrepareMtlSlot(uint count, IEnumerable iem) {
// Prepare count first
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareMtlSlotCount(getPointer(), count));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareMtlSlotCount(GetPointer(), count));
// Then put data
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareMtlSlot(getPointer(), out IntPtr out_mem));
- var cast_iem = iem.Select((mtl) => mtl is null ? Utils.INVALID_CKID : mtl.getCKID());
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareMtlSlot(GetPointer(), out IntPtr out_mem));
+ var cast_iem = iem.Select((mtl) => mtl is null ? Utils.INVALID_CKID : mtl.GetCKID());
Utils.CKIDAssigner(out_mem, count, cast_iem);
}
public void PrepareFace(uint count, IEnumerable vec_idx, IEnumerable nml_idx, IEnumerable uv_idx, IEnumerable mtl_idx) {
// Prepare count first
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceCount(getPointer(), count));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceCount(GetPointer(), count));
// Get data address
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceVertexIndices(getPointer(), out IntPtr raw_vec_idx));
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceNormalIndices(getPointer(), out IntPtr raw_nml_idx));
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceUVIndices(getPointer(), out IntPtr raw_uv_idx));
- BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceMtlSlot(getPointer(), out IntPtr raw_mtl_idx));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceVertexIndices(GetPointer(), out IntPtr raw_vec_idx));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceNormalIndices(GetPointer(), out IntPtr raw_nml_idx));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceUVIndices(GetPointer(), out IntPtr raw_uv_idx));
+ BMapException.ThrowIfFailed(BMap.BMMeshTrans_PrepareFaceMtlSlot(GetPointer(), out IntPtr raw_mtl_idx));
// Assign data
Utils.CKFaceIndicesAssigner(raw_vec_idx, count, vec_idx);
Utils.CKFaceIndicesAssigner(raw_nml_idx, count, nml_idx);
diff --git a/Assets/BMapBindings/BMapSharp/BMapSharpTestbench/.editorconfig b/Assets/BMapBindings/BMapSharp/BMapSharpTest/.editorconfig
similarity index 100%
rename from Assets/BMapBindings/BMapSharp/BMapSharpTestbench/.editorconfig
rename to Assets/BMapBindings/BMapSharp/BMapSharpTest/.editorconfig
diff --git a/Assets/BMapBindings/BMapSharp/BMapSharpTestbench/BMapSharpTestbench.csproj b/Assets/BMapBindings/BMapSharp/BMapSharpTest/BMapSharpTest.csproj
similarity index 72%
rename from Assets/BMapBindings/BMapSharp/BMapSharpTestbench/BMapSharpTestbench.csproj
rename to Assets/BMapBindings/BMapSharp/BMapSharpTest/BMapSharpTest.csproj
index 46c4055..cc70e30 100644
--- a/Assets/BMapBindings/BMapSharp/BMapSharpTestbench/BMapSharpTestbench.csproj
+++ b/Assets/BMapBindings/BMapSharp/BMapSharpTest/BMapSharpTest.csproj
@@ -4,10 +4,6 @@
-
-
-
-
Exe
net8.0
diff --git a/Assets/BMapBindings/BMapSharp/BMapSharpTest/Cli.cs b/Assets/BMapBindings/BMapSharp/BMapSharpTest/Cli.cs
new file mode 100644
index 0000000..4629aef
--- /dev/null
+++ b/Assets/BMapBindings/BMapSharp/BMapSharpTest/Cli.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BMapSharpTest {
+
+ public class CliException : Exception {
+ public CliException() { }
+ public CliException(string message)
+ : base(message) { }
+ public CliException(string message, Exception inner)
+ : base(message, inner) { }
+ }
+
+ public class Cli {
+ public Cli() {
+ var filename = System.Environment.GetEnvironmentVariable("BMAP_FILE_NAME");
+ if (filename is null) {
+ throw new CliException("You must specify BMAP_FILE_NAME environment variable before running this test.");
+ }
+ this.FileName = filename;
+
+ var ballance_dir = System.Environment.GetEnvironmentVariable("BMAP_BALLANCE_DIR");
+ if (ballance_dir is null) {
+ throw new CliException("You must specify BMAP_BALLANCE_DIR environment variable before running this test.");
+ }
+ this.BallanceDirectory = ballance_dir;
+
+ var encodings = System.Environment.GetEnvironmentVariable("BMAP_ENCODINGS");
+ if (encodings is null) {
+ throw new CliException("You must specify BMAP_ENCODINGS environment variable before running this test.");
+ }
+ this.Encodings = encodings.Split(",");
+ }
+
+ ///
+ /// The path to the map for loading.
+ ///
+ public string FileName { get; private set; }
+ ///
+ /// The path to the Ballance directory for finding textures
+ ///
+ public string BallanceDirectory { get; private set; }
+ ///
+ /// The name of encodings used by BMap for loading map.
+ ///
+ public string[] Encodings { get; private set; }
+ }
+
+
+}
diff --git a/Assets/BMapBindings/BMapSharp/BMapSharpTest/Program.cs b/Assets/BMapBindings/BMapSharp/BMapSharpTest/Program.cs
new file mode 100644
index 0000000..5d98705
--- /dev/null
+++ b/Assets/BMapBindings/BMapSharp/BMapSharpTest/Program.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+using System.Diagnostics;
+using BMapSharp;
+
+namespace BMapSharpTest {
+ internal class Program {
+
+ static void Main(string[] args) {
+ // Parse arguments
+ try {
+
+ } catch (CliException e) {
+ Console.WriteLine($"Can not launch test. Reason: {e.Message}");
+ Environment.Exit(0);
+ }
+
+ // Check console encoding.
+ Console.OutputEncoding = Encoding.UTF8;
+ // Check BMap status.
+ if (!BMapSharp.BMapWrapper.Utils.IsBMapAvailable()) {
+ Console.WriteLine("Fail to initialize native BMap.");
+ Environment.Exit(0);
+ }
+
+ // Waiting debugger
+ int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
+ Console.WriteLine($"C# PID is {pid}. Waiting debugger, press any key to continue...");
+ Console.ReadKey(true);
+
+ // Start testbench
+ 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)) {
+ TestSuits.TestCommon.Test(reader);
+ TestSuits.TestIEquatable.Test(reader);
+ }
+
+ Console.WriteLine("Press any key to quit...");
+ Console.ReadKey(true);
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Assets/BMapBindings/BMapSharp/BMapSharpTest/TestSuits.cs b/Assets/BMapBindings/BMapSharp/BMapSharpTest/TestSuits.cs
new file mode 100644
index 0000000..65e4fa9
--- /dev/null
+++ b/Assets/BMapBindings/BMapSharp/BMapSharpTest/TestSuits.cs
@@ -0,0 +1,177 @@
+using BMapSharp.BMapWrapper;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace BMapSharpTest.TestSuits {
+
+ public static class TestCommon {
+
+ 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("===== Target Cameras =====");
+ TestTargetCamera(reader);
+ Console.WriteLine("===== END =====");
+ }
+
+ private static void TestGroup(BMFileReader reader) {
+ foreach (var gp in reader.GetGroups()) {
+ Console.WriteLine(gp.GetName());
+ foreach (var gp_item in gp.GetObjects()) {
+ Console.WriteLine($"\t{gp_item.GetName()}");
+ }
+ }
+ }
+
+ private static void Test3dObject(BMFileReader reader) {
+ foreach (var obj in reader.Get3dObjects()) {
+ Console.WriteLine(obj.GetName());
+
+ var current_mesh = obj.GetCurrentMesh();
+ var mesh_name = current_mesh is null ? "" : current_mesh.GetName();
+ Console.WriteLine($"\tMesh: {mesh_name}");
+ Console.WriteLine($"\tVisibility: {obj.GetVisibility()}");
+ Console.WriteLine($"\tMatrix: {obj.GetWorldMatrix().ToManaged()}");
+ }
+ }
+
+ private static void TestMesh(BMFileReader reader) {
+ foreach (var mesh in reader.GetMeshes()) {
+ Console.WriteLine(mesh.GetName());
+
+ Console.WriteLine($"\tLit Mode: {mesh.GetLitMode()}");
+ Console.WriteLine($"\tVertex Count: {mesh.GetVertexCount()}");
+ Console.WriteLine($"\tFace Count: {mesh.GetFaceCount()}");
+ Console.WriteLine($"\tMaterial Slot Count: {mesh.GetMaterialSlotCount()}");
+ }
+ }
+
+ private static void TestMaterial(BMFileReader reader) {
+ 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($"\tSpecular Power: {mtl.GetSpecularPower()}");
+
+ 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($"\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 Func: {mtl.GetAlphaFunc()}");
+ Console.WriteLine($"\tZ Func: {mtl.GetZFunc()}");
+ }
+ }
+
+ private static void TestTexture(BMFileReader reader) {
+ foreach (var tex in reader.GetTextures()) {
+ Console.WriteLine(tex.GetName());
+
+ Console.WriteLine($"\tFile Name: {tex.GetFileName()}");
+ Console.WriteLine($"\tSave Options: {tex.GetSaveOptions()}");
+ Console.WriteLine($"\tVideo Format: {tex.GetVideoFormat()}");
+ }
+ }
+
+ private static void TestTargetLight(BMFileReader reader) {
+ 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()}");
+ }
+ }
+
+ private static void TestTargetCamera(BMFileReader reader) {
+ foreach (var cam in reader.GetTargetCameras()) {
+ Console.WriteLine(cam.GetName());
+
+ Console.WriteLine($"\tVisibility: {cam.GetVisibility()}");
+ Console.WriteLine($"\tMatrix: {cam.GetWorldMatrix().ToManaged()}");
+
+ Console.WriteLine($"Type: {cam.GetProjectionType()}");
+ Console.WriteLine($"Orthographic Zoom: {cam.GetOrthographicZoom()}");
+ Console.WriteLine($"Front Plane: {cam.GetFrontPlane()}");
+ Console.WriteLine($"Back Plane: {cam.GetBackPlane()}");
+ Console.WriteLine($"Fov: {cam.GetFov()}");
+
+ cam.GetAspectRatio(out var width, out var height);
+ Console.WriteLine($"Aspect Ratio: {width} x {height}");
+ }
+ }
+ }
+
+ public static class TestIEquatable {
+
+ public static void Test(BMFileReader reader) {
+ if (reader.Get3dObjectCount() < 2u) {
+ Debug.Fail(
+ "Invalid file for test IEquatable.",
+ "We can not perform IEquatable test because the length of 3dObject is too short (must greater than 2). Please choose another file to perform."
+ );
+ return;
+ }
+
+ // Prepare test variables
+ var all_3dobjects = new List(reader.Get3dObjects());
+ var first_3dobj = all_3dobjects[0];
+ var second_3dobj = all_3dobjects[1];
+ all_3dobjects = new List(reader.Get3dObjects());
+ var first_3dobj_again = all_3dobjects[0];
+ Debug.Assert(!Object.ReferenceEquals(first_3dobj, first_3dobj_again));
+
+ // Hashtable test
+ var test_hashset = new HashSet();
+ Debug.Assert(test_hashset.Add(first_3dobj));
+ Debug.Assert(!test_hashset.Add(first_3dobj_again));
+ Debug.Assert(test_hashset.Add(second_3dobj));
+
+ // Dictionary test
+ var test_dictionary = new Dictionary();
+ Debug.Assert(test_dictionary.TryAdd(first_3dobj, first_3dobj.GetName()));
+ Debug.Assert(!test_dictionary.TryAdd(first_3dobj_again, first_3dobj_again.GetName()));
+ Debug.Assert(test_dictionary.TryAdd(second_3dobj, second_3dobj.GetName()));
+
+ }
+
+ }
+
+}
diff --git a/Assets/BMapBindings/BMapSharp/BMapSharpTestbench/Program.cs b/Assets/BMapBindings/BMapSharp/BMapSharpTestbench/Program.cs
deleted file mode 100644
index 44235d6..0000000
--- a/Assets/BMapBindings/BMapSharp/BMapSharpTestbench/Program.cs
+++ /dev/null
@@ -1,219 +0,0 @@
-using BMapSharp.BMapWrapper;
-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()) {
- Console.WriteLine("Fail to initialize native BMap.");
- Environment.Exit(0);
- }
-
- // Waiting debugger
- int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
- Console.WriteLine($"C# PID is {pid}. Waiting debugger, press any key to continue...");
- Console.ReadKey(true);
-
- // Start testbench
- 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);
- TestIEquatable(reader);
- }
-
- Console.WriteLine("Press any key to quit...");
- Console.ReadKey(true);
-
- }
-
- 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
- ("--file-path", "The path to input Virtools file.");
- fileNameOpt.IsRequired = true;
- var tempFolderOpt = new Option
- ("--temp-dir", "The temp folder used by BMap.");
- tempFolderOpt.IsRequired = true;
- var textureFolderOpt = new Option