Texture
A high level texture object to make it easier to manage textures
Static Members
fromImage(image: clay.Image, ?premultiplyAlpha: Bool = false): Texture| Name | Type | Default |
|---|---|---|
image |
clay.Image | |
premultiplyAlpha |
Bool | false |
| Returns |
|---|
| Texture |
Instance Members
index: InttextureId: clay.TextureIdpremultiplyAlpha: BoolIs true if image has been processed to be stored as premultiplied alpha in GPU memory.
compressed: BoolIf true, the pixels buffer should store compressed image data that the GPU understands
format: clay.TextureFormatThe GPU texture format (RGBA, RGB...)
type: clay.TextureTypeThe GPU texture type (TEXTURE_2D)
dataType: clay.TextureDataTypeThe GPU data type (UNSIGNED_BYTE)
width: IntWhen creating a texture manually, the width of this texture.
height: IntWhen creating a texture manually, the height of this texture.
widthActual: IntThe width of the actual texture, needed when the texture may be padded to POT sizes
heightActual: IntThe height of the actual texture, needed when the texture may be padded to POT sizes
pixels: Null<clay.buffers.Uint8Array>When creating a texture manually, the pixels for this texture.
Properties width and height must be defined when providing pixels.
filterMin: clay.TextureFilterSet the minification filter type (default LINEAR)
filterMag: clay.TextureFilterSet the magnification filter type (default LINEAR)
wrapS: clay.TextureWrapSet the s (horizontal) clamp type (default CLAMP_TO_EDGE)
wrapT: clay.TextureWrapSet the t (vertical) clamp type (default CLAMP_TO_EDGE)
init(): VoidInitialize this texture. Must be called before using the actual texture. When calling init(), properties should be defined accordingly.
destroy(): VoidBind this texture to its active texture slot,
and it's texture id to the texture type. Calling this
repeatedly is fine, as the state is tracked by Graphics.
| Name | Type | Default |
|---|---|---|
slot |
Int | 0 |
submit(?pixels: Null<clay.buffers.Uint8Array>): VoidSubmit a pixels array to the texture id. Must match the type and format accordingly.
| Name | Type | Default |
|---|---|---|
pixels |
Null<clay.buffers.Uint8Array> | (optional) |
fetch(into: clay.buffers.Uint8Array, ?x: Int = 0, ?y: Int = 0, ?w: Int = -1, ?h: Int = -1): clay.buffers.Uint8ArrayFetch the pixels from the texture id, storing them in the provided array buffer view.
Returns image pixels in RGBA format, as unsigned byte (0-255) values only.
This means that the view must be w * h * 4 in length, minimum.
By default, x and y are 0, 0, and the texture width and height
are used (not widthActual / heightActual)
| Name | Type | Default |
|---|---|---|
into |
clay.buffers.Uint8Array | |
x |
Int | 0 |
y |
Int | 0 |
w |
Int | -1 |
h |
Int | -1 |
| Returns |
|---|
| clay.buffers.Uint8Array |
new(): Void