mirror of
https://github.com/open-goal/jak-project
synced 2026-07-09 23:01:56 -04:00
a3e004f475
Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
260 lines
8.5 KiB
Common Lisp
Vendored
Generated
260 lines
8.5 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type prim-vertex
|
|
(deftype prim-vertex (structure)
|
|
"Vertex for the prim renderer. These vertices are generated by
|
|
some special effect code, then sent to the prim renderer to be drawn."
|
|
((stq vector :inline)
|
|
(nokick uint32 :overlay-at (-> stq data 2))
|
|
(col rgba :overlay-at (-> stq data 3))
|
|
(pos vector :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type prim-vertex
|
|
(defmethod inspect ((this prim-vertex))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'prim-vertex)
|
|
(format #t "~1Tstq: #<vector @ #x~X>~%" (-> this stq))
|
|
(format #t "~1Tnokick: ~D~%" (-> this stq z))
|
|
(format #t "~1Tcol: ~D~%" (-> this col))
|
|
(format #t "~1Tpos: #<vector @ #x~X>~%" (-> this pos))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type prim-base
|
|
(deftype prim-base (basic)
|
|
"Base class for prim-strip."
|
|
()
|
|
(:methods
|
|
(generate-dma! (_type_ matrix) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type prim-base
|
|
(defmethod inspect ((this prim-base))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type prim-client
|
|
(deftype prim-client (basic)
|
|
()
|
|
(:methods
|
|
(prim-client-method-9 (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type prim-client
|
|
(defmethod inspect ((this prim-client))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for method 9 of type prim-client
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod prim-client-method-9 ((this prim-client))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition of type prim-strip
|
|
(deftype prim-strip (prim-base)
|
|
"A collection of vertices, all with the same texture and draw settings.
|
|
These are owned by the thing submitting to prim, not the prim renderer itself."
|
|
((flags prim-flags)
|
|
(tex-name basic)
|
|
(tex basic)
|
|
(tex-id texture-id)
|
|
(adnops gs-adcmd 2 :inline)
|
|
(data0 gs-test :overlay-at (-> adnops 0 word 0))
|
|
(reg0 gs-reg64 :overlay-at (-> adnops 0 word 2))
|
|
(data1 gs-test :offset 48)
|
|
(reg1 gs-reg64 :offset 56)
|
|
(clamp gs-clamp)
|
|
(alpha gs-alpha)
|
|
(level level)
|
|
(texture-index int8)
|
|
(num-verts uint16)
|
|
(allocated-num-verts uint16)
|
|
(last-tex-id uint32)
|
|
(data prim-vertex :dynamic)
|
|
)
|
|
(:methods
|
|
(new (symbol type int texture-id string) _type_)
|
|
(setup-dma-and-tex (_type_ draw-control) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type prim-strip
|
|
(defmethod inspect ((this prim-strip))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~1Tflags: ~D~%" (-> this flags))
|
|
(format #t "~1Ttex-name: ~A~%" (-> this tex-name))
|
|
(format #t "~1Ttex: ~A~%" (-> this tex))
|
|
(format #t "~1Ttex-id: ~D~%" (-> this tex-id))
|
|
(format #t "~1Tadnops[2] @ #x~X~%" (-> this adnops))
|
|
(format #t "~1Tdata0: ~D~%" (-> this data0))
|
|
(format #t "~1Treg0: ~D~%" (-> this adnops 0 cmds))
|
|
(format #t "~1Tdata1: ~D~%" (-> this data1))
|
|
(format #t "~1Treg1: ~D~%" (-> this adnops 1 cmds))
|
|
(format #t "~1Tclamp: ~D~%" (-> this clamp))
|
|
(format #t "~1Talpha: ~D~%" (-> this alpha))
|
|
(format #t "~1Tlevel: ~A~%" (-> this level))
|
|
(format #t "~1Ttexture-index: ~D~%" (-> this texture-index))
|
|
(format #t "~1Tnum-verts: ~D~%" (-> this num-verts))
|
|
(format #t "~1Tallocated-num-verts: ~D~%" (-> this allocated-num-verts))
|
|
(format #t "~1Tlast-tex-id: ~D~%" (-> this last-tex-id))
|
|
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for method 0 of type prim-strip
|
|
(defmethod new prim-strip ((allocation symbol) (type-to-make type) (arg0 int) (arg1 texture-id) (arg2 string))
|
|
"Allocate a new prim-strip and room for vertices. The texture can be specified by name or ID."
|
|
(with-pp
|
|
(let ((s5-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* arg0 32))))))
|
|
(if (zero? s5-0)
|
|
(go process-drawable-art-error "prim-strip")
|
|
)
|
|
(add-connection *prim-engine* pp #f pp s5-0 #f)
|
|
(set! (-> s5-0 flags) (prim-flags alpha-blend-enable texture-enable))
|
|
(set! (-> s5-0 num-verts) (the-as uint arg0))
|
|
(set! (-> s5-0 allocated-num-verts) (the-as uint arg0))
|
|
(set! (-> s5-0 data0) (new 'static 'gs-test))
|
|
(set! (-> s5-0 adnops 0 cmds) (gs-reg64 hack))
|
|
(set! (-> s5-0 data1) (new 'static 'gs-test))
|
|
(set! (-> s5-0 adnops 1 cmds) (gs-reg64 hack))
|
|
(set! (-> s5-0 clamp) (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)))
|
|
(set! (-> s5-0 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
|
|
(cond
|
|
(arg2
|
|
(set! (-> s5-0 tex-id) (lookup-texture-id-by-name arg2 (the-as string #f)))
|
|
(set! (-> s5-0 tex-name) arg2)
|
|
(logclear! (-> s5-0 flags) (prim-flags no-texture-name))
|
|
)
|
|
(else
|
|
(set! (-> s5-0 tex-id) arg1)
|
|
(set! (-> s5-0 tex-name) #f)
|
|
(logior! (-> s5-0 flags) (prim-flags no-texture-name))
|
|
)
|
|
)
|
|
(set! (-> s5-0 tex) #f)
|
|
(set! (-> s5-0 level) (-> *level* level-default))
|
|
(set! (-> s5-0 texture-index) 4)
|
|
(let ((f0-1 (/ 1.0 (the float (/ (+ arg0 -1) 2)))))
|
|
(dotimes (v1-22 arg0)
|
|
(let ((a0-6 (&+ (-> s5-0 data) (* v1-22 32))))
|
|
(set! (-> a0-6 0) (the-as prim-vertex (* (the float (/ v1-22 2)) f0-1)))
|
|
(set! (-> a0-6 1) (the-as prim-vertex (the float (logand v1-22 1))))
|
|
(set! (-> a0-6 2) (the-as prim-vertex 0.0))
|
|
(set! (-> a0-6 3) (the-as prim-vertex 0.0))
|
|
)
|
|
(set! (-> (the-as (inline-array prim-vertex) (+ (the-as uint s5-0) (* v1-22 32))) 3 stq z)
|
|
(the-as float (the-as uint #x80808080))
|
|
)
|
|
(set-vector!
|
|
(the-as vector (+ (the-as uint (the-as vector (&-> s5-0 data 4))) (* v1-22 32)))
|
|
(* 4096.0 (the float (/ v1-22 2)))
|
|
(* 4096.0 (the float (logand v1-22 1)))
|
|
0.0
|
|
1.0
|
|
)
|
|
)
|
|
)
|
|
s5-0
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 5 of type prim-strip
|
|
;; WARN: Return type mismatch uint vs int.
|
|
(defmethod asize-of ((this prim-strip))
|
|
(the-as int (+ (-> this type size) (* (-> this allocated-num-verts) 32)))
|
|
)
|
|
|
|
;; definition of type prim-sink
|
|
(deftype prim-sink (structure)
|
|
((vertex-count uint8)
|
|
(control-count uint8)
|
|
)
|
|
:allow-misaligned
|
|
)
|
|
|
|
;; definition for method 3 of type prim-sink
|
|
(defmethod inspect ((this prim-sink))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'prim-sink)
|
|
(format #t "~1Tvertex-count: ~D~%" (-> this vertex-count))
|
|
(format #t "~1Tcontrol-count: ~D~%" (-> this control-count))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type prim-work
|
|
(deftype prim-work (structure)
|
|
((vertex-tmpl dma-packet 3 :inline)
|
|
(control-tmpl dma-packet 2 :inline)
|
|
(giftag generic-gif-tag :inline)
|
|
(call-scissor dma-packet :inline)
|
|
(call-noclip dma-packet :inline)
|
|
(shader adgif-shader :inline)
|
|
(mask vector4w :inline)
|
|
(in-verts int32)
|
|
(num-verts int32)
|
|
(vert-ptr (inline-array prim-vertex))
|
|
(sinks prim-sink 114 :inline)
|
|
)
|
|
(:methods
|
|
(prim-work-method-9 () none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type prim-work
|
|
(defmethod inspect ((this prim-work))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'prim-work)
|
|
(format #t "~1Tvertex-tmpl[3] @ #x~X~%" (-> this vertex-tmpl))
|
|
(format #t "~1Tcontrol-tmpl[2] @ #x~X~%" (-> this control-tmpl))
|
|
(format #t "~1Tgiftag: #<generic-gif-tag @ #x~X>~%" (-> this giftag))
|
|
(format #t "~1Tcall-scissor: #<dma-packet @ #x~X>~%" (-> this call-scissor))
|
|
(format #t "~1Tcall-noclip: #<dma-packet @ #x~X>~%" (-> this call-noclip))
|
|
(format #t "~1Tshader: #<adgif-shader @ #x~X>~%" (-> this shader))
|
|
(format #t "~1Tmask: #<vector4w @ #x~X>~%" (-> this mask))
|
|
(format #t "~1Tin-verts: ~D~%" (-> this in-verts))
|
|
(format #t "~1Tnum-verts: ~D~%" (-> this num-verts))
|
|
(format #t "~1Tvert-ptr: #<prim-vertex @ #x~X>~%" (-> this vert-ptr))
|
|
(format #t "~1Tsinks[114] @ #x~X~%" (-> this sinks))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|