diff options
author | Colin Okay <colin@cicadas.surf> | 2022-06-29 11:54:24 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-06-29 11:54:24 -0500 |
commit | 82f71b0d13788b1cff9a24c5b652effd11631523 (patch) | |
tree | f0ec127b2f10f46029983ee95b6c72ef29bc504c /src/assets/png.lisp | |
parent | 4d1ee56c96ce254134b692f0e3b3271c87a42b54 (diff) |
[refactor] [structure] modularized project file structure
Diffstat (limited to 'src/assets/png.lisp')
-rw-r--r-- | src/assets/png.lisp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/assets/png.lisp b/src/assets/png.lisp new file mode 100644 index 0000000..aa259f0 --- /dev/null +++ b/src/assets/png.lisp @@ -0,0 +1,31 @@ +;;;; png.lisp + +(in-package #:wheelwork) + +(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) + 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) + (gl:tex-parameter :texture-2d :texture-wrap-t wrap-t) + (gl:tex-parameter :texture-2d :texture-min-filter min-filter) + (gl:tex-parameter :texture-2d :texture-mag-filter mag-filter) + (gl:tex-image-2d :texture-2d + 0 + internal-format + width + height + 0 + image-format + :unsigned-byte + (pngload:data data)) + (gl:bind-texture :texture-2d 0) + (when (texture-mipmap png) + (gl:generate-mipmap :texture-2d))))) |