-
Notifications
You must be signed in to change notification settings - Fork 370
Open
Labels
feature request 📬A request for new changes to improve functionalityA request for new changes to improve functionalityhigh-performance 🚂Issues/PRs for the HighPerformance packageIssues/PRs for the HighPerformance package
Description
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
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;
}
}
}
}Breaking change?
No
Alternatives
Using normal 3D arrays.
Additional context
No response
Help us help you
No, just wanted to propose this
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature request 📬A request for new changes to improve functionalityA request for new changes to improve functionalityhigh-performance 🚂Issues/PRs for the HighPerformance packageIssues/PRs for the HighPerformance package