Created
July 16, 2025 07:43
-
-
Save peterhirn/9c241386aecbf45de59256314c2a6372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
namespace MyNamespace; | |
internal static unsafe partial class NwCreate | |
{ | |
internal const string NwCreateDll = "nwcreate_21.dll"; | |
internal enum LtNwcApiStatus | |
{ | |
LI_NWC_API_OK, | |
LI_NWC_API_NOT_LICENSED, | |
LI_NWC_API_INTERNAL_ERROR | |
} | |
internal enum LtNwcSeverity | |
{ | |
LI_NWC_SEVERITY_ERROR, | |
LI_NWC_SEVERITY_WARNING | |
} | |
internal enum LtNwcVertexProperty | |
{ | |
LI_NWC_VERTEX_NONE = 0x0, /** No extra vertex properties */ | |
LI_NWC_VERTEX_NORMAL = 0x1, /** Normals */ | |
LI_NWC_VERTEX_COLOR = 0x2, /** Colors */ | |
LI_NWC_VERTEX_TEX_COORD = 0x4 /** Texture Coordinates */ | |
} | |
internal enum LtNwcWriteStatus | |
{ | |
LI_NWC_WRITE_OK, /** Write succeeded */ | |
LI_NWC_WRITE_CANT_OPEN, /** Can't open file for write */ | |
LI_NWC_WRITE_NO_ROOM, /** Not enough disk space for write */ | |
LI_NWC_WRITE_CANCELED, /** User canceled write */ | |
LI_NWC_WRITE_INTERNAL_ERROR, /** Write failed due to API internal error */ | |
LI_NWC_WRITE_NOT_LICENSED, /** LiNwcSceneWriteEx: No publisher license available */ | |
LI_NWC_WRITE_OUT_OF_MEMORY, /** LiNwcSceneWriteEx/LiNecSceneWriteCache: Not enough memory to complete write */ | |
} | |
public struct Handle { } | |
public delegate void LtNwcErrorCallbackWide(LtNwcSeverity severity, [MarshalAs(UnmanagedType.LPWStr)] string message, void* user_data); | |
public delegate bool LtNwcProgressCallback(double progress, void* user_data); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcApiErrorInitialise")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcApiErrorInitialise(); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcApiInitialise")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial LtNwcApiStatus LiNwcApiInitialise(); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcApiTerminate")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcApiTerminate(); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcApiSetErrorHandlerWide")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcApiSetErrorHandlerWide(LtNwcErrorCallbackWide handler, void* user_data); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcSceneCreate")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial Handle* LiNwcSceneCreate(); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcSceneDestroy")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcSceneDestroy(Handle* scene); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcSceneSetWorldUpVector")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcSceneSetWorldUpVector(Handle* scene, double x, double y, double z); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcSceneSetWorldNorthVector")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcSceneSetWorldNorthVector(Handle* scene, double x, double y, double z); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcSceneSetWorldFrontVector")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcSceneSetWorldFrontVector(Handle* scene, double x, double y, double z); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcSceneSetBackgroundColor")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcSceneSetBackgroundColor(Handle* scene, double r, double g, double b); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGroupCreate")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial Handle* LiNwcGroupCreate(); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGroupDestroy")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGroupDestroy(Handle* group); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGroupSetLayer")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGroupSetLayer(Handle* group, [MarshalAs(UnmanagedType.Bool)] bool flag); | |
[LibraryImport( | |
NwCreateDll, | |
EntryPoint = "LiNwcNodeSetClassName", | |
StringMarshalling = StringMarshalling.Utf16)] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcNodeSetClassName(Handle* node, string user_name, [MarshalAs(UnmanagedType.LPStr)] string internal_name); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcSceneAddNode")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcSceneAddNode(Handle* scene, Handle* node); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGroupAddNode")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGroupAddNode(Handle* group, Handle* node); | |
[LibraryImport( | |
NwCreateDll, | |
EntryPoint = "LiNwcSceneWriteEx", | |
StringMarshalling = StringMarshalling.Utf16)] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial LtNwcWriteStatus LiNwcSceneWriteEx(Handle* scene, string filename, LtNwcProgressCallback? progress, void* user_data); | |
[LibraryImport( | |
NwCreateDll, | |
EntryPoint = "LiNwcSceneWriteCacheEx", | |
StringMarshalling = StringMarshalling.Utf16)] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial LtNwcWriteStatus LiNwcSceneWriteCacheEx(Handle* scene, string orig_filename, string filename, LtNwcProgressCallback? progress, void* user_data); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryCreate")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial Handle* LiNwcGeometryCreate(); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryDestroy")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryDestroy(Handle* geometry); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcTransformCreateAffine")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial Handle* LiNwcTransformCreateAffine(ReadOnlySpan<double> matrix, [MarshalAs(UnmanagedType.Bool)] bool reverses); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcTransformDestroy")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcTransformDestroy(Handle* transform); | |
[LibraryImport( | |
NwCreateDll, | |
EntryPoint = "LiNwcNodeSetName", | |
StringMarshalling = StringMarshalling.Utf16)] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcNodeSetName(Handle* node, string name); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcMaterialCreate")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial Handle* LiNwcMaterialCreate(); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcMaterialDestroy")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcMaterialDestroy(Handle* geometry); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcMaterialSetDiffuseColor")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcMaterialSetDiffuseColor(Handle* material, double r, double g, double b); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcMaterialSetAmbientColor")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcMaterialSetAmbientColor(Handle* material, double r, double g, double b); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcMaterialSetSpecularColor")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcMaterialSetSpecularColor(Handle* material, double r, double g, double b); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcMaterialSetEmissiveColor")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcMaterialSetEmissiveColor(Handle* material, double r, double g, double b); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcMaterialSetShininess")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcMaterialSetShininess(Handle* material, double t); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcMaterialSetTransparency")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcMaterialSetTransparency(Handle* material, double t); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcNodeAddAttribute")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcNodeAddAttribute(Handle* node, Handle* attribute); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryOpenStream")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial Handle* LiNwcGeometryOpenStream(Handle* geometry); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryCloseStream")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryCloseStream(Handle* geometry, Handle* stream); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryStreamBegin")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryStreamBegin(Handle* stream, LtNwcVertexProperty vertex_properties); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryStreamEnd")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryStreamEnd(Handle* stream); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryStreamTriangleVertex")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryStreamTriangleVertex(Handle* stream, double x, double y, double z); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryStreamNormal")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryStreamNormal(Handle* stream, double x, double y, double z); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryStreamBeginPolygon")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryStreamBeginPolygon(Handle* stream); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryStreamEndPolygon")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryStreamEndPolygon(Handle* stream); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryStreamBeginPolygonContour")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryStreamBeginPolygonContour(Handle* stream); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryStreamEndPolygonContour")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryStreamEndPolygonContour(Handle* stream); | |
[LibraryImport(NwCreateDll, EntryPoint = "LiNwcGeometryStreamConvexPolyVertex")] | |
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvStdcall) })] | |
internal static partial void LiNwcGeometryStreamConvexPolyVertex(Handle* stream, double x, double y, double z); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment