Skip to main content

Class: SectionVisibilityGraph

Sodium-style section traversal graph. Each meshed section reports which of its face pairs see each other through non-opaque voxels; a per-frame BFS from the camera's section walks the graph, only continuing through a section when the face it entered connects to the face it wants to leave by, and never doubling back toward the camera. Sections the walk cannot reach are occluded — enclosed interiors stop paying for the terrain around them.

Constructors​

constructor​

• new SectionVisibilityGraph(options): SectionVisibilityGraph

Parameters​

NameType
optionsSectionVisibilityGraphOptions

Returns​

SectionVisibilityGraph

Accessors​

isComplete​

• get isComplete(): boolean

Whether the last walk started from a loaded section. When the camera stands outside the graph the walk cannot claim anything is hidden, and callers must fall back to frustum-only culling.

Returns​

boolean


sectionCount​

• get sectionCount(): number

Returns​

number


stats​

• get stats(): Object

Returns​

Object

NameType
constrainednumber
isCompleteboolean
reachednumber
sectionsnumber
visiblenumber

Methods​

addChunk​

▸ addChunk(cx, cz): void

Parameters​

NameType
cxnumber
cznumber

Returns​

void


clear​

▸ clear(): void

Returns​

void


isSectionReached​

▸ isSectionReached(cx, cz, level): boolean

Parameters​

NameType
cxnumber
cznumber
levelnumber

Returns​

boolean


isSectionVisible​

▸ isSectionVisible(cx, cz, level): boolean

Parameters​

NameType
cxnumber
cznumber
levelnumber

Returns​

boolean


removeChunk​

▸ removeChunk(cx, cz): void

Parameters​

NameType
cxnumber
cznumber

Returns​

void


setConnectivity​

▸ setConnectivity(cx, cz, level, connectivity): void

Parameters​

NameType
cxnumber
cznumber
levelnumber
connectivitynumber

Returns​

void


walk​

▸ walk(cameraPosition, projectionScreenMatrix, fogFar, isSuspended?): void

Runs the traversal for the current camera. The walk itself follows only connectivity — frustum and fog decide which reached sections count as visible, never where the walk may go, so the reached set stays a pure "an air path exists" answer that shadow-safe chunks can trust. fogFar (in blocks, horizontal) is the fully-fogged distance; Infinity disables fog culling.

isSuspended is the caller saying the air-path proof does not hold for this view: a noclip camera inside rock sees through the unmeshed faces between solid voxels, so connectivity is no evidence that anything is hidden. The walk then reports incomplete and callers fall back to frustum-only culling. A noclip camera in open air is not suspended; it sees exactly what a walking player at the same eye would.

Parameters​

NameTypeDefault value
cameraPositionVector3undefined
projectionScreenMatrixMatrix4undefined
fogFarnumberundefined
isSuspendedbooleanfalse

Returns​

void