Updated for new cl-tuples
[mixamesh.git] / material.lisp
blob23adbd88c81ceda9c11926f2d336e5351376aaf8
2 (in-package :mixamesh)
4 (defparameter *textures* (make-hash-table :test 'eql)
5 "A table of textures.")
7 (defclass material ()
8 ((diffuse :accessor diffuse-color-of :initform (new-colour))
9 (ambient :accessor ambient-color-of :initform (new-colour))
10 (specular :accessor specular-color-of :initform (new-colour)))
11 (:metaclass closer-mop:funcallable-standard-class)
12 (:documentation "Material associated with mesh polygons"))
14 (defclass texture ()
15 ((id :allocation :class :reader id-of :initform (get-universal-time))
16 (width :accessor width-of :initarg :width)
17 (height :accessor height-of :initarg :height)
18 (map :accessor map-of :initarg :map)))
23 (defun make-texture (&key width height colour-map)
24 (let* ((texture
25 (make-instance 'texture :width width :height height :map colour-map))
26 (result
27 (id-of texture)))
28 (setf (gethash (id-of texture) *textures*) texture)
29 (incf (slot-value texture 'id))
30 result))