(defn
->image-entity
"Returns an image entity with a vector of image `data`,\n along with a `width` and `height` in pixels."
[game data width height]
(->>
{:vertex image-vertex-shader,
:fragment image-fragment-shader,
:attributes
{'a_position
{:data primitives/rect, :type (gl game FLOAT), :size 2}},
:uniforms
{'u_image
{:data data,
:opts
{:mip-level 0,
:internal-fmt (gl game RGBA),
:width width,
:height height,
:border 0,
:src-fmt (gl game RGBA),
:src-type (gl game UNSIGNED_BYTE)},
:params
{(gl game TEXTURE_WRAP_S) (gl game CLAMP_TO_EDGE),
(gl game TEXTURE_WRAP_T) (gl game CLAMP_TO_EDGE),
(gl game TEXTURE_MIN_FILTER) (gl game NEAREST),
(gl game TEXTURE_MAG_FILTER) (gl game NEAREST)}},
'u_texture_matrix (m/identity-matrix 3)},
:width width,
:height height}
map->ImageEntity))