123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- 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<InternalTexture>;
- /**
- * Observable called when the texture load is raising an error
- */
- onErrorObservable: Observable<Partial<{
- message: string;
- exception: any;
- }>>;
- /**
- * If this callback is defined it will be called instead of the default _rebuild function
- */
- onRebuildCallback: Nullable<(internalTexture: InternalTexture) => {
- proxy: Nullable<InternalTexture | Promise<InternalTexture>>;
- 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<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap>;
- /** @internal */
- _bufferView: Nullable<ArrayBufferView>;
- /** @internal */
- _bufferViewArray: Nullable<ArrayBufferView[]>;
- /** @internal */
- _bufferViewArrayArray: Nullable<ArrayBufferView[][]>;
- /** @internal */
- _size: number;
- /** @internal */
- _extension: string;
- /** @internal */
- _files: Nullable<string[]>;
- /** @internal */
- _workingCanvas: Nullable<ICanvas>;
- /** @internal */
- _workingContext: Nullable<ICanvasRenderingContext>;
- /** @internal */
- _cachedCoordinatesMode: Nullable<number>;
- /** @internal */
- _isDisabled: boolean;
- /** @internal */
- _compression: Nullable<string>;
- /** @internal */
- _sphericalPolynomial: Nullable<SphericalPolynomial>;
- /** @internal */
- _sphericalPolynomialPromise: Nullable<Promise<SphericalPolynomial>>;
- /** @internal */
- _sphericalPolynomialComputed: boolean;
- /** @internal */
- _lodGenerationScale: number;
- /** @internal */
- _lodGenerationOffset: number;
- /** @internal */
- _useSRGBBuffer: boolean;
- /** @internal */
- _creationFlags: number;
- /** @internal */
- _originalFormat?: number;
- /** @internal */
- _lodTextureHigh: Nullable<BaseTexture>;
- /** @internal */
- _lodTextureMid: Nullable<BaseTexture>;
- /** @internal */
- _lodTextureLow: Nullable<BaseTexture>;
- /** @internal */
- _isRGBD: boolean;
- /** @internal */
- _linearSpecularLOD: boolean;
- /** @internal */
- _irradianceTexture: Nullable<BaseTexture>;
- /** @internal */
- _hardwareTexture: Nullable<HardwareTextureWrapper>;
- /** @internal */
- _maxLodLevel: Nullable<number>;
- /** @internal */
- _references: number;
- /** @internal */
- _gammaSpace: Nullable<boolean>;
- /** @internal */
- _premulAlpha: boolean;
- /** @internal */
- _dynamicTextureSource: Nullable<ImageSource>;
- 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;
- }
|