rasterized occlusion culling #38
No files matched your search
+6
-6
@@ -58,12 +58,6 @@ public final class PackedSectionMetadata {
|
||||
private static final int VISUALS_FLAGS_SHIFT = 46;
|
||||
private static final long VISUALS_FLAGS_MASK = 0b111L;
|
||||
|
||||
/**
|
||||
* Fields whose changes can alter the result of a visibility search or its
|
||||
* render-list output: visibility graph data and visual-presence flags.
|
||||
*/
|
||||
public static final long GRAPH_INPUT_MASK = VISIBILITY_MASK | (VISUALS_FLAGS_MASK << VISUALS_FLAGS_SHIFT);
|
||||
|
||||
// Bits 49..51: 0 means no pending update; otherwise ordinal + 1.
|
||||
private static final int PENDING_UPDATE_SHIFT = 49;
|
||||
private static final long PENDING_UPDATE_MASK = 0b111L;
|
||||
@@ -76,6 +70,12 @@ public final class PackedSectionMetadata {
|
||||
private static final int HAS_OCCLUDER_DATA_BIT = 53;
|
||||
private static final long HAS_OCCLUDER_DATA_FLAG = 1L << HAS_OCCLUDER_DATA_BIT;
|
||||
|
||||
/**
|
||||
* Fields whose changes can alter the result of a visibility search or its
|
||||
* render-list output: visibility graph data and visual-presence flags.
|
||||
*/
|
||||
public static final long GRAPH_INPUT_MASK = VISIBILITY_MASK | (VISUALS_FLAGS_MASK << VISUALS_FLAGS_SHIFT);
|
||||
|
||||
/** Returns only the visibility graph field. */
|
||||
public static long getVisibilityData(long packed) {
|
||||
return packed & VISIBILITY_MASK;
|
||||
|
||||
+6
-1
@@ -277,13 +277,18 @@ public final class SectionLattice {
|
||||
long previous = this.sectionMeta[idx];
|
||||
this.sectionMeta[idx] = packedMetadata;
|
||||
|
||||
boolean occluderChanged = false;
|
||||
|
||||
if (this.rasterOcclusion) {
|
||||
int[] data = PackedSectionMetadata.hasOccluderData(packedMetadata) ? occluderDataOf(this.latticeSection[idx]) : null;
|
||||
// A rebuild allocates a fresh array, so identity is enough to detect
|
||||
// new boxes even when the packed metadata is otherwise unchanged.
|
||||
occluderChanged = this.occluderData[idx] != data;
|
||||
this.occluderData[idx] = data;
|
||||
this.occluderBounds[idx] = boundsOf(data);
|
||||
}
|
||||
|
||||
return ((previous ^ packedMetadata) & PackedSectionMetadata.GRAPH_INPUT_MASK) != 0;
|
||||
return occluderChanged || ((previous ^ packedMetadata) & PackedSectionMetadata.GRAPH_INPUT_MASK) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user