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

;; definition of type rigid-body
(deftype rigid-body (structure)
  ((mass                        float              :offset-assert   0)
   (inv-mass                    float              :offset-assert   4)
   (lin-momentum-damping-factor float              :offset-assert   8)
   (ang-momentum-damping-factor float              :offset-assert  12)
   (inertial-tensor             matrix     :inline :offset-assert  16)
   (inv-inertial-tensor         matrix     :inline :offset-assert  80)
   (cm-offset-joint             vector     :inline :offset-assert 144)
   (position                    vector     :inline :offset-assert 160)
   (rotation                    quaternion :inline :offset-assert 176)
   (lin-momentum                vector     :inline :offset-assert 192)
   (ang-momentum                vector     :inline :offset-assert 208)
   (lin-velocity                vector     :inline :offset-assert 224)
   (ang-velocity                vector     :inline :offset-assert 240)
   (inv-i-world                 matrix     :inline :offset-assert 256)
   (matrix                      matrix     :inline :offset-assert 320)
   (force                       vector     :inline :offset-assert 384)
   (torque                      vector     :inline :offset-assert 400)
   (max-ang-momentum            float              :offset-assert 416)
   (max-ang-velocity            float              :offset-assert 420)
   )
  :method-count-assert 23
  :size-assert         #x1a8
  :flag-assert         #x17000001a8
  (:methods
    (TODO-RENAME-9 (_type_ float float float float) none 9)
    (dummy-10 (_type_ float) none 10)
    (clear-force-torque! (_type_) none 11)
    (clear-momentum! (_type_) none 12)
    (TODO-RENAME-13 (_type_ vector vector) none 13)
    (TODO-RENAME-14 (_type_ vector vector) none 14)
    (TODO-RENAME-15 (_type_ vector) none 15)
    (TODO-RENAME-16 (_type_ vector vector float) none 16)
    (TODO-RENAME-17 (_type_ vector vector) vector 17)
    (TODO-RENAME-18 (_type_ vector) vector 18)
    (dummy-19 (_type_) none 19)
    (dummy-20 (_type_) none 20)
    (TODO-RENAME-21 (_type_) none 21)
    (TODO-RENAME-22 (_type_ vector quaternion float float) none 22)
    )
  )

;; definition for method 3 of type rigid-body
(defmethod inspect rigid-body ((obj rigid-body))
  (format #t "[~8x] ~A~%" obj 'rigid-body)
  (format #t "~Tmass: ~f~%" (-> obj mass))
  (format #t "~Tinv-mass: ~f~%" (-> obj inv-mass))
  (format #t "~Tlin-momentum-damping-factor: ~f~%" (-> obj lin-momentum-damping-factor))
  (format #t "~Tang-momentum-damping-factor: ~f~%" (-> obj ang-momentum-damping-factor))
  (format #t "~Tinertial-tensor: #<matrix @ #x~X>~%" (-> obj inertial-tensor))
  (format #t "~Tinv-inertial-tensor: #<matrix @ #x~X>~%" (-> obj inv-inertial-tensor))
  (format #t "~Tcm-offset-joint: #<vector @ #x~X>~%" (-> obj cm-offset-joint))
  (format #t "~Tposition: #<vector @ #x~X>~%" (-> obj position))
  (format #t "~Trotation: #<quaternion @ #x~X>~%" (-> obj rotation))
  (format #t "~Tlin-momentum: #<vector @ #x~X>~%" (-> obj lin-momentum))
  (format #t "~Tang-momentum: #<vector @ #x~X>~%" (-> obj ang-momentum))
  (format #t "~Tlin-velocity: #<vector @ #x~X>~%" (-> obj lin-velocity))
  (format #t "~Tang-velocity: #<vector @ #x~X>~%" (-> obj ang-velocity))
  (format #t "~Tinv-i-world: #<matrix @ #x~X>~%" (-> obj inv-i-world))
  (format #t "~Tmatrix: #<matrix @ #x~X>~%" (-> obj matrix))
  (format #t "~Tforce: #<vector @ #x~X>~%" (-> obj force))
  (format #t "~Ttorque: #<vector @ #x~X>~%" (-> obj torque))
  (format #t "~Tmax-ang-momentum: ~f~%" (-> obj max-ang-momentum))
  (format #t "~Tmax-ang-velocity: ~f~%" (-> obj max-ang-velocity))
  obj
  )

;; definition of type rigid-body-control-point
(deftype rigid-body-control-point (structure)
  ((local-pos vector :inline :offset-assert   0)
   (world-pos vector :inline :offset-assert  16)
   (velocity  vector :inline :offset-assert  32)
   )
  :method-count-assert 9
  :size-assert         #x30
  :flag-assert         #x900000030
  )

;; definition for method 3 of type rigid-body-control-point
(defmethod inspect rigid-body-control-point ((obj rigid-body-control-point))
  (format #t "[~8x] ~A~%" obj 'rigid-body-control-point)
  (format #t "~Tlocal-pos: #<vector @ #x~X>~%" (-> obj local-pos))
  (format #t "~Tworld-pos: #<vector @ #x~X>~%" (-> obj world-pos))
  (format #t "~Tvelocity: #<vector @ #x~X>~%" (-> obj velocity))
  obj
  )

;; failed to figure out what this is:
0
