diff options
-rw-r--r-- | wheelwork.lisp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/wheelwork.lisp b/wheelwork.lisp index 52f0eb0..2e23c96 100644 --- a/wheelwork.lisp +++ b/wheelwork.lisp @@ -151,7 +151,7 @@ necessary." ((title :with :std "Wheelwork App") (asset-root :ri :std #P"./" :doc "Directory under which assets are stored.") (asset-classifiers - :std '(("png" texture)) + :std '(("png" png) ("ttf" font)) :doc "ALIST of (EXT CLASS). EXT is a string, file estension. CLASS is a symbol, class name.") (assets :with :a :std (make-hash-table :test 'equal) :doc "maps asset names to asset instances.") @@ -333,7 +333,7 @@ necessary." (setf (asset-loadedp thing) t)) thing) -(defclass/std texture (asset) +(defclass/std texture () ((width height id mipmap :with :r) (internal-format image-format :ri :with :std :rgba) (wrap-s wrap-t :ri :with :std :repeat) @@ -342,13 +342,15 @@ necessary." (defmethod cleanup ((texture texture)) (gl:delete-texture (texture-id texture))) -(defmethod ensure-loaded ((texture texture)) +(defclass/std png (asset texture) ()) + +(defmethod ensure-loaded ((png png)) (with-slots (width height id wrap-s wrap-t min-filter mag-filter internal-format image-format) - texture - (pngload:with-png-in-static-vector (png (asset-path texture) :flip-y t) - (setf width (pngload:width png) - height (pngload:height png) + png + (pngload:with-png-in-static-vector (data (asset-path png) :flip-y t) + (setf width (pngload:width data) + height (pngload:height data) id (gl:gen-texture)) (gl:bind-texture :texture-2d id) (gl:tex-parameter :texture-2d :texture-wrap-s wrap-s) @@ -363,14 +365,12 @@ necessary." 0 image-format :unsigned-byte - (pngload:data png)) + (pngload:data data)) (gl:bind-texture :texture-2d 0) - (when (texture-mipmap texture) + (when (texture-mipmap png) (gl:generate-mipmap :texture-2d))))) - - (defun refocus-on (target &optional (app *application*)) "Sets focus of application to TARGET, if TARGET is focusable. " (when (focusablep target) |