-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmesh.lisp
29 lines (24 loc) · 827 Bytes
/
mesh.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(in-package :cl-mesh)
(defclass mesh ()
())
(defgeneric compute-normals (mesh &optional method)
(:documentation "Compute the normals of the mesh using the face normals"))
(defclass geometric-mesh (mesh)
((vertices :type (or (simple-array (vector float 3)) null)
:initarg :vertices
:initform nil)
(indices :initarg :indices
:initform nil)
(normals :type (simple-array (vector float 3))
:initarg :normals
:initform nil)
(tangents :type (simple-array (vector float 3))
:initarg :normals
:initform nil)))
(defun make-mesh (vertices indices &optional normals tangents)
(make-instance 'geometric-mesh
:vertices vertices
:indices indices
:normals normals
:tangents tangents))
(defmethod compute-normals ((mesh geometric-mesh) &optional method))