Added Ufbx

This commit is contained in:
2026-03-14 18:29:18 +09:00
parent 254b08bc81
commit cce1cf7256
372 changed files with 11672 additions and 154 deletions

View File

@@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public static unsafe partial class Api
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum EdgeFixup
{

View File

@@ -1,6 +1,6 @@
using System.Diagnostics;
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
/// <summary>Defines the annotation found in a native declaration.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]

View File

@@ -1,6 +1,6 @@
using System.Diagnostics;
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
/// <summary>Defines the type of a member as it was used in the native signature.</summary>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)]

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttAlphaMode
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttBatchList
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttBoolean
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttCPUInputBuffer
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttChannelOrder
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttCompressionOptions
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttContainer
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttContext
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttCubeLayout
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttCubeSurface
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttEncodeFlags
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public unsafe partial struct NvttEncodeSettings
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttError
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttFormat
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttGPUInputBuffer
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttInputFormat
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttMipmapFilter
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttNormalTransform
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttOutputOptions
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttPixelType
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttQuality
{

View File

@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public unsafe partial struct NvttRefImage
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttResizeFilter
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttRoundMode
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttSeverity
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttSurface
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttSurfaceSet
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttTextureType
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public partial struct NvttTimingContext
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttToneMapper
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttValueType
{

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt.Native
namespace Ghost.Nvtt
{
public enum NvttWrapMode
{

View File

@@ -15,10 +15,6 @@
<IsAotCompatible>True</IsAotCompatible>
</PropertyGroup>
<ItemGroup>
<Using Include="Ghost.Nvtt.Native" />
</ItemGroup>
<ItemGroup>
<None Update="runtimes\win-x64\native\nvtt.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Wrapper around an nvtt batch list — a list of (surface, face, mipmap,

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Controls how a surface is compressed - format, quality, pixel layout and

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Wrapper around the nvtt compression context — the central object that drives

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Wrapper around an nvtt cube-map surface (six faces, optional mip chain).

View File

@@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Static helpers wrapping global nvtt functions (version, CUDA detection,

View File

@@ -1,7 +1,7 @@
using System.Runtime.CompilerServices;
using System.Text;
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Internal helpers for converting between managed and unmanaged types.

View File

@@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Configures where compressed data is written and how it is formatted.
@@ -26,10 +26,10 @@ public sealed unsafe class NvttOutputOptionsHandle : IDisposable
private delegate void BeginImageDelegate(int size, int width, int height, int depth, int face, int mipLevel);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate Ghost.Nvtt.Native.NvttBoolean OutputDataDelegate(void* data, int size, Ghost.Nvtt.Native.NvttBoolean lastChunk);
private delegate NvttBoolean OutputDataDelegate(void* data, int size, NvttBoolean lastChunk);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void ErrorDelegate(Ghost.Nvtt.Native.NvttError error);
private delegate void ErrorDelegate(NvttError error);
// Pinned delegate instances - must stay alive as long as native code may call them.
private BeginImageDelegate? _beginImageDelegate;
@@ -174,8 +174,7 @@ public sealed unsafe class NvttOutputOptionsHandle : IDisposable
_outputDataDelegate = (data, size, lastChunk) =>
{
var ok = outputData?.Invoke((nint)data, size) ?? true;
return ok ? Ghost.Nvtt.Native.NvttBoolean.NVTT_True
: Ghost.Nvtt.Native.NvttBoolean.NVTT_False;
return ok ? Ghost.Nvtt.NvttBoolean.NVTT_True : Ghost.Nvtt.NvttBoolean.NVTT_False;
};
var beginPtr = Marshal.GetFunctionPointerForDelegate(_beginImageDelegate);
@@ -184,7 +183,7 @@ public sealed unsafe class NvttOutputOptionsHandle : IDisposable
Api.nvttSetOutputOptionsOutputHandler(
_ptr,
(delegate* unmanaged[Cdecl]<int, int, int, int, int, int, void>)beginPtr,
(delegate* unmanaged[Cdecl]<void*, int, Ghost.Nvtt.Native.NvttBoolean>)outputPtr,
(delegate* unmanaged[Cdecl]<void*, int, NvttBoolean>)outputPtr,
IntPtr.Zero);
}
@@ -196,7 +195,7 @@ public sealed unsafe class NvttOutputOptionsHandle : IDisposable
var errorPtr = Marshal.GetFunctionPointerForDelegate(_errorDelegate);
Api.nvttSetOutputOptionsErrorHandler(
_ptr,
(delegate* unmanaged[Cdecl]<Ghost.Nvtt.Native.NvttError, void>)errorPtr);
(delegate* unmanaged[Cdecl]<NvttError, void>)errorPtr);
}
// -------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Wrapper around a single 2-D / 3-D / cube-face image surface used as input
@@ -201,7 +201,7 @@ public sealed unsafe class NvttSurfaceHandle : IDisposable
var utf8 = NvttInterop.ToUtf8(fileName, buf);
fixed (byte* p = utf8)
{
Ghost.Nvtt.Native.NvttBoolean nvAlpha;
NvttBoolean nvAlpha;
var ok = NvttInterop.ToBool(
Api.nvttSurfaceLoad(_ptr, (sbyte*)p, &nvAlpha,
NvttInterop.ToNvtt(expectSigned), tc));
@@ -217,7 +217,7 @@ public sealed unsafe class NvttSurfaceHandle : IDisposable
ThrowIfDisposed();
fixed (byte* p = data)
{
Ghost.Nvtt.Native.NvttBoolean nvAlpha;
NvttBoolean nvAlpha;
var ok = NvttInterop.ToBool(
Api.nvttSurfaceLoadFromMemory(_ptr, p, (ulong)data.Length,
&nvAlpha, NvttInterop.ToNvtt(expectSigned), tc));

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Wrapper around an nvtt surface set — a collection of faces and mip levels

View File

@@ -1,4 +1,4 @@
namespace Ghost.Nvtt;
namespace Ghost.Nvtt.Warper;
/// <summary>
/// Wraps an nvtt timing context that records per-operation wall-clock times.