mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 06:38:33 -04:00
46 lines
1.8 KiB
Common Lisp
46 lines
1.8 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
(bundles "ENGINE.CGO" "GAME.CGO")
|
|
(require "engine/draw/drawable-inline-array-h.gc")
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
;; Node in a bounding-volume hierarchy used for view-frustum culling and
|
|
;; broad-phase collision. Child points directly at the first element of a
|
|
;; contiguous drawable span, not at a drawable-inline-array wrapper; child-count
|
|
;; supplies the span length. Depending on flags, the span contains more
|
|
;; draw-nodes or renderer-specific leaves.
|
|
;; Typically child and child-count represent a small section of a much larger
|
|
;; array. Some renderers will have a large array of all nodes of a given depth,
|
|
;; others may have arbitrary tree structures.
|
|
;;
|
|
;; Most terrain and collision trees have one to eight roots, one to eight
|
|
;; children per node, equal-depth leaves, and visibility IDs on nodes and leaves.
|
|
;; Shrub permits arbitrary child counts and leaf depths and does not use
|
|
;; visibility IDs.
|
|
|
|
(defenum draw-node-flags
|
|
:type uint8
|
|
:bitfield #t
|
|
;; child points to another contiguous draw-node span instead of renderer leaves.
|
|
(children-are-draw-nodes 0))
|
|
|
|
(deftype draw-node (drawable)
|
|
((child-count uint8 :offset 6)
|
|
(flags draw-node-flags :offset 7)
|
|
(child drawable :offset 8)
|
|
(distance float :offset 12)))
|
|
|
|
;; Top-level container for one depth of a non-shrub draw-node hierarchy.
|
|
(deftype drawable-inline-array-node (drawable-inline-array)
|
|
((data draw-node 1 :inline)
|
|
(pad uint32)))
|
|
|
|
;; Ping-pong scratchpad input banks for draw-node-cull. The culler copies nodes
|
|
;; in bulk and alternates between the two 32-node banks while walking a level.
|
|
;; Shrub's unrestricted tree layout is handled separately and cannot use this
|
|
;; fixed-bank traversal.
|
|
(deftype draw-node-dma (structure)
|
|
((banka draw-node 32 :inline)
|
|
(bankb draw-node 32 :inline)))
|