Class FrustumCulling
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
The frustum culler keeps the planes of the current view pyramid and tests whether an object is inside them All visibility rules live here and are used by both the single object checks (InFrustum and friends) and the batched version in PoolCullData Open in GitHub
public class FrustumCulling
- Inheritance
-
FrustumCulling
- Inherited Members
- Extension Methods
Fields
ViewDistanceSq
public int ViewDistanceSq
Field Value
lod0BiasSq
public float lod0BiasSq
Field Value
lod2BiasSq
If the squared distance is above this share of ViewDistanceSq we switch to LOD2 The default corresponds to roughly 67 percent of the player view distance With the default about 55 percent of all drawn chunks use LOD2
public double lod2BiasSq
Field Value
shadowRangeX
public double shadowRangeX
Field Value
shadowRangeZ
public double shadowRangeZ
Field Value
Methods
CalcFrustumEquations(BlockPos, double[], double[])
Rebuilds the frustum planes from the projection and camera matrices
public void CalcFrustumEquations(BlockPos playerPos, double[] projectionMatrix, double[] cameraMatrix)
Parameters
InFrustum(Sphere)
The sphere is inside the frustum, ignoring range and LOD
public bool InFrustum(Sphere sphere)
Parameters
sphereSphere
Returns
InFrustumAndRange(Sphere, int)
Full check for the normal pass: range and LOD first, then the planes
public bool InFrustumAndRange(Sphere sphere, int lodLevel = 0)
Parameters
Returns
InFrustumShadowPass(Sphere)
The object is inside the area the shadows are built from
public bool InFrustumShadowPass(Sphere sphere)
Parameters
sphereSphere
Returns
SphereInFrustum(double, double, double, double)
Tests a sphere against all six planes with the center as the point and the radius as tolerance Returns true when the sphere is at least partly inside the frustum
public bool SphereInFrustum(double x, double y, double z, double radius)
Parameters
Returns
UpdateViewDistance(int)
Updates the view distance A small margin of 20 blocks is added to it
public void UpdateViewDistance(int newValue)
Parameters
newValueint