feat(bindings): update C# wrappers for meshopt, nvtt, ufbx

Refactor and regenerate native C# bindings for Ghost.MeshOptimizer, Ghost.Nvtt, and Ghost.Ufbx to match updated native APIs and improve usability.
- Replace meshoptimizer.dll with newer version.
- Move meshoptimizer functions to static methods in partial class; add new meshlet, simplification, quantization features.
- Remove enum wrappers in favor of constants; delete meshopt_Allocator.cs.
- Regenerate native wrappers with PascalCase naming, XML doc comments, and aggressive inlining.
- Implement IDisposable for resource structs; update configs for naming, documentation, and method mapping.
- Update user code to use new wrapper classes and method names.
- Improve documentation and comments for clarity.

BREAKING CHANGE: API surface changes, wrapper class and method names updated, enum wrappers removed, custom allocator deleted.
This commit is contained in:
2026-03-17 00:19:54 +09:00
parent 9bae3e647e
commit e831b71a79
62 changed files with 3820 additions and 1285 deletions

View File

@@ -41,19 +41,19 @@ internal sealed unsafe class NvttBindingTest : ITest
{
// ---- Test 1: Version ---------------------------------------------------
Console.Write("[Test 1] nvttVersion ... ");
var version = Api.nvttVersion();
var version = NvttApi.Version();
Assert(version > 0, $"Expected version > 0, got {version}");
Console.WriteLine($"OK (version = {version >> 16}.{(version >> 8) & 0xFF}.{version & 0xFF})");
Console.WriteLine($"OK (version = {version >> 16}.{(version >> 8) & 0xFFu}.{version & 0xFFu})");
// ---- Test 2: CUDA support query (must not crash) ----------------------
Console.Write("[Test 2] IsCudaSupported ... ");
var cuda = Api.nvttIsCudaSupported();
var cuda = NvttApi.IsCudaSupported();
Console.WriteLine($"OK (cuda = {cuda})");
// ---- Test 3: Global message callback ----------------------------------
Console.Write("[Test 3] SetMessageCallback ... ");
var callbackFired = 0;
var token = Api.nvttSetMessageCallback(&CallBack, &callbackFired);
var token = NvttApi.SetMessageCallback(&CallBack, &callbackFired);
Console.WriteLine($"OK (no crash, callback fired {callbackFired} times during install)");

View File

@@ -1,4 +1,4 @@
using Ghost.MicroTest;
using Ghost.Test.Core;
TestRunner.Run<UfbxBindingTest>();
TestRunner.Run<UfbxBindingTest>();

View File

@@ -14,7 +14,7 @@ internal unsafe class UfbxBindingTest : ITest
var load_Opts = new ufbx_load_opts();
var error = new ufbx_error();
var pScene = ufbx_scene.load_file_len("F:/c/Third Parties/ufbx/data/blender_340_z_up_7400_binary.fbx"u8, &load_Opts, &error);
var pScene = ufbx_scene.LoadFileLen("F:/c/Third Parties/ufbx/data/blender_340_z_up_7400_binary.fbx"u8, &load_Opts, &error);
if (pScene == null)
{
@@ -46,7 +46,7 @@ internal unsafe class UfbxBindingTest : ITest
}
}
pScene->free();
pScene->Dispose();
Console.WriteLine("Done.");
}