Properties

buffers?: ArrayBuffer[]

Transcoded / compressed texture data.

compressed: boolean

True if the texture is compressed.

destroyed: boolean = false

True if this SceneTexture has been destroyed.

encoding: number

SceneTexture encoding format.

Supported values are LinearEncoding and sRGBEncoding.

flipY: boolean

Flips this SceneTexture's source data along its vertical axis when true.

height: number

Pixel height of the texture.

id: string

ID for the texture.

Already-decoded image source the renderer can hand straight to texSubImage2DHTMLImageElement, HTMLCanvasElement, ImageBitmap, or OffscreenCanvas.

magFilter: number

How the texture is sampled when a texel covers more than one pixel.

Supported values are LinearFilter and NearestFilter.

mediaType?: number

Media type of this SceneTexture.

Supported values are GIFMediaType, PNGMediaType and JPEGMediaType.

Ignored for compressed textures.

minFilter: number

How the texture is sampled when a texel covers less than one pixel. Supported values are LinearMipmapLinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter and LinearMipMapLinearFilter.

Ignored for compressed textures.

mipmap: boolean

Mipmap opt-in. true routes meshes whose materials reference this SceneTexture into a mipmap-bearing batch; the per-batch atlas is allocated with a full mip pyramid and sampled trilinearly. Default false.

model: SceneModel

The SceneModel that this texture belongs to.

numMaterials: number

The count of SceneMaterials that reference this SceneTexture (in any of the colour, normals, metallic-roughness, occlusion, or emissive slots). Maintained by SceneModel.createMaterial / SceneModel._destroyMaterial. Used by destroy to refuse destruction while at least one material still references the texture (the same guard SceneGeometry.destroy and SceneMaterial.destroy carry).

preloadColor: Vec4

RGBA color to preload the texture with.

src?: string

URL to fetch the image from. Any URL form (http(s):, blob:, data:). toParams writes serialised images here as data URLs.

width: number

Pixel width of the texture.

wrapR: number

R wrapping mode.

Supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping.

Ignored for compressed textures.

wrapS: number

S wrapping mode.

Supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping.

Ignored for compressed textures.

wrapT: number

T wrapping mode.

Supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping.

Ignored for compressed textures.

Accessors

  • get imageData(): ImageData

    The raw pixel buffer backing this SceneTexture, or undefined for image-element / encoded-buffer textures.

    Returns ImageData

  • set imageData(value: ImageData | SceneTexturePixelBuffer): void

    Replace this SceneTexture's pixel buffer.

    Accepts either a DOM ImageData or the JSON-friendly {data, width, height} form (normalised to ImageData here). Every assignment fires Scene.events.onSceneTextureImageDataChanged so the renderer can re-upload the pixels into its atlas sub-rect via texSubImage2D — no batch / mesh / material rebuild.

    The setter fires unconditionally on every assignment (no identity skip), so callers that mutate the bytes of an existing ImageData in place can re-trigger the upload by reassigning the same buffer: texture.imageData = texture.imageData.

    Parameters

    Returns void

Methods

  • Returns a JSON-serializable object containing this SceneTexture's parameters.

    image (canvas / HTMLImage / ImageBitmap / OffscreenCanvas) isn't JSON-serialisable, so it gets rendered through a 2D canvas and folded into src as a PNG data URL — src is the one canonical field for "encoded image, please decode it." imageData (raw pixels) is emitted as a { data, width, height } plain object so the typed array survives JSON.stringify. buffers and the rest of the sampler state pass straight through.

    Returns SDKResult<SceneTextureParams>