Table of Contents

Class Octree

Namespace
ValveResourceFormat.Renderer
Assembly
Renderer.dll

Spatial partitioning structure for efficient scene node culling and queries.

public class Octree

Inheritance

Inherited Members

Constructors

Octree(float)

Initializes a new octree with the specified size.

public Octree(float size)

Parameters

size float

Total size of the octree region (centered at origin).

Octree(AABB)

Initializes a new octree with the specified bounding box as the largest region.

public Octree(AABB size)

Parameters

size AABB

Properties

DebugRenderer

public OctreeDebugRenderer? DebugRenderer { get; set; }

Property Value

OctreeDebugRenderer?

Dirty

Gets or sets whether this octree needs to be rebuilt.

public bool Dirty { get; set; }

Property Value

bool

Root

Gets the root node of the octree.

public Octree.Node Root { get; }

Property Value

Octree.Node

Methods

Clear()

Clears all nodes and elements from the octree.

public void Clear()

Clear(AABB)

Clears all nodes and roughly sizes root to the specified bounds.

public void Clear(AABB rootBounds)

Parameters

rootBounds AABB

Insert(SceneNode)

Inserts a scene node into the octree.

public void Insert(SceneNode obj)

Parameters

obj SceneNode

Scene node to insert.

Exceptions

ArgumentNullException

Thrown if obj is null.

Remove(SceneNode)

Removes a scene node from the octree.

public void Remove(SceneNode obj)

Parameters

obj SceneNode

Scene node to remove.

Exceptions

ArgumentNullException

Thrown if obj is null.

Update(SceneNode, in AABB)

Updates a scene node's position in the octree after its bounds have changed.

public void Update(SceneNode obj, in AABB oldBounds)

Parameters

obj SceneNode

Scene node to update.

oldBounds AABB

Previous bounding box of the scene node.

Remarks

Relocates the node to the appropriate octree node based on its new bounds. May push the node down to child nodes or up to ancestor nodes as needed.

Exceptions

ArgumentNullException

Thrown if obj is null.