Table of Contents

Class Octree.Node

Namespace
ValveResourceFormat.Renderer
Assembly
Renderer.dll

A single node in the octree containing elements and child nodes.

public class Octree.Node

Inheritance

Inherited Members

Constructors

Node(Node?, Vector3, Vector3)

Initializes a new octree node.

public Node(Octree.Node? parent, Vector3 regionMin, Vector3 regionSize)

Parameters

parent Octree.Node?

Parent node, or null for root.

regionMin Vector3

Minimum corner of the node's region.

regionSize Vector3

Size of the node's region in each dimension.

Properties

Children

Gets the eight child octree nodes created after subdivision.

public Octree.Node[] Children { get; }

Property Value

Octree.Node[]

Elements

Gets the scene nodes stored directly in this node.

public List<SceneNode>? Elements { get; }

Property Value

List<SceneNode>?

FrustumCulled

Gets or sets whether this node is outside the view frustum.

public bool FrustumCulled { get; set; }

Property Value

bool

HasChildren

Gets whether this node has been subdivided into child nodes.

public bool HasChildren { get; }

Property Value

bool

HasElements

Gets whether this node contains any scene elements.

public bool HasElements { get; }

Property Value

bool

OcclusionCulled

Gets or sets whether this node is occluded by other geometry.

public bool OcclusionCulled { get; set; }

Property Value

bool

OcclusionQueryHandle

Gets or sets the OpenGL occlusion query handle for this node.

public int OcclusionQueryHandle { get; set; }

Property Value

int

OcculsionQuerySubmitted

Gets or sets whether an occlusion query has been submitted for this node.

public bool OcculsionQuerySubmitted { get; set; }

Property Value

bool

Parent

Gets the parent node, or null if this is the root.

public Octree.Node? Parent { get; }

Property Value

Octree.Node?

Region

Gets the spatial region covered by this node.

public AABB Region { get; }

Property Value

AABB

Methods

Clear()

Clears all elements and children from this node and releases OpenGL resources.

public void Clear()

Find(SceneNode, in AABB)

Finds a scene node within this node or its children.

public (Octree.Node? Node, int Index) Find(SceneNode clientObject, in AABB bounds)

Parameters

clientObject SceneNode

Scene node to locate.

bounds AABB

Bounding box of the scene node.

Returns

(Octree.Node? Node, int Index)

Tuple containing the node where the element was found and its index, or (null, -1) if not found.

GetBounds()

Calculates the combined bounding box of all elements in this node and its children.

public AABB GetBounds()

Returns

AABB

Axis-aligned bounding box encompassing all contained elements.

Insert(SceneNode)

Inserts a scene node into this octree node or an appropriate child.

public void Insert(SceneNode element)

Parameters

element SceneNode

Scene node to insert.

Remarks

Automatically subdivides the node if element density exceeds threshold. Elements are pushed down to child nodes when they fit entirely within a child's region.

Query(in AABB, List<SceneNode>)

Queries scene nodes that intersect with the specified bounding box.

public void Query(in AABB boundingBox, List<SceneNode> results)

Parameters

boundingBox AABB

Bounding box to test against.

results List<SceneNode>

List to populate with intersecting scene nodes.

Query(Frustum, List<SceneNode>)

Queries scene nodes visible within the specified view frustum.

public void Query(Frustum frustum, List<SceneNode> results)

Parameters

frustum Frustum

View frustum to test against.

results List<SceneNode>

List to populate with visible scene nodes.

Remarks

Performs frustum and occlusion culling during traversal.

Subdivide()

Splits this node into eight child nodes and redistributes elements.

public void Subdivide()

Remarks

Elements that fit entirely within a child node are moved down. Elements spanning multiple children remain in this node.