Skip to content
Permalink
Browse files

Fix some stupid shit

  • Loading branch information...
Shinmera committed Aug 1, 2019
1 parent 19890c4 commit e6087041f2fd537d9cd0a74825b5d2e496afbd1e
Showing with 7 additions and 5 deletions.
  1. +2 −0 assets/mesh.lisp
  2. +5 −5 geometry.lisp
@@ -30,8 +30,10 @@
(pathname (gethash (geometry-name mesh) (meshes (read-geometry input T))))
(T input)))
(vao (etypecase input
;; FIXME: pass vertex-attributes
(vertex-mesh (change-class (copy-instance input) 'vertex-array))
(vertex-array input))))
(setf (vertex-form mesh) (vertex-form vao))
(setf (bindings mesh) (mapcar #'enlist (bindings vao)))
(setf (size mesh) (size vao))
(loop for (buffer) in (bindings mesh)
@@ -209,16 +209,16 @@
(replace-vertex-data (make-array 0 :adjustable T :element-type 'single-float)
mesh :attributes attributes))

(defmethod update-instance-for-different-class ((mesh vertex-mesh) (array vertex-array) &key (data-usage :static-draw) (attributes T))
(defmethod update-instance-for-different-class ((mesh vertex-mesh) (array vertex-array) &key (data-usage :static-draw) (vertex-attributes T))
(setf (vertex-form array) (ecase (face-length mesh)
(1 :points)
(2 :lines)
(3 :triangles)))
(if (< 0 (length (vertices mesh)))
(let* ((primer (aref (vertices mesh) 0))
(attributes (etypecase attributes
(attributes (etypecase vertex-attributes
((eql T) (vertex-attributes primer))
(list attributes)))
(list vertex-attributes)))
(sizes (loop for attr in attributes collect (vertex-attribute-size primer attr)))
(buffer (make-vertex-data mesh :attributes attributes)))
(setf (data-pointer array) NIL)
@@ -233,8 +233,8 @@
for offset = 0 then (+ offset size)
for size in sizes
for index from 0
collect (list vbo :stride (* stride (cffi:foreign-type-size :float))
:offset (* offset (cffi:foreign-type-size :float))
collect (list vbo :stride (* stride (gl-type-size :float))
:offset (* offset (gl-type-size :float))
:size size
:index index))))
(setf (bindings array) (list* ebo specs))

0 comments on commit e608704

Please sign in to comment.
You can’t perform that action at this time.