Skip to main content

actor-hash-h​

source

Variables​


*actor-list-length*​

*actor-list-length*: intsource

*actor-list*​

*actor-list*: pointersource

actor-hash​

source

Types​


actor-cshape-ptr​

actor-cshape-ptr: structuresource
Fields​
cshape: collide-shape

actor-hash-bucket​

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​

actor-hash-buckets: structuresource

Functions​


update-actor-hash​

update-actor-hash() => nonesource

Variables​


*actor-hash-buckets*​

*actor-hash-buckets*: actor-hash-bucketssource

*actor-hash*​

*actor-hash*: spatial-hashsource

collide-hash-h​

source

Types​


collide-hash​

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-bucket​

collide-hash-bucket: structuresource
Fields​
index: int16
count: int16

collide-hash-fragment​

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​

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​

collide-hash-fragment-stats: structuresource
Fields​
num-verts: uint16
num-polys: uint8
poly-count: uint8

collide-hash-item​

collide-hash-item: structuresource
Fields​
id: uint32
collidable: basic

collide-hash-poly​

collide-hash-poly: structuresource
Fields​
data: uint8
vert-index0: uint8
vert-index1: uint8
vert-index2: uint8
pat-index: uint8
word: uint32

collide-hash-scratch​

collide-hash-scratch: structuresource
Fields​
collidable-bits: uint128
poly-bits: uint64
id-bits: uint32
tris: uint32

Variables​


*already-printed-exeeded-max-cache-tris*​

*already-printed-exeeded-max-cache-tris*: symbolsource

*collide-hash-fragments-instance*​

*collide-hash-fragments-instance*: objectsource

*collide-hash-fragments-tfrag*​

*collide-hash-fragments-tfrag*: objectsource

*collide-hash-fragments*​

*collide-hash-fragments*: objectsource

*collide-list-boxes*​

*collide-list-boxes*: objectsource

collide-hash​

source
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​

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​

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​

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

spatial-hash-h​

source

Types​


find-nav-sphere-ids-params​

find-nav-sphere-ids-params: structuresource
Fields​
bsphere: sphere
y-threshold: float
len: int16
max-len: int16
mask: uint8
array: pointer

grid-hash​

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
setup-search-box(obj: grid-hash, arg0: int, arg1: vector, arg2: vector, arg3: vector) => nonesource
search-for-point(obj: grid-hash, arg0: vector) => pointersource
search-for-sphere(obj: grid-hash, arg0: vector, arg1: float) => pointersource
draw(obj: grid-hash, arg0: rgba) => nonesource

Draws the grid-hash

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

verify-bits-in-bucket(obj: grid-hash, arg0: grid-hash-box, arg1: grid-hash-box) => nonesource
box-of-everything(obj: grid-hash, arg0: object, arg1: grid-hash-box) => nonesource
grid-hash-method-18: unknown
grid-hash-method-19: unknown
do-search!: unknown
set-up-box(obj: grid-hash, arg0: grid-hash-box, arg1: vector, arg2: vector) => nonesource
sphere-to-grid-box: unknown
line-sphere-to-grid-box(obj: grid-hash, arg0: grid-hash-box, arg1: vector, arg2: vector, arg3: float) => nonesource
update-grid(obj: grid-hash) => nonesource

grid-hash-box​

grid-hash-box: structuresource
Fields​
min: int8
max: int8

grid-hash-word​

grid-hash-word: uint8source

hash-object-info​

hash-object-info: structuresource
Fields​
object: basic

spatial-hash​

spatial-hash: sphere-hashsource
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
sphere-array: inline-array
max-object-count: int16
pad: int16
mem-sphere-array: uint32
spr-sphere-array: uint32
object-array: inline-array
mem-object-array: inline-array
spr-object-array: inline-array
Methods​
add-an-object(obj: spatial-hash, arg0: vector, arg1: hash-object-info) => intsource
fill-actor-list-for-box: unknown
fill-actor-list-for-sphere: unknown
fill-actor-list-for-line-sphere: unknown
fill-actor-list-for-vec+r(obj: spatial-hash, arg0: vector, arg1: pointer, arg2: int) => intsource
spatial-hash-method-39: unknown
validate-objects(obj: spatial-hash) => nonesource

sphere-hash​

sphere-hash: grid-hashsource
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
sphere-array: inline-array
max-object-count: int16
pad: int16
mem-sphere-array: uint32
spr-sphere-array: uint32
Methods​
clear-objects!(obj: sphere-hash) => nonesource
add-a-sphere(obj: sphere-hash, arg0: vector) => intsource
add-a-sphere-with-flag(obj: sphere-hash, arg0: vector, arg1: int) => intsource
update-from-spheres: unknown
sphere-hash-method-29: unknown
find-nav-sphere-ids: unknown
add-sphere-with-mask-and-id: unknown
sphere-hash-method-32: unknown
remove-by-id: unknown

spatial-hash​

source

Types​


grid-hash-work​

grid-hash-work: basicsource
Fields​
type: type
result-words: uint8
result-bits: uint8
object-id: int32
temp-box-min: vector
temp-box-max: vector
visit-count: int32
temp-time: uint32
queue-object-time: uint32
make-hash-time: uint32
search-time: uint32
add-object-time: uint32

Functions​


draw-grid​

draw-grid(arg0: vector, arg1: vector, arg2: pointer, arg3: rgba) => nonesource

draw-line-sphere​

draw-line-sphere(arg0: vector, arg1: vector, arg2: float, arg3: rgba) => nonesource

draw-sphere-box​

draw-sphere-box(arg0: sphere, arg1: rgba) => nonesource

validate-bucket-bits​

validate-bucket-bits(arg0: grid-hash, arg1: pointer) => symbolsource

Variables​


*grid-hash-work*​

*grid-hash-work*: grid-hash-worksource