mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
80 lines
3.3 KiB
Common Lisp
80 lines
3.3 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: drawable-h.gc
|
|
;; name in dgo: drawable-h
|
|
;; dgos: GAME, ENGINE
|
|
|
|
(declare-type ambient-list structure)
|
|
(declare-type collide-list structure)
|
|
|
|
;; These is the base class for the scene graph node.
|
|
;; Note that it doesn't always make sense to call all of these methods on all types,
|
|
;; and that certain methods should only be called at certain times, and may require coordination
|
|
;; with having certain VU0 or scratchpad data present.
|
|
;; In many cases, "draw" simply adds data to a buffer that must later be converted to dma in finish-background
|
|
;; or similar. Or just does nothing.
|
|
|
|
(declare-type drawable-error drawable)
|
|
(deftype drawable (basic)
|
|
((id int16 :offset-assert 4) ;; ID number for visibility (not always used)
|
|
(bsphere vector :inline :offset-assert 16) ;; bounding sphere
|
|
)
|
|
:method-count-assert 18
|
|
:size-assert #x20
|
|
:flag-assert #x1200000020
|
|
(:methods
|
|
;; initialize the drawable after it has been loaded.
|
|
(login (_type_) _type_ 9)
|
|
;; do some sort of drawing... this really does different things for different types.
|
|
(draw (_type_ _type_ display-frame) none 10)
|
|
|
|
;; add collision meshes to the given collide list if they intersect the bounding box in *collide-work*
|
|
;; the integer argument can be used to call this method on an inline-array of drawables (only some support this)
|
|
;; this avoids the dynamic dispatch on each element of the array.
|
|
(collide-with-box (_type_ int collide-list) none 11)
|
|
|
|
;; similar to above, but only add if the collision mesh intersects with a "y probe"
|
|
(collide-y-probe (_type_ int collide-list) none 12)
|
|
|
|
;; similar to above, but only add if the collision mesh intersects a ray of spheres.
|
|
(collide-ray (_type_ int collide-list) none 13)
|
|
|
|
;; different for different types, but generally collects debug statistics like numbers of triangles
|
|
(collect-stats (_type_) none 14)
|
|
|
|
;; different for different types, but usually does nothing.
|
|
(debug-draw (_type_ drawable display-frame) none 15)
|
|
|
|
;; given VIS data (uncompressed), compute the visiblity bit string.
|
|
(unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 16)
|
|
|
|
;; find "ambients" inside the given sphere and add to list.
|
|
(collect-ambients (_type_ sphere int ambient-list) none 17)
|
|
)
|
|
)
|
|
|
|
|
|
|
|
;; A drawable that simply draws a sphere and an error message at the origin of the bounding sphere.
|
|
(deftype drawable-error (drawable)
|
|
((name string :offset-assert 32)
|
|
)
|
|
:method-count-assert 18
|
|
:size-assert #x24
|
|
:flag-assert #x1200000024
|
|
)
|
|
|
|
(declare-type process-drawable process)
|
|
(define-extern process-drawable-art-error (state string process-drawable))
|
|
(define-extern foreground-engine-execute (function engine display-frame int int none))
|
|
(define-extern sphere-in-view-frustum? (function sphere symbol))
|
|
|
|
(declare-type draw-control basic)
|
|
(define-extern add-process-drawable (function process-drawable draw-control symbol dma-buffer none))
|
|
(define-extern dma-add-process-drawable-hud (function process-drawable draw-control symbol dma-buffer none))
|
|
(define-extern dma-add-process-drawable (function process-drawable draw-control symbol dma-buffer none))
|
|
(define-extern vis-cull (function int symbol))
|
|
|
|
(define-extern line-in-view-frustum? (function vector vector symbol)) ;; TODO - not confirmed
|