aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/interactive/canvas.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2024-12-14 08:36:23 -0800
committercolin <colin@cicadas.surf>2024-12-14 08:36:23 -0800
commit3a2217263d581be9a7f629b10d75aa8e3d581890 (patch)
tree23f5f0a5449a06473aba2ec7914a3c2193823a10 /src/interactive/canvas.lisp
parent03cdbb6a15e130a012377ab8d54074b6864e3480 (diff)
parent8a51ba81c7df6b0b6dab7cf4b35b5ca084b653ba (diff)
Merge branch 'refactor-with-def'
Diffstat (limited to 'src/interactive/canvas.lisp')
-rw-r--r--src/interactive/canvas.lisp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/interactive/canvas.lisp b/src/interactive/canvas.lisp
index af54634..f4b2b74 100644
--- a/src/interactive/canvas.lisp
+++ b/src/interactive/canvas.lisp
@@ -2,9 +2,11 @@
(in-package #:wheelwork)
-(defclass/std pixels ()
- ((pixel-width pixel-height :std (error "pixel-width and pixel-height are required"))
- (data :a :with :doc "Array of RGBA data representing an image of pixel-width X pixel-height")))
+(def:class pixels ()
+ (pixel-width pixel-height :required :type fixnum)
+ (data :prefix
+ :type (vector (unsigned-byte 8))
+ :documentation "Array of RGBA data"))
(defmethod initialize-instance :after ((pixels pixels) &key)
(with-slots (pixel-width pixel-height data) pixels
@@ -145,14 +147,15 @@ e.g., drawing a line in a particular color."
(gl:delete-vertex-arrays (list *canvas-render-vao*)))
(when *canvas-shader-program*
(gl:delete-program *canvas-shader-program*))
- (setf-many *canvas-fbo-vao*
- *canvas-render-vao*
+ (setf-many *canvas-render-vao*
*canvas-shader-program*
nil)))))
-(defclass/std canvas (unit interactive pixels)
- ((fbo :with :r :doc "framebuffer object for use in off-screen-rendering of this canvas to a texture")
- (texture :with :a :doc "texture instance")))
+(def:class canvas (unit interactive pixels)
+ ((fbo "framebuffer object for use in off-screen rendering of this canvas to a texture")
+ :prefix :ro)
+ ((texture "the texture where the pixles are rendered")
+ :prefix))
(defmethod cleanup ((canvas canvas))
(cleanup (canvas-texture canvas))