Variables
*actor-list*: pointersource
Types
actor-cshape-ptr: structuresource
Fields
cshape: collide-shape
actor-hash-bucket: structuresource
Fields
length: int16
max-length: int16
data: inline-array
Methods
add-actor-cshape(obj: actor-hash-bucket, arg0: collide-shape) => nonesource
actor-hash-buckets: structuresource
Fields
hash: spatial-hash
list: engine
data: actor-hash-bucket
tpos: vector
Methods
hash-actors(obj: actor-hash-buckets) => nonesource
Functions
update-actor-hash() => nonesource
Variables
Types
collide-hash: drawablesource
Fields
type: type
id: int16
bsphere: vector
num-ids: uint16
id-count: uint16
num-buckets: uint32
qwc-id-bits: uint32
grid-step: vector
bbox: bounding-box
bbox4w: bounding-box4w
axis-scale: vector
avg-extents: vector
bucket-array: uint32
item-array: inline-array
dimension-array: uint32
num-items: uint32
collide-hash-fragment: drawablesource
Fields
type: type
id: int16
bsphere: vector
num-buckets: uint16
num-indices: uint16
pat-array: uint32
bucket-array: uint32
grid-step: vector
bbox: bounding-box
bbox4w: bounding-box4w
axis-scale: vector
avg-extents: vector
dimension-array: uint32
stats: collide-hash-fragment-stats
num-verts: uint16
num-polys: uint8
poly-count: uint8
poly-array: uint32
vert-array: uint32
index-array: uint32
collide-hash-fragment-array: arraysource
Fields
type: type
length: int32
allocated-length: int32
content-type: type
data: uint8
fragments: collide-hash-fragment
collide-hash-fragment-stats: structuresource
collide-hash-poly: structuresource
Fields
data: uint8
vert-index0: uint8
vert-index1: uint8
vert-index2: uint8
pat-index: uint8
word: uint32
collide-hash-scratch: structuresource
Variables
*collide-hash-fragments*: objectsource
*collide-list-boxes*: objectsource
Expand description
collide-hash is the broad phase collision detector for background collisions.
It esssentially answers the question "what collide fragments are near X"?
and this answer is passed down to lower level collision checks.
unlike jak 1, this uses a "spatial hash". The idea is to divide space into a grid, then map
cells in this grid to a smaller number of buckets using a hash function.
hash collisions are probably not too common, as most space is empty, and can be reject relatively quickly
by doing a bounding sphere check with the collision fragments.
in this file, boxes are commonly represented as a vector, with xyz being the origin, and w being half
the side length.
Functions
add-collide-debug-box(arg0: vector, arg1: rgba) => nonesource
Debug draw a box represented as (origin, half-side-length).
collide-list-fill-bg-using-box(arg0: collide-cache, arg1: collide-list, arg2: collide-query) => nonesource
Given a list of collision meshes, fill the given collide collide with triangles which are
inside the box.
collide-list-fill-bg-using-line-sphere(arg0: collide-cache, arg1: collide-list, arg2: collide-query) => nonesource
line-sphere version of collide-list-fill-bg-using-box.
Logic is basically the same, but transforming the line-sphere query is a bit trickier.
print-collide-cache-tri-count() => nonesource
print-exceeded-max-cache-tris() => nonesource
Types
find-nav-sphere-ids-params: structuresource
grid-hash: basicsource
Fields
type: type
work: grid-hash-work
search-box: grid-hash-box
bucket-size: int16
axis-scale: float
dimension-array: int8
vertical-cell-count: int8
bucket-array: pointer
box-min: float
box-max: float
object-count: int16
bucket-count: int16
min-cell-size: float
bucket-memory-size: int32
mem-bucket-array: pointer
spr-bucket-array: pointer
debug-draw: symbol
use-scratch-ram: symbol
Methods
update-grid-for-objects-in-box(obj: grid-hash, arg0: int, arg1: vector, arg2: vector) => nonesource
clear-bucket-array(obj: grid-hash) => nonesource
search-for-point(obj: grid-hash, arg0: vector) => pointersource
search-for-sphere(obj: grid-hash, arg0: vector, arg1: float) => pointersource
dump-grid-info(obj: grid-hash) => nonesource
Prints out info about the grid-hash, also draws via grid-hash::draw-grid if debug-draw
is #t