Skip to content

Instantly share code, notes, and snippets.

@psilord
Last active September 15, 2024 05:18
Show Gist options
  • Save psilord/dbc163c4d991f41183f6cb55327cb146 to your computer and use it in GitHub Desktop.
Save psilord/dbc163c4d991f41183f6cb55327cb146 to your computer and use it in GitHub Desktop.
(c:define-texture-map g000-1d-phy-gnd-one-non (:1d :unique)
(c:data-elements
(0 (c:image-element :logloc (textures 1d-64x1))))
(c:mipmap-1d
:extent (c:span-1d :origin 0 :extent 64)
(c:mapping-span-1d :to (c:data-span-1d :origin 0 :extent 64)
:from (c:data-span-1d :origin 0 :extent 64 :elidx 0))))
;; -
;; |
;; | The same grounded form as above, but built from programmatic API.
;; |
;; v
(defun test-g000-1d-imp-gnd-one-non ()
(let* (;; define all data elements
(de0 (texmap:make-image-element :logloc '(textures 1d-64x1)))
;; create the data-elements array
(data-elements (texmap:make-data-elements :encode de0))
;; define, in groups, all mapping spans for each mipmap and then the
;; mipmap itself.
;; mipmap 0
(mip0-ms0-to (texmap:make-data-span-1d :origin 0 :extent 64))
(mip0-ms0-from (texmap:make-data-span-1d :origin 0 :extent 64
:elidx 0))
(mip0-ms0 (texmap:make-mapping-span-1d :to mip0-ms0-to
:from mip0-ms0-from))
(mip0-mspans (texmap:make-mapping-spans :encode mip0-ms0))
(mip0-extent (texmap:make-span-1d :origin 0 :extent 64))
(mip0 (texmap:make-mipmap-1d :extent mip0-extent
:mapping-spans mip0-mspans))
;; create the mipmaps array
(mipmaps (texmap:make-mipmaps :encode mip0))
;; finally wire together the texture-map
(texture-map (texmap:make-texture-map-1d
:name 'g000-1d-imp-gnd-one-non
:anonymous-p nil
:model :1d
:style :unique
:store nil
:data-elements data-elements
:mipmaps mipmaps
;; If any attributes, put them here as appropriate.
;; :cattrs ((...) ...)
))
;; HOWEVER: If there were any attributes, deal with them here. Each
;; storage-forms absorbs the texture-map while using :cattr (or
;; whatever as appropriate)
texture-map)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment