;;-*-Lisp-*-
(in-package goal)

;; definition of type vis-gif-tag
(deftype vis-gif-tag (structure)
  ((fog0  uint32  :offset-assert   0)
   (strip uint32  :offset-assert   4)
   (regs  uint32  :offset-assert   8)
   (fan   uint32  :offset-assert  12)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type vis-gif-tag
(defmethod inspect vis-gif-tag ((obj vis-gif-tag))
  (format #t "[~8x] ~A~%" obj 'vis-gif-tag)
  (format #t "~Tfog0: ~D~%" (-> obj fog0))
  (format #t "~Tstrip: ~D~%" (-> obj strip))
  (format #t "~Tregs: ~D~%" (-> obj regs))
  (format #t "~Tfan: ~D~%" (-> obj fan))
  obj
  )

;; definition of type cull-info
(deftype cull-info (structure)
  ((x-fact      float  :offset-assert   0)
   (y-fact      float  :offset-assert   4)
   (z-fact      float  :offset-assert   8)
   (cam-radius  float  :offset-assert  12)
   (cam-x       float  :offset-assert  16)
   (cam-y       float  :offset-assert  20)
   (xz-dir-ax   float  :offset-assert  24)
   (xz-dir-az   float  :offset-assert  28)
   (xz-dir-bx   float  :offset-assert  32)
   (xz-dir-bz   float  :offset-assert  36)
   (xz-cross-ab float  :offset-assert  40)
   (yz-dir-ay   float  :offset-assert  44)
   (yz-dir-az   float  :offset-assert  48)
   (yz-dir-by   float  :offset-assert  52)
   (yz-dir-bz   float  :offset-assert  56)
   (yz-cross-ab float  :offset-assert  60)
   )
  :pack-me
  :method-count-assert 9
  :size-assert         #x40
  :flag-assert         #x900000040
  )

;; definition for method 3 of type cull-info
(defmethod inspect cull-info ((obj cull-info))
  (format #t "[~8x] ~A~%" obj 'cull-info)
  (format #t "~Tx-fact: ~f~%" (-> obj x-fact))
  (format #t "~Ty-fact: ~f~%" (-> obj y-fact))
  (format #t "~Tz-fact: ~f~%" (-> obj z-fact))
  (format #t "~Tcam-radius: ~f~%" (-> obj cam-radius))
  (format #t "~Tcam-x: ~f~%" (-> obj cam-x))
  (format #t "~Tcam-y: ~f~%" (-> obj cam-y))
  (format #t "~Txz-dir-ax: ~f~%" (-> obj xz-dir-ax))
  (format #t "~Txz-dir-az: ~f~%" (-> obj xz-dir-az))
  (format #t "~Txz-dir-bx: ~f~%" (-> obj xz-dir-bx))
  (format #t "~Txz-dir-bz: ~f~%" (-> obj xz-dir-bz))
  (format #t "~Txz-cross-ab: ~f~%" (-> obj xz-cross-ab))
  (format #t "~Tyz-dir-ay: ~f~%" (-> obj yz-dir-ay))
  (format #t "~Tyz-dir-az: ~f~%" (-> obj yz-dir-az))
  (format #t "~Tyz-dir-by: ~f~%" (-> obj yz-dir-by))
  (format #t "~Tyz-dir-bz: ~f~%" (-> obj yz-dir-bz))
  (format #t "~Tyz-cross-ab: ~f~%" (-> obj yz-cross-ab))
  obj
  )

;; definition of type math-camera
(deftype math-camera (basic)
  ((d                          meters                :offset-assert   4)
   (f                          meters                :offset-assert   8)
   (fov                        degrees               :offset-assert  12)
   (x-ratio                    float                 :offset-assert  16)
   (y-ratio                    float                 :offset-assert  20)
   (x-pix                      float                 :offset-assert  24)
   (x-clip                     float                 :offset-assert  28)
   (x-clip-ratio-in            float                 :offset-assert  32)
   (x-clip-ratio-over          float                 :offset-assert  36)
   (y-pix                      float                 :offset-assert  40)
   (y-clip                     float                 :offset-assert  44)
   (y-clip-ratio-in            float                 :offset-assert  48)
   (y-clip-ratio-over          float                 :offset-assert  52)
   (cull-info                  cull-info   :inline   :offset-assert  56)
   (fog-start                  meters                :offset-assert 120)
   (fog-end                    meters                :offset-assert 124)
   (fog-max                    float                 :offset-assert 128)
   (fog-min                    float                 :offset-assert 132)
   (reset                      int32                 :offset-assert 136)
   (smooth-step                float                 :offset-assert 140)
   (smooth-t                   float                 :offset-assert 144)
   (perspective                matrix      :inline   :offset-assert 160)
   (isometric                  matrix      :inline   :offset-assert 224)
   (sprite-2d                  matrix      :inline   :offset-assert 288)
   (sprite-2d-hvdf             vector      :inline   :offset-assert 352)
   (camera-rot                 matrix      :inline   :offset-assert 368)
   (inv-camera-rot             matrix      :inline   :offset-assert 432)
   (inv-camera-rot-smooth      matrix      :inline   :offset-assert 496)
   (inv-camera-rot-smooth-from quaternion  :inline   :offset-assert 560)
   (camera-temp                matrix      :inline   :offset-assert 576)
   (prev-camera-temp           matrix      :inline   :offset-assert 640)
   (hmge-scale                 vector      :inline   :offset-assert 704)
   (inv-hmge-scale             vector      :inline   :offset-assert 720)
   (hvdf-off                   vector      :inline   :offset-assert 736)
   (guard                      vector      :inline   :offset-assert 752)
   (vis-gifs                   vis-gif-tag 4 :inline :offset-assert 768)
   (vis-gifs-quads             uint128     4         :offset        768)
   (giftex                     vis-gif-tag           :offset        768)
   (gifgr                      vis-gif-tag           :offset        784)
   (giftex-trans               vis-gif-tag           :offset        800)
   (gifgr-trans                vis-gif-tag           :offset        816)
   (pfog0                      float                 :offset-assert 832)
   (pfog1                      float                 :offset-assert 836)
   (trans                      vector      :inline   :offset-assert 848)
   (plane                      plane       4 :inline :offset-assert 864)
   (guard-plane                plane       4 :inline :offset-assert 928)
   (shrub-mat                  matrix      :inline   :offset-assert 992)
   (fov-correction-factor      float                 :offset-assert 1056)
   )
  :method-count-assert 9
  :size-assert         #x424
  :flag-assert         #x900000424
  (:methods
    (new (symbol type) _type_ 0)
    )
  )

;; definition for method 3 of type math-camera
;; Used lq/sq
(defmethod inspect math-camera ((obj math-camera))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Td: (meters ~m)~%" (-> obj d))
  (format #t "~Tf: (meters ~m)~%" (-> obj f))
  (format #t "~Tfov: (deg ~r)~%" (-> obj fov))
  (format #t "~Tx-ratio: ~f~%" (-> obj x-ratio))
  (format #t "~Ty-ratio: ~f~%" (-> obj y-ratio))
  (format #t "~Tx-pix: ~f~%" (-> obj x-pix))
  (format #t "~Tx-clip: ~f~%" (-> obj x-clip))
  (format #t "~Tx-clip-ratio-in: ~f~%" (-> obj x-clip-ratio-in))
  (format #t "~Tx-clip-ratio-over: ~f~%" (-> obj x-clip-ratio-over))
  (format #t "~Ty-pix: ~f~%" (-> obj y-pix))
  (format #t "~Ty-clip: ~f~%" (-> obj y-clip))
  (format #t "~Ty-clip-ratio-in: ~f~%" (-> obj y-clip-ratio-in))
  (format #t "~Ty-clip-ratio-over: ~f~%" (-> obj y-clip-ratio-over))
  (format #t "~Tcull-info: #<cull-info @ #x~X>~%" (-> obj cull-info))
  (format #t "~Tfog-start: (meters ~m)~%" (-> obj fog-start))
  (format #t "~Tfog-end: (meters ~m)~%" (-> obj fog-end))
  (format #t "~Tfog-max: ~f~%" (-> obj fog-max))
  (format #t "~Tfog-min: ~f~%" (-> obj fog-min))
  (format #t "~Treset: ~D~%" (-> obj reset))
  (format #t "~Tsmooth-step: ~f~%" (-> obj smooth-step))
  (format #t "~Tsmooth-t: ~f~%" (-> obj smooth-t))
  (format #t "~Tperspective: #<matrix @ #x~X>~%" (-> obj perspective))
  (format #t "~Tisometric: #<matrix @ #x~X>~%" (-> obj isometric))
  (format #t "~Tsprite-2d: #<matrix @ #x~X>~%" (-> obj sprite-2d))
  (format #t "~Tsprite-2d-hvdf: #<vector @ #x~X>~%" (-> obj sprite-2d-hvdf))
  (format #t "~Tcamera-rot: #<matrix @ #x~X>~%" (-> obj camera-rot))
  (format #t "~Tinv-camera-rot: #<matrix @ #x~X>~%" (-> obj inv-camera-rot))
  (format #t "~Tinv-camera-rot-smooth: #<matrix @ #x~X>~%" (-> obj inv-camera-rot-smooth))
  (format #t "~Tinv-camera-rot-smooth-from: #<quaternion @ #x~X>~%" (-> obj inv-camera-rot-smooth-from))
  (format #t "~Tcamera-temp: #<matrix @ #x~X>~%" (-> obj camera-temp))
  (format #t "~Tprev-camera-temp: #<matrix @ #x~X>~%" (-> obj prev-camera-temp))
  (format #t "~Thmge-scale: #<vector @ #x~X>~%" (-> obj hmge-scale))
  (format #t "~Tinv-hmge-scale: #<vector @ #x~X>~%" (-> obj inv-hmge-scale))
  (format #t "~Thvdf-off: #<vector @ #x~X>~%" (-> obj hvdf-off))
  (format #t "~Tguard: #<vector @ #x~X>~%" (-> obj guard))
  (format #t "~Tvis-gifs[4] @ #x~X~%" (-> obj vis-gifs))
  (format #t "~Tgiftex: ~D~%" (-> obj vis-gifs-quads 0))
  (format #t "~Tgifgr: ~D~%" (-> obj vis-gifs-quads 1))
  (format #t "~Tgiftex-trans: ~D~%" (-> obj vis-gifs-quads 2))
  (format #t "~Tgifgr-trans: ~D~%" (-> obj vis-gifs-quads 3))
  (format #t "~Tpfog0: ~f~%" (-> obj pfog0))
  (format #t "~Tpfog1: ~f~%" (-> obj pfog1))
  (format #t "~Ttrans: ~`vector`P~%" (-> obj trans))
  (format #t "~Tplane[4] @ #x~X~%" (-> obj plane))
  (format #t "~Tguard-plane[4] @ #x~X~%" (-> obj guard-plane))
  (format #t "~Tshrub-mat: #<matrix @ #x~X>~%" (-> obj shrub-mat))
  (format #t "~Tfov-correction-factor: ~f~%" (-> obj fov-correction-factor))
  obj
  )

;; failed to figure out what this is:
0
