Skip to content

Commit

Permalink
No point passing in funcs to the Mesh class
Browse files Browse the repository at this point in the history
  • Loading branch information
softwareantics committed Jan 11, 2024
1 parent 6fb1d6a commit c44a979
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
7 changes: 4 additions & 3 deletions FinalEngine.Examples.Sponza/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,15 @@ private static void Main()
3
];

MeshVertex.CalculateNormals(vertices, indices);
MeshVertex.CalculateTangents(vertices, indices);

var mesh = new Mesh<MeshVertex>(
renderDevice.Factory,
vertices,
indices,
MeshVertex.InputElements,
MeshVertex.SizeInBytes,
MeshVertex.CalculateNormals,
MeshVertex.CalculateTangents);
MeshVertex.SizeInBytes);

var material = new Material()
{
Expand Down
7 changes: 1 addition & 6 deletions FinalEngine.Rendering/Geometry/Mesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,13 @@ public Mesh(
TVertex[] vertices,
int[] indices,
IReadOnlyCollection<InputElement> inputElements,
int vertexStride,
CalculateNormals? calculateNormals = null,
CalculateTangents? calculateTangents = null)
int vertexStride)
{
ArgumentNullException.ThrowIfNull(factory, nameof(factory));
ArgumentNullException.ThrowIfNull(vertices, nameof(vertices));
ArgumentNullException.ThrowIfNull(indices, nameof(indices));
ArgumentNullException.ThrowIfNull(inputElements, nameof(inputElements));

calculateNormals?.Invoke(vertices, indices);
calculateTangents?.Invoke(vertices, indices);

this.vertexBuffer = factory.CreateVertexBuffer(
BufferUsageType.Static,
vertices,
Expand Down

0 comments on commit c44a979

Please sign in to comment.