aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/interactive/button.lisp4
-rw-r--r--src/interactive/frameset.lisp2
-rw-r--r--src/interactive/image.lisp (renamed from src/interactive/bitmap.lisp)72
-rw-r--r--src/package.lisp2
4 files changed, 40 insertions, 40 deletions
diff --git a/src/interactive/button.lisp b/src/interactive/button.lisp
index 0a15d79..7c94663 100644
--- a/src/interactive/button.lisp
+++ b/src/interactive/button.lisp
@@ -88,8 +88,8 @@
(make-instance
'button
:on-press pressed :on-release released
- :up (make-instance 'bitmap :texture (get-asset up))
- :down (make-instance 'bitmap :texture (get-asset down))))
+ :up (make-instance 'image :texture (get-asset up))
+ :down (make-instance 'image :texture (get-asset down))))
(defun make-text-button
(font up down
diff --git a/src/interactive/frameset.lisp b/src/interactive/frameset.lisp
index a8ba079..86f445d 100644
--- a/src/interactive/frameset.lisp
+++ b/src/interactive/frameset.lisp
@@ -77,7 +77,7 @@
(loop for name in asset-names
collect
(make-instance
- 'bitmap
+ 'image
:texture (get-asset name :asset-args asset-args))))
(sequence
(loop for name in sequenced-assets
diff --git a/src/interactive/bitmap.lisp b/src/interactive/image.lisp
index 96d8e07..7c84df3 100644
--- a/src/interactive/bitmap.lisp
+++ b/src/interactive/image.lisp
@@ -1,37 +1,37 @@
-;;;; bitmap.lisp
+;;;; image.lisp
(in-package #:wheelwork)
-(defvar *bitmap-shader-program* nil
+(defvar *image-shader-program* nil
"Cached for later cleanup.")
-(defvar *bitmap-vao* nil)
+(defvar *image-vao* nil)
-(defvar *bitmap-count* 0
+(defvar *image-count* 0
"Used by finalizers to determin if the shader should be destroyed.")
-(defun bitmap-finalizer ()
- "executed after a bitmap has been reclaimed by gc. decrements bitmap
+(defun image-finalizer ()
+ "executed after a image has been reclaimed by gc. decrements image
count and destroys shader-program if necessary."
- (decf *bitmap-count*)
- (unless (plusp *bitmap-count*)
- (when *bitmap-vao*
- (gl:delete-vertex-arrays (list *bitmap-vao*))
- (setf *bitmap-vao* nil))
- (when *bitmap-shader-program*
- (gl:delete-program *bitmap-shader-program*)
- (setf *bitmap-shader-program* nil))))
+ (decf *image-count*)
+ (unless (plusp *image-count*)
+ (when *image-vao*
+ (gl:delete-vertex-arrays (list *image-vao*))
+ (setf *image-vao* nil))
+ (when *image-shader-program*
+ (gl:delete-program *image-shader-program*)
+ (setf *image-shader-program* nil))))
-(defclass/std bitmap (affine interactive)
- ((texture :ri :std (error "A bitmap requires a texture."))))
+(defclass/std image (affine interactive)
+ ((texture :ri :std (error "A image requires a texture."))))
-(defmethod initialize-instance :after ((bitmap bitmap) &key)
- (incf *bitmap-count*)
- (trivial-garbage:finalize bitmap #'bitmap-finalizer)
- (with-slots (base-width base-height texture) bitmap
+(defmethod initialize-instance :after ((image image) &key)
+ (incf *image-count*)
+ (trivial-garbage:finalize image #'image-finalizer)
+ (with-slots (base-width base-height texture) image
(setf base-height (texture-height texture)
base-width (texture-width texture))
- (unless *bitmap-shader-program*
- (setf *bitmap-shader-program*
+ (unless *image-shader-program*
+ (setf *image-shader-program*
(create-shader
'(:vertex
((vert :vec2))
@@ -47,12 +47,12 @@ count and destroys shader-program if necessary."
(vari:discard)
frag))))))
(gl:program-uniformi
- *bitmap-shader-program*
- (gl:get-uniform-location *bitmap-shader-program* "TEX")
+ *image-shader-program*
+ (gl:get-uniform-location *image-shader-program* "TEX")
0))
- (unless *bitmap-vao*
- (setf *bitmap-vao* (gl:gen-vertex-array))
- (gl:bind-vertex-array *bitmap-vao*)
+ (unless *image-vao*
+ (setf *image-vao* (gl:gen-vertex-array))
+ (gl:bind-vertex-array *image-vao*)
(let ((vbo (gl:gen-buffer)))
(with-gl-array (verts :float
0.0 1.0
@@ -69,18 +69,18 @@ count and destroys shader-program if necessary."
(gl:bind-buffer :array-buffer 0)
(gl:bind-vertex-array 0))))
-(defmethod cleanup ((bitmap bitmap))
- (bitmap-finalizer))
+(defmethod cleanup ((image image))
+ (image-finalizer))
-(defmethod render ((bitmap bitmap))
- (with-slots (texture) bitmap
+(defmethod render ((image image))
+ (with-slots (texture) image
(gl:active-texture 0)
(gl:bind-texture :texture-2d (texture-id texture))
- (gl:use-program *bitmap-shader-program*)
+ (gl:use-program *image-shader-program*)
(gl:program-uniform-matrix-4fv
- *bitmap-shader-program*
- (gl:get-uniform-location *bitmap-shader-program* "TRANSFORM")
- (projected-matrix bitmap))
- (gl:bind-vertex-array *bitmap-vao*)
+ *image-shader-program*
+ (gl:get-uniform-location *image-shader-program* "TRANSFORM")
+ (projected-matrix image))
+ (gl:bind-vertex-array *image-vao*)
(gl:draw-arrays :triangles 0 6)
(gl:bind-vertex-array 0)))
diff --git a/src/package.lisp b/src/package.lisp
index eef6173..7487af8 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -85,7 +85,7 @@
#:unit-visbilep
;; Specific Unit Classes and APIs
- #:bitmap
+ #:image
#:button
#:button-bg