Small World Engine API Reference - v0.46.1
    Preparing search index...

    Class Texture

    Represents a 2D texture.

    Hierarchy (View Summary)

    Index

    Constructors

    • Protected constructor. Use static factory methods to create instances.

      Parameters

      • Optionalimage: ImageBitmap | HTMLImageElement

        Optional initial image data.

      • options: TextureOptions = {}

        Optional configuration options.

      Returns Texture

    Properties

    addressModeU: TextureWrap = TextureWrap.REPEAT

    The wrapping mode for the U coordinate.

    addressModeV: TextureWrap = TextureWrap.REPEAT

    The wrapping mode for the V coordinate.

    anisotropy: number = 1

    Desired anisotropic filtering level for this texture.

    generateMipmaps: boolean = true

    Whether mipmaps should be generated for this texture.

    image: ImageBitmap | HTMLImageElement | undefined = undefined

    The underlying image or bitmap data.

    isLoaded: boolean = false

    Whether the texture is fully loaded and ready for use.

    magFilter: TextureFilter = TextureFilter.LINEAR

    The magnification filter.

    minFilter: TextureFilter = TextureFilter.LINEAR

    The minification filter.

    offset: { x: number; y: number } = ...

    The UV offset.

    repeat: { x: number; y: number } = ...

    The UV repeat factors.

    Methods

    • Flips the texture horizontally by modifying the UV offset and repeat.

      Returns this

      This texture instance for chaining.

    • Flips the texture vertically by modifying the UV offset and repeat.

      Returns this

      This texture instance for chaining.

    • Creates a texture from an existing image or bitmap.

      Parameters

      • image: ImageBitmap | HTMLImageElement

        The image or bitmap data.

      • Optionaloptions: TextureOptions

        Optional configuration options.

      Returns Texture

      A new Texture instance.