Class: PickIdLayout<T>
Experimental
Contiguous id-range layout, rebuilt for every pick: each pickable draw gets size ids starting right after the previous one (instanced markers need one per instance, meshes one per vertex / triangle / instance, or one for the whole object). Rebuilding per pick keeps the id space compact with no bookkeeping when counts change, and costs O(pickables). Ranges are stored in reused arrays, so the steady state does not allocate.
Type Parameters
| Type Parameter |
|---|
T |
Constructors
Constructor
new PickIdLayout<T>(): PickIdLayout<T>;Experimental
Returns
PickIdLayout<T>
Accessors
count
Get Signature
get count(): number;Experimental
Number of ranges.
Returns
number
total
Get Signature
get total(): number;Experimental
Total ids allocated.
Returns
number
Methods
allocate()
allocate(entry, size): number;Experimental
Append a range of size ids for entry and return its base id.
Parameters
| Parameter | Type |
|---|---|
entry | T |
size | number |
Returns
number
Throws
RangeError when the id space (2³² − 1 ids) is exhausted.
lookup()
lookup(id, out): boolean;Experimental
Find the range containing id (binary search; bases are ascending). Writes it into out and returns true, or returns false when no range contains id.
Parameters
| Parameter | Type |
|---|---|
id | number |
out | PickIdRange<T> |
Returns
boolean
reset()
reset(): void;Experimental
Forget all ranges (keeps capacity).
Returns
void