CLASSES
TagsA - Z

MapTexture

Description

class MapTexture extends Texture

Constructor

new MapTexture(name, scene, size, samplingMode, useMipMap, margin)

Parameters

Name Type Description
name string
scene Scene
size ISize the portion to fit the clip space to the portion to fit the clip space to
optional samplingMode number
optional useMipMap boolean

Members

freeSpace : number

Return the available space in the range of [O;1]. 0 being not space left at all, 1 being an empty texture map.

This is the cumulated space, not the biggest available surface. Due to fragmentation you may not allocate a rect corresponding to this surface.

@returns {}

canRescale : boolean

Methods

allocateRect(size) PackedRect

Allocate a rectangle of a given size in the texture map

@return the PackedRect instance corresponding to the allocated rect or null is there was not enough space to allocate it.

Parameters

Name Type Description
size Size the size of the rectangle to allocation the portion to fit the clip space to the portion to fit the clip space to

freeRect(rectInfo) void

Free a given rectangle from the texture map

Parameters

Name Type Description
rectInfo PackedRect the instance corresponding to the rect to free. the instance corresponding to the rect to free. the instance corresponding to the rect to free.

bindTextureForRect(rect, clear) void

Bind the texture to the rendering engine to render in the zone of a given rectangle.

Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.

Don't forget to call unbindTexture when you're done rendering

Parameters

Name Type Description
rect PackedRect the zone to render to the zone to render to the zone to render to
clear boolean true to clear the portion's color/depth data true to clear the portion's color/depth data true to clear the portion's color/depth data

bindTextureForPosSize(pos, size, clear) void

Bind the texture to the rendering engine to render in the zone of the given size at the given position.

Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.

Don't forget to call unbindTexture when you're done rendering

Parameters

Name Type Description
pos Vector2 the position into the texture the position into the texture the position into the texture
size Size the portion to fit the clip space to the portion to fit the clip space to the portion to fit the clip space to
clear boolean true to clear the portion's color/depth data true to clear the portion's color/depth data true to clear the portion's color/depth data

unbindTexture(dumpForDebug) void

Unbind the texture map from the rendering engine.

Call this method when you're done rendering. A previous call to bindTextureForRect has to be made.

Parameters

Name Type Description
optional dumpForDebug boolean if set to true the content of the texture map will be dumped to a picture file that will be sent to the internet browser. if set to true the content of the texture map will be dumped to a picture file that will be sent to the internet browser. if set to true the content of the texture map will be dumped to a picture file that will be sent to the internet browser.

clone() MapTexture