Class Octree.Node
- Namespace
- ValveResourceFormat.Renderer
- Assembly
- Renderer.dll
A single node in the octree containing elements and child nodes.
public class Octree.NodeInheritance
Inherited Members
Constructors
Node(Node?, Vector3, Vector3)
Initializes a new octree node.
public Node(Octree.Node? parent, Vector3 regionMin, Vector3 regionSize)Parameters
parentOctree.Node?-
Parent node, or null for root.
regionMinVector3-
Minimum corner of the node's region.
regionSizeVector3-
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
Elements
Gets the scene nodes stored directly in this node.
public List<SceneNode>? Elements { get; }Property Value
FrustumCulled
Gets or sets whether this node is outside the view frustum.
public bool FrustumCulled { get; set; }Property Value
HasChildren
Gets whether this node has been subdivided into child nodes.
public bool HasChildren { get; }Property Value
HasElements
Gets whether this node contains any scene elements.
public bool HasElements { get; }Property Value
OcclusionCulled
Gets or sets whether this node is occluded by other geometry.
public bool OcclusionCulled { get; set; }Property Value
OcclusionQueryHandle
Gets or sets the OpenGL occlusion query handle for this node.
public int OcclusionQueryHandle { get; set; }Property Value
OcculsionQuerySubmitted
Gets or sets whether an occlusion query has been submitted for this node.
public bool OcculsionQuerySubmitted { get; set; }Property Value
Parent
Gets the parent node, or null if this is the root.
public Octree.Node? Parent { get; }Property Value
Region
Gets the spatial region covered by this node.
public AABB Region { get; }Property Value
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
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
elementSceneNode-
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
boundingBoxAABB-
Bounding box to test against.
resultsList<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
frustumFrustum-
View frustum to test against.
resultsList<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.