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

@@ -2,22 +2,26 @@
// This file is generated by Ghost.NativeWrapperGen. Do not edit manually.
// </auto-generated>
using System.Runtime.CompilerServices;
namespace Ghost.Ufbx;
public unsafe partial struct ufbx_mesh
public unsafe partial struct ufbx_mesh : System.IDisposable
{
// From: ufbx_find_face_index(ufbx_mesh*, nuint)
public uint find_face_index(nuint index)
/// <summary>
/// From: <see cref="Api.ufbx_find_face_index(ufbx_mesh*, nuint)" />
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public uint FindFaceIndex(nuint index)
{
return Api.ufbx_find_face_index(
(ufbx_mesh*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
index);
}
// From: ufbx_compute_topology(ufbx_mesh*, ufbx_topo_edge*, nuint)
public void compute_topology(ufbx_topo_edge* topo, nuint num_topo)
/// <summary>
/// From: <see cref="Api.ufbx_compute_topology(ufbx_mesh*, ufbx_topo_edge*, nuint)" />
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void ComputeTopology(ufbx_topo_edge* topo, nuint num_topo)
{
Api.ufbx_compute_topology(
(ufbx_mesh*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
@@ -25,8 +29,11 @@ public unsafe partial struct ufbx_mesh
num_topo);
}
// From: ufbx_generate_normal_mapping(ufbx_mesh*, ufbx_topo_edge*, nuint, uint*, nuint, bool)
public nuint generate_normal_mapping(ufbx_topo_edge* topo, nuint num_topo, uint* normal_indices, nuint num_normal_indices, bool assume_smooth)
/// <summary>
/// From: <see cref="Api.ufbx_generate_normal_mapping(ufbx_mesh*, ufbx_topo_edge*, nuint, uint*, nuint, bool)" />
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public nuint GenerateNormalMapping(ufbx_topo_edge* topo, nuint num_topo, uint* normal_indices, nuint num_normal_indices, bool assume_smooth)
{
return Api.ufbx_generate_normal_mapping(
(ufbx_mesh*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
@@ -37,8 +44,11 @@ public unsafe partial struct ufbx_mesh
assume_smooth);
}
// From: ufbx_compute_normals(ufbx_mesh*, ufbx_vertex_vec3*, uint*, nuint, Misaki.HighPerformance.Mathematics.float3*, nuint)
public void compute_normals(ufbx_vertex_vec3* positions, uint* normal_indices, nuint num_normal_indices, Misaki.HighPerformance.Mathematics.float3* normals, nuint num_normals)
/// <summary>
/// From: <see cref="Api.ufbx_compute_normals(ufbx_mesh*, ufbx_vertex_vec3*, uint*, nuint, Misaki.HighPerformance.Mathematics.float3*, nuint)" />
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void ComputeNormals(ufbx_vertex_vec3* positions, uint* normal_indices, nuint num_normal_indices, Misaki.HighPerformance.Mathematics.float3* normals, nuint num_normals)
{
Api.ufbx_compute_normals(
(ufbx_mesh*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
@@ -49,8 +59,11 @@ public unsafe partial struct ufbx_mesh
num_normals);
}
// From: ufbx_subdivide_mesh(ufbx_mesh*, nuint, ufbx_subdivide_opts*, ufbx_error*)
public ufbx_mesh* subdivide(nuint level, ufbx_subdivide_opts* opts, ufbx_error* error)
/// <summary>
/// From: <see cref="Api.ufbx_subdivide_mesh(ufbx_mesh*, nuint, ufbx_subdivide_opts*, ufbx_error*)" />
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public ufbx_mesh* Subdivide(nuint level, ufbx_subdivide_opts* opts, ufbx_error* error)
{
return Api.ufbx_subdivide_mesh(
(ufbx_mesh*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this),
@@ -59,14 +72,20 @@ public unsafe partial struct ufbx_mesh
error);
}
// From: ufbx_free_mesh(ufbx_mesh*)
public void free()
/// <summary>
/// From: <see cref="Api.ufbx_free_mesh(ufbx_mesh*)" />
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Dispose()
{
Api.ufbx_free_mesh((ufbx_mesh*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this));
}
// From: ufbx_retain_mesh(ufbx_mesh*)
public void retain()
/// <summary>
/// From: <see cref="Api.ufbx_retain_mesh(ufbx_mesh*)" />
/// </summary>
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Retain()
{
Api.ufbx_retain_mesh((ufbx_mesh*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref this));
}