Documentation
    Preparing search index...

    Class VideoTexture

    A restorable video texture. Frame callbacks only invalidate; the application calls update() before rendering. Without callbacks, currentTime is the fallback signal. The video and read surface remain caller-owned. New video dimensions are validated against maximumBytes before any canvas or texture allocation changes.

    Hierarchy (View Summary)

    Index
    id: string = ...

    Stable identity (§77, §83), assigned at construction from a monotonic counter and formatted texture-<n>. Unique within a process, ascending in construction order, never reused.

    • get anisotropy(): number

      How many anisotropic samples this texture asks for (§77; R-30b), 1 when the source names none.

      A request: the backend clamps it to the device maximum and ignores it where EXT_texture_filter_anisotropic is absent — see TextureSource.anisotropy for why that is §62's answer rather than §85's.

      Returns number

    • get byteLength(): number

      Bytes this texture describes (§83, §84's textureMemory) — four per texel at the current size, which is what an RGBA8 upload costs.

      new Texture({ width: 256, height: 256 }).byteLength; // 262144
      

      Counted from the size, not from data: a source with no CPU-side bytes still makes the backend allocate zero-filled storage of exactly this size (see TextureSource.data), so billing it zero would under-report the memory the engine holds.

      Mip levels count since R-30b (2026-08-21): a texture with mipmaps: true bills the whole chain, summed level by level down to 1 × 1 — about a third more, and exactly a third more only for a square power-of-two texture, which is why it is summed rather than multiplied by 4/3. A texture with no chain is unchanged, so no existing §84 number moves.

      new Texture({ width: 4, height: 4, mipmaps: true }).byteLength;
      // 64 + 16 + 4 = 84

      0 once disposed, because a disposed texture holds nothing — one rule, so that a write into a disposed texture (already a §83 "disposed resource still in use" mistake) cannot resurrect its bytes in the process-wide totals.

      Returns number

    • get colorSpace(): ColorSpace

      The colour space of the texels (§60a). Resolved here rather than left optional so the backend reads one value and never repeats the ??; MaterialTexture.colorSpace stays optional because a test double and every pre-R-15 texture satisfy it unchanged.

      Authored colorSpace always wins. When it is omitted: TextureSource.role "color" resolves to "srgb", and every other case — "data", or no role at all — stays "linear", the dated R-15 default. See TextureSource.role for the table.

      Returns ColorSpace

    • get data(): Uint8Array<ArrayBufferLike> | null

      The RGBA8 bytes, or null when the source carries none.

      A flat accessor rather than source.data because it is the field a backend reads on the upload path, and because SpriteMaterial's SpriteTexture contract — the seam through which a backend actually sees a texture — is expressed in terms of it. null rather than undefined for the same reason: the contract is "there is no data", and a backend narrows it with one comparison.

      Returns Uint8Array<ArrayBufferLike> | null

    • get filter(): MaterialTextureFilter

      How this texture is sampled between texel centres (§77; R-30), "linear" when the source names none — see TextureSource.filter.

      Resolved here rather than left optional for colorSpace's reason: the backend reads one value and never repeats the ??, while MaterialTexture.filter stays optional so every pre-R-30 texture and every test double satisfies the contract unchanged.

      Sampler state is read at upload time. Changing it on a texture the backend has already uploaded therefore needs Texture.markDirty (or a new Texture.source, which bumps the version for you) — the same announcement an in-place texel edit needs, and for the same reason.

      Returns MaterialTextureFilter

    • get mipmaps(): boolean

      Whether this texture carries a mip chain (§77; R-30b), false when the source says nothing — see TextureSource.mipmaps.

      Like every other piece of sampler state, it is read at upload time: turning it on for a texture a backend already holds needs Texture.markDirty (or a new Texture.source).

      Returns boolean

    • get role(): TextureMapRole | null

      Whether this texture is a colour map or a data map (§60a, §77; R-30c). null when the source names none — see TextureSource.role. No default is invented: omitting the field is how every pre-R-30c texture keeps its dated "linear" colour space.

      Returns TextureMapRole | null

    • get version(): number

      Counter incremented on every mutation (§77). Backends cache GPU uploads against it; treat it as opaque and compare for inequality, exactly like Transform.version. Monotonic, never wraps in a realistic session.

      Returns number

    • Releases this texture's CPU-side data (§83). Idempotent.

      The byte array is dropped — a 2048² atlas is 16 MB, and its owner should be able to reclaim that the moment nothing needs it — and the version is bumped so any backend cache keyed on it re-reads. A backend that then meets this texture in a render list skips the draw: Texture.disposed is the flag the §83 "disposed resource still in use" diagnostic checks, and drawing a sprite with no texels would paint undefined content rather than report the mistake.

      Disposing does not notify the materials pointing at this texture; ownership is explicit and upwards (§83), so whoever created the texture decides when nothing needs it any more.

      It does remove this texture and its bytes from the process-wide §83 totals (textureMemoryBytes, liveTextureCount), exactly once: the idempotence guard above is what makes a double dispose() subtract once rather than twice.

      Returns void

    • Explicit signal for hosts without a frame callback or for a paused-frame edit.

      Returns void

    • Announces a mutation the texture could not see — an in-place write into source.data. Bumps Texture.version by one, which invalidates every backend upload keyed on it.

      Calling it after assigning Texture.source is harmless, only wasteful: the version advances again and the texture re-uploads once more.

      Parameters

      Returns void