SBTexture#
This class describes a texture that can be attached to a surface for rendering.
Textures in the Python API are represented by RGBA byte data together with their width and height, which makes them convenient for building or inspecting custom textured meshes.
- class samson.SBTexture(self: samson.SBTexture, width: SupportsInt | SupportsIndex, height: SupportsInt | SupportsIndex, textureData: collections.abc.Sequence[SupportsInt | SupportsIndex])#
Bases:
pybind11_objectThis class describes a texture.
Construct a texture from flattened RGBA byte data.
- Parameters:
width (int) – Texture width in pixels.
height (int) – Texture height in pixels.
textureData (list[int]) – Flattened RGBA byte buffer. The list must contain exactly
4 * width * heightvalues.
- Raises:
RuntimeError – If
textureDatadoes not contain exactly4 * width * heightvalues.
- getTextureData(self: samson.SBTexture) list[int]#
Return the flattened RGBA byte buffer.
- Returns:
Texture bytes with length
4 * width * height.- Return type:
list[int]
- setTextureData(self: samson.SBTexture, data: collections.abc.Sequence[SupportsInt | SupportsIndex]) None#
Set the flattened RGBA byte buffer.
- Parameters:
data (list[int]) – Texture bytes. The expected length is
4 * width * height.
- property height#
Texture height in pixels.
- property width#
Texture width in pixels.