Skip to content

Commit

Permalink
cleanup resolved todos and todos that are tracked elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
douira committed Dec 17, 2023
1 parent 97b3854 commit 7b19249
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ public void appendQuad(ModelQuadView quadView, ChunkVertexEncoder.Vertex[] verti
// POS_X, POS_Y, POS_Z, NEG_X, NEG_Y, NEG_Z
float[] extents = new float[] { posXExtent, posYExtent, posZExtent, negXExtent, negYExtent, negZExtent };

// TODO: does it make a difference if we compute the center as the average of
// the unique vertices or as the center of the extents? (the latter would be
// less work)

// TODO: some of these things should probably only be computed on demand, and an
// allocation of a Quad object should be avoided
AccumulationGroup accGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@
import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFacing;

/**
* TODO:
* - make partition finding more sophisticated by using distancesByNormal
* and other information.
* - pass partition information to child nodes instead of discarding if
* partition didn't work
* - detect many coplanar quads and avoid partitioning sorting alltogether. Try
* to partition so that large groups of coplanar quads are kept together and
* then not sorted at all.
* - sort the quads inside a node using the same heuristics as in the global
* level: convex hulls (like cuboids where the faces point outwards) don't need
* to be sorted. This could be used to optimize the inside of honey blocks, and
* other blocks.
*
* Implementation note:
* - Presorting the points in block-sized buckets doesn't help. It seems the
* sort algorithm is just fast enough to handle this.
Expand Down Expand Up @@ -78,9 +65,6 @@ record NodeReuseData(float[][] quadExtents, int[] indexes, int indexCount, int m
static NodeReuseData prepareNodeReuse(BSPWorkspace workspace, IntArrayList indexes, int depth) {
// if node reuse is enabled, only enable on the first level of children (not the
// root node and not anything deeper than its children)
// TODO: more sophisticated reuse scheduling (make uset configurable, and only
// do once the section has been modified at least once already to avoid making
// this data on terrain sections that are never touched)
if (workspace.prepareNodeReuse && depth == 1 && indexes.size() > NODE_REUSE_THRESHOLD) {
// collect the extents of the indexed quads and hash them
var quadExtents = new float[indexes.size()][];
Expand Down Expand Up @@ -325,7 +309,6 @@ static BSPNode build(BSPWorkspace workspace, IntArrayList indexes, int depth, BS
// check a different axis if everything is in one quadsBefore,
// which means there are no gaps
if (quadsBefore != null && quadsBefore.size() == indexes.size()) {
// TODO: reuse the sorted point array for child nodes (add to workspace)
continue;
}

Expand Down Expand Up @@ -356,14 +339,11 @@ static BSPNode build(BSPWorkspace workspace, IntArrayList indexes, int depth, BS
partitions, axis, endsWithPlane);
}

// TODO: attempt unaligned partitioning, convex decomposition, etc.

// test if the geometry intersects with itself
// if there is self-intersection, return a multi leaf node to just give up
// sorting this geometry. intersecting geometry is rare but when it does happen,
// it should simply be accepted and rendered as-is. Whatever artifacts this
// causes are considered "ok".
// TODO: also do this test with unaligned quads
int testsRemaining = 10000;
for (int quadAIndex = 0; quadAIndex < indexes.size(); quadAIndex++) {
var quadA = workspace.quads[indexes.getInt(quadAIndex)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public static BSPDynamicData fromMesh(BuiltSectionMeshParts translucentMesh,
dynamicData.sort(cameraPos);

// prepare accumulation groups for integration into GFNI triggering
// TODO: combine this and the similar code in TopoSortDynamicData
var aligned = result.getAlignedDistances();
if (aligned != null) {
for (var accGroup : aligned) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,14 @@ public static TopoSortDynamicData fromMesh(BuiltSectionMeshParts translucentMesh

var distancesByNormal = new Object2ReferenceOpenHashMap<Vector3fc, float[]>(size);
if (collector.getAlignedDistances() != null) {
for (int direction = 0; direction < ModelQuadFacing.DIRECTIONS; direction++) {
var accGroup = collector.getAlignedDistances()[direction];
for (var accGroup : collector.getAlignedDistances()) {
if (accGroup != null) {
accGroup.prepareAndInsert(distancesByNormal);
}
}
}
if (collector.getUnalignedDistanceCount() > 0) {
for (var accGroup : collector.getUnalignedDistances()) {
// TODO: get rid of collector key and just use the normal vector's hash code
accGroup.prepareAndInsert(distancesByNormal);
}
}
Expand Down

0 comments on commit 7b19249

Please sign in to comment.