# BACKFACE_EPSILON
const BACKFACE_EPSILON = 1.e-002Defines the backface epsilon constant used by the miniquake2 renderer classic visibility module.
src/miniquake2/renderer/classic/visibility.mlProvides miniquake2 renderer classic visibility facilities for this project.
miniquake2/format/bsp.ml as fbsp → src/miniquake2/format/bsp.mlminiquake2/format/constants.ml as fc → src/miniquake2/format/constants.mlminiquake2/format/types.ml as ft → src/miniquake2/format/types.mlminiquake2/qcommon/byteio.ml as rvisibilitybyteio → src/miniquake2/qcommon/byteio.mlminiquake2/renderer/classic/constants.ml as rclassicconstants → src/miniquake2/renderer/classic/constants.mlminiquake2/renderer/classic/types.ml as rclassictypes → src/miniquake2/renderer/classic/types.mlminiquake2/renderer/constants.ml as rc → src/miniquake2/renderer/constants.mlstd/array.ml as rvisibilityarray → ../MiniLangCompilerML/std/array.ml external dependencystd/bytes.ml as rvisibilitybytes → ../MiniLangCompilerML/std/bytes.ml external dependencystd/math.ml as rvisibilitymath → ../MiniLangCompilerML/std/math.ml external dependencyconst BACKFACE_EPSILON = 1.e-002Defines the backface epsilon constant used by the miniquake2 renderer classic visibility module.
miniquake2.renderer.classic.visibility.ClassicAlphaOrderState struct
miniquake2.renderer.classic.visibility.ClassicBrushBounds struct
miniquake2.renderer.classic.visibility.ClassicBrushSelection struct
miniquake2.renderer.classic.visibility.ClassicFrustumPlane struct
miniquake2.renderer.classic.visibility.ClassicPvsSelection struct
miniquake2.renderer.classic.visibility.ClassicViewClusters struct
function classicVisibilityAngleAxes(angles)Return the classic visibility angle axes value.
| Parameter | Type | Default | Description |
|---|---|---|---|
angles | dynamic | — | angles value consumed by this operation. |
function classicVisibilityAppendAlphaNode(state, nodeIndex)Append one BSP node in the order produced when R_RecursiveWorldNode's front-to-back traversal inserts transparent surfaces at the chain head.
| Parameter | Type | Default | Description |
|---|---|---|---|
state | dynamic | — | Mutable state inspected or updated by the operation. |
nodeIndex | dynamic | — | Zero-based index of node. |
inline function classicVisibilityAreaAllowed(areaBits, area)Return the classic visibility area allowed value.
| Parameter | Type | Default | Description |
|---|---|---|---|
areaBits | dynamic | — | areaBits value consumed by this operation. |
area | dynamic | — | area value consumed by this operation. |
inline function classicVisibilityAreaBitsEqual(first, second)Report whether classic visibility area bits equal.
| Parameter | Type | Default | Description |
|---|---|---|---|
first | dynamic | — | first value consumed by this operation. |
second | dynamic | — | second value consumed by this operation. |
miniquake2.renderer.classic.visibility.ClassicVisibilityAxes struct
inline function classicVisibilityBoxOutsidePlane(draw, plane)Return the classic visibility box outside plane value.
| Parameter | Type | Default | Description |
|---|---|---|---|
draw | dynamic | — | draw value consumed by this operation. |
plane | dynamic | — | plane value consumed by this operation. |
function classicVisibilityBrushBounds(brushModel, entity)Return the classic visibility brush bounds.
| Parameter | Type | Default | Description |
|---|---|---|---|
brushModel | dynamic | — | brushModel value consumed by this operation. |
entity | dynamic | — | entity value consumed by this operation. |
function classicVisibilityBrushLocalView(entity, viewOrigin)Return the classic visibility brush local view value.
| Parameter | Type | Default | Description |
|---|---|---|---|
entity | dynamic | — | entity value consumed by this operation. |
viewOrigin | dynamic | — | viewOrigin value consumed by this operation. |
function classicVisibilityBrushModelVisible(brushModel, entity, frame)Report whether classic visibility brush model visible.
| Parameter | Type | Default | Description |
|---|---|---|---|
brushModel | dynamic | — | brushModel value consumed by this operation. |
entity | dynamic | — | entity value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
function classicVisibilityBrushModelVisiblePrepared(brushModel, entity, planes)Report whether classic visibility brush model visible in prepared frustum.
| Parameter | Type | Default | Description |
|---|---|---|---|
brushModel | dynamic | — | brushModel value consumed by this operation. |
entity | dynamic | — | entity value consumed by this operation. |
planes | dynamic | — | planes value consumed by this operation. |
function classicVisibilityBrushWorldPoint(entity, localPoint)Return the classic visibility brush world point value.
| Parameter | Type | Default | Description |
|---|---|---|---|
entity | dynamic | — | entity value consumed by this operation. |
localPoint | dynamic | — | localPoint value consumed by this operation. |
classicVisibilityCacheSlotStores module-wide classic visibility cache slot state for the miniquake2 renderer classic visibility module.
miniquake2.renderer.classic.visibility.ClassicVisibilityCacheSlot struct
function classicVisibilityCopyAreaBits(value)Copy classic visibility area bits.
| Parameter | Type | Default | Description |
|---|---|---|---|
value | dynamic | — | Value consumed or transformed by the operation. |
function classicVisibilityCulledCount(selection)Return the classic visibility culled count.
| Parameter | Type | Default | Description |
|---|---|---|---|
selection | dynamic | — | selection value consumed by this operation. |
function classicVisibilityFinishSelection(pvs, frame)Finish classic visibility selection with a compact public array. This keeps the diagnostic API while product rendering avoids the per-frame copy.
| Parameter | Type | Default | Description |
|---|---|---|---|
pvs | dynamic | — | pvs value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
function classicVisibilityFinishSelectionPrefix(pvs, frame)Finish classic visibility selection into reusable prefix storage. The count is authoritative; live rendering must not scan the unused capacity tail.
| Parameter | Type | Default | Description |
|---|---|---|---|
pvs | dynamic | — | pvs value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
function classicVisibilityFrontFacing(draw, viewOrigin)Return the classic visibility front facing value.
| Parameter | Type | Default | Description |
|---|---|---|---|
draw | dynamic | — | draw value consumed by this operation. |
viewOrigin | dynamic | — | viewOrigin value consumed by this operation. |
inline function classicVisibilityFrontFacingFixed(draw, viewX, viewY, viewZ)Return the classic visibility front facing fixed value.
| Parameter | Type | Default | Description |
|---|---|---|---|
draw | dynamic | — | draw value consumed by this operation. |
viewX | dynamic | — | viewX value consumed by this operation. |
viewY | dynamic | — | viewY value consumed by this operation. |
viewZ | dynamic | — | viewZ value consumed by this operation. |
function classicVisibilityFrustum(frame)Return the classic visibility frustum value.
| Parameter | Type | Default | Description |
|---|---|---|---|
frame | dynamic | — | frame value consumed by this operation. |
classicVisibilityFrustumScratchStores module-wide classic visibility frustum scratch state for the miniquake2 renderer classic visibility module.
function classicVisibilityInsideFrustum(draw, frame)Report whether classic visibility inside frustum.
| Parameter | Type | Default | Description |
|---|---|---|---|
draw | dynamic | — | draw value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
inline function classicVisibilityInsidePreparedFrustum(draw, planes)Report whether classic visibility inside prepared frustum.
| Parameter | Type | Default | Description |
|---|---|---|---|
draw | dynamic | — | draw value consumed by this operation. |
planes | dynamic | — | planes value consumed by this operation. |
function classicVisibilityMarkLeafFaces(map, leaf, marked)Mark classic visibility leaf faces.
| Parameter | Type | Default | Description |
|---|---|---|---|
map | dynamic | — | map value consumed by this operation. |
leaf | dynamic | — | leaf value consumed by this operation. |
marked | dynamic | — | marked value consumed by this operation. |
inline function classicVisibilityPlane(normalX, normalY, normalZ, distance)Return the classic visibility plane value.
| Parameter | Type | Default | Description |
|---|---|---|---|
normalX | dynamic | — | normalX value consumed by this operation. |
normalY | dynamic | — | normalY value consumed by this operation. |
normalZ | dynamic | — | normalZ value consumed by this operation. |
distance | dynamic | — | distance value consumed by this operation. |
function classicVisibilityPointLeaf(map, origin)Return the classic visibility point leaf value.
| Parameter | Type | Default | Description |
|---|---|---|---|
map | dynamic | — | map value consumed by this operation. |
origin | dynamic | — | origin value consumed by this operation. |
inline function classicVisibilityPvsContains(row, cluster)Report whether classic visibility pvs contains.
| Parameter | Type | Default | Description |
|---|---|---|---|
row | dynamic | — | row value consumed by this operation. |
cluster | dynamic | — | cluster value consumed by this operation. |
function classicVisibilityPvsRow(map, cluster)Return the classic visibility pvs row value.
| Parameter | Type | Default | Description |
|---|---|---|---|
map | dynamic | — | map value consumed by this operation. |
cluster | dynamic | — | cluster value consumed by this operation. |
classicVisibilitySelectionScratchStores module-wide classic visibility selection scratch state for the miniquake2 renderer classic visibility module.
function classicVisibilitySelectPvs(world, frame)Select classic visibility pvs.
| Parameter | Type | Default | Description |
|---|---|---|---|
world | dynamic | — | world value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
inline function classicVisibilitySetPlane(plane, normalX, normalY, normalZ, distance)Update one reusable fixed-point frustum plane without allocating a record.
| Parameter | Type | Default | Description |
|---|---|---|---|
plane | dynamic | — | plane value consumed by this operation. |
normalX | dynamic | — | normalX value consumed by this operation. |
normalY | dynamic | — | normalY value consumed by this operation. |
normalZ | dynamic | — | normalZ value consumed by this operation. |
distance | dynamic | — | distance value consumed by this operation. |
function classicVisibilitySphereInsideFrustum(origin, radius, frame)Test a conservative world-space sphere against the prepared fixed-point frustum. Alias models use this with their current/previous pose union radius so no interpolated vertex can be clipped prematurely.
| Parameter | Type | Default | Description |
|---|---|---|---|
origin | dynamic | — | origin value consumed by this operation. |
radius | dynamic | — | radius value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
function classicVisibilityStockAlphaDraws(world, draws, viewOrigin)Order visible world alpha polygons exactly like ref_gl's global alpha chain.
| Parameter | Type | Default | Description |
|---|---|---|---|
world | dynamic | — | world value consumed by this operation. |
draws | dynamic | — | draws value consumed by this operation. |
viewOrigin | dynamic | — | viewOrigin value consumed by this operation. |
function classicVisibilityStockAlphaDrawsPrefix(world, draws, drawCount, viewOrigin)Order a visible alpha prefix using world-owned scratch storage. This is the live equivalent of classicVisibilityStockAlphaDraws without allocating two face tables and an output array on every rendered frame.
| Parameter | Type | Default | Description |
|---|---|---|---|
world | dynamic | — | world value consumed by this operation. |
draws | dynamic | — | draws value consumed by this operation. |
drawCount | dynamic | — | Number of draw to process. |
viewOrigin | dynamic | — | viewOrigin value consumed by this operation. |
function classicVisibilityViewClusters(map, origin)Match R_SetupFrame's second-cluster probe so crossing a solid water boundary exposes both PVS rows instead of popping the opposite side of the surface.
| Parameter | Type | Default | Description |
|---|---|---|---|
map | dynamic | — | map value consumed by this operation. |
origin | dynamic | — | origin value consumed by this operation. |
function compactClassicDraws(values, count)Return the compact classic draws value.
| Parameter | Type | Default | Description |
|---|---|---|---|
values | dynamic | — | values value consumed by this operation. |
count | dynamic | — | Number of items or units to process. |
function selectClassicBrushModel(brushModel, entity, frame)Select classic brush model.
| Parameter | Type | Default | Description |
|---|---|---|---|
brushModel | dynamic | — | brushModel value consumed by this operation. |
entity | dynamic | — | entity value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
function selectClassicBrushModelPrepared(brushModel, entity, frame, planes)Select a classic brush model using the frame-owned frustum and retain the local view point needed by the special-surface planner.
| Parameter | Type | Default | Description |
|---|---|---|---|
brushModel | dynamic | — | brushModel value consumed by this operation. |
entity | dynamic | — | entity value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
planes | dynamic | — | planes value consumed by this operation. |
function selectClassicWorld(world, frame)Select classic world.
| Parameter | Type | Default | Description |
|---|---|---|---|
world | dynamic | — | world value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
function selectClassicWorldCached(world, frame)Product snapshots carry an area-bit array on every frame even when no door changed. Key the cached candidate list by its contents as well as cluster; treating every non-void array as an override forced a full BSP/PVS scan of roughly 7k surfaces every rendered frame.
| Parameter | Type | Default | Description |
|---|---|---|---|
world | dynamic | — | world value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
function selectClassicWorldCachedPrefix(world, frame)Cached product selection retaining the capacity-sized reusable output.
| Parameter | Type | Default | Description |
|---|---|---|---|
world | dynamic | — | world value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
function selectClassicWorldPrefix(world, frame)Select the world into reusable prefix storage for live OpenGL submission.
| Parameter | Type | Default | Description |
|---|---|---|---|
world | dynamic | — | world value consumed by this operation. |
frame | dynamic | — | frame value consumed by this operation. |
const VISIBILITY_DEG_TO_RAD = 1.74532925199433e-002Defines the visibility deg to rad constant used by the miniquake2 renderer classic visibility module.
const VISIBILITY_FAR = 8192.Defines the visibility far constant used by the miniquake2 renderer classic visibility module.
const VISIBILITY_NEAR = 4.Defines the visibility near constant used by the miniquake2 renderer classic visibility module.