Skip to content

Commit

Permalink
#39 Basic resource import. Skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
borodust committed Nov 7, 2016
1 parent 5518855 commit 7874104
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 12 deletions.
4 changes: 4 additions & 0 deletions math/matrix.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
(make-instance 'mat4 :value (m4:rotation-from-euler (v3:make x y z))))


(definline rotation-mat4-from-euler-axis (a vec3)
(make-instance 'mat4 :value (m4:rotation-from-axis-angle (value-of vec3) a)))


(definline rotation-mat4 (vec)
(make-instance 'mat4 :value (m4:rotation-from-euler (value-of vec))))

Expand Down
22 changes: 12 additions & 10 deletions math/vector.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@


(defun vref (vec idx)
(ecase idx
(0 (v:x vec))
(1 (v:y vec))
(2 (v:z vec))
(3 (v:w vec))))
(let ((vec (value-of vec)))
(ecase idx
(0 (v:x vec))
(1 (v:y vec))
(2 (v:z vec))
(3 (v:w vec)))))


(defun (setf vref) (value vec idx)
(ecase idx
(0 (setf (v:x vec) value))
(1 (setf (v:y vec) value))
(2 (setf (v:z vec) value))
(3 (setf (v:w vec) value))))
(let ((vec (value-of vec)))
(ecase idx
(0 (setf (v:x vec) value))
(1 (setf (v:y vec) value))
(2 (setf (v:z vec) value))
(3 (setf (v:w vec) value)))))


(defmethod summarize ((this vec3) (that vec3))
Expand Down
8 changes: 7 additions & 1 deletion packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
identity-mat4
rotation-mat4
rotation-mat4*
rotation-mat4-from-euler-axis
translation-mat4
translation-mat4*
scaling-mat4*
Expand Down Expand Up @@ -352,7 +353,12 @@
mesh-chunk-id
mesh-chunk-face
mesh-chunk-arrays
mesh-chunk-indexes))
mesh-chunk-indexes

skeleton-chunks-of
skeleton-children
skeleton-bone-children
skeleton-bone-transform))


(defpackage :cl-bodge.animation
Expand Down
19 changes: 19 additions & 0 deletions resources/basic-chunks.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,22 @@

(defun text-shader-chunks-of (resource)
(chunks-by-type resource :text-shader))


;;;
;;;
;;;

(define-chunk-structure (skeleton-bone t skeleton-bone)
transform)


(define-chunk-structure (skeleton-chunk t skeleton-bone))


(defmethod parse-chunk ((this (eql :skeleton)) params data)
(make-skeleton-chunk data))


(defun skeleton-chunks-of (resource)
(chunks-by-type resource :skeleton))
2 changes: 1 addition & 1 deletion scene/transformations.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

;;;
;;;
;;;c
;;;
(defclass body-transform-node (node)
((position :initform (make-vec3*))
(rotation :initform (identity-mat4))
Expand Down

0 comments on commit 7874104

Please sign in to comment.