giawa / opengl4csharp

OpenGL 4 Bindings (partially based on OpenTK) for C#
Other
232 stars 61 forks source link

Span and allocation free overloads for Geometry.CalculateNormals #47

Closed TheAIBot closed 4 years ago

TheAIBot commented 4 years ago

Added two new overloads to Geometry.CalculateNormals

´Span´ is part of the nuget package System.Memory. System.Memory required newer versions of the other packages this project uses so they had to be updated.

There was previously two versions on CalculateNormals, one that took an uint array of elements and one that took an int array. I merged those two into one method. Added two checks to the method. First verifies that the element array length is a multiple of three. The second checks whether the supplied normal array is the same length as the vertex array.

Lastly added a few tests to verify the behavior.

TheAIBot commented 4 years ago

Currently on my linux machine and the test project uses dotnet framework so i will have to wait with the code changes for a few days.