rasterized occlusion culling #38

Merged
embeddedt merged 20 commits from rdh/celeritas:raster into stonecutter 2026-09-04 22:15:05 -04:00
2 changed files with 13 additions and 23 deletions
Showing only changes of commit 344e3c549c - Show all commits

No files matched your search

@@ -1,22 +0,0 @@
package org.embeddedt.embeddium.impl.render.chunk.occlusion;
import grondag.bitraster.Matrix4L;
import org.joml.Matrix4fc;
/** Bridges JOML matrices into bitraster's fixed-point ones. */
public final class RasterMatrices {
private RasterMatrices() {
}
/**
* {@link Matrix4L} indexes {@code a<row><col>} while JOML indexes {@code m<col><row>}, so this
* transposes. Feeding it straight through instead still produces plausible-looking output.
*/
public static void copy(Matrix4fc src, Matrix4L dst) {
dst.set(
src.m00(), src.m10(), src.m20(), src.m30(),
src.m01(), src.m11(), src.m21(), src.m31(),
src.m02(), src.m12(), src.m22(), src.m32(),
src.m03(), src.m13(), src.m23(), src.m33());
}
}
@@ -103,7 +103,19 @@ public final class RasterOccluder extends BoxOccluder {
chooseBufferSize(vpMatrix, searchDistance);
invalidate();
prepareScene(viewVersion, transform.x, transform.y, transform.z,
Matrix4L::loadIdentity, m -> RasterMatrices.copy(vpMatrix, m));
Matrix4L::loadIdentity, m -> copyMatrix(vpMatrix, m));
}
/**
* {@link Matrix4L} indexes {@code a<row><col>} while JOML indexes {@code m<col><row>}, so this
* transposes. Feeding it straight through instead still produces plausible-looking output.
*/
private static void copyMatrix(Matrix4fc src, Matrix4L dst) {
dst.set(
src.m00(), src.m10(), src.m20(), src.m30(),
src.m01(), src.m11(), src.m21(), src.m31(),
src.m02(), src.m12(), src.m22(), src.m32(),
src.m03(), src.m13(), src.m23(), src.m33());
}
/**