123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518 |
- import type { Nullable, IndicesArray, DataArray, FloatArray, DeepImmutable } from "../types";
- import { Engine } from "../Engines/engine";
- import type { VertexBuffer } from "../Buffers/buffer";
- import { InternalTexture, InternalTextureSource } from "../Materials/Textures/internalTexture";
- import type { BaseTexture } from "../Materials/Textures/baseTexture";
- import type { Effect } from "../Materials/effect";
- import { DataBuffer } from "../Buffers/dataBuffer";
- import type { Scene } from "../scene";
- import type { RenderTargetCreationOptions, TextureSize, DepthTextureCreationOptions, InternalTextureCreationOptions } from "../Materials/Textures/textureCreationOptions";
- import type { IPipelineContext } from "./IPipelineContext";
- import type { IColor3Like, IColor4Like, IViewportLike } from "../Maths/math.like";
- import type { ISceneLike } from "./abstractEngine";
- import type { IMaterialContext } from "./IMaterialContext";
- import type { IDrawContext } from "./IDrawContext";
- import type { ICanvas, IImage } from "./ICanvas";
- import type { IStencilState } from "../States/IStencilState";
- import type { RenderTargetWrapper } from "./renderTargetWrapper";
- import type { NativeData } from "./Native/nativeDataStream";
- import { NativeDataStream } from "./Native/nativeDataStream";
- import type { INative, NativeFramebuffer, NativeTexture } from "./Native/nativeInterfaces";
- import type { HardwareTextureWrapper } from "../Materials/Textures/hardwareTextureWrapper";
- /**
- * Returns _native only after it has been defined by BabylonNative.
- * @internal
- */
- export declare function AcquireNativeObjectAsync(): Promise<INative>;
- /**
- * Registers a constructor on the _native object. See NativeXRFrame for an example.
- * @internal
- */
- export declare function RegisterNativeTypeAsync<Type>(typeName: string, constructor: Type): Promise<void>;
- /**
- * Container for accessors for natively-stored mesh data buffers.
- */
- declare class NativeDataBuffer extends DataBuffer {
- /**
- * Accessor value used to identify/retrieve a natively-stored index buffer.
- */
- nativeIndexBuffer?: NativeData;
- /**
- * Accessor value used to identify/retrieve a natively-stored vertex buffer.
- */
- nativeVertexBuffer?: NativeData;
- }
- /**
- * Options to create the Native engine
- */
- export interface NativeEngineOptions {
- /**
- * defines whether to adapt to the device's viewport characteristics (default: false)
- */
- adaptToDeviceRatio?: boolean;
- }
- /** @internal */
- export declare class NativeEngine extends Engine {
- private static readonly PROTOCOL_VERSION;
- private readonly _engine;
- private readonly _camera;
- private readonly _commandBufferEncoder;
- private _boundBuffersVertexArray;
- private _currentDepthTest;
- private _stencilTest;
- private _stencilMask;
- private _stencilFunc;
- private _stencilFuncRef;
- private _stencilFuncMask;
- private _stencilOpStencilFail;
- private _stencilOpDepthFail;
- private _stencilOpStencilDepthPass;
- private _zOffset;
- private _zOffsetUnits;
- private _depthWrite;
- setHardwareScalingLevel(level: number): void;
- constructor(options?: NativeEngineOptions);
- dispose(): void;
- /** @internal */
- static _createNativeDataStream(): NativeDataStream;
- /**
- * Can be used to override the current requestAnimationFrame requester.
- * @internal
- */
- protected _queueNewFrame(bindedRenderFunction: any, requester?: any): number;
- protected _restoreEngineAfterContextLost(): void;
- /**
- * Override default engine behavior.
- * @param framebuffer
- */
- _bindUnboundFramebuffer(framebuffer: Nullable<WebGLFramebuffer>): void;
- /**
- * Gets host document
- * @returns the host document object
- */
- getHostDocument(): Nullable<Document>;
- clear(color: Nullable<IColor4Like>, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
- createIndexBuffer(indices: IndicesArray, updateable?: boolean, _label?: string): NativeDataBuffer;
- createVertexBuffer(vertices: DataArray, updateable?: boolean, _label?: string): NativeDataBuffer;
- protected _recordVertexArrayObject(vertexArray: any, vertexBuffers: {
- [key: string]: VertexBuffer;
- }, indexBuffer: Nullable<NativeDataBuffer>, effect: Effect, overrideVertexBuffers?: {
- [kind: string]: Nullable<VertexBuffer>;
- }): void;
- bindBuffers(vertexBuffers: {
- [key: string]: VertexBuffer;
- }, indexBuffer: Nullable<NativeDataBuffer>, effect: Effect): void;
- recordVertexArrayObject(vertexBuffers: {
- [key: string]: VertexBuffer;
- }, indexBuffer: Nullable<NativeDataBuffer>, effect: Effect, overrideVertexBuffers?: {
- [kind: string]: Nullable<VertexBuffer>;
- }): WebGLVertexArrayObject;
- private _deleteVertexArray;
- bindVertexArrayObject(vertexArray: WebGLVertexArrayObject): void;
- releaseVertexArrayObject(vertexArray: WebGLVertexArrayObject): void;
- getAttributes(pipelineContext: IPipelineContext, attributesNames: string[]): number[];
- /**
- * Draw a list of indexed primitives
- * @param fillMode defines the primitive to use
- * @param indexStart defines the starting index
- * @param indexCount defines the number of index to draw
- * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
- */
- drawElementsType(fillMode: number, indexStart: number, indexCount: number, instancesCount?: number): void;
- /**
- * Draw a list of unindexed primitives
- * @param fillMode defines the primitive to use
- * @param verticesStart defines the index of first vertex to draw
- * @param verticesCount defines the count of vertices to draw
- * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
- */
- drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void;
- createPipelineContext(): IPipelineContext;
- createMaterialContext(): IMaterialContext | undefined;
- createDrawContext(): IDrawContext | undefined;
- /**
- * @internal
- */
- _preparePipelineContext(pipelineContext: IPipelineContext, vertexSourceCode: string, fragmentSourceCode: string, createAsRaw: boolean, _rawVertexSourceCode: string, _rawFragmentSourceCode: string, _rebuildRebind: any, defines: Nullable<string>): void;
- /**
- * @internal
- */
- _executeWhenRenderingStateIsCompiled(pipelineContext: IPipelineContext, action: () => void): void;
- createRawShaderProgram(): WebGLProgram;
- createShaderProgram(pipelineContext: IPipelineContext, vertexCode: string, fragmentCode: string, defines: Nullable<string>): WebGLProgram;
- /**
- * Inline functions in shader code that are marked to be inlined
- * @param code code to inline
- * @returns inlined code
- */
- inlineShaderCode(code: string): string;
- protected _setProgram(program: WebGLProgram): void;
- _deletePipelineContext(pipelineContext: IPipelineContext): void;
- getUniforms(pipelineContext: IPipelineContext, uniformsNames: string[]): WebGLUniformLocation[];
- bindUniformBlock(pipelineContext: IPipelineContext, blockName: string, index: number): void;
- bindSamplers(effect: Effect): void;
- getRenderWidth(useScreen?: boolean): number;
- getRenderHeight(useScreen?: boolean): number;
- setViewport(viewport: IViewportLike, requiredWidth?: number, requiredHeight?: number): void;
- enableScissor(x: number, y: number, width: number, height: number): void;
- disableScissor(): void;
- setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean, cullBackFaces?: boolean, stencil?: IStencilState, zOffsetUnits?: number): void;
- /**
- * Gets the client rect of native canvas. Needed for InputManager.
- * @returns a client rectangle
- */
- getInputElementClientRect(): Nullable<DOMRect>;
- /**
- * Set the z offset Factor to apply to current rendering
- * @param value defines the offset to apply
- */
- setZOffset(value: number): void;
- /**
- * Gets the current value of the zOffset Factor
- * @returns the current zOffset Factor state
- */
- getZOffset(): number;
- /**
- * Set the z offset Units to apply to current rendering
- * @param value defines the offset to apply
- */
- setZOffsetUnits(value: number): void;
- /**
- * Gets the current value of the zOffset Units
- * @returns the current zOffset Units state
- */
- getZOffsetUnits(): number;
- /**
- * Enable or disable depth buffering
- * @param enable defines the state to set
- */
- setDepthBuffer(enable: boolean): void;
- /**
- * Gets a boolean indicating if depth writing is enabled
- * @returns the current depth writing state
- */
- getDepthWrite(): boolean;
- getDepthFunction(): Nullable<number>;
- setDepthFunction(depthFunc: number): void;
- /**
- * Enable or disable depth writing
- * @param enable defines the state to set
- */
- setDepthWrite(enable: boolean): void;
- /**
- * Enable or disable color writing
- * @param enable defines the state to set
- */
- setColorWrite(enable: boolean): void;
- /**
- * Gets a boolean indicating if color writing is enabled
- * @returns the current color writing state
- */
- getColorWrite(): boolean;
- private applyStencil;
- private _setStencil;
- /**
- * Enable or disable the stencil buffer
- * @param enable defines if the stencil buffer must be enabled or disabled
- */
- setStencilBuffer(enable: boolean): void;
- /**
- * Gets a boolean indicating if stencil buffer is enabled
- * @returns the current stencil buffer state
- */
- getStencilBuffer(): boolean;
- /**
- * Gets the current stencil operation when stencil passes
- * @returns a number defining stencil operation to use when stencil passes
- */
- getStencilOperationPass(): number;
- /**
- * Sets the stencil operation to use when stencil passes
- * @param operation defines the stencil operation to use when stencil passes
- */
- setStencilOperationPass(operation: number): void;
- /**
- * Sets the current stencil mask
- * @param mask defines the new stencil mask to use
- */
- setStencilMask(mask: number): void;
- /**
- * Sets the current stencil function
- * @param stencilFunc defines the new stencil function to use
- */
- setStencilFunction(stencilFunc: number): void;
- /**
- * Sets the current stencil reference
- * @param reference defines the new stencil reference to use
- */
- setStencilFunctionReference(reference: number): void;
- /**
- * Sets the current stencil mask
- * @param mask defines the new stencil mask to use
- */
- setStencilFunctionMask(mask: number): void;
- /**
- * Sets the stencil operation to use when stencil fails
- * @param operation defines the stencil operation to use when stencil fails
- */
- setStencilOperationFail(operation: number): void;
- /**
- * Sets the stencil operation to use when depth fails
- * @param operation defines the stencil operation to use when depth fails
- */
- setStencilOperationDepthFail(operation: number): void;
- /**
- * Gets the current stencil mask
- * @returns a number defining the new stencil mask to use
- */
- getStencilMask(): number;
- /**
- * Gets the current stencil function
- * @returns a number defining the stencil function to use
- */
- getStencilFunction(): number;
- /**
- * Gets the current stencil reference value
- * @returns a number defining the stencil reference value to use
- */
- getStencilFunctionReference(): number;
- /**
- * Gets the current stencil mask
- * @returns a number defining the stencil mask to use
- */
- getStencilFunctionMask(): number;
- /**
- * Gets the current stencil operation when stencil fails
- * @returns a number defining stencil operation to use when stencil fails
- */
- getStencilOperationFail(): number;
- /**
- * Gets the current stencil operation when depth fails
- * @returns a number defining stencil operation to use when depth fails
- */
- getStencilOperationDepthFail(): number;
- /**
- * Sets alpha constants used by some alpha blending modes
- * @param r defines the red component
- * @param g defines the green component
- * @param b defines the blue component
- * @param a defines the alpha component
- */
- setAlphaConstants(r: number, g: number, b: number, a: number): void;
- /**
- * Sets the current alpha mode
- * @param mode defines the mode to use (one of the BABYLON.Constants.ALPHA_XXX)
- * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)
- * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering
- */
- setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
- /**
- * Gets the current alpha mode
- * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering
- * @returns the current alpha mode
- */
- getAlphaMode(): number;
- setInt(uniform: WebGLUniformLocation, int: number): boolean;
- setIntArray(uniform: WebGLUniformLocation, array: Int32Array): boolean;
- setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): boolean;
- setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): boolean;
- setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): boolean;
- setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): boolean;
- setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): boolean;
- setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): boolean;
- setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): boolean;
- setArray(uniform: WebGLUniformLocation, array: number[]): boolean;
- setArray2(uniform: WebGLUniformLocation, array: number[]): boolean;
- setArray3(uniform: WebGLUniformLocation, array: number[]): boolean;
- setArray4(uniform: WebGLUniformLocation, array: number[]): boolean;
- setMatrices(uniform: WebGLUniformLocation, matrices: DeepImmutable<FloatArray>): boolean;
- setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): boolean;
- setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): boolean;
- setFloat(uniform: WebGLUniformLocation, value: number): boolean;
- setFloat2(uniform: WebGLUniformLocation, x: number, y: number): boolean;
- setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): boolean;
- setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): boolean;
- setColor3(uniform: WebGLUniformLocation, color3: IColor3Like): boolean;
- setColor4(uniform: WebGLUniformLocation, color3: IColor3Like, alpha: number): boolean;
- wipeCaches(bruteForce?: boolean): void;
- protected _createTexture(): WebGLTexture;
- protected _deleteTexture(texture: Nullable<WebGLTexture>): void;
- /**
- * Update the content of a dynamic texture
- * @param texture defines the texture to update
- * @param canvas defines the canvas containing the source
- * @param invertY defines if data must be stored with Y axis inverted
- * @param premulAlpha defines if alpha is stored as premultiplied
- * @param format defines the format of the data
- */
- updateDynamicTexture(texture: Nullable<InternalTexture>, canvas: any, invertY: boolean, premulAlpha?: boolean, format?: number): void;
- createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture;
- createVideoElement(constraints: MediaTrackConstraints): any;
- updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;
- createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, type?: number, creationFlags?: number, useSRGBBuffer?: boolean): InternalTexture;
- createRawTexture2DArray(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, textureType?: number): InternalTexture;
- updateRawTexture(texture: Nullable<InternalTexture>, bufferView: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>, type?: number, useSRGBBuffer?: boolean): void;
- /**
- * Usually called from Texture.ts.
- * Passed information to create a NativeTexture
- * @param url defines a value which contains one of the following:
- * * A conventional http URL, e.g. 'http://...' or 'file://...'
- * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
- * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
- * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file
- * @param invertY when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)
- * @param scene needed for loading to the correct scene
- * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)
- * @param onLoad optional callback to be called upon successful completion
- * @param onError optional callback to be called upon failure
- * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob
- * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities
- * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures
- * @param forcedExtension defines the extension to use to pick the right loader
- * @param mimeType defines an optional mime type
- * @param loaderOptions options to be passed to the loader
- * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
- * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
- * @returns a InternalTexture for assignment back into BABYLON.Texture
- */
- createTexture(url: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<ISceneLike>, samplingMode?: number, onLoad?: Nullable<(texture: InternalTexture) => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap>, fallback?: Nullable<InternalTexture>, format?: Nullable<number>, forcedExtension?: Nullable<string>, mimeType?: string, loaderOptions?: any, creationFlags?: number, useSRGBBuffer?: boolean): InternalTexture;
- /**
- * Wraps an external native texture in a Babylon texture.
- * @param texture defines the external texture
- * @param hasMipMaps defines whether the external texture has mip maps
- * @param samplingMode defines the sampling mode for the external texture (default: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE)
- * @returns the babylon internal texture
- */
- wrapNativeTexture(texture: NativeTexture, hasMipMaps?: boolean, samplingMode?: number): InternalTexture;
- /**
- * Wraps an external web gl texture in a Babylon texture.
- * @returns the babylon internal texture
- */
- wrapWebGLTexture(): InternalTexture;
- _createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;
- /**
- * @internal
- */
- _releaseFramebufferObjects(framebuffer: Nullable<NativeFramebuffer>): void;
- /**
- * @internal Engine abstraction for loading and creating an image bitmap from a given source string.
- * @param imageSource source to load the image from.
- * @param options An object that sets options for the image's extraction.
- * @returns ImageBitmap
- */
- _createImageBitmapFromSource(imageSource: string, options?: ImageBitmapOptions): Promise<ImageBitmap>;
- /**
- * Engine abstraction for createImageBitmap
- * @param image source for image
- * @param options An object that sets options for the image's extraction.
- * @returns ImageBitmap
- */
- createImageBitmap(image: ImageBitmapSource, options?: ImageBitmapOptions): Promise<ImageBitmap>;
- /**
- * Resize an image and returns the image data as an uint8array
- * @param image image to resize
- * @param bufferWidth destination buffer width
- * @param bufferHeight destination buffer height
- * @returns an uint8array containing RGBA values of bufferWidth * bufferHeight size
- */
- resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;
- /**
- * Creates a cube texture
- * @param rootUrl defines the url where the files to load is located
- * @param scene defines the current scene
- * @param files defines the list of files to load (1 per face)
- * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)
- * @param onLoad defines an optional callback raised when the texture is loaded
- * @param onError defines an optional callback raised if there is an issue to load the texture
- * @param format defines the format of the data
- * @param forcedExtension defines the extension to use to pick the right loader
- * @param createPolynomials if a polynomial sphere should be created for the cube texture
- * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness
- * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness
- * @param fallback defines texture to use while falling back when (compressed) texture file not found.
- * @param loaderOptions options to be passed to the loader
- * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
- * @returns the cube texture as an InternalTexture
- */
- createCubeTexture(rootUrl: string, scene: Nullable<Scene>, files: Nullable<string[]>, noMipmap?: boolean, onLoad?: Nullable<(data?: any) => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number, forcedExtension?: any, createPolynomials?: boolean, lodScale?: number, lodOffset?: number, fallback?: Nullable<InternalTexture>, loaderOptions?: any, useSRGBBuffer?: boolean): InternalTexture;
- /** @internal */
- _createHardwareTexture(): HardwareTextureWrapper;
- /** @internal */
- _createHardwareRenderTargetWrapper(isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper;
- /** @internal */
- _createInternalTexture(size: TextureSize, options: boolean | InternalTextureCreationOptions, _delayGPUTextureCreation?: boolean, source?: InternalTextureSource): InternalTexture;
- createRenderTargetTexture(size: number | {
- width: number;
- height: number;
- depth: number;
- }, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper;
- updateRenderTargetTextureSampleCount(rtWrapper: RenderTargetWrapper, samples: number): number;
- updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void;
- bindFramebuffer(texture: RenderTargetWrapper, faceIndex?: number, requiredWidth?: number, requiredHeight?: number, forceFullscreenViewport?: boolean): void;
- unBindFramebuffer(texture: RenderTargetWrapper, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
- createDynamicVertexBuffer(data: DataArray): DataBuffer;
- updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset?: number): void;
- updateDynamicVertexBuffer(vertexBuffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void;
- protected _setTexture(channel: number, texture: Nullable<BaseTexture>, isPartOfTextureArray?: boolean, depthStencilTexture?: boolean): boolean;
- private _setTextureSampling;
- private _setTextureWrapMode;
- private _setTextureCore;
- private _updateAnisotropicLevel;
- /**
- * @internal
- */
- _bindTexture(channel: number, texture: InternalTexture): void;
- protected _deleteBuffer(buffer: NativeDataBuffer): void;
- /**
- * Create a canvas
- * @param width width
- * @param height height
- * @returns ICanvas interface
- */
- createCanvas(width: number, height: number): ICanvas;
- /**
- * Create an image to use with canvas
- * @returns IImage interface
- */
- createCanvasImage(): IImage;
- /**
- * Update a portion of an internal texture
- * @param texture defines the texture to update
- * @param imageData defines the data to store into the texture
- * @param xOffset defines the x coordinates of the update rectangle
- * @param yOffset defines the y coordinates of the update rectangle
- * @param width defines the width of the update rectangle
- * @param height defines the height of the update rectangle
- * @param faceIndex defines the face index if texture is a cube (0 by default)
- * @param lod defines the lod level to update (0 by default)
- * @param generateMipMaps defines whether to generate mipmaps or not
- */
- updateTextureData(texture: InternalTexture, imageData: ArrayBufferView, xOffset: number, yOffset: number, width: number, height: number, faceIndex?: number, lod?: number, generateMipMaps?: boolean): void;
- /**
- * @internal
- */
- _uploadCompressedDataToTextureDirectly(texture: InternalTexture, internalFormat: number, width: number, height: number, data: ArrayBufferView, faceIndex?: number, lod?: number): void;
- /**
- * @internal
- */
- _uploadDataToTextureDirectly(texture: InternalTexture, imageData: ArrayBufferView, faceIndex?: number, lod?: number): void;
- /**
- * @internal
- */
- _uploadArrayBufferViewToTexture(texture: InternalTexture, imageData: ArrayBufferView, faceIndex?: number, lod?: number): void;
- /**
- * @internal
- */
- _uploadImageToTexture(texture: InternalTexture, image: HTMLImageElement, faceIndex?: number, lod?: number): void;
- getFontOffset(font: string): {
- ascent: number;
- height: number;
- descent: number;
- };
- /**
- * No equivalent for native. Do nothing.
- */
- flushFramebuffer(): void;
- _readTexturePixels(texture: InternalTexture, width: number, height: number, faceIndex?: number, level?: number, buffer?: Nullable<ArrayBufferView>, _flushRenderer?: boolean, _noDataConversion?: boolean, x?: number, y?: number): Promise<ArrayBufferView>;
- }
- export {};
|