Static variables

@:value(Clamp)staticDEFAULT_WRAP:Wrap = Clamp

@:value(true)staticTRILINEAR_FILTERING_ENABLED:Bool = true

@:value(4)staticinlineread only__startingMip_bits:Int = 4

@:value(1966080)staticinlineread only__startingMip_mask:Int = 1966080

@:value(17)staticinlineread only__startingMip_offset:Int = 17

@:value(2)staticinlineread onlyfilter_bits:Int = 2

@:value(12)staticinlineread onlyfilter_mask:Int = 12

@:value(2)staticinlineread onlyfilter_offset:Int = 2

@:value(2)staticinlineread onlymipMap_bits:Int = 2

@:value(3)staticinlineread onlymipMap_mask:Int = 3

@:value(0)staticinlineread onlymipMap_offset:Int = 0

@:value(RGBA)staticread onlynativeFormat:TextureFormat = RGBA

The default texture color format

@:value(4)staticinlineread onlypackedAnisotropicMaxLevel_bits:Int = 4

@:value(-268435456)staticinlineread onlypackedAnisotropicMaxLevel_mask:Int = -268435456

@:value(28)staticinlineread onlypackedAnisotropicMaxLevel_offset:Int = 28

@:value(7)staticinlineread onlypackedLodBias_bits:Int = 7

@:value(266338304)staticinlineread onlypackedLodBias_mask:Int = 266338304

@:value(21)staticinlineread onlypackedLodBias_offset:Int = 21

@:value(11)staticinlineread onlyslice_bits:Int = 11

@:value(131008)staticinlineread onlyslice_mask:Int = 131008

@:value(6)staticinlineread onlyslice_offset:Int = 6

@:value(2)staticinlineread onlywrap_bits:Int = 2

@:value(48)staticinlineread onlywrap_mask:Int = 48

@:value(4)staticinlineread onlywrap_offset:Int = 4

Static methods

staticdefaultCubeTexture():Texture

Returns a default dummy 1x1 black cube texture

@:value({ alpha : 1. })staticfromColor(color:Int, alpha:Float = 1.):Null<Texture>

Creates a 1x1 texture using the RGB color passed as parameter.

staticfromPixels(pixels:Pixels, ?format:TextureFormat):Texture

staticgenChecker(size:Int):Texture

Returns a checker texture of size x size, than can be repeated

@:value({ alpha : 1. })staticgenDisc(size:Int, color:Int, alpha:Float = 1.):Texture

staticgenNoise(size:Int):Texture

staticgetCubeFaceMatrix(face:Int):Matrix

Returns the matrix transforming vec3(uv * 2 - 1, 1) into the direction of the given cube face. The matrix is shared and must not be modified.

staticgetDefaultDepth():Texture

This will return the default depth buffer, which is automatically resized to the screen size.

staticinlinegetFilter(v:Int):Int

staticinlinegetMipMap(v:Int):Int

staticinlinegetPackedAnisotropicMaxLevel(v:Int):Int

staticinlinegetPackedLodBias(v:Int):Int

staticinlinegetSlice(v:Int):Int

staticinlinegetWrap(v:Int):Int

staticinlineget__startingMip(v:Int):Int

Constructor

new(w:Int, h:Int, ?flags:Array<TextureFlags>, ?format:Null<TextureFormat>)

Variables

depthBuffer:Texture

When the texture is used as render target, tells which depth buffer will be used. If set to null, depth testing is disabled.

@:bits(bits)filter:Filter

read onlyflags:EnumFlags<TextureFlags>

read onlyheight:Int

read onlyid:Int

read onlylayerCount:Int

lodBias:Float

read onlymipLevels:Int

@:bits(bits)mipMap:MipMap

read onlyname:String

@:value(0)read onlyresidentMip:Int = 0

The most detailed mip level allocated on the GPU : mip levels before it are not allocated, and the texture is sampled starting at this level.

@:bits(bits,11)slice:Int

@:value(-1)read onlyvisibleFrame:Int = -1

For a Streamed texture, the last frame (hxd.Timer.frameCount) in which the texture was visible, see markVisible.

read onlywidth:Int

@:bits(bits)wrap:Wrap

realloc:() ‑> Void

If this callback is set, the texture can be re-allocated when the 3D context has been lost or when it's been free because of lack of memory.

Methods

alloc():Void

@:value({ mipLevel : 0, face : 0 })capturePixels(face:Int = 0, mipLevel:Int = 0, ?region:IBounds):Pixels

Downloads the current texture data from the GPU. Beware, this is a very slow operation that shouldn't be done during rendering.

@:value({ layer : -1, alpha : 1. })clear(color:Int, alpha:Float = 1., layer:Int = -1):Void

@:value({ layer : -1, a : 0., b : 0., g : 0., r : 0. })clearF(r:Float = 0., g:Float = 0., b:Float = 0., a:Float = 0., layer:Int = -1):Void

dispose():Void

hasStencil():Bool

isDepth():Bool

inlineisDisposed():Bool

isSRGB():Bool

inlinemarkVisible():Void

Records that the texture is used by something visible during the current frame. Streamed textures that are not visible lose mip levels when the streaming budget is exceeded (see hxd.res.TextureStream).

preventAutoDispose():Void

In case we run out of GPU memory, textures that hasn't been used for a long time will be disposed. Calling this will make this texture not considered for auto disposal.

resize(width:Int, height:Int):Void

setName(n:String):Void

setResidentMip(mip:Int):Bool

@:value({ layer : 0, mipLevel : 0 })uploadBitmap(bmp:BitmapData, mipLevel:Int = 0, layer:Int = 0):Void

@:value({ layer : 0, mipLevel : 0 })uploadPixels(pixels:Pixels, mipLevel:Int = 0, layer:Int = 0):Void

waitLoad(f:() ‑> Void):Void

Some textures might take some time to load. You can check flags.has(Loading) or add a waitLoad callback which will get called either immediately if the texture is already loaded or when loading is complete.