Hello,

I have written an MD2 3d mesh loader, everything works fine except for
the animations.

Because  the model  save only  the key  frame for  each  animation the
loader  must interpolate  the vertex  position of  the mesh  to  get a
smooth animation.

My solution was to save the  triangles vertices in a gl-array for each
frame an then doing linear interpolation, something like that:


(defun lerp-gl-array (a b c count interpolation-factor)
  (dotimes (i count) 
    (setf (gl:glaref c i) 
      (alexandria:lerp interpolation-factor (gl:glaref a i) (gl:glaref b i)))))

but it seem to be too slow as shown by the SBCL profiler


  seconds  |     gc     |     consed    | calls |  sec/call  |  name  
-----------------------------------------------------------
   264.554 |      8.189 | 8,307,049,792 | 2,870 |   0.092179 | 
CL-GL-UTILS:LERP-GL-ARRAY
-----------------------------------------------------------
   264.554 |      8.189 | 8,307,049,792 | 2,870 |            | Total

is this my fault? Any idea how can I improve performance?

Thank you.
C.

-- 
source code published is licensed under the "Simplified BSD License"

_______________________________________________
cl-opengl-devel mailing list
cl-opengl-devel@common-lisp.net
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/cl-opengl-devel

Reply via email to