Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obj v2 #20

Merged
merged 13 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MeshIO.FBX.Tests/FbxReaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace MeshIO.FBX.Tests
{
public class FbxReaderTest : ReaderTestsBase
public class FbxReaderTest : IOTestsBase
{
public static readonly TheoryData<string> AsciiFiles;

Expand Down
17 changes: 17 additions & 0 deletions src/MeshIO.FBX.Tests/FbxRootNodeTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using Xunit;

namespace MeshIO.FBX.Tests
{
public class FbxRootNodeTest
{
public static readonly TheoryData<FbxVersion> Versions = TestCasesData.Versions;

[Theory]
[MemberData(nameof(TestCasesData.Versions))]
public void CreateFromEmptySceneTest(FbxVersion version)
{
FbxRootNode root = FbxRootNode.CreateFromScene(new Scene(), version);
}
}
}
48 changes: 48 additions & 0 deletions src/MeshIO.FBX.Tests/FbxWriterTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using MeshIO.Tests.Shared;
using System.IO;
using Xunit;
using Xunit.Abstractions;

namespace MeshIO.FBX.Tests
{
public class FbxWriterTest : IOTestsBase
{
public static readonly TheoryData<FbxVersion> Versions = new TheoryData<FbxVersion>();

static FbxWriterTest()
{
Versions.Add(FbxVersion.v7000);
Versions.Add(FbxVersion.v7100);
Versions.Add(FbxVersion.v7200);
Versions.Add(FbxVersion.v7300);
Versions.Add(FbxVersion.v7400);
Versions.Add(FbxVersion.v7500);
Versions.Add(FbxVersion.v7600);
Versions.Add(FbxVersion.v7700);
}

public FbxWriterTest(ITestOutputHelper output) : base(output) { }

[Theory]
[MemberData(nameof(Versions))]
public void WriteEmptyAsciiStream(FbxVersion version)
{
using (FbxWriter writer = new FbxWriter(new MemoryStream(), new Scene(), version))
{
writer.OnNotification += this.onNotification;
writer.Write(FbxFileFormat.ASCII);
}
}

[Theory]
[MemberData(nameof(Versions))]
public void WriteEmptyBinaryStream(FbxVersion version)
{
using (FbxWriter writer = new FbxWriter(new MemoryStream(), new Scene(), version))
{
writer.OnNotification += this.onNotification;
writer.Write(FbxFileFormat.Binary);
}
}
}
}
31 changes: 31 additions & 0 deletions src/MeshIO.FBX.Tests/TestCasesData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using MeshIO.Entities.Geometries;
using Xunit;

namespace MeshIO.FBX.Tests
{
public static class TestCasesData
{
public static readonly TheoryData<FbxVersion> Versions = new TheoryData<FbxVersion>();

static TestCasesData()
{
//Only compatible version
Versions.Add(FbxVersion.v7000);
Versions.Add(FbxVersion.v7100);
Versions.Add(FbxVersion.v7200);
Versions.Add(FbxVersion.v7300);
Versions.Add(FbxVersion.v7400);
Versions.Add(FbxVersion.v7500);
Versions.Add(FbxVersion.v7600);
Versions.Add(FbxVersion.v7700);
}

public static Scene CreateBoxScene()
{
Scene scene = new Scene();
scene.RootNode.Nodes.Add(new Mesh("Box"));

return scene;
}
}
}
15 changes: 15 additions & 0 deletions src/MeshIO.FBX/Converters/ConverterBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using MeshIO.Core;
using System;

namespace MeshIO.FBX.Converters
{
public abstract class ConverterBase
{
public event NotificationEventHandler OnNotification;

protected void notify(string message, NotificationType notificationType = NotificationType.Information, Exception ex = null)
{
this.OnNotification?.Invoke(this, new NotificationEventArgs(message, notificationType, ex));
}
}
}
8 changes: 0 additions & 8 deletions src/MeshIO.FBX/Converters/FbxConverter7000.cs

This file was deleted.

Loading