@babylonjs/core 5.46.0 → 5.47.1
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.
- package/Actions/actionManager.js +6 -1
- package/Actions/actionManager.js.map +1 -1
- package/Debug/physicsViewer.js +3 -3
- package/Debug/physicsViewer.js.map +1 -1
- package/DeviceInput/eventFactory.d.ts +1 -1
- package/DeviceInput/eventFactory.js +4 -4
- package/DeviceInput/eventFactory.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +2 -2
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.alpha.js +7 -0
- package/Engines/Extensions/engine.alpha.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.alpha.js +8 -0
- package/Engines/WebGPU/Extensions/engine.alpha.js.map +1 -1
- package/Engines/engine.d.ts +1 -3
- package/Engines/engine.js +27 -33
- package/Engines/engine.js.map +1 -1
- package/Engines/thinEngine.d.ts +44 -30
- package/Engines/thinEngine.js +42 -57
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +10 -56
- package/Engines/webgpuEngine.js +15 -31
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/pointerEvents.js +1 -1
- package/Events/pointerEvents.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +4 -3
- package/Inputs/scene.inputManager.js +12 -11
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -3
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/videoTexture.js +1 -1
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Maths/math.vector.d.ts +21 -0
- package/Maths/math.vector.js +27 -0
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/mesh.js +1 -1
- package/Meshes/mesh.js.map +1 -1
- package/Particles/particleSystemComponent.js +5 -0
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Physics/index.d.ts +1 -0
- package/Physics/index.js +1 -0
- package/Physics/index.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +12 -14
- package/Physics/v2/IPhysicsEnginePlugin.js +6 -5
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +14 -5
- package/Physics/v2/physicsBody.js +19 -7
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsConstraint.d.ts +139 -66
- package/Physics/v2/physicsConstraint.js +146 -79
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +9 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js +3 -0
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +3 -0
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +129 -124
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js +1 -3
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/fluidRenderingParticleDepth.fragment.js +5 -1
- package/Shaders/fluidRenderingParticleDepth.fragment.js.map +1 -1
- package/Shaders/fluidRenderingRender.fragment.js +7 -2
- package/Shaders/fluidRenderingRender.fragment.js.map +1 -1
- package/Shaders/geometry.fragment.d.ts +2 -0
- package/Shaders/geometry.fragment.js +5 -1
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/geometry.vertex.d.ts +2 -0
- package/Shaders/geometry.vertex.js +8 -4
- package/Shaders/geometry.vertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import type { BaseTexture } from "../Materials/Textures/baseTexture";
|
|
|
11
11
|
import type { IShaderProcessor } from "./Processors/iShaderProcessor";
|
|
12
12
|
import type { ShaderProcessingContext } from "./Processors/shaderProcessingOptions";
|
|
13
13
|
import { WebGPUTextureHelper } from "./WebGPU/webgpuTextureHelper";
|
|
14
|
-
import type { ISceneLike } from "./thinEngine";
|
|
14
|
+
import type { ISceneLike, ThinEngineOptions } from "./thinEngine";
|
|
15
15
|
import { WebGPUBufferManager } from "./WebGPU/webgpuBufferManager";
|
|
16
16
|
import type { HardwareTextureWrapper } from "../Materials/Textures/hardwareTextureWrapper";
|
|
17
17
|
import type { IColor4Like } from "../Maths/math.like";
|
|
@@ -53,36 +53,7 @@ export interface GlslangOptions {
|
|
|
53
53
|
/**
|
|
54
54
|
* Options to create the WebGPU engine
|
|
55
55
|
*/
|
|
56
|
-
export interface WebGPUEngineOptions extends GPURequestAdapterOptions {
|
|
57
|
-
/**
|
|
58
|
-
* If delta time between frames should be constant
|
|
59
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep
|
|
60
|
-
*/
|
|
61
|
-
deterministicLockstep?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Maximum about of steps between frames (Default: 4)
|
|
64
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep
|
|
65
|
-
*/
|
|
66
|
-
lockstepMaxSteps?: number;
|
|
67
|
-
/**
|
|
68
|
-
* Defines the seconds between each deterministic lock step
|
|
69
|
-
*/
|
|
70
|
-
timeStep?: number;
|
|
71
|
-
/**
|
|
72
|
-
* Defines that engine should ignore context lost events
|
|
73
|
-
* If this event happens when this parameter is true, you will have to reload the page to restore rendering
|
|
74
|
-
*/
|
|
75
|
-
doNotHandleContextLost?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Defines that engine should ignore modifying touch action attribute and style
|
|
78
|
-
* If not handle, you might need to set it up on your side for expected touch devices behavior.
|
|
79
|
-
*/
|
|
80
|
-
doNotHandleTouchAction?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Defines if webaudio should be initialized as well
|
|
83
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic
|
|
84
|
-
*/
|
|
85
|
-
audioEngine?: boolean;
|
|
56
|
+
export interface WebGPUEngineOptions extends ThinEngineOptions, GPURequestAdapterOptions {
|
|
86
57
|
/**
|
|
87
58
|
* Defines the category of adapter to use.
|
|
88
59
|
* Is it the discrete or integrated device.
|
|
@@ -96,14 +67,6 @@ export interface WebGPUEngineOptions extends GPURequestAdapterOptions {
|
|
|
96
67
|
* Defines the requested Swap Chain Format.
|
|
97
68
|
*/
|
|
98
69
|
swapChainFormat?: GPUTextureFormat;
|
|
99
|
-
/**
|
|
100
|
-
* Defines whether MSAA is enabled on the canvas.
|
|
101
|
-
*/
|
|
102
|
-
antialiasing?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Defines whether the stencil buffer should be enabled.
|
|
105
|
-
*/
|
|
106
|
-
stencil?: boolean;
|
|
107
70
|
/**
|
|
108
71
|
* Defines whether we should generate debug markers in the gpu command lists (can be seen with PIX for eg)
|
|
109
72
|
*/
|
|
@@ -116,23 +79,6 @@ export interface WebGPUEngineOptions extends GPURequestAdapterOptions {
|
|
|
116
79
|
* Options to load the associated Twgsl library
|
|
117
80
|
*/
|
|
118
81
|
twgslOptions?: TwgslOptions;
|
|
119
|
-
/**
|
|
120
|
-
* Defines if the engine should no exceed a specified device ratio
|
|
121
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio
|
|
122
|
-
*/
|
|
123
|
-
limitDeviceRatio?: number;
|
|
124
|
-
/**
|
|
125
|
-
* Defines whether to adapt to the device's viewport characteristics (default: false)
|
|
126
|
-
*/
|
|
127
|
-
adaptToDeviceRatio?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Defines whether the canvas should be created in "premultiplied" mode (if false, the canvas is created in the "opaque" mode) (true by default)
|
|
130
|
-
*/
|
|
131
|
-
premultipliedAlpha?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* Make the matrix computations to be performed in 64 bits instead of 32 bits. False by default
|
|
134
|
-
*/
|
|
135
|
-
useHighPrecisionMatrix?: boolean;
|
|
136
82
|
}
|
|
137
83
|
/**
|
|
138
84
|
* The web GPU engine class provides support for WebGPU version of babylon.js.
|
|
@@ -337,6 +283,14 @@ export declare class WebGPUEngine extends Engine {
|
|
|
337
283
|
* @returns a promise that resolves with the created engine
|
|
338
284
|
*/
|
|
339
285
|
static CreateAsync(canvas: HTMLCanvasElement, options?: WebGPUEngineOptions): Promise<WebGPUEngine>;
|
|
286
|
+
/**
|
|
287
|
+
* Indicates if the z range in NDC space is 0..1 (value: true) or -1..1 (value: false)
|
|
288
|
+
*/
|
|
289
|
+
readonly isNDCHalfZRange: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Indicates that the origin of the texture/framebuffer space is the bottom left corner. If false, the origin is top left
|
|
292
|
+
*/
|
|
293
|
+
readonly hasOriginBottomLeft: boolean;
|
|
340
294
|
/**
|
|
341
295
|
* Create a new instance of the gpu engine.
|
|
342
296
|
* @param canvas Defines the canvas to use to display the result
|
package/Engines/webgpuEngine.js
CHANGED
|
@@ -35,7 +35,6 @@ import { WebGPUTintWASM } from "./WebGPU/webgpuTintWASM.js";
|
|
|
35
35
|
import { WebGPUShaderProcessor } from "./WebGPU/webgpuShaderProcessor.js";
|
|
36
36
|
import { ShaderLanguage } from "../Materials/shaderLanguage.js";
|
|
37
37
|
import { WebGPUSnapshotRendering } from "./WebGPU/webgpuSnapshotRendering.js";
|
|
38
|
-
import { PerformanceConfigurator } from "./performanceConfigurator.js";
|
|
39
38
|
/**
|
|
40
39
|
* The web GPU engine class provides support for WebGPU version of babylon.js.
|
|
41
40
|
* @since 5.0.0
|
|
@@ -188,8 +187,8 @@ export class WebGPUEngine extends Engine {
|
|
|
188
187
|
* @param options Defines the options passed to the engine to create the GPU context dependencies
|
|
189
188
|
*/
|
|
190
189
|
constructor(canvas, options = {}) {
|
|
191
|
-
var _a, _b
|
|
192
|
-
super(null);
|
|
190
|
+
var _a, _b;
|
|
191
|
+
super(null, (_a = options.antialias) !== null && _a !== void 0 ? _a : true, options);
|
|
193
192
|
// Page Life cycle and constants
|
|
194
193
|
this._uploadEncoderDescriptor = { label: "upload" };
|
|
195
194
|
this._renderEncoderDescriptor = { label: "render" };
|
|
@@ -254,6 +253,14 @@ export class WebGPUEngine extends Engine {
|
|
|
254
253
|
this.dbgLogIfNotDrawWrapper = true;
|
|
255
254
|
/** @internal */
|
|
256
255
|
this.dbgShowEmptyEnableEffectCalls = true;
|
|
256
|
+
/**
|
|
257
|
+
* Indicates if the z range in NDC space is 0..1 (value: true) or -1..1 (value: false)
|
|
258
|
+
*/
|
|
259
|
+
this.isNDCHalfZRange = true;
|
|
260
|
+
/**
|
|
261
|
+
* Indicates that the origin of the texture/framebuffer space is the bottom left corner. If false, the origin is top left
|
|
262
|
+
*/
|
|
263
|
+
this.hasOriginBottomLeft = false;
|
|
257
264
|
//------------------------------------------------------------------------------
|
|
258
265
|
// Dynamic WebGPU States
|
|
259
266
|
//------------------------------------------------------------------------------
|
|
@@ -273,13 +280,8 @@ export class WebGPUEngine extends Engine {
|
|
|
273
280
|
[null, null, null, null],
|
|
274
281
|
];
|
|
275
282
|
this._name = "WebGPU";
|
|
276
|
-
this.isNDCHalfZRange = true;
|
|
277
|
-
this.hasOriginBottomLeft = false;
|
|
278
283
|
options.deviceDescriptor = options.deviceDescriptor || {};
|
|
279
|
-
options.antialiasing = options.antialiasing === undefined ? true : options.antialiasing;
|
|
280
|
-
options.stencil = (_a = options.stencil) !== null && _a !== void 0 ? _a : true;
|
|
281
284
|
options.enableGPUDebugMarkers = (_b = options.enableGPUDebugMarkers) !== null && _b !== void 0 ? _b : false;
|
|
282
|
-
PerformanceConfigurator.SetMatrixPrecision(!!options.useHighPrecisionMatrix);
|
|
283
285
|
Logger.Log(`Babylon.js v${Engine.Version} - ${this.description} engine`);
|
|
284
286
|
if (!navigator.gpu) {
|
|
285
287
|
Logger.Error("WebGPU is not supported by your browser.");
|
|
@@ -288,29 +290,11 @@ export class WebGPUEngine extends Engine {
|
|
|
288
290
|
options.swapChainFormat = options.swapChainFormat || navigator.gpu.getPreferredCanvasFormat();
|
|
289
291
|
this._isWebGPU = true;
|
|
290
292
|
this._shaderPlatformName = "WEBGPU";
|
|
291
|
-
if (options.deterministicLockstep === undefined) {
|
|
292
|
-
options.deterministicLockstep = false;
|
|
293
|
-
}
|
|
294
|
-
if (options.lockstepMaxSteps === undefined) {
|
|
295
|
-
options.lockstepMaxSteps = 4;
|
|
296
|
-
}
|
|
297
|
-
if (options.audioEngine === undefined) {
|
|
298
|
-
options.audioEngine = true;
|
|
299
|
-
}
|
|
300
|
-
this._deterministicLockstep = options.deterministicLockstep;
|
|
301
|
-
this._lockstepMaxSteps = options.lockstepMaxSteps;
|
|
302
|
-
this._timeStep = options.timeStep || 1 / 60;
|
|
303
|
-
this._doNotHandleContextLost = !!options.doNotHandleContextLost;
|
|
304
293
|
this._canvas = canvas;
|
|
305
294
|
this._options = options;
|
|
306
|
-
this.
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const adaptToDeviceRatio = (_d = options.adaptToDeviceRatio) !== null && _d !== void 0 ? _d : false;
|
|
310
|
-
this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;
|
|
311
|
-
this._mainPassSampleCount = options.antialiasing ? this._defaultSampleCount : 1;
|
|
312
|
-
this._isStencilEnable = options.stencil;
|
|
313
|
-
this._sharedInit(canvas, !!options.doNotHandleTouchAction, options.audioEngine);
|
|
295
|
+
this._mainPassSampleCount = options.antialias ? this._defaultSampleCount : 1;
|
|
296
|
+
this._setupMobileChecks();
|
|
297
|
+
this._sharedInit(canvas);
|
|
314
298
|
this._shaderProcessor = new WebGPUShaderProcessorGLSL();
|
|
315
299
|
this._shaderProcessorWGSL = new WebGPUShaderProcessorWGSL();
|
|
316
300
|
}
|
|
@@ -569,7 +553,7 @@ export class WebGPUEngine extends Engine {
|
|
|
569
553
|
this._bufferManager.setSubData(this._ubInvertY, 4, bufferDataUpdate);
|
|
570
554
|
this._bufferManager.setSubData(this._ubDontInvertY, 4, bufferDataUpdate);
|
|
571
555
|
let mainColorAttachments;
|
|
572
|
-
if (this._options.
|
|
556
|
+
if (this._options.antialias) {
|
|
573
557
|
const mainTextureDescriptor = {
|
|
574
558
|
label: "Texture_MainColor_antialiasing",
|
|
575
559
|
size: this._mainTextureExtends,
|
|
@@ -2118,7 +2102,7 @@ export class WebGPUEngine extends Engine {
|
|
|
2118
2102
|
const swapChainTexture = this._context.getCurrentTexture();
|
|
2119
2103
|
this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].set(swapChainTexture);
|
|
2120
2104
|
// Resolve in case of MSAA
|
|
2121
|
-
if (this._options.
|
|
2105
|
+
if (this._options.antialias) {
|
|
2122
2106
|
this._mainRenderPassWrapper.renderPassDescriptor.colorAttachments[0].resolveTarget = swapChainTexture.createView();
|
|
2123
2107
|
}
|
|
2124
2108
|
else {
|