@twinfinity/core
    Preparing search index...

    Class LazyResizableRawTexture

    A resizable RGBA raw texture where bits and bytes can be manipulated freely. The texture will always be square.

    Implements

    • ISceneComponent
    Index

    Constructors

    • Constructor

      Parameters

      • name: string

        Name of texture

      • hasAlpha: boolean

        Whether texture has alpha or not.

      • _maxTextureSize: number = 4096

        Maximum size of the texture. Default is 4096. May actually become less than the specified value if the GPU does not support it.

      • _onPixelChanged: Uint32BitsOnChangedEventHandler = ...

        Callback invoked when a pixel has changed its value.

      Returns LazyResizableRawTexture

    Properties

    hasAlpha: boolean

    Whether texture has alpha or not.

    name: string

    Name of texture

    onUpdateObservable: Observable<LazyResizableRawTexture> = ...

    Accessors

    • get scene(): Scene

      Returns Scene

    • get size(): number

      Size in pixels (RGBA) of texture.

      Returns number

    • get sizeInBytes(): number

      Total size in bytes of the RGBA texture

      Returns number

    Methods

    • Gets a Uint32Bits instance that can be used to manipulate the bits of the RGBA pixel stored at the offset specified by pixelOffset WARNING: Never ever store a reference to the Uint32Bits instance. It is reused for all pixels in the texture. whenever bits or bytes are called again the Uint32Bits instance will point to a new pixel. This behavior is because of performace.

      Parameters

      • pixelOffset: number

        Pixel offset.

      Returns Uint32Bits

      Uint32Bits instance

    • Gets a Uint32Bytes instance that can be used to manipulate the bytes of the RGBA pixel stored at the offset specified by pixelOffset WARNING: Never ever store a reference to the Uint32Bytes instance. It is reused for all pixels in the texture. whenever bits or bytes are called again the Uint32Bytes instance will point to a new pixel. This behavior is because of performace.

      Parameters

      • pixelOffset: number

        Pixel offset.

      Returns Uint32Bytes

      Uint32Bits instance

    • Returns void

    • Gets a BJS RawTexture that represents the current LazyResizableRawTexture instance.

      Parameters

      Returns RawTexture

      A BJS RawTexture.

    • Returns void

    • Returns void

    • Resets texture. back to 0 size.

      Returns void

    • Sets the minimum size of the texture. If the texture is already larger then size will not be changed.

      Parameters

      • sz: number

        Minimum size.

      Returns number

      The actual size.

    • Updates the texture (uploads it to the GPU) if required. Will only be updated if there actually is changes in the texture since the last time that updateIfTextureHasChanges was called.

      Parameters

      • scene: Scene
      • forceRecreate: boolean = false

      Returns boolean

      true if texture was updated, otherwise false.