import { Observable } from "../../Misc/observable"; import type { ImageSource, Nullable, int } from "../../types"; import type { ICanvas, ICanvasRenderingContext } from "../../Engines/ICanvas"; import type { HardwareTextureWrapper } from "./hardwareTextureWrapper"; import { TextureSampler } from "./textureSampler"; import type { AbstractEngine } from "../../Engines/abstractEngine"; import type { BaseTexture } from "../../Materials/Textures/baseTexture"; import type { SphericalPolynomial } from "../../Maths/sphericalPolynomial"; /** * Defines the source of the internal texture */ export declare enum InternalTextureSource { /** * The source of the texture data is unknown */ Unknown = 0, /** * Texture data comes from an URL */ Url = 1, /** * Texture data is only used for temporary storage */ Temp = 2, /** * Texture data comes from raw data (ArrayBuffer) */ Raw = 3, /** * Texture content is dynamic (video or dynamic texture) */ Dynamic = 4, /** * Texture content is generated by rendering to it */ RenderTarget = 5, /** * Texture content is part of a multi render target process */ MultiRenderTarget = 6, /** * Texture data comes from a cube data file */ Cube = 7, /** * Texture data comes from a raw cube data */ CubeRaw = 8, /** * Texture data come from a prefiltered cube data file */ CubePrefiltered = 9, /** * Texture content is raw 3D data */ Raw3D = 10, /** * Texture content is raw 2D array data */ Raw2DArray = 11, /** * Texture content is a depth/stencil texture */ DepthStencil = 12, /** * Texture data comes from a raw cube data encoded with RGBD */ CubeRawRGBD = 13, /** * Texture content is a depth texture */ Depth = 14 } /** * Class used to store data associated with WebGL texture data for the engine * This class should not be used directly */ export declare class InternalTexture extends TextureSampler { /** * Defines if the texture is ready */ isReady: boolean; /** * Defines if the texture is a cube texture */ isCube: boolean; /** * Defines if the texture contains 3D data */ is3D: boolean; /** * Defines if the texture contains 2D array data */ is2DArray: boolean; /** * Defines if the texture contains multiview data */ isMultiview: boolean; /** * Gets the URL used to load this texture */ url: string; /** @internal */ _originalUrl: string; /** * Gets a boolean indicating if the texture needs mipmaps generation */ generateMipMaps: boolean; /** * Gets a boolean indicating if the texture uses mipmaps * TODO implements useMipMaps as a separate setting from generateMipMaps */ get useMipMaps(): boolean; set useMipMaps(value: boolean); /** * Gets the number of samples used by the texture (WebGL2+ only) */ samples: number; /** * Gets the type of the texture (int, float...) */ type: number; /** * Gets the format of the texture (RGB, RGBA...) */ format: number; /** * Observable called when the texture is loaded */ onLoadedObservable: Observable; /** * Observable called when the texture load is raising an error */ onErrorObservable: Observable>; /** * If this callback is defined it will be called instead of the default _rebuild function */ onRebuildCallback: Nullable<(internalTexture: InternalTexture) => { proxy: Nullable>; isReady: boolean; isAsync: boolean; }>; /** * Gets the width of the texture */ width: number; /** * Gets the height of the texture */ height: number; /** * Gets the depth of the texture */ depth: number; /** * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures) */ baseWidth: number; /** * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures) */ baseHeight: number; /** * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures) */ baseDepth: number; /** * Gets a boolean indicating if the texture is inverted on Y axis */ invertY: boolean; /** @internal */ _invertVScale: boolean; /** @internal */ _associatedChannel: number; /** @internal */ _source: InternalTextureSource; /** @internal */ _buffer: Nullable; /** @internal */ _bufferView: Nullable; /** @internal */ _bufferViewArray: Nullable; /** @internal */ _bufferViewArrayArray: Nullable; /** @internal */ _size: number; /** @internal */ _extension: string; /** @internal */ _files: Nullable; /** @internal */ _workingCanvas: Nullable; /** @internal */ _workingContext: Nullable; /** @internal */ _cachedCoordinatesMode: Nullable; /** @internal */ _isDisabled: boolean; /** @internal */ _compression: Nullable; /** @internal */ _sphericalPolynomial: Nullable; /** @internal */ _sphericalPolynomialPromise: Nullable>; /** @internal */ _sphericalPolynomialComputed: boolean; /** @internal */ _lodGenerationScale: number; /** @internal */ _lodGenerationOffset: number; /** @internal */ _useSRGBBuffer: boolean; /** @internal */ _creationFlags: number; /** @internal */ _originalFormat?: number; /** @internal */ _lodTextureHigh: Nullable; /** @internal */ _lodTextureMid: Nullable; /** @internal */ _lodTextureLow: Nullable; /** @internal */ _isRGBD: boolean; /** @internal */ _linearSpecularLOD: boolean; /** @internal */ _irradianceTexture: Nullable; /** @internal */ _hardwareTexture: Nullable; /** @internal */ _maxLodLevel: Nullable; /** @internal */ _references: number; /** @internal */ _gammaSpace: Nullable; /** @internal */ _premulAlpha: boolean; /** @internal */ _dynamicTextureSource: Nullable; private _engine; private _uniqueId; /** @internal */ static _Counter: number; /** Gets the unique id of the internal texture */ get uniqueId(): number; /** @internal */ _setUniqueId(id: number): void; /** * Gets the Engine the texture belongs to. * @returns The babylon engine */ getEngine(): AbstractEngine; /** * Gets the data source type of the texture */ get source(): InternalTextureSource; /** * Creates a new InternalTexture * @param engine defines the engine to use * @param source defines the type of data that will be used * @param delayAllocation if the texture allocation should be delayed (default: false) */ constructor(engine: AbstractEngine, source: InternalTextureSource, delayAllocation?: boolean); /** * Increments the number of references (ie. the number of Texture that point to it) */ incrementReferences(): void; /** * Change the size of the texture (not the size of the content) * @param width defines the new width * @param height defines the new height * @param depth defines the new depth (1 by default) */ updateSize(width: int, height: int, depth?: int): void; /** @internal */ _rebuild(): void; /** * @internal */ _swapAndDie(target: InternalTexture, swapAll?: boolean): void; /** * Dispose the current allocated resources */ dispose(): void; }