Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OctreeBlock<T>

Class used to store a cell in an octree

see

https://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees

Type parameters

  • T

Hierarchy

  • OctreeBlock

Index

Constructors

constructor

  • Creates a new block

    Parameters

    • minPoint: Vector3

      defines the minimum vector (in world space) of the block's bounding box

    • maxPoint: Vector3

      defines the maximum vector (in world space) of the block's bounding box

    • capacity: number

      defines the maximum capacity of this block (if capacity is reached the block will be split into sub blocks)

    • depth: number

      defines the current depth of this block in the octree

    • maxDepth: number

      defines the maximal depth allowed (beyond this value, the capacity is ignored)

    • creationFunc: (entry: T, block: OctreeBlock<T>) => void

      defines a callback to call when an element is added to the block

    Returns OctreeBlock

Properties

blocksSearch playground for blocks

blocks: Array<OctreeBlock<T>>

Gets the list of block children

entriesSearch playground for entries

entries: T[]

Gets the content of the current block

Accessors

capacity

  • get capacity(): number
  • Gets the maximum capacity of this block (if capacity is reached the block will be split into sub blocks)

    Returns number

maxPoint

  • Gets the maximum vector (in world space) of the block's bounding box

    Returns Vector3

minPoint

  • Gets the minimum vector (in world space) of the block's bounding box

    Returns Vector3

Methods

addEntriesSearch playground for addEntries

  • addEntries(entries: T[]): void
  • Add an array of elements to this block

    Parameters

    • entries: T[]

      defines the array of elements to add

    Returns void

addEntrySearch playground for addEntry

  • addEntry(entry: T): void
  • Add a new element to this block

    Parameters

    • entry: T

      defines the element to add

    Returns void

createInnerBlocksSearch playground for createInnerBlocks

  • createInnerBlocks(): void
  • Subdivide the content into child blocks (this block will then be empty)

    Returns void

intersectsSearch playground for intersects

  • Test if the current block intersect with the given bounding sphere and if yes, then add its content to the selection array

    Parameters

    • sphereCenter: Vector3

      defines the bounding sphere center

    • sphereRadius: number

      defines the bounding sphere radius

    • selection: SmartArrayNoDuplicate<T>

      defines the array to store current content if selection is positive

    • Optional allowDuplicate: boolean

      defines if the selection array can contains duplicated entries

    Returns void

intersectsRaySearch playground for intersectsRay

  • Test if the current block intersect with the given ray and if yes, then add its content to the selection array

    Parameters

    • ray: Ray

      defines the ray to test with

    • selection: SmartArrayNoDuplicate<T>

      defines the array to store current content if selection is positive

    Returns void

removeEntrySearch playground for removeEntry

  • removeEntry(entry: T): void
  • Remove an element from this block

    Parameters

    • entry: T

      defines the element to remove

    Returns void

selectSearch playground for select

  • Test if the current block intersects the frustum planes and if yes, then add its content to the selection array

    Parameters

    • frustumPlanes: Plane[]

      defines the frustum planes to test

    • selection: SmartArrayNoDuplicate<T>

      defines the array to store current content if selection is positive

    • Optional allowDuplicate: boolean

      defines if the selection array can contains duplicated entries

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method