new Cell(aabb)
Constructs a new cell with the given values.
Parameters:
Name | Type | Description |
---|---|---|
aabb |
AABB | The bounding volume of the cell. |
Members
-
aabb :AABB
-
The bounding volume of the cell.
-
readonly entries :Array.<Any>
-
The list of entries which belong to this cell.
Methods
-
add(entry) → {Cell}
-
Adds an entry to this cell.
Parameters:
Name Type Description entry
Any The entry to add.
-
empty() → {Boolean}
-
Returns true if this cell is empty.
Returns:
Boolean -Whether this cell is empty or not.
-
fromJSON(json) → {Cell}
-
Restores this instance from the given JSON object.
Parameters:
Name Type Description json
Object The JSON object.
-
intersects(aabb) → {Boolean}
-
Returns true if the given AABB intersects the internal bounding volume of this cell.
Parameters:
Name Type Description aabb
AABB The AABB to test.
Returns:
Boolean -Whether this cell intersects with the given AABB or not.
-
makeEmpty() → {Cell}
-
Removes all entries from this cell.
-
remove(entry) → {Cell}
-
Removes an entry from this cell.
Parameters:
Name Type Description entry
Any The entry to remove.
-
resolveReferences(entities) → {Cell}
-
Restores UUIDs with references to GameEntity objects.
Parameters:
Name Type Description entities
Map.<String, GameEntity> Maps game entities to UUIDs.
-
toJSON() → {Object}
-
Transforms this instance into a JSON object.
Returns:
Object -The JSON object.