A texture map contains the raw texel data that are ready to be uploaded to the GPU. Through this interface, you can change a variety of settings and properties; where each of them will have a direct impact on the texel data maintained by the structure.
The interface below also contains a series of helpers which allows you to directly access texel data, convert, resize and even save the raw data directly to disk using popular file formats etc...
See Also
Name | Description |
---|---|
byte_array | Access the raw byte array of texel data. |
float_array | Access the raw floating point array of texel data. |
Name | Description |
---|---|
width | Width of the texture data in pixel. |
height | Height of the texture data in pixel. |
depth | Depth of the texture data in pixel. |
byte | Amount of components per pixel. |
samples | Amount of samples for multisample anti-alias Texture. |
options | Bit mask of TexmapOptions flag(s) currently assigned to the active Texmap. |
Name | Description |
---|---|
To16Bits | Convert the current Texmap data to 16bits. |
Generate | Regenerate the Texmap texel array. |
Resize | Upscale or downscale the current texel data to a new resolution. |
GetByteSize | Return the size of the current byte/options Texmap configuration. |
SetByte | Manually update the byte value of a texel. |
SetFloat | Manually update the float value of a texel. |
GetByte | Retrieve the current value of a specific byte texel. |
GetFloat | Retrieve the current value of a specific floating point texel. |
GetMemUsage | Total amount in bytes used by the Texmap texel data. |
Clear | Release the current texel array data from memory. |
SavePNG | Save on disk the current texel data array to PNG . |
SaveTGA | Save on disk the current texel data array to TGA . |
SaveBMP | Save on disk the current texel data array to BMP . |
SaveHDR | Save on disk the current texel data array to HDR . |
SaveKTX | Save on disk the current texel data array to KTX . |
Bit flags are combined together to form the options
used by a Texmap. The flags listed below will modify the type of data handled by the Texmap as well as some of its internal behaviors.
fLuminanceToAlpha
: Convert grayscale to an alpha channel.f16bits
: Specifies that the Texmap data is converted to 16 bits.fUse5551
: In the event, the Texmap contains an RGBA channel and is flagged to be converted as 16 bits; convert using the 5551 methods instead of using the default 4444 bits per component.fFloat
: Flag the Texmap to use floating point values instead of bytes.fNoClear
: Prevent the Texmap texel data to be freed after it is upload to the GPU.fNoSave
: Force to do not save the texmap data. This option is generally use to mark texmaps that are procedurally generated at runtime and do not need to be saved.fNoOverride
: Prevent the Texmap to be resized or compressed.fMultiSample
: Enable multisample anti-alias. Take note that MSAA textures needs to be blit into a regular attachment. The code below show how to blit color and depth Texture attachment from one framebuffer to another.fArray
: Convert a texture3D
into a sampler2DArray
.
Luafunction OnEnd()
-- The destination framebuffer (the active camera).
local dst = event.object.data.camera.framebuffer
-- The source framebuffer.
local src = event.object.scene:GetObject( "Camera" ).data.camera.framebuffer
dst:BlitBegin()
-- Blit the color and depth buffer.
dst:Blit( src,
Graphics.ClearBuffer.fColorBufferBit +
Graphics.ClearBuffer.fDepthBufferBit,
0,
0,
false) -- Requires linear to be set to false.
dst:BlitEnd()
end
|