Files
GhostEngine/src/Test/Ghost.MicroTest/UfbxBindingTest.cs
Misaki e831b71a79 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.
2026-03-17 00:19:54 +09:00

57 lines
1.5 KiB
C#

using Ghost.Test.Core;
using Ghost.Ufbx;
namespace Ghost.MicroTest;
internal unsafe class UfbxBindingTest : ITest
{
public void Setup()
{
}
public void Run()
{
var load_Opts = new ufbx_load_opts();
var error = new ufbx_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)
{
Console.WriteLine(error.description.ToString());
}
for (var i = 0u; i < pScene->nodes.count; i++)
{
var node = pScene->nodes.data[i];
if (node->is_root)
{
continue;
}
Console.WriteLine($"Object: {node->name}");
if (node->mesh != null)
{
Console.WriteLine($"-> mesh with {node->mesh->num_faces} faces");
Console.WriteLine($"-> mesh with positions: {node->local_transform.translation}");
}
for (var j = 0u; j < node->materials.count; j++)
{
var mat = node->materials.data[j];
Console.WriteLine("-> material: " + mat->name);
Console.WriteLine(" -> shader type: " + mat->shader_type);
Console.WriteLine(" -> texture count: " + mat->textures.count);
}
}
pScene->Dispose();
Console.WriteLine("Done.");
}
public void Cleanup()
{
}
}