@babylonjs/core 8.45.4 → 8.45.5

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