Skip to content

Commit

Permalink
Update to Assimp v5.4.3 (#4)
Browse files Browse the repository at this point in the history
* Add updated binaries

* Add updated binaries

* x64 MacOS to ARM64

* Properly support non-x64 architectures

* Readd macOS x64

* Add x64 MacOS config

* Oops

* Reorder matrix values for slightly nicer output

* Only run once on PR

* Apply library changes

* Add docs
  • Loading branch information
Saalvage authored Nov 25, 2024
1 parent 24c6aac commit fedbff8
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 19 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ on:

jobs:
build:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Build ${{ matrix.name }} ${{ matrix.configuration }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [Windows x64, Linux, MacOS x64, MacOS ARM64]
configuration: [Release, Debug]
name: [Windows x64, Linux, MacOS]
include:
- name: Windows x64
os: windows-latest
Expand All @@ -23,8 +24,10 @@ jobs:
# additional_args: -a x86
- name: Linux
os: ubuntu-latest
- name: MacOS
- name: MacOS x64
os: macos-13
- name: MacOS ARM64
os: macos-latest

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions AssimpNet/AssimpNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<Content Include="..\libs\Assimp\win-x86\assimp.dll" Link="nuget\runtimes\win-x86\native\assimp.dll" PackagePath="runtimes\win-x86\native" />
<Content Include="..\libs\Assimp\linux-x64\libassimp.so" Link="nuget\runtimes\linux-x64\native\libassimp.so" PackagePath="runtimes\linux-x64\native" />
<Content Include="..\libs\Assimp\osx-x64\libassimp.dylib" Link="nuget\runtimes\osx-x64\native\libassimp.dylib" PackagePath="runtimes\osx-x64\native" />
<Content Include="..\libs\Assimp\osx-arm64\libassimp.dylib" Link="nuget\runtimes\osx-arm64\native\libassimp.dylib" PackagePath="runtimes\osx-arm64\native" />
<Content Include="AssimpNet.targets" Link="nuget\build\AssimpNet.targets" PackagePath="build" />
</ItemGroup>

Expand All @@ -62,6 +63,10 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>runtimes\osx-x64\native\%(Filename)%(Extension)</Link>
</None>
<None Include="..\libs\Assimp\osx-arm64\libassimp.dylib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>runtimes\osx-arm64\native\%(Filename)%(Extension)</Link>
</None>
</ItemGroup>

<!-- Copies Unity plugin files into a folder with Release build DLLs which can be drag n dropped into a unity project -->
Expand Down
91 changes: 84 additions & 7 deletions AssimpNet/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,17 @@ public enum MetaDataType
/// <summary>
/// Metadata is a <see cref="Vector3"/>.
/// </summary>
Vector3 = 6
Vector3 = 6,

/// <summary>
/// Metadata is a signed 64-bit integer.
/// </summary>
Int64 = 7,

/// <summary>
/// Metadata is an unsigned 32-bit integer.
/// </summary>
UInt32 = 8,
}

/// <summary>
Expand Down Expand Up @@ -96,13 +106,15 @@ public enum PostProcessSteps : uint
/// Identifies and joins identical vertex data sets within all
/// imported meshes.
/// <para>
/// After this step is run each mesh does contain only unique vertices
/// anymore, so a vertex is possibly used by multiple faces. You usually
/// want to use this post processing step. If your application deals with
/// After this step is run, each mesh contains unique vertices,
/// so a vertex may be used by multiple faces. You usually want
/// to use this post processing step. If your application deals with
/// indexed geometry, this step is compulsory or you'll just waste rendering
/// time.</para>
/// <para>If this flag is not specified, no vertices are referenced by more than one
/// face and no index buffer is required for rendering.</para>
/// <para>Unless the importer (like ply) had to split vertices.
/// Then you need one regardless.</para>
/// </summary>
JoinIdenticalVertices = 0x2,

Expand Down Expand Up @@ -634,9 +646,9 @@ public enum AnimationBehaviour
public enum MeshMorphingMethod
{
/// <summary>
/// No morphing.
/// Morphing method to be determined.
/// </summary>
None = 0x0,
Unknown = 0x0,

/// <summary>
/// Interpolation between morph targets.
Expand Down Expand Up @@ -1050,7 +1062,46 @@ public enum TextureType : int
/// An unknown texture that does not mention any of the defined texture type definitions. It is still imported, but is excluded from any
/// further postprocessing.
/// </summary>
Unknown = 18
Unknown = 18,

/// <summary>
/// Generally used to simulate textiles that are covered in a layer of microfibers, e.g. velvet.
/// <a href="https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_sheen"/>
/// </summary>
Sheen = 19,

/// <summary>
/// Simulates a layer of 'polish' or 'lacquer' layered on top of a PBR substrate.
/// <a href="https://autodesk.github.io/standard-surface/#closures/coating"/>
/// <a href="https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat"/>
/// </summary>
Clearcoat = 20,

/// <summary>
/// Simulates transmission through the surface.
/// May include further information such as wall thickness.
/// </summary>
Transmission = 21,

/// <summary>
/// Maya material declaration for a base color texture.
/// </summary>
MayaBase = 22,

/// <summary>
/// Maya material declaration for a specular texture.
/// </summary>
MayaSpecular = 23,

/// <summary>
/// Maya material declaration for a specular color texture.
/// </summary>
MayaSpecularColor = 24,

/// <summary>
/// Maya material declaration for a specular roughness texture.
/// </summary>
MayaSpecularRoughness = 25,
}

/// <summary>
Expand Down Expand Up @@ -1335,4 +1386,30 @@ public enum ImporterFeatureFlags
/// </summary>
Experimental = 0x10
}

/// <summary>
/// Defines the type of interpolation to use.
/// </summary>
public enum AnimInterpolation
{
/// <summary>
/// Step interpolation.
/// </summary>
Step,

/// <summary>
/// Linear interpolation.
/// </summary>
Linear,

/// <summary>
/// Spherical linear interpolation.
/// </summary>
SphericalLinear,

/// <summary>
/// Cubic spline interpolation.
/// </summary>
CubicSpline,
}
}
4 changes: 2 additions & 2 deletions AssimpNet/Matrix3x3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ public void Inverse()
float det = Determinant();
if(det == 0.0f)
{
// Matrix not invertible. Setting all elements to NaN is not really
// correct in a mathematical sense but it is easy to debug for the
// Matrix is not invertible. Setting all elements to NaN is not really
// correct in a mathematical sense, but it is easy to debug for the
// programmer.
A1 = float.NaN;
A2 = float.NaN;
Expand Down
2 changes: 1 addition & 1 deletion AssimpNet/Mesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ public Mesh(String name, PrimitiveType primType)
m_name = name;
m_primitiveType = primType;
m_materialIndex = 0;
m_morphMethod = MeshMorphingMethod.None;
m_morphMethod = MeshMorphingMethod.Unknown;

m_vertices = new List<Vector3>();
m_normals = new List<Vector3>();
Expand Down
23 changes: 23 additions & 0 deletions AssimpNet/Unmanaged/AssimpLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,24 @@ public CompileFlags GetCompileFlags()

#endregion

/// <summary>
/// Gets an embedded texture.
/// </summary>
/// <param name="scene">Input asset.</param>
/// <param name="filename">Texture path extracted from <see cref="GetMaterialString"/>.</param>
/// <returns>An embedded texture, or nullptr.</returns>
public IntPtr GetEmbeddedTexture(IntPtr scene, String filename)
{
LoadIfNotLoaded();

if(scene == IntPtr.Zero)
return IntPtr.Zero;

Functions.aiGetEmbeddedTexture func = GetFunction<Functions.aiGetEmbeddedTexture>(FunctionNames.aiGetEmbeddedTexture);

return func(scene, filename);
}

#region Function names

/// <summary>
Expand Down Expand Up @@ -1153,6 +1171,8 @@ internal static class FunctionNames
public const String aiGetBranchName = "aiGetBranchName";

#endregion

public const String aiGetEmbeddedTexture = "aiGetEmbeddedTexture";
}

#endregion
Expand Down Expand Up @@ -1359,6 +1379,9 @@ internal static class Functions
public delegate uint aiGetCompileFlags();

#endregion

[UnmanagedFunctionPointer(CallingConvention.Cdecl), UnmanagedFunctionName(FunctionNames.aiGetEmbeddedTexture)]
public delegate IntPtr aiGetEmbeddedTexture(IntPtr scene, [In, MarshalAs(UnmanagedType.LPUTF8Str)] String filename);
}

#endregion
Expand Down
4 changes: 0 additions & 4 deletions AssimpNet/Unmanaged/UnmanagedLibraryResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ private String GetRIDOS()

private String GetRIDArch()
{
#if NETSTANDARD1_3
switch(RuntimeInformation.ProcessArchitecture)
{
case Architecture.Arm:
Expand All @@ -336,9 +335,6 @@ private String GetRIDArch()
default:
return "x64";
}
#else
return UnmanagedLibrary.Is64Bit ? "x64" : "x86";
#endif
}
}
}
9 changes: 7 additions & 2 deletions AssimpNet/VectorKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public struct VectorKey : IEquatable<VectorKey>
/// </summary>
public Vector3 Value;

/// <summary>
/// The interpolation setting of this key.
/// </summary>
public AnimInterpolation Interpolation = AnimInterpolation.Linear;

/// <summary>
/// Constructs a new VectorKey.
/// </summary>
Expand Down Expand Up @@ -144,8 +149,8 @@ public override int GetHashCode()
public override string ToString()
{
CultureInfo info = CultureInfo.CurrentCulture;
return String.Format(info, "{{Time:{0} Vector:{1}}}",
new Object[] { Time.ToString(info), Value.ToString() });
return String.Format(info, "{{Time:{0} Vector:{1} Interpolation:{2}}}",
new Object[] { Time.ToString(info), Value.ToString(), Interpolation.ToString() });
}
}
}
Binary file modified libs/Assimp/linux-x64/libassimp.so
Binary file not shown.
Binary file added libs/Assimp/osx-arm64/libassimp.dylib
Binary file not shown.
Binary file modified libs/Assimp/osx-x64/libassimp.dylib
Binary file not shown.
Binary file modified libs/Assimp/win-x64/assimp.dll
Binary file not shown.
Binary file modified libs/Assimp/win-x86/assimp.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion libs/VersionList.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Assimp 5.2.5
Assimp 5.4.3

0 comments on commit fedbff8

Please sign in to comment.