Replace generic Graph with concrete implemetation and include ChunkLayout #315
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, outside of tests, the only implementation of
Graph
isDualGraph
. This used to not be true, as the server used aGraph<()>
instead, but to allow server-side collision checking, this has changed. In the spirit of only using generics when necessary, this PR gets rid of theGraph
/DualGraph
distinction.As part of this change, this PR also attaches
ChunkLayout
data toGraph
, as it arguably makes sense for this data to live together, but it was harder to do something like this cleanly whenGraph
was generic. This can enable additional helper methods, such as one that takes aChunkId
and a set of coordinates and alters corresponding voxel, taking care of adjacent chunk margins and surface invalidation (without needing to repeatedly pass in the dimension as a parameter).This PR doesn't refactor most code to use the
ChunkLayout
inGraph
instead of thechunk_size
inSimConfig
, as there isn't a clear benefit. However, to ensure there is at least one usage of this new functionality, this PR alters the collision checking code to use theChunkLayout
inGraph
instead of taking it in as a parameter.