Skip to content

Commit

Permalink
Fix reordered-vertex-data to consider correct number of vertices
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinmera committed Oct 26, 2023
1 parent 344e202 commit 2f55b9c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions geometry.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,16 @@
(defmethod reordered-vertex-data ((mesh mesh-data) new-attributes)
(if (equal new-attributes (vertex-attributes mesh))
(vertex-data mesh)
(let* ((vertices (length (index-data mesh)))
(let* ((old-stride (vertex-attribute-stride mesh))
(old-offsets (loop for attribute in new-attributes
collect (vertex-attribute-offset attribute (vertex-attributes mesh))))
(old-data (vertex-data mesh))
(vertices (truncate (length old-data) old-stride))
(new-stride (loop for attribute in new-attributes
sum (vertex-attribute-size attribute)))
(old-stride (vertex-attribute-size mesh))
(new-data (make-array (* new-stride vertices) :element-type 'single-float))
(old-data (vertex-data mesh))
(new-offsets (loop for attribute in new-attributes
collect (vertex-attribute-offset attribute new-attributes)))
(old-offsets (loop for attribute in new-attributes
collect (vertex-attribute-offset attribute (vertex-attributes mesh))))
(new-base 0)
(old-base 0))
(dotimes (vertex vertices new-data)
Expand Down

0 comments on commit 2f55b9c

Please sign in to comment.