nativeEngine.d.ts 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. import type { Nullable, IndicesArray, DataArray, FloatArray, DeepImmutable } from "../types";
  2. import { Engine } from "../Engines/engine";
  3. import type { VertexBuffer } from "../Buffers/buffer";
  4. import { InternalTexture, InternalTextureSource } from "../Materials/Textures/internalTexture";
  5. import type { BaseTexture } from "../Materials/Textures/baseTexture";
  6. import type { Effect } from "../Materials/effect";
  7. import { DataBuffer } from "../Buffers/dataBuffer";
  8. import type { Scene } from "../scene";
  9. import type { RenderTargetCreationOptions, TextureSize, DepthTextureCreationOptions, InternalTextureCreationOptions } from "../Materials/Textures/textureCreationOptions";
  10. import type { IPipelineContext } from "./IPipelineContext";
  11. import type { IColor3Like, IColor4Like, IViewportLike } from "../Maths/math.like";
  12. import type { ISceneLike } from "./abstractEngine";
  13. import type { IMaterialContext } from "./IMaterialContext";
  14. import type { IDrawContext } from "./IDrawContext";
  15. import type { ICanvas, IImage } from "./ICanvas";
  16. import type { IStencilState } from "../States/IStencilState";
  17. import type { RenderTargetWrapper } from "./renderTargetWrapper";
  18. import type { NativeData } from "./Native/nativeDataStream";
  19. import { NativeDataStream } from "./Native/nativeDataStream";
  20. import type { INative, NativeFramebuffer, NativeTexture } from "./Native/nativeInterfaces";
  21. import type { HardwareTextureWrapper } from "../Materials/Textures/hardwareTextureWrapper";
  22. /**
  23. * Returns _native only after it has been defined by BabylonNative.
  24. * @internal
  25. */
  26. export declare function AcquireNativeObjectAsync(): Promise<INative>;
  27. /**
  28. * Registers a constructor on the _native object. See NativeXRFrame for an example.
  29. * @internal
  30. */
  31. export declare function RegisterNativeTypeAsync<Type>(typeName: string, constructor: Type): Promise<void>;
  32. /**
  33. * Container for accessors for natively-stored mesh data buffers.
  34. */
  35. declare class NativeDataBuffer extends DataBuffer {
  36. /**
  37. * Accessor value used to identify/retrieve a natively-stored index buffer.
  38. */
  39. nativeIndexBuffer?: NativeData;
  40. /**
  41. * Accessor value used to identify/retrieve a natively-stored vertex buffer.
  42. */
  43. nativeVertexBuffer?: NativeData;
  44. }
  45. /**
  46. * Options to create the Native engine
  47. */
  48. export interface NativeEngineOptions {
  49. /**
  50. * defines whether to adapt to the device's viewport characteristics (default: false)
  51. */
  52. adaptToDeviceRatio?: boolean;
  53. }
  54. /** @internal */
  55. export declare class NativeEngine extends Engine {
  56. private static readonly PROTOCOL_VERSION;
  57. private readonly _engine;
  58. private readonly _camera;
  59. private readonly _commandBufferEncoder;
  60. private _boundBuffersVertexArray;
  61. private _currentDepthTest;
  62. private _stencilTest;
  63. private _stencilMask;
  64. private _stencilFunc;
  65. private _stencilFuncRef;
  66. private _stencilFuncMask;
  67. private _stencilOpStencilFail;
  68. private _stencilOpDepthFail;
  69. private _stencilOpStencilDepthPass;
  70. private _zOffset;
  71. private _zOffsetUnits;
  72. private _depthWrite;
  73. setHardwareScalingLevel(level: number): void;
  74. constructor(options?: NativeEngineOptions);
  75. dispose(): void;
  76. /** @internal */
  77. static _createNativeDataStream(): NativeDataStream;
  78. /**
  79. * Can be used to override the current requestAnimationFrame requester.
  80. * @internal
  81. */
  82. protected _queueNewFrame(bindedRenderFunction: any, requester?: any): number;
  83. protected _restoreEngineAfterContextLost(): void;
  84. /**
  85. * Override default engine behavior.
  86. * @param framebuffer
  87. */
  88. _bindUnboundFramebuffer(framebuffer: Nullable<WebGLFramebuffer>): void;
  89. /**
  90. * Gets host document
  91. * @returns the host document object
  92. */
  93. getHostDocument(): Nullable<Document>;
  94. clear(color: Nullable<IColor4Like>, backBuffer: boolean, depth: boolean, stencil?: boolean): void;
  95. createIndexBuffer(indices: IndicesArray, updateable?: boolean, _label?: string): NativeDataBuffer;
  96. createVertexBuffer(vertices: DataArray, updateable?: boolean, _label?: string): NativeDataBuffer;
  97. protected _recordVertexArrayObject(vertexArray: any, vertexBuffers: {
  98. [key: string]: VertexBuffer;
  99. }, indexBuffer: Nullable<NativeDataBuffer>, effect: Effect, overrideVertexBuffers?: {
  100. [kind: string]: Nullable<VertexBuffer>;
  101. }): void;
  102. bindBuffers(vertexBuffers: {
  103. [key: string]: VertexBuffer;
  104. }, indexBuffer: Nullable<NativeDataBuffer>, effect: Effect): void;
  105. recordVertexArrayObject(vertexBuffers: {
  106. [key: string]: VertexBuffer;
  107. }, indexBuffer: Nullable<NativeDataBuffer>, effect: Effect, overrideVertexBuffers?: {
  108. [kind: string]: Nullable<VertexBuffer>;
  109. }): WebGLVertexArrayObject;
  110. private _deleteVertexArray;
  111. bindVertexArrayObject(vertexArray: WebGLVertexArrayObject): void;
  112. releaseVertexArrayObject(vertexArray: WebGLVertexArrayObject): void;
  113. getAttributes(pipelineContext: IPipelineContext, attributesNames: string[]): number[];
  114. /**
  115. * Draw a list of indexed primitives
  116. * @param fillMode defines the primitive to use
  117. * @param indexStart defines the starting index
  118. * @param indexCount defines the number of index to draw
  119. * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
  120. */
  121. drawElementsType(fillMode: number, indexStart: number, indexCount: number, instancesCount?: number): void;
  122. /**
  123. * Draw a list of unindexed primitives
  124. * @param fillMode defines the primitive to use
  125. * @param verticesStart defines the index of first vertex to draw
  126. * @param verticesCount defines the count of vertices to draw
  127. * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
  128. */
  129. drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void;
  130. createPipelineContext(): IPipelineContext;
  131. createMaterialContext(): IMaterialContext | undefined;
  132. createDrawContext(): IDrawContext | undefined;
  133. /**
  134. * @internal
  135. */
  136. _preparePipelineContext(pipelineContext: IPipelineContext, vertexSourceCode: string, fragmentSourceCode: string, createAsRaw: boolean, _rawVertexSourceCode: string, _rawFragmentSourceCode: string, _rebuildRebind: any, defines: Nullable<string>): void;
  137. /**
  138. * @internal
  139. */
  140. _executeWhenRenderingStateIsCompiled(pipelineContext: IPipelineContext, action: () => void): void;
  141. createRawShaderProgram(): WebGLProgram;
  142. createShaderProgram(pipelineContext: IPipelineContext, vertexCode: string, fragmentCode: string, defines: Nullable<string>): WebGLProgram;
  143. /**
  144. * Inline functions in shader code that are marked to be inlined
  145. * @param code code to inline
  146. * @returns inlined code
  147. */
  148. inlineShaderCode(code: string): string;
  149. protected _setProgram(program: WebGLProgram): void;
  150. _deletePipelineContext(pipelineContext: IPipelineContext): void;
  151. getUniforms(pipelineContext: IPipelineContext, uniformsNames: string[]): WebGLUniformLocation[];
  152. bindUniformBlock(pipelineContext: IPipelineContext, blockName: string, index: number): void;
  153. bindSamplers(effect: Effect): void;
  154. getRenderWidth(useScreen?: boolean): number;
  155. getRenderHeight(useScreen?: boolean): number;
  156. setViewport(viewport: IViewportLike, requiredWidth?: number, requiredHeight?: number): void;
  157. enableScissor(x: number, y: number, width: number, height: number): void;
  158. disableScissor(): void;
  159. setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean, cullBackFaces?: boolean, stencil?: IStencilState, zOffsetUnits?: number): void;
  160. /**
  161. * Gets the client rect of native canvas. Needed for InputManager.
  162. * @returns a client rectangle
  163. */
  164. getInputElementClientRect(): Nullable<DOMRect>;
  165. /**
  166. * Set the z offset Factor to apply to current rendering
  167. * @param value defines the offset to apply
  168. */
  169. setZOffset(value: number): void;
  170. /**
  171. * Gets the current value of the zOffset Factor
  172. * @returns the current zOffset Factor state
  173. */
  174. getZOffset(): number;
  175. /**
  176. * Set the z offset Units to apply to current rendering
  177. * @param value defines the offset to apply
  178. */
  179. setZOffsetUnits(value: number): void;
  180. /**
  181. * Gets the current value of the zOffset Units
  182. * @returns the current zOffset Units state
  183. */
  184. getZOffsetUnits(): number;
  185. /**
  186. * Enable or disable depth buffering
  187. * @param enable defines the state to set
  188. */
  189. setDepthBuffer(enable: boolean): void;
  190. /**
  191. * Gets a boolean indicating if depth writing is enabled
  192. * @returns the current depth writing state
  193. */
  194. getDepthWrite(): boolean;
  195. getDepthFunction(): Nullable<number>;
  196. setDepthFunction(depthFunc: number): void;
  197. /**
  198. * Enable or disable depth writing
  199. * @param enable defines the state to set
  200. */
  201. setDepthWrite(enable: boolean): void;
  202. /**
  203. * Enable or disable color writing
  204. * @param enable defines the state to set
  205. */
  206. setColorWrite(enable: boolean): void;
  207. /**
  208. * Gets a boolean indicating if color writing is enabled
  209. * @returns the current color writing state
  210. */
  211. getColorWrite(): boolean;
  212. private applyStencil;
  213. private _setStencil;
  214. /**
  215. * Enable or disable the stencil buffer
  216. * @param enable defines if the stencil buffer must be enabled or disabled
  217. */
  218. setStencilBuffer(enable: boolean): void;
  219. /**
  220. * Gets a boolean indicating if stencil buffer is enabled
  221. * @returns the current stencil buffer state
  222. */
  223. getStencilBuffer(): boolean;
  224. /**
  225. * Gets the current stencil operation when stencil passes
  226. * @returns a number defining stencil operation to use when stencil passes
  227. */
  228. getStencilOperationPass(): number;
  229. /**
  230. * Sets the stencil operation to use when stencil passes
  231. * @param operation defines the stencil operation to use when stencil passes
  232. */
  233. setStencilOperationPass(operation: number): void;
  234. /**
  235. * Sets the current stencil mask
  236. * @param mask defines the new stencil mask to use
  237. */
  238. setStencilMask(mask: number): void;
  239. /**
  240. * Sets the current stencil function
  241. * @param stencilFunc defines the new stencil function to use
  242. */
  243. setStencilFunction(stencilFunc: number): void;
  244. /**
  245. * Sets the current stencil reference
  246. * @param reference defines the new stencil reference to use
  247. */
  248. setStencilFunctionReference(reference: number): void;
  249. /**
  250. * Sets the current stencil mask
  251. * @param mask defines the new stencil mask to use
  252. */
  253. setStencilFunctionMask(mask: number): void;
  254. /**
  255. * Sets the stencil operation to use when stencil fails
  256. * @param operation defines the stencil operation to use when stencil fails
  257. */
  258. setStencilOperationFail(operation: number): void;
  259. /**
  260. * Sets the stencil operation to use when depth fails
  261. * @param operation defines the stencil operation to use when depth fails
  262. */
  263. setStencilOperationDepthFail(operation: number): void;
  264. /**
  265. * Gets the current stencil mask
  266. * @returns a number defining the new stencil mask to use
  267. */
  268. getStencilMask(): number;
  269. /**
  270. * Gets the current stencil function
  271. * @returns a number defining the stencil function to use
  272. */
  273. getStencilFunction(): number;
  274. /**
  275. * Gets the current stencil reference value
  276. * @returns a number defining the stencil reference value to use
  277. */
  278. getStencilFunctionReference(): number;
  279. /**
  280. * Gets the current stencil mask
  281. * @returns a number defining the stencil mask to use
  282. */
  283. getStencilFunctionMask(): number;
  284. /**
  285. * Gets the current stencil operation when stencil fails
  286. * @returns a number defining stencil operation to use when stencil fails
  287. */
  288. getStencilOperationFail(): number;
  289. /**
  290. * Gets the current stencil operation when depth fails
  291. * @returns a number defining stencil operation to use when depth fails
  292. */
  293. getStencilOperationDepthFail(): number;
  294. /**
  295. * Sets alpha constants used by some alpha blending modes
  296. * @param r defines the red component
  297. * @param g defines the green component
  298. * @param b defines the blue component
  299. * @param a defines the alpha component
  300. */
  301. setAlphaConstants(r: number, g: number, b: number, a: number): void;
  302. /**
  303. * Sets the current alpha mode
  304. * @param mode defines the mode to use (one of the BABYLON.Constants.ALPHA_XXX)
  305. * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)
  306. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering
  307. */
  308. setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;
  309. /**
  310. * Gets the current alpha mode
  311. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering
  312. * @returns the current alpha mode
  313. */
  314. getAlphaMode(): number;
  315. setInt(uniform: WebGLUniformLocation, int: number): boolean;
  316. setIntArray(uniform: WebGLUniformLocation, array: Int32Array): boolean;
  317. setIntArray2(uniform: WebGLUniformLocation, array: Int32Array): boolean;
  318. setIntArray3(uniform: WebGLUniformLocation, array: Int32Array): boolean;
  319. setIntArray4(uniform: WebGLUniformLocation, array: Int32Array): boolean;
  320. setFloatArray(uniform: WebGLUniformLocation, array: Float32Array): boolean;
  321. setFloatArray2(uniform: WebGLUniformLocation, array: Float32Array): boolean;
  322. setFloatArray3(uniform: WebGLUniformLocation, array: Float32Array): boolean;
  323. setFloatArray4(uniform: WebGLUniformLocation, array: Float32Array): boolean;
  324. setArray(uniform: WebGLUniformLocation, array: number[]): boolean;
  325. setArray2(uniform: WebGLUniformLocation, array: number[]): boolean;
  326. setArray3(uniform: WebGLUniformLocation, array: number[]): boolean;
  327. setArray4(uniform: WebGLUniformLocation, array: number[]): boolean;
  328. setMatrices(uniform: WebGLUniformLocation, matrices: DeepImmutable<FloatArray>): boolean;
  329. setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): boolean;
  330. setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): boolean;
  331. setFloat(uniform: WebGLUniformLocation, value: number): boolean;
  332. setFloat2(uniform: WebGLUniformLocation, x: number, y: number): boolean;
  333. setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): boolean;
  334. setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): boolean;
  335. setColor3(uniform: WebGLUniformLocation, color3: IColor3Like): boolean;
  336. setColor4(uniform: WebGLUniformLocation, color3: IColor3Like, alpha: number): boolean;
  337. wipeCaches(bruteForce?: boolean): void;
  338. protected _createTexture(): WebGLTexture;
  339. protected _deleteTexture(texture: Nullable<WebGLTexture>): void;
  340. /**
  341. * Update the content of a dynamic texture
  342. * @param texture defines the texture to update
  343. * @param canvas defines the canvas containing the source
  344. * @param invertY defines if data must be stored with Y axis inverted
  345. * @param premulAlpha defines if alpha is stored as premultiplied
  346. * @param format defines the format of the data
  347. */
  348. updateDynamicTexture(texture: Nullable<InternalTexture>, canvas: any, invertY: boolean, premulAlpha?: boolean, format?: number): void;
  349. createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture;
  350. createVideoElement(constraints: MediaTrackConstraints): any;
  351. updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;
  352. 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;
  353. createRawTexture2DArray(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, textureType?: number): InternalTexture;
  354. updateRawTexture(texture: Nullable<InternalTexture>, bufferView: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>, type?: number, useSRGBBuffer?: boolean): void;
  355. /**
  356. * Usually called from Texture.ts.
  357. * Passed information to create a NativeTexture
  358. * @param url defines a value which contains one of the following:
  359. * * A conventional http URL, e.g. 'http://...' or 'file://...'
  360. * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
  361. * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
  362. * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file
  363. * @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)
  364. * @param scene needed for loading to the correct scene
  365. * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)
  366. * @param onLoad optional callback to be called upon successful completion
  367. * @param onError optional callback to be called upon failure
  368. * @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
  369. * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities
  370. * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures
  371. * @param forcedExtension defines the extension to use to pick the right loader
  372. * @param mimeType defines an optional mime type
  373. * @param loaderOptions options to be passed to the loader
  374. * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
  375. * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
  376. * @returns a InternalTexture for assignment back into BABYLON.Texture
  377. */
  378. 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;
  379. /**
  380. * Wraps an external native texture in a Babylon texture.
  381. * @param texture defines the external texture
  382. * @param hasMipMaps defines whether the external texture has mip maps
  383. * @param samplingMode defines the sampling mode for the external texture (default: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE)
  384. * @returns the babylon internal texture
  385. */
  386. wrapNativeTexture(texture: NativeTexture, hasMipMaps?: boolean, samplingMode?: number): InternalTexture;
  387. /**
  388. * Wraps an external web gl texture in a Babylon texture.
  389. * @returns the babylon internal texture
  390. */
  391. wrapWebGLTexture(): InternalTexture;
  392. _createDepthStencilTexture(size: TextureSize, options: DepthTextureCreationOptions, rtWrapper: RenderTargetWrapper): InternalTexture;
  393. /**
  394. * @internal
  395. */
  396. _releaseFramebufferObjects(framebuffer: Nullable<NativeFramebuffer>): void;
  397. /**
  398. * @internal Engine abstraction for loading and creating an image bitmap from a given source string.
  399. * @param imageSource source to load the image from.
  400. * @param options An object that sets options for the image's extraction.
  401. * @returns ImageBitmap
  402. */
  403. _createImageBitmapFromSource(imageSource: string, options?: ImageBitmapOptions): Promise<ImageBitmap>;
  404. /**
  405. * Engine abstraction for createImageBitmap
  406. * @param image source for image
  407. * @param options An object that sets options for the image's extraction.
  408. * @returns ImageBitmap
  409. */
  410. createImageBitmap(image: ImageBitmapSource, options?: ImageBitmapOptions): Promise<ImageBitmap>;
  411. /**
  412. * Resize an image and returns the image data as an uint8array
  413. * @param image image to resize
  414. * @param bufferWidth destination buffer width
  415. * @param bufferHeight destination buffer height
  416. * @returns an uint8array containing RGBA values of bufferWidth * bufferHeight size
  417. */
  418. resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;
  419. /**
  420. * Creates a cube texture
  421. * @param rootUrl defines the url where the files to load is located
  422. * @param scene defines the current scene
  423. * @param files defines the list of files to load (1 per face)
  424. * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)
  425. * @param onLoad defines an optional callback raised when the texture is loaded
  426. * @param onError defines an optional callback raised if there is an issue to load the texture
  427. * @param format defines the format of the data
  428. * @param forcedExtension defines the extension to use to pick the right loader
  429. * @param createPolynomials if a polynomial sphere should be created for the cube texture
  430. * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness
  431. * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness
  432. * @param fallback defines texture to use while falling back when (compressed) texture file not found.
  433. * @param loaderOptions options to be passed to the loader
  434. * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
  435. * @returns the cube texture as an InternalTexture
  436. */
  437. 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;
  438. /** @internal */
  439. _createHardwareTexture(): HardwareTextureWrapper;
  440. /** @internal */
  441. _createHardwareRenderTargetWrapper(isMulti: boolean, isCube: boolean, size: TextureSize): RenderTargetWrapper;
  442. /** @internal */
  443. _createInternalTexture(size: TextureSize, options: boolean | InternalTextureCreationOptions, _delayGPUTextureCreation?: boolean, source?: InternalTextureSource): InternalTexture;
  444. createRenderTargetTexture(size: number | {
  445. width: number;
  446. height: number;
  447. depth: number;
  448. }, options: boolean | RenderTargetCreationOptions): RenderTargetWrapper;
  449. updateRenderTargetTextureSampleCount(rtWrapper: RenderTargetWrapper, samples: number): number;
  450. updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void;
  451. bindFramebuffer(texture: RenderTargetWrapper, faceIndex?: number, requiredWidth?: number, requiredHeight?: number, forceFullscreenViewport?: boolean): void;
  452. unBindFramebuffer(texture: RenderTargetWrapper, disableGenerateMipMaps?: boolean, onBeforeUnbind?: () => void): void;
  453. createDynamicVertexBuffer(data: DataArray): DataBuffer;
  454. updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset?: number): void;
  455. updateDynamicVertexBuffer(vertexBuffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void;
  456. protected _setTexture(channel: number, texture: Nullable<BaseTexture>, isPartOfTextureArray?: boolean, depthStencilTexture?: boolean): boolean;
  457. private _setTextureSampling;
  458. private _setTextureWrapMode;
  459. private _setTextureCore;
  460. private _updateAnisotropicLevel;
  461. /**
  462. * @internal
  463. */
  464. _bindTexture(channel: number, texture: InternalTexture): void;
  465. protected _deleteBuffer(buffer: NativeDataBuffer): void;
  466. /**
  467. * Create a canvas
  468. * @param width width
  469. * @param height height
  470. * @returns ICanvas interface
  471. */
  472. createCanvas(width: number, height: number): ICanvas;
  473. /**
  474. * Create an image to use with canvas
  475. * @returns IImage interface
  476. */
  477. createCanvasImage(): IImage;
  478. /**
  479. * Update a portion of an internal texture
  480. * @param texture defines the texture to update
  481. * @param imageData defines the data to store into the texture
  482. * @param xOffset defines the x coordinates of the update rectangle
  483. * @param yOffset defines the y coordinates of the update rectangle
  484. * @param width defines the width of the update rectangle
  485. * @param height defines the height of the update rectangle
  486. * @param faceIndex defines the face index if texture is a cube (0 by default)
  487. * @param lod defines the lod level to update (0 by default)
  488. * @param generateMipMaps defines whether to generate mipmaps or not
  489. */
  490. updateTextureData(texture: InternalTexture, imageData: ArrayBufferView, xOffset: number, yOffset: number, width: number, height: number, faceIndex?: number, lod?: number, generateMipMaps?: boolean): void;
  491. /**
  492. * @internal
  493. */
  494. _uploadCompressedDataToTextureDirectly(texture: InternalTexture, internalFormat: number, width: number, height: number, data: ArrayBufferView, faceIndex?: number, lod?: number): void;
  495. /**
  496. * @internal
  497. */
  498. _uploadDataToTextureDirectly(texture: InternalTexture, imageData: ArrayBufferView, faceIndex?: number, lod?: number): void;
  499. /**
  500. * @internal
  501. */
  502. _uploadArrayBufferViewToTexture(texture: InternalTexture, imageData: ArrayBufferView, faceIndex?: number, lod?: number): void;
  503. /**
  504. * @internal
  505. */
  506. _uploadImageToTexture(texture: InternalTexture, image: HTMLImageElement, faceIndex?: number, lod?: number): void;
  507. getFontOffset(font: string): {
  508. ascent: number;
  509. height: number;
  510. descent: number;
  511. };
  512. /**
  513. * No equivalent for native. Do nothing.
  514. */
  515. flushFramebuffer(): void;
  516. _readTexturePixels(texture: InternalTexture, width: number, height: number, faceIndex?: number, level?: number, buffer?: Nullable<ArrayBufferView>, _flushRenderer?: boolean, _noDataConversion?: boolean, x?: number, y?: number): Promise<ArrayBufferView>;
  517. }
  518. export {};