Skip to content

Commit 7dbe30d

Browse files
committed
readers
1 parent 7594638 commit 7dbe30d

27 files changed

Lines changed: 368 additions & 140 deletions

src/MeshIO/Entities/Primitives/Box.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ public Box(string name) : base(name) { }
4242
/// <summary>
4343
/// Initializes a new instance of the Box class with the specified dimensions and center point.
4444
/// </summary>
45-
/// <param name="xDimension">The length of the box along the X-axis. Must be a positive value.</param>
46-
/// <param name="yDimension">The length of the box along the Y-axis. Must be a positive value.</param>
47-
/// <param name="zDimension">The length of the box along the Z-axis. Must be a positive value.</param>
45+
/// <param name="lengthX">The length of the box along the X-axis. Must be a positive value.</param>
46+
/// <param name="lengthY">The length of the box along the Y-axis. Must be a positive value.</param>
47+
/// <param name="lengthZ">The length of the box along the Z-axis. Must be a positive value.</param>
4848
/// <param name="center">The center point of the box, specified as an XYZ coordinate.</param>
49-
public Box(double xDimension, double yDimension, double zDimension, XYZ center) : this()
49+
public Box(double lengthX, double lengthY, double lengthZ, XYZ center) : this()
5050
{
51-
this.LengthX = xDimension;
52-
this.LengthY = yDimension;
53-
this.LengthZ = zDimension;
51+
this.LengthX = lengthX;
52+
this.LengthY = lengthY;
53+
this.LengthZ = lengthZ;
5454
this.Center = center;
5555
}
5656

@@ -93,7 +93,10 @@ private void createFace(
9393
int index0, int index1, int index2,
9494
int dir1, int dir2,
9595
double length, double height, double width,
96-
List<XYZ> vertices, List<XYZ> normals, List<XY> uvs, List<Quad> polygons,
96+
List<XYZ> vertices,
97+
List<XYZ> normals,
98+
List<XY> uvs,
99+
List<Quad> polygons,
97100
ref int currQuad)
98101
{
99102
//Creates a face with no shared vertices

src/MeshIO/Formats/ContentType.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace MeshIO.Formats;
2+
3+
public enum ContentType
4+
{
5+
Binary,
6+
ASCII,
7+
}

src/MeshIO/Formats/Fbx/FbxReader.cs

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,44 @@
44

55
namespace MeshIO.Formats.Fbx
66
{
7-
public class FbxReader : ReaderBase
7+
/// <summary>
8+
/// Provides functionality for reading and parsing FBX files or streams into scene objects.
9+
/// </summary>
10+
/// <remarks>
11+
/// The <see cref="FbxReader"/> supports reading FBX data from both file paths and streams. It exposes options for
12+
/// controlling the reading process via the Options property. Notifications and warnings encountered during reading can
13+
/// be handled by subscribing to the OnNotification event or by providing a notification handler.
14+
/// </remarks>
15+
public class FbxReader : SceneReader
816
{
17+
/// <summary>
18+
/// Gets the options used to control the behavior of the FBX reader.
19+
/// </summary>
20+
/// <remarks>Use this property to configure how FBX files are read, such as specifying import settings or
21+
/// handling of specific data types. The options are read-only; to modify them, update the properties of the returned
22+
/// <see cref="FbxReaderOptions"/> instance.</remarks>
923
public FbxReaderOptions Options { get; } = new FbxReaderOptions();
1024

1125
/// <summary>
12-
/// Initializes a new instance of the <see cref="FbxReader"/> class for the specified file.
26+
/// Initializes a new instance of the FbxReader class for reading FBX files from the specified path.
1327
/// </summary>
14-
/// <param name="path">The complete file path to read from</param>
15-
public FbxReader(string path) : base(File.OpenRead(path)) { }
28+
/// <param name="path">The file system path to the FBX file to be read. Cannot be null or empty.</param>
29+
/// <param name="notification">An optional delegate to receive notifications or warnings during the reading process. If null, notifications are not
30+
/// raised.</param>
31+
public FbxReader(string path, NotificationEventHandler notification = null)
32+
: base(path, notification) { }
1633

1734
/// <summary>
18-
/// Initializes a new instance of the <see cref="FbxReader"/> class for the specified stream.
35+
/// Initializes a new instance of the FbxReader class to read FBX data from the specified stream.
1936
/// </summary>
20-
/// <param name="stream">The stream to read from</param>
21-
public FbxReader(Stream stream) : base(stream) { }
37+
/// <remarks>The caller is responsible for managing the lifetime of the provided stream. The FbxReader does not
38+
/// close or dispose the stream when finished.</remarks>
39+
/// <param name="stream">The input stream containing FBX data to be read. The stream must be readable and positioned at the start of the FBX
40+
/// content.</param>
41+
/// <param name="notification">An optional event handler for receiving notifications or warnings during the reading process. If null, notifications
42+
/// are not raised.</param>
43+
public FbxReader(Stream stream, NotificationEventHandler notification = null)
44+
: base(stream, notification) { }
2245

2346
/// <summary>
2447
/// Read a fbx file into an scene
@@ -52,17 +75,15 @@ public static Scene Read(Stream stream, NotificationEventHandler notificationHan
5275
public FbxRootNode Parse()
5376
{
5477
FbxRootNode root;
55-
using (IFbxParser parser = getParser(this._stream, this.Options))
78+
using (IFbxParser parser = getParser(this._stream.Stream, this.Options))
5679
{
5780
root = parser.Parse();
5881
}
5982

6083
return root;
6184
}
6285

63-
/// <summary>
64-
/// Read the FBX file
65-
/// </summary>
86+
/// <inheritdoc/>
6687
public override Scene Read()
6788
{
6889
FbxRootNode root = this.Parse();
@@ -87,4 +108,4 @@ private static IFbxParser getParser(Stream stream, FbxReaderOptions options)
87108
return parser;
88109
}
89110
}
90-
}
111+
}

src/MeshIO/Formats/Fbx/Readers/FbxFileBuilderBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using MeshIO.Core;
2-
using MeshIO.Formats.Fbx.Connections;
1+
using MeshIO.Formats.Fbx.Connections;
32
using MeshIO.Formats.Fbx.Templates;
43
using System;
54
using System.Collections.Generic;

0 commit comments

Comments
 (0)