magic-pixels
    Preparing search index...

    Class Texture

    A texture is plain data: an image plus sampling parameters. The renderer uploads it the first time it is used as a uniform and assigns texture units.

    Index
    colorSpace: ColorSpace = ColorSpace.LINEAR

    Whether the image is sRGB-encoded, as every photo or hand-painted texture is ('srgb'), or holds numbers that only look like an image, like a normal or roughness map ('linear', the default: no conversion). 'srgb' uploads with an sRGB internal format so the GPU decodes it to linear values before the shader samples it.

    flipY: boolean = false

    Flip the image vertically on upload (default false). glTF and most image loaders assume row 0 is the top; WebGL's texture coordinate v = 0 is the bottom, so flipping here makes v = 0 line up with the top of the picture instead of flipping UVs in the shader.

    isEmpty: boolean = false

    True for a texture made with Texture.empty: it has a size but no pixels, so the renderer allocates GPU storage for it instead of uploading image.

    magFilter: Filter = Filter.NEAREST
    minFilter: Filter = Filter.NEAREST
    needsUpdate: boolean = false

    Set to true after the image (or its contents, e.g. a video frame or a canvas) changed so the renderer re-uploads it. The renderer resets it.

    wrapS: Wrapping = Wrapping.CLAMP_TO_EDGE
    wrapT: Wrapping = Wrapping.CLAMP_TO_EDGE
    • A texture with no image data yet, sized width x height. Used for render target attachments: nothing ever samples this placeholder's pixels, so its data is empty and only width/height are real - the renderer allocates GPU storage at that size instead of uploading pixels.

      Parameters

      Returns Texture