API reference
API reference
Select your platform
No SDKs available
No versions available

SceneTexture Class

Modifiers: final
The SceneTexture class represents a texture resource. SceneTextures are used to construct SceneMaterials and can be used as inputs for shaders also in the construction of SceneMaterials.
Example ways to create a SceneTexture:
SceneTexture(getDrawable(R.drawable.myDrawable)) // Creating a SceneTexture from drawable in resources
SceneTexture(Color.valueOf(Color.BLACK)) // Creating a plain black SceneTexture

SceneTextures are also generated as part of the Panel rendering process and are used to render Panels by populating their SceneMaterial. This is not necessary for Layer panels, but can be enabled with PanelConfigOptions "forceSceneTexture" parameter.

Signature

class SceneTexture

Constructors

SceneTexture ( width , height , numberOfMips , samplerConfig )
Signature
constructor(width: Int, height: Int, numberOfMips: Int, samplerConfig: SamplerConfig = SamplerConfig())
Parameters
width: Int
height: Int
numberOfMips: Int
samplerConfig: SamplerConfig
SceneTexture ( image , samplerConfig )
Signature
constructor(image: Image, samplerConfig: SamplerConfig = SamplerConfig())
Parameters
image: Image
samplerConfig: SamplerConfig
SceneTexture ( bitmap , samplerConfig )
Signature
constructor(bitmap: Bitmap, samplerConfig: SamplerConfig = SamplerConfig())
Parameters
bitmap: Bitmap
samplerConfig: SamplerConfig
SceneTexture ( drawable )
Signature
constructor(drawable: Drawable?)
Parameters
drawable: Drawable?
SceneTexture ( color , samplerConfig )
Signature
constructor(color: Color, samplerConfig: SamplerConfig = SamplerConfig())
Parameters
color: Color
samplerConfig: SamplerConfig

Properties

handle : Long
[Get]
Signature
var handle: Long

Functions

destroy ()
Signature
fun destroy()
nativeHandle ()
Signature
fun nativeHandle(): Long
Returns
Long
update ( buffer , width , height , strideInBytes )
Updates the texture with new data.
Signature
fun update(buffer: ByteBuffer, width: Int, height: Int, strideInBytes: Int)
Parameters
buffer: ByteBuffer
ByteBuffer containing the pixel data
width: Int
Width of the image data in pixels
height: Int
Height of the image data in pixels
strideInBytes: Int
Number of bytes per row in the buffer

Companion Object

Companion Object Functions

calculateMips ( w , h )
Calculates the number of mipmap levels for a texture of the given dimensions.
Mipmaps are smaller versions of a texture used for rendering at different distances, which improves rendering quality and performance.
Signature
fun calculateMips(w: Int, h: Int): Int
Parameters
w: Int
Width of the texture in pixels
h: Int
Height of the texture in pixels
Returns
Int
The number of mipmap levels
createFromPlatformImage ( w , h , mips , platformImage , samplerConfig )
DeprecatedUse SceneTexture constructor and SceneTexture.update instead.
Signature
fun createFromPlatformImage(w: Int, h: Int, mips: Int, platformImage: Long, samplerConfig: SamplerConfig = SamplerConfig()): SceneTexture
Parameters
w: Int
h: Int
mips: Int
platformImage: Long
samplerConfig: SamplerConfig
Did you find this page helpful?