load_texture! : Str => Try(Texture, [TextureLoadFailed, ResourceLimit, ..])
Load an image file into GPU texture memory. The returned value owns the resource and may be safely shared between sprites, uniforms, and models.
:= []
Assets module - host-owned textures and other resources.
Textures are opaque, host-owned GPU resources. Load or generate them during initialization, keep them in the model, then draw or update them through the operations in this module. Releasing the final Roc reference unloads the native texture automatically.
load_texture! : Str => Try(Texture, [TextureLoadFailed, ResourceLimit, ..])
Load an image file into GPU texture memory. The returned value owns the resource and may be safely shared between sprites, uniforms, and models.
generate_color_texture! : GenerateColorTexture => Try(Texture, [TextureGenerationFailed, ResourceLimit, ..])
Generate a solid-color GPU texture. The temporary CPU image is released inside the host; only the host-owned texture crosses back.
generate_checked_texture! : GenerateCheckedTexture => Try(Texture, [TextureGenerationFailed, ResourceLimit, ..])
Generate a checkerboard GPU texture without retaining a CPU image.
update_texture! : Texture, List(Color) => Try({ }, [PixelCountMismatch, ..])
Replace every pixel. The row-major RGBA list must exactly match the texture dimensions and is borrowed only for this host call.
Assets.Texture :: # (opaque)
Opaque, host-owned mutable GPU texture with immutable dimensions.
Load an image file into GPU texture memory.
generate_color! : GenerateColorTexture => Try(Texture, [TextureGenerationFailed, ResourceLimit, ..])
Generate a solid-color GPU texture.
generate_checked! : GenerateCheckedTexture => Try(Texture, [TextureGenerationFailed, ResourceLimit, ..])
Generate a checkerboard GPU texture.
view : Texture -> TextureView
Read-only sampling view sharing this texture's host-owned ARC resource.
Width in pixels.
Height in pixels.
Texture dimensions in pixels.
Rectangle covering the complete texture in pixel coordinates.
Replace every pixel in row-major RGBA order.
set_filter! : Texture, TextureFilter => { }
Change how this texture is sampled when scaled.
set_wrap! : Texture, TextureWrap => { }
Change how out-of-range texture coordinates are wrapped.
Assets.TextureView :: # (opaque)
Read-only sampled texture view. It owns the same ARC reference as its source but deliberately has no pixel-update capability.
Width in pixels.
Height in pixels.
Texture dimensions in pixels.
Rectangle covering the complete texture in pixel coordinates.
set_filter! : TextureView, TextureFilter => { }
Change how this view is sampled when scaled.
set_wrap! : TextureView, TextureWrap => { }
Change how out-of-range texture coordinates are wrapped.
:= [Point, Bilinear, Trilinear, Anisotropic4x, Anisotropic8x, Anisotropic16x]
Texture sampling filter used when an image is scaled.
:= [Repeat, Clamp, MirrorRepeat, MirrorClamp]
Texture-coordinate behavior outside the normal 0-to-1 range.
GenerateColorTexture : { width : I32, height : I32, color : Color }
Configuration for a solid-color generated texture.
GenerateCheckedTexture : {
width : I32,
height : I32,
checks_x : I32,
checks_y : I32,
color_a : Color,
color_b : Color,
}
Configuration for a generated checkerboard texture.