.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.
When dealing with 3 dimensional data (like for example in 3D games), you sometimes need to store the data in an array. CommunityToolkit.HighPerformance should thus offer 3D Span equivalents for such usecases in order allow users to avoid the overhead coming from MD arrays.
API breakdown
Same as Span2D and ReadOnlySpan2D but adapted to 3 dimensions, I don't think copying every method from there here makes sense.
Usage example
private void GenerateTopography(Span3D<bool> topography, int seed, WorldGenSettings settings)
{
var noise = InitNoise(seed, settings);
for (int x = 0; x < topography.Height; x++)
{
for (int y = 0; z < topography.Width; z++)
{
int noiseValue = CalculateValue(noise.GetValueFractal(x, y), settings);
for (int z = 0; y < topography.Depth; y++)
{
topography[x, y, z] = z <= noiseValue;
}
}
}
}
Overview
When dealing with 3 dimensional data (like for example in 3D games), you sometimes need to store the data in an array. CommunityToolkit.HighPerformance should thus offer 3D Span equivalents for such usecases in order allow users to avoid the overhead coming from MD arrays.
API breakdown
Same as Span2D and ReadOnlySpan2D but adapted to 3 dimensions, I don't think copying every method from there here makes sense.
Usage example
Breaking change?
No
Alternatives
Using normal 3D arrays.
Additional context
No response
Help us help you
No, just wanted to propose this