Interface SceneTextureParams

SceneTexture creation parameters for SceneModel.createTexture.

interface SceneTextureParams {
    buffers?: ArrayBuffer[];
    encoding?: number;
    flipY?: boolean;
    id: string;
    image?: SceneTextureImageSource;
    imageData?: ImageData | SceneTexturePixelBuffer;
    magFilter?: number;
    mediaType?: any;
    minFilter?: number;
    mipmap?: boolean;
    preloadColor?: Vec4;
    src?: string;
    wrapR?: number;
    wrapS?: number;
    wrapT?: number;
}

Properties

buffers?: ArrayBuffer[]

Transcoded / compressed texture data, decoded by the runtime transcoder pipeline before upload.

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.

id: string

ID for the texture.

Already-decoded image source the renderer can hand straight to texSubImage2D. Pass canvases, HTMLImageElements, ImageBitmaps, and OffscreenCanvases here.

imageData?: ImageData | SceneTexturePixelBuffer

Raw pixel buffer with explicit dimensions. JSON-serialisable params produced by SceneTexture.toParams use the plain { data, width, height } form; the constructor normalises that back into a DOM ImageData for the renderer.

Use SceneTextureParams.image for already-decoded canvas / image / ImageBitmap inputs.

magFilter?: number

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

Supported values are LinearFilter and NearestFilter.

mediaType?: any

Media type.

minFilter?: number

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

Supported values are LinearMipmapLinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter and LinearMipMapLinearFilter.

mipmap?: boolean

Opt this texture into mipmapped sampling. When true, the renderer 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 with LINEAR_MIPMAP_LINEAR, eliminating shimmer at distance and grazing angles.

Default false — mipmaps cost about 33% extra atlas memory and the renderer regenerates the whole atlas pyramid on every slice add (cheap when textures are uploaded once at load, noticeable past ~100 streamed-in textures).

Caveat: a material that binds a mix of opted-in and non-opted-in textures lands its meshes in a single mipped batch — the non-opted-in textures end up in a mipped atlas too. In practice, opt every map of a material in or out together.

preloadColor?: Vec4

RGBA color to preload the texture with.

src?: string

URL to fetch the image from. Any URL form is accepted — http(s):, blob:, or data:. A canvas serialised via canvas.toDataURL() belongs here, not in imageData.

wrapR?: number

Wrap parameter for texture coordinate R.

Supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping.

wrapS?: number

Wrap parameter for texture coordinate S.

Supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping.

wrapT?: number

Wrap parameter for texture coordinate T.

Supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping.