MiniQuake

src/miniquake/render/ray_shadow.ml

Package
miniquake.render.ray_shadow
Reachable
Yes

Imports

Declarations

acceptProjection

function acceptProjection(index, hit, receiverSurface, fraction, hitX, hitY, hitZ, normalX, normalY, normalZ)

Validate and store one native or scalar ray result with a receiver-normal bias that prevents depth fighting on the actual world polygon.

ParameterTypeDefaultDescription
indexdynamic—Zero-based index of the requested entry.
hitdynamic—The hit input consumed by `acceptProjection`.
receiverSurfacedynamic—The receiver surface input consumed by `acceptProjection`.
fractiondynamic—The fraction input consumed by `acceptProjection`.
hitXdynamic—The hit x input consumed by `acceptProjection`.
hitYdynamic—The hit y input consumed by `acceptProjection`.
hitZdynamic—The hit z input consumed by `acceptProjection`.
normalXdynamic—The normal x input consumed by `acceptProjection`.
normalYdynamic—The normal y input consumed by `acceptProjection`.
normalZdynamic—The normal z input consumed by `acceptProjection`.

View source

activeMap

activeMap

Tracks the module-level active map state owned by `miniquake.render.ray_shadow`.

View source

activeRootNode

activeRootNode

Tracks the module-level active root node state owned by `miniquake.render.ray_shadow`.

View source

activeSurfaces

activeSurfaces

Tracks the module-level active surfaces state owned by `miniquake.render.ray_shadow`.

View source

beginPrimitive

function beginPrimitive()

Start an independently indexed brush polygon while retaining the current light sample. Alias triangles deliberately share one generation so repeated MDL vertex indexes are traced only once.

View source

beginProjectionSample

function beginProjectionSample(offsetX, offsetY)

Begin one hard-shadow or area-light sample and invalidate cached projected vertices by advancing a generation counter instead of clearing large arrays.

ParameterTypeDefaultDescription
offsetXdynamic—The offset x input consumed by `beginProjectionSample`.
offsetYdynamic—The offset y input consumed by `beginProjectionSample`.

View source

configureAlias

function configureAlias(worldMap, worldSurfaces, entity, model, doubleEyes, lightActive, lightX, lightY, lightZ)

Configure an MDL caster using the exact GLQuake alias transform, including the doubled-eyes compatibility special case.

ParameterTypeDefaultDescription
worldMapdynamic—The world map input consumed by `configureAlias`.
worldSurfacesdynamic—The world surfaces input consumed by `configureAlias`.
entitydynamic—Entity affected by the operation.
modeldynamic—Model resource processed by the operation.
doubleEyesdynamic—The double eyes input consumed by `configureAlias`.
lightActivedynamic—The light active input consumed by `configureAlias`.
lightXdynamic—The light x input consumed by `configureAlias`.
lightYdynamic—The light y input consumed by `configureAlias`.
lightZdynamic—The light z input consumed by `configureAlias`.

View source

configureBrush

function configureBrush(worldMap, worldSurfaces, entity, lightActive, lightX, lightY, lightZ)

Configure an inline or external BSP caster. Brush model vertices are already expressed in model-local world units and use the positive pitch transform.

ParameterTypeDefaultDescription
worldMapdynamic—The world map input consumed by `configureBrush`.
worldSurfacesdynamic—The world surfaces input consumed by `configureBrush`.
entitydynamic—Entity affected by the operation.
lightActivedynamic—The light active input consumed by `configureBrush`.
lightXdynamic—The light x input consumed by `configureBrush`.
lightYdynamic—The light y input consumed by `configureBrush`.
lightZdynamic—The light z input consumed by `configureBrush`.

View source

configureCaster

function configureCaster(worldMap, worldSurfaces, entity, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, pitchSign, lightActive, lightX, lightY, lightZ)

Configure common world, entity transform and light state for one caster.

ParameterTypeDefaultDescription
worldMapdynamic—The world map input consumed by `configureCaster`.
worldSurfacesdynamic—The world surfaces input consumed by `configureCaster`.
entitydynamic—Entity affected by the operation.
scaleXdynamic—The scale x input consumed by `configureCaster`.
scaleYdynamic—The scale y input consumed by `configureCaster`.
scaleZdynamic—The scale z input consumed by `configureCaster`.
offsetXdynamic—The offset x input consumed by `configureCaster`.
offsetYdynamic—The offset y input consumed by `configureCaster`.
offsetZdynamic—The offset z input consumed by `configureCaster`.
pitchSigndynamic—The pitch sign input consumed by `configureCaster`.
lightActivedynamic—The light active input consumed by `configureCaster`.
lightXdynamic—The light x input consumed by `configureCaster`.
lightYdynamic—The light y input consumed by `configureCaster`.
lightZdynamic—The light z input consumed by `configureCaster`.

View source

ensureNativeWorld

function ensureNativeWorld(worldMap, worldSurfaces)

Upload a triangulated copy of the render BSP once per map. The native bridge builds a CPU BVH; MiniLang retains ownership of caster/light policy and all emitted shadow geometry.

ParameterTypeDefaultDescription
worldMapdynamic—The world map input consumed by `ensureNativeWorld`.
worldSurfacesdynamic—The world surfaces input consumed by `ensureNativeWorld`.

View source

ensureVertexCapacity

function ensureVertexCapacity(index)

Grow every parallel vertex cache together so a model vertex index remains a stable key throughout one shadow sample.

ParameterTypeDefaultDescription
indexdynamic—Zero-based index of the requested entry.

View source

hitPacket

hitPacket

Tracks the module-level hit packet state owned by `miniquake.render.ray_shadow`.

View source

INITIAL_VERTEX_CACHE

const INITIAL_VERTEX_CACHE = 1024

Defines the initial vertex cache value used by `miniquake.render.ray_shadow`.

View source

isReady

inline function isReady()

Report whether the current caster has a valid render-BSP context.

View source

MAX_RECEIVER_DISTANCE

const MAX_RECEIVER_DISTANCE = 768.

Defines the max receiver distance value used by `miniquake.render.ray_shadow`.

View source

minimumHitFraction

minimumHitFraction

Tracks the module-level minimum hit fraction state owned by `miniquake.render.ray_shadow`.

View source

modelOffsetX

modelOffsetX

Tracks the module-level model offset x state owned by `miniquake.render.ray_shadow`.

View source

modelOffsetY

modelOffsetY

Tracks the module-level model offset y state owned by `miniquake.render.ray_shadow`.

View source

modelOffsetZ

modelOffsetZ

Tracks the module-level model offset z state owned by `miniquake.render.ray_shadow`.

View source

modelScaleX

modelScaleX

Tracks the module-level model scale x state owned by `miniquake.render.ray_shadow`.

View source

modelScaleY

modelScaleY

Tracks the module-level model scale y state owned by `miniquake.render.ray_shadow`.

View source

modelScaleZ

modelScaleZ

Tracks the module-level model scale z state owned by `miniquake.render.ray_shadow`.

View source

nativeWorldReady

nativeWorldReady

Tracks the module-level native world ready state owned by `miniquake.render.ray_shadow`.

View source

originX

originX

Tracks the module-level origin x state owned by `miniquake.render.ray_shadow`.

View source

originY

originY

Tracks the module-level origin y state owned by `miniquake.render.ray_shadow`.

View source

originZ

originZ

Tracks the module-level origin z state owned by `miniquake.render.ray_shadow`.

View source

pitchCos

pitchCos

Tracks the module-level pitch cos state owned by `miniquake.render.ray_shadow`.

View source

pitchSin

pitchSin

Tracks the module-level pitch sin state owned by `miniquake.render.ray_shadow`.

View source

pointLightActive

pointLightActive

Tracks the module-level point light active state owned by `miniquake.render.ray_shadow`.

View source

pointLightX

pointLightX

Tracks the module-level point light x state owned by `miniquake.render.ray_shadow`.

View source

pointLightY

pointLightY

Tracks the module-level point light y state owned by `miniquake.render.ray_shadow`.

View source

pointLightZ

pointLightZ

Tracks the module-level point light z state owned by `miniquake.render.ray_shadow`.

View source

prepareVertexRay

function prepareVertexRay(index, packedX, packedY, packedZ)

Transform one model vertex and pack its finite light segment for either the native BVH batch or the scalar MiniLang fallback.

ParameterTypeDefaultDescription
indexdynamic—Zero-based index of the requested entry.
packedXdynamic—The packed x input consumed by `prepareVertexRay`.
packedYdynamic—The packed y input consumed by `prepareVertexRay`.
packedZdynamic—The packed z input consumed by `prepareVertexRay`.

View source

projectAliasVertices

function projectAliasVertices(vertices)

Trace every MDL frame vertex through one native call for the current sample.

ParameterTypeDefaultDescription
verticesdynamic—The vertices input consumed by `projectAliasVertices`.

View source

projectBrushVertices

function projectBrushVertices(vertices)

Trace every vertex of one BSP caster polygon through one native call.

ParameterTypeDefaultDescription
verticesdynamic—The vertices input consumed by `projectBrushVertices`.

View source

projectedPointSurface

inline function projectedPointSurface(index)

Return the render-BSP surface reached by one cached native ray.

ParameterTypeDefaultDescription
indexdynamic—Zero-based index of the requested entry.

View source

projectedPointValid

inline function projectedPointValid(index)

Report whether one vertex reached a compatible receiver in this sample.

ParameterTypeDefaultDescription
indexdynamic—Zero-based index of the requested entry.

View source

projectedPointX

inline function projectedPointX(index)

Return one cached projected x coordinate.

ParameterTypeDefaultDescription
indexdynamic—Zero-based index of the requested entry.

View source

projectedPointY

inline function projectedPointY(index)

Return one cached projected y coordinate.

ParameterTypeDefaultDescription
indexdynamic—Zero-based index of the requested entry.

View source

projectedPointZ

inline function projectedPointZ(index)

Return one cached projected z coordinate.

ParameterTypeDefaultDescription
indexdynamic—Zero-based index of the requested entry.

View source

projectionGeneration

projectionGeneration

Tracks the module-level projection generation state owned by `miniquake.render.ray_shadow`.

View source

projectionNormalX

projectionNormalX

Tracks the module-level projection normal x state owned by `miniquake.render.ray_shadow`.

View source

projectionNormalY

projectionNormalY

Tracks the module-level projection normal y state owned by `miniquake.render.ray_shadow`.

View source

projectionNormalZ

projectionNormalZ

Tracks the module-level projection normal z state owned by `miniquake.render.ray_shadow`.

View source

projectionStamp

projectionStamp

Tracks the module-level projection stamp state owned by `miniquake.render.ray_shadow`.

View source

projectionSurface

projectionSurface

Tracks the module-level projection surface state owned by `miniquake.render.ray_shadow`.

View source

projectionTravel

projectionTravel

Tracks the module-level projection travel state owned by `miniquake.render.ray_shadow`.

View source

projectionValid

projectionValid

Tracks the module-level projection valid state owned by `miniquake.render.ray_shadow`.

View source

projectionX

projectionX

Tracks the module-level projection x state owned by `miniquake.render.ray_shadow`.

View source

projectionY

projectionY

Tracks the module-level projection y state owned by `miniquake.render.ray_shadow`.

View source

projectionZ

projectionZ

Tracks the module-level projection z state owned by `miniquake.render.ray_shadow`.

View source

projectVertex

function projectVertex(index, packedX, packedY, packedZ)

Project an individual vertex for diagnostics and compatibility callers. The production alias/brush paths use the two batch entry points above.

ParameterTypeDefaultDescription
indexdynamic—Zero-based index of the requested entry.
packedXdynamic—The packed x input consumed by `projectVertex`.
packedYdynamic—The packed y input consumed by `projectVertex`.
packedZdynamic—The packed z input consumed by `projectVertex`.

View source

rayPacket

rayPacket

Tracks the module-level ray packet state owned by `miniquake.render.ray_shadow`.

View source

rayPreparedValid

rayPreparedValid

Tracks the module-level ray prepared valid state owned by `miniquake.render.ray_shadow`.

View source

ready

ready

Tracks the module-level ready state owned by `miniquake.render.ray_shadow`.

View source

RECEIVER_BIAS

const RECEIVER_BIAS = 0.65

Defines the receiver bias value used by `miniquake.render.ray_shadow`.

View source

receiverEdgeCompatible

function receiverEdgeCompatible(left, right)

Test one projected edge for a compatible receiver plane and bounded stretch.

ParameterTypeDefaultDescription
leftdynamic—The left input consumed by `receiverEdgeCompatible`.
rightdynamic—The right input consumed by `receiverEdgeCompatible`.

View source

receiverEdgeContinuity

inline function receiverEdgeContinuity(sourceLength, projectedLength, travelDifference)

Reject receiver discontinuities before the rasterizer interpolates a source edge across empty space. The allowance scales with the caster edge so a normal slope remains intact, while an adjacent ledge/floor pair cannot form the long translucent triangles previously visible around crate corners.

ParameterTypeDefaultDescription
sourceLengthdynamic—Length of the requested data in units appropriate to the operation.
projectedLengthdynamic—Length of the requested data in units appropriate to the operation.
travelDifferencedynamic—The travel difference input consumed by `receiverEdgeContinuity`.

View source

receiverSurfaceContinuity

inline function receiverSurfaceContinuity(leftSurface, rightSurface)

Require native ray hits to remain on one concrete BSP receiver polygon. The scalar fallback cannot expose a surface id and retains the geometric normal/stretch checks below, represented by its negative sentinel.

ParameterTypeDefaultDescription
leftSurfacedynamic—The left surface input consumed by `receiverSurfaceContinuity`.
rightSurfacedynamic—The right surface input consumed by `receiverSurfaceContinuity`.

View source

receiverTriangleCompatible

function receiverTriangleCompatible(first, second, third)

Reject a triangle whose rays land across an abrupt BSP corner or stretch far beyond its source edge. Skipping that triangle prevents geometry from being interpolated through a wall between otherwise individually valid hits.

ParameterTypeDefaultDescription
firstdynamic—The first input consumed by `receiverTriangleCompatible`.
seconddynamic—The second input consumed by `receiverTriangleCompatible`.
thirddynamic—The third input consumed by `receiverTriangleCompatible`.

View source

rollCos

rollCos

Tracks the module-level roll cos state owned by `miniquake.render.ray_shadow`.

View source

rollSin

rollSin

Tracks the module-level roll sin state owned by `miniquake.render.ray_shadow`.

View source

sampleOffsetX

sampleOffsetX

Tracks the module-level sample offset x state owned by `miniquake.render.ray_shadow`.

View source

sampleOffsetY

sampleOffsetY

Tracks the module-level sample offset y state owned by `miniquake.render.ray_shadow`.

View source

sourceX

sourceX

Tracks the module-level source x state owned by `miniquake.render.ray_shadow`.

View source

sourceY

sourceY

Tracks the module-level source y state owned by `miniquake.render.ray_shadow`.

View source

sourceZ

sourceZ

Tracks the module-level source z state owned by `miniquake.render.ray_shadow`.

View source

tracePreparedVertices

function tracePreparedVertices(count)

Trace the prepared prefix as one native BVH batch, falling back to the allocation-free render-BSP walker if the native acceleration is unavailable.

ParameterTypeDefaultDescription
countdynamic—Number of entries or units to process.

View source

uploadedMapName

uploadedMapName

Tracks the module-level uploaded map name state owned by `miniquake.render.ray_shadow`.

View source

uploadedSurfaceCount

uploadedSurfaceCount

Tracks the module-level uploaded surface count state owned by `miniquake.render.ray_shadow`.

View source

worldTrianglePacket

worldTrianglePacket

Tracks the module-level world triangle packet state owned by `miniquake.render.ray_shadow`.

View source

yawCos

yawCos

Tracks the module-level yaw cos state owned by `miniquake.render.ray_shadow`.

View source

yawSin

yawSin

Tracks the module-level yaw sin state owned by `miniquake.render.ray_shadow`.

View source