Class BspVoxelVisibility
Namespace: ValveResourceFormat.Blocks
Assembly: ValveResourceFormat.dll
A binary tree of split planes where a leaf is a cluster outright, named by a child index past the end of the nodes.
public sealed class BspVoxelVisibility : IWorldVisibilityInheritance
Implements
Properties
BytesPerCluster
Gets the number of bytes in one cluster's visibility row.
public int BytesPerCluster { get; }Property Value
ClusterBitfieldWordCount
Gets how many 32 bit words a cluster bitfield needs.
public int ClusterBitfieldWordCount { get; }Property Value
ClusterCount
Gets the number of clusters, excluding any rows stored past them.
public int ClusterCount { get; }Property Value
Clusters
Gets the clusters, which are this tree's leaves.
public BspVoxelVisibility.Cluster[] Clusters { get; }Property Value
HasVisibilityData
Gets whether this holds visibility that can be queried.
public bool HasVisibilityData { get; }Property Value
MaxBounds
Gets the maximum bounds of the visibility volume.
public Vector3 MaxBounds { get; }Property Value
MinBounds
Gets the minimum bounds of the visibility volume.
public Vector3 MinBounds { get; }Property Value
Nodes
Gets the split plane tree. The root is index 0.
public BspVoxelVisibility.Node[] Nodes { get; }Property Value
SunVisibility
Gets the visibility row listing the clusters sunlight reaches, empty when the format has none.
public ReadOnlyMemory<byte> SunVisibility { get; }Property Value
Remarks
This format has no sun row.
VisData
Gets the visibility rows, addressed by .
public byte[] VisData { get; }Property Value
byte[]
Methods
BuildClusterChildBounds()
Builds the list of boxes making up each cluster, for debug drawing.
public Dictionary<ushort, List<(Vector3 Min, Vector3 Max)>> BuildClusterChildBounds()Returns
Dictionary<ushort, List<(Vector3 Min, Vector3 Max)>>
GetClusterForPosition(Vector3)
Gets the cluster containing a point, or a value below zero when there is none.
public int GetClusterForPosition(Vector3 position)Parameters
position Vector3
World-space point.
Returns
GetVisClustersForBox(Vector3, Vector3, Span<uint>)
Fills a bitfield with every cluster the given box overlaps.
public void GetVisClustersForBox(Vector3 min, Vector3 max, Span<uint> clusterBits)Parameters
min Vector3
Minimum corner of the box.
max Vector3
Maximum corner of the box.
Destination bitfield, at least words long.
GetVisibilityRow(int)
Gets the visibility row for a cluster, or empty when it has none.
public ReadOnlyMemory<byte> GetVisibilityRow(int clusterId)Parameters
clusterId int
Cluster to look up.
Returns
GetVisibilityRowForPoint(Vector3)
Gets the visibility row for the cluster at a point, empty when the point resolves to nothing.
public ReadOnlyMemory<byte> GetVisibilityRowForPoint(Vector3 point)Parameters
point Vector3
World-space point.
Returns
Read(KVObject)
Reads the layout out of the block's key values.
public void Read(KVObject data)Parameters
data KVObject
The block's KV3 data.

