@babylonjs/core 5.6.0 → 5.8.0
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/Animations/animation.js +2 -1
- package/Animations/animation.js.map +1 -1
- package/Animations/easing.d.ts +14 -14
- package/Animations/easing.js +13 -13
- package/Animations/easing.js.map +1 -1
- package/Cameras/Inputs/freeCameraTouchInput.js +2 -2
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/DeviceInput/InputDevices/webDeviceInputSystem.js +1 -1
- package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.dynamicBuffer.js +7 -5
- package/Engines/Extensions/engine.dynamicBuffer.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +10 -1
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.d.ts +4 -2
- package/Engines/Extensions/engine.rawTexture.js +7 -4
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +2 -0
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.js +3 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicBuffer.js +3 -21
- package/Engines/WebGPU/Extensions/engine.dynamicBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +7 -0
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +7 -3
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +8 -2
- package/Engines/WebGPU/webgpuConstants.js +15 -8
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +4 -0
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/constants.d.ts +2 -0
- package/Engines/constants.js +2 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +59 -51
- package/Engines/engine.js +2 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +2 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/engineFactory.d.ts +2 -2
- package/Engines/engineFactory.js.map +1 -1
- package/Engines/nativeEngine.d.ts +4 -4
- package/Engines/nativeEngine.js +12 -7
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +4 -2
- package/Engines/nullEngine.js +9 -2
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -0
- package/Engines/thinEngine.js +43 -5
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +3 -8
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +5 -0
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +1 -0
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +1 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/index.d.ts +0 -1
- package/Materials/Node/Blocks/Dual/index.js +0 -1
- package/Materials/Node/Blocks/Dual/index.js.map +1 -1
- package/Materials/Node/Blocks/{Dual → Fragment}/TBNBlock.d.ts +0 -0
- package/Materials/Node/Blocks/{Dual → Fragment}/TBNBlock.js +4 -4
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -0
- package/Materials/Node/Blocks/Fragment/index.d.ts +1 -0
- package/Materials/Node/Blocks/Fragment/index.js +1 -0
- package/Materials/Node/Blocks/Fragment/index.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +7 -0
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +4 -2
- package/Materials/Node/nodeMaterial.js +13 -5
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +2 -2
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/internalTexture.js +1 -1
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +4 -0
- package/Materials/Textures/multiRenderTarget.js +16 -3
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/rawTexture.d.ts +10 -4
- package/Materials/Textures/rawTexture.js +20 -9
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/shaderMaterial.js +2 -1
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +7 -2
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.vector.js +5 -5
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/groundBuilder.d.ts +1 -1
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.js +4 -0
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +15 -5
- package/Meshes/abstractMesh.js +46 -27
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/instancedMesh.js +1 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +1 -1
- package/Meshes/mesh.js +60 -32
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.js +1 -1
- package/Meshes/subMesh.js.map +1 -1
- package/Morph/morphTargetManager.js +2 -1
- package/Morph/morphTargetManager.js.map +1 -1
- package/Particles/particleHelper.js +3 -2
- package/Particles/particleHelper.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.d.ts +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.d.ts +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.js +2 -4
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/Shaders/ShadersInclude/defaultFragmentDeclaration.js +1 -1
- package/Shaders/ShadersInclude/defaultFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js.map +1 -1
- package/Shaders/ShadersInclude/vertexColorMixing.js +1 -1
- package/Shaders/ShadersInclude/vertexColorMixing.js.map +1 -1
- package/Shaders/default.fragment.js +1 -1
- package/Shaders/default.fragment.js.map +1 -1
- package/Sprites/spriteManager.js +2 -1
- package/Sprites/spriteManager.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js +1 -1
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -1
- package/scene.js.map +1 -1
- package/Materials/Node/Blocks/Dual/TBNBlock.js.map +0 -1
package/Animations/easing.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This represents the main contract an easing function should follow.
|
|
3
3
|
* Easing functions are used throughout the animation system.
|
|
4
|
-
* @see https://doc.babylonjs.com/
|
|
4
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
5
5
|
*/
|
|
6
6
|
export interface IEasingFunction {
|
|
7
7
|
/**
|
|
@@ -16,7 +16,7 @@ export interface IEasingFunction {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Base class used for every default easing function.
|
|
19
|
-
* @see https://doc.babylonjs.com/
|
|
19
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
20
20
|
*/
|
|
21
21
|
export declare class EasingFunction implements IEasingFunction {
|
|
22
22
|
/**
|
|
@@ -58,7 +58,7 @@ export declare class EasingFunction implements IEasingFunction {
|
|
|
58
58
|
/**
|
|
59
59
|
* Easing function with a circle shape (see link below).
|
|
60
60
|
* @see https://easings.net/#easeInCirc
|
|
61
|
-
* @see https://doc.babylonjs.com/
|
|
61
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
62
62
|
*/
|
|
63
63
|
export declare class CircleEase extends EasingFunction implements IEasingFunction {
|
|
64
64
|
/**
|
|
@@ -70,7 +70,7 @@ export declare class CircleEase extends EasingFunction implements IEasingFunctio
|
|
|
70
70
|
/**
|
|
71
71
|
* Easing function with a ease back shape (see link below).
|
|
72
72
|
* @see https://easings.net/#easeInBack
|
|
73
|
-
* @see https://doc.babylonjs.com/
|
|
73
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
74
74
|
*/
|
|
75
75
|
export declare class BackEase extends EasingFunction implements IEasingFunction {
|
|
76
76
|
/** Defines the amplitude of the function */
|
|
@@ -92,7 +92,7 @@ export declare class BackEase extends EasingFunction implements IEasingFunction
|
|
|
92
92
|
/**
|
|
93
93
|
* Easing function with a bouncing shape (see link below).
|
|
94
94
|
* @see https://easings.net/#easeInBounce
|
|
95
|
-
* @see https://doc.babylonjs.com/
|
|
95
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
96
96
|
*/
|
|
97
97
|
export declare class BounceEase extends EasingFunction implements IEasingFunction {
|
|
98
98
|
/** Defines the number of bounces */
|
|
@@ -119,7 +119,7 @@ export declare class BounceEase extends EasingFunction implements IEasingFunctio
|
|
|
119
119
|
/**
|
|
120
120
|
* Easing function with a power of 3 shape (see link below).
|
|
121
121
|
* @see https://easings.net/#easeInCubic
|
|
122
|
-
* @see https://doc.babylonjs.com/
|
|
122
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
123
123
|
*/
|
|
124
124
|
export declare class CubicEase extends EasingFunction implements IEasingFunction {
|
|
125
125
|
/**
|
|
@@ -131,7 +131,7 @@ export declare class CubicEase extends EasingFunction implements IEasingFunction
|
|
|
131
131
|
/**
|
|
132
132
|
* Easing function with an elastic shape (see link below).
|
|
133
133
|
* @see https://easings.net/#easeInElastic
|
|
134
|
-
* @see https://doc.babylonjs.com/
|
|
134
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
135
135
|
*/
|
|
136
136
|
export declare class ElasticEase extends EasingFunction implements IEasingFunction {
|
|
137
137
|
/** Defines the number of oscillations*/
|
|
@@ -158,7 +158,7 @@ export declare class ElasticEase extends EasingFunction implements IEasingFuncti
|
|
|
158
158
|
/**
|
|
159
159
|
* Easing function with an exponential shape (see link below).
|
|
160
160
|
* @see https://easings.net/#easeInExpo
|
|
161
|
-
* @see https://doc.babylonjs.com/
|
|
161
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
162
162
|
*/
|
|
163
163
|
export declare class ExponentialEase extends EasingFunction implements IEasingFunction {
|
|
164
164
|
/** Defines the exponent of the function */
|
|
@@ -180,7 +180,7 @@ export declare class ExponentialEase extends EasingFunction implements IEasingFu
|
|
|
180
180
|
/**
|
|
181
181
|
* Easing function with a power shape (see link below).
|
|
182
182
|
* @see https://easings.net/#easeInQuad
|
|
183
|
-
* @see https://doc.babylonjs.com/
|
|
183
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
184
184
|
*/
|
|
185
185
|
export declare class PowerEase extends EasingFunction implements IEasingFunction {
|
|
186
186
|
/** Defines the power of the function */
|
|
@@ -202,7 +202,7 @@ export declare class PowerEase extends EasingFunction implements IEasingFunction
|
|
|
202
202
|
/**
|
|
203
203
|
* Easing function with a power of 2 shape (see link below).
|
|
204
204
|
* @see https://easings.net/#easeInQuad
|
|
205
|
-
* @see https://doc.babylonjs.com/
|
|
205
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
206
206
|
*/
|
|
207
207
|
export declare class QuadraticEase extends EasingFunction implements IEasingFunction {
|
|
208
208
|
/**
|
|
@@ -214,7 +214,7 @@ export declare class QuadraticEase extends EasingFunction implements IEasingFunc
|
|
|
214
214
|
/**
|
|
215
215
|
* Easing function with a power of 4 shape (see link below).
|
|
216
216
|
* @see https://easings.net/#easeInQuart
|
|
217
|
-
* @see https://doc.babylonjs.com/
|
|
217
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
218
218
|
*/
|
|
219
219
|
export declare class QuarticEase extends EasingFunction implements IEasingFunction {
|
|
220
220
|
/**
|
|
@@ -226,7 +226,7 @@ export declare class QuarticEase extends EasingFunction implements IEasingFuncti
|
|
|
226
226
|
/**
|
|
227
227
|
* Easing function with a power of 5 shape (see link below).
|
|
228
228
|
* @see https://easings.net/#easeInQuint
|
|
229
|
-
* @see https://doc.babylonjs.com/
|
|
229
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
230
230
|
*/
|
|
231
231
|
export declare class QuinticEase extends EasingFunction implements IEasingFunction {
|
|
232
232
|
/**
|
|
@@ -238,7 +238,7 @@ export declare class QuinticEase extends EasingFunction implements IEasingFuncti
|
|
|
238
238
|
/**
|
|
239
239
|
* Easing function with a sin shape (see link below).
|
|
240
240
|
* @see https://easings.net/#easeInSine
|
|
241
|
-
* @see https://doc.babylonjs.com/
|
|
241
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
242
242
|
*/
|
|
243
243
|
export declare class SineEase extends EasingFunction implements IEasingFunction {
|
|
244
244
|
/**
|
|
@@ -250,7 +250,7 @@ export declare class SineEase extends EasingFunction implements IEasingFunction
|
|
|
250
250
|
/**
|
|
251
251
|
* Easing function with a bezier shape (see link below).
|
|
252
252
|
* @see http://cubic-bezier.com/#.17,.67,.83,.67
|
|
253
|
-
* @see https://doc.babylonjs.com/
|
|
253
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
254
254
|
*/
|
|
255
255
|
export declare class BezierCurveEase extends EasingFunction implements IEasingFunction {
|
|
256
256
|
/** Defines the x component of the start tangent in the bezier curve */
|
package/Animations/easing.js
CHANGED
|
@@ -2,7 +2,7 @@ import { __extends } from "tslib";
|
|
|
2
2
|
import { BezierCurve } from "../Maths/math.path.js";
|
|
3
3
|
/**
|
|
4
4
|
* Base class used for every default easing function.
|
|
5
|
-
* @see https://doc.babylonjs.com/
|
|
5
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
6
6
|
*/
|
|
7
7
|
var EasingFunction = /** @class */ (function () {
|
|
8
8
|
function EasingFunction() {
|
|
@@ -67,7 +67,7 @@ export { EasingFunction };
|
|
|
67
67
|
/**
|
|
68
68
|
* Easing function with a circle shape (see link below).
|
|
69
69
|
* @see https://easings.net/#easeInCirc
|
|
70
|
-
* @see https://doc.babylonjs.com/
|
|
70
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
71
71
|
*/
|
|
72
72
|
var CircleEase = /** @class */ (function (_super) {
|
|
73
73
|
__extends(CircleEase, _super);
|
|
@@ -88,7 +88,7 @@ export { CircleEase };
|
|
|
88
88
|
/**
|
|
89
89
|
* Easing function with a ease back shape (see link below).
|
|
90
90
|
* @see https://easings.net/#easeInBack
|
|
91
|
-
* @see https://doc.babylonjs.com/
|
|
91
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
92
92
|
*/
|
|
93
93
|
var BackEase = /** @class */ (function (_super) {
|
|
94
94
|
__extends(BackEase, _super);
|
|
@@ -119,7 +119,7 @@ export { BackEase };
|
|
|
119
119
|
/**
|
|
120
120
|
* Easing function with a bouncing shape (see link below).
|
|
121
121
|
* @see https://easings.net/#easeInBounce
|
|
122
|
-
* @see https://doc.babylonjs.com/
|
|
122
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
123
123
|
*/
|
|
124
124
|
var BounceEase = /** @class */ (function (_super) {
|
|
125
125
|
__extends(BounceEase, _super);
|
|
@@ -171,7 +171,7 @@ export { BounceEase };
|
|
|
171
171
|
/**
|
|
172
172
|
* Easing function with a power of 3 shape (see link below).
|
|
173
173
|
* @see https://easings.net/#easeInCubic
|
|
174
|
-
* @see https://doc.babylonjs.com/
|
|
174
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
175
175
|
*/
|
|
176
176
|
var CubicEase = /** @class */ (function (_super) {
|
|
177
177
|
__extends(CubicEase, _super);
|
|
@@ -191,7 +191,7 @@ export { CubicEase };
|
|
|
191
191
|
/**
|
|
192
192
|
* Easing function with an elastic shape (see link below).
|
|
193
193
|
* @see https://easings.net/#easeInElastic
|
|
194
|
-
* @see https://doc.babylonjs.com/
|
|
194
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
195
195
|
*/
|
|
196
196
|
var ElasticEase = /** @class */ (function (_super) {
|
|
197
197
|
__extends(ElasticEase, _super);
|
|
@@ -235,7 +235,7 @@ export { ElasticEase };
|
|
|
235
235
|
/**
|
|
236
236
|
* Easing function with an exponential shape (see link below).
|
|
237
237
|
* @see https://easings.net/#easeInExpo
|
|
238
|
-
* @see https://doc.babylonjs.com/
|
|
238
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
239
239
|
*/
|
|
240
240
|
var ExponentialEase = /** @class */ (function (_super) {
|
|
241
241
|
__extends(ExponentialEase, _super);
|
|
@@ -268,7 +268,7 @@ export { ExponentialEase };
|
|
|
268
268
|
/**
|
|
269
269
|
* Easing function with a power shape (see link below).
|
|
270
270
|
* @see https://easings.net/#easeInQuad
|
|
271
|
-
* @see https://doc.babylonjs.com/
|
|
271
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
272
272
|
*/
|
|
273
273
|
var PowerEase = /** @class */ (function (_super) {
|
|
274
274
|
__extends(PowerEase, _super);
|
|
@@ -299,7 +299,7 @@ export { PowerEase };
|
|
|
299
299
|
/**
|
|
300
300
|
* Easing function with a power of 2 shape (see link below).
|
|
301
301
|
* @see https://easings.net/#easeInQuad
|
|
302
|
-
* @see https://doc.babylonjs.com/
|
|
302
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
303
303
|
*/
|
|
304
304
|
var QuadraticEase = /** @class */ (function (_super) {
|
|
305
305
|
__extends(QuadraticEase, _super);
|
|
@@ -319,7 +319,7 @@ export { QuadraticEase };
|
|
|
319
319
|
/**
|
|
320
320
|
* Easing function with a power of 4 shape (see link below).
|
|
321
321
|
* @see https://easings.net/#easeInQuart
|
|
322
|
-
* @see https://doc.babylonjs.com/
|
|
322
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
323
323
|
*/
|
|
324
324
|
var QuarticEase = /** @class */ (function (_super) {
|
|
325
325
|
__extends(QuarticEase, _super);
|
|
@@ -339,7 +339,7 @@ export { QuarticEase };
|
|
|
339
339
|
/**
|
|
340
340
|
* Easing function with a power of 5 shape (see link below).
|
|
341
341
|
* @see https://easings.net/#easeInQuint
|
|
342
|
-
* @see https://doc.babylonjs.com/
|
|
342
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
343
343
|
*/
|
|
344
344
|
var QuinticEase = /** @class */ (function (_super) {
|
|
345
345
|
__extends(QuinticEase, _super);
|
|
@@ -359,7 +359,7 @@ export { QuinticEase };
|
|
|
359
359
|
/**
|
|
360
360
|
* Easing function with a sin shape (see link below).
|
|
361
361
|
* @see https://easings.net/#easeInSine
|
|
362
|
-
* @see https://doc.babylonjs.com/
|
|
362
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
363
363
|
*/
|
|
364
364
|
var SineEase = /** @class */ (function (_super) {
|
|
365
365
|
__extends(SineEase, _super);
|
|
@@ -379,7 +379,7 @@ export { SineEase };
|
|
|
379
379
|
/**
|
|
380
380
|
* Easing function with a bezier shape (see link below).
|
|
381
381
|
* @see http://cubic-bezier.com/#.17,.67,.83,.67
|
|
382
|
-
* @see https://doc.babylonjs.com/
|
|
382
|
+
* @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions
|
|
383
383
|
*/
|
|
384
384
|
var BezierCurveEase = /** @class */ (function (_super) {
|
|
385
385
|
__extends(BezierCurveEase, _super);
|
package/Animations/easing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easing.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Animations/easing.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAmBjD;;;GAGG;AACH;IAAA;QAgBY,gBAAW,GAAG,cAAc,CAAC,iBAAiB,CAAC;IA+C3D,CAAC;IA7CG;;;OAGG;IACI,sCAAa,GAApB,UAAqB,UAAkB;QACnC,IAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IACzB,CAAC;IACD;;;OAGG;IACI,sCAAa,GAApB;QACI,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,6DAA6D;IACtD,mCAAU,GAAjB,UAAkB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"../Maths/math.path\";\r\n\r\n/**\r\n * This represents the main contract an easing function should follow.\r\n * Easing functions are used throughout the animation system.\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport interface IEasingFunction {\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * The link below provides some of the most common examples of easing functions.\r\n * @see https://easings.net/\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n ease(gradient: number): number;\r\n}\r\n\r\n/**\r\n * Base class used for every default easing function.\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class EasingFunction implements IEasingFunction {\r\n /**\r\n * Interpolation follows the mathematical formula associated with the easing function.\r\n */\r\n public static readonly EASINGMODE_EASEIN = 0;\r\n\r\n /**\r\n * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function.\r\n */\r\n public static readonly EASINGMODE_EASEOUT = 1;\r\n\r\n /**\r\n * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half.\r\n */\r\n public static readonly EASINGMODE_EASEINOUT = 2;\r\n\r\n private _easingMode = EasingFunction.EASINGMODE_EASEIN;\r\n\r\n /**\r\n * Sets the easing mode of the current function.\r\n * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT)\r\n */\r\n public setEasingMode(easingMode: number) {\r\n const n = Math.min(Math.max(easingMode, 0), 2);\r\n this._easingMode = n;\r\n }\r\n /**\r\n * Gets the current easing mode.\r\n * @returns the easing mode\r\n */\r\n public getEasingMode(): number {\r\n return this._easingMode;\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public easeInCore(gradient: number): number {\r\n throw new Error(\"You must implement this method\");\r\n }\r\n\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n public ease(gradient: number): number {\r\n switch (this._easingMode) {\r\n case EasingFunction.EASINGMODE_EASEIN:\r\n return this.easeInCore(gradient);\r\n case EasingFunction.EASINGMODE_EASEOUT:\r\n return 1 - this.easeInCore(1 - gradient);\r\n }\r\n\r\n if (gradient >= 0.5) {\r\n return (1 - this.easeInCore((1 - gradient) * 2)) * 0.5 + 0.5;\r\n }\r\n\r\n return this.easeInCore(gradient * 2) * 0.5;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a circle shape (see link below).\r\n * @see https://easings.net/#easeInCirc\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class CircleEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n gradient = Math.max(0, Math.min(1, gradient));\r\n return 1.0 - Math.sqrt(1.0 - gradient * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a ease back shape (see link below).\r\n * @see https://easings.net/#easeInBack\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class BackEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a back ease easing\r\n * @see https://easings.net/#easeInBack\r\n * @param amplitude Defines the amplitude of the function\r\n */\r\n constructor(\r\n /** Defines the amplitude of the function */\r\n public amplitude: number = 1\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n const num = Math.max(0, this.amplitude);\r\n return Math.pow(gradient, 3.0) - gradient * num * Math.sin(3.1415926535897931 * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a bouncing shape (see link below).\r\n * @see https://easings.net/#easeInBounce\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class BounceEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a bounce easing\r\n * @see https://easings.net/#easeInBounce\r\n * @param bounces Defines the number of bounces\r\n * @param bounciness Defines the amplitude of the bounce\r\n */\r\n constructor(\r\n /** Defines the number of bounces */\r\n public bounces: number = 3,\r\n /** Defines the amplitude of the bounce */\r\n public bounciness: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n const y = Math.max(0.0, this.bounces);\r\n let bounciness = this.bounciness;\r\n if (bounciness <= 1.0) {\r\n bounciness = 1.001;\r\n }\r\n const num9 = Math.pow(bounciness, y);\r\n const num5 = 1.0 - bounciness;\r\n const num4 = (1.0 - num9) / num5 + num9 * 0.5;\r\n const num15 = gradient * num4;\r\n const num65 = Math.log(-num15 * (1.0 - bounciness) + 1.0) / Math.log(bounciness);\r\n const num3 = Math.floor(num65);\r\n const num13 = num3 + 1.0;\r\n const num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);\r\n const num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);\r\n const num7 = (num8 + num12) * 0.5;\r\n const num6 = gradient - num7;\r\n const num2 = num7 - num8;\r\n return (-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2) * (num6 + num2);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 3 shape (see link below).\r\n * @see https://easings.net/#easeInCubic\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class CubicEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with an elastic shape (see link below).\r\n * @see https://easings.net/#easeInElastic\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class ElasticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an elastic easing function\r\n * @see https://easings.net/#easeInElastic\r\n * @param oscillations Defines the number of oscillations\r\n * @param springiness Defines the amplitude of the oscillations\r\n */\r\n constructor(\r\n /** Defines the number of oscillations*/\r\n public oscillations: number = 3,\r\n /** Defines the amplitude of the oscillations*/\r\n public springiness: number = 3\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n let num2;\r\n const num3 = Math.max(0.0, this.oscillations);\r\n const num = Math.max(0.0, this.springiness);\r\n\r\n if (num == 0) {\r\n num2 = gradient;\r\n } else {\r\n num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);\r\n }\r\n return num2 * Math.sin((6.2831853071795862 * num3 + 1.5707963267948966) * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with an exponential shape (see link below).\r\n * @see https://easings.net/#easeInExpo\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class ExponentialEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an exponential easing function\r\n * @see https://easings.net/#easeInExpo\r\n * @param exponent Defines the exponent of the function\r\n */\r\n constructor(\r\n /** Defines the exponent of the function */\r\n public exponent: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n if (this.exponent <= 0) {\r\n return gradient;\r\n }\r\n\r\n return (Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class PowerEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an power base easing function\r\n * @see https://easings.net/#easeInQuad\r\n * @param power Defines the power of the function\r\n */\r\n constructor(\r\n /** Defines the power of the function */\r\n public power: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n const y = Math.max(0.0, this.power);\r\n return Math.pow(gradient, y);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 2 shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class QuadraticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 4 shape (see link below).\r\n * @see https://easings.net/#easeInQuart\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class QuarticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 5 shape (see link below).\r\n * @see https://easings.net/#easeInQuint\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class QuinticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a sin shape (see link below).\r\n * @see https://easings.net/#easeInSine\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class SineEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return 1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient));\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a bezier shape (see link below).\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nexport class BezierCurveEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a bezier function\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @param x1 Defines the x component of the start tangent in the bezier curve\r\n * @param y1 Defines the y component of the start tangent in the bezier curve\r\n * @param x2 Defines the x component of the end tangent in the bezier curve\r\n * @param y2 Defines the y component of the end tangent in the bezier curve\r\n */\r\n constructor(\r\n /** Defines the x component of the start tangent in the bezier curve */\r\n public x1: number = 0,\r\n /** Defines the y component of the start tangent in the bezier curve */\r\n public y1: number = 0,\r\n /** Defines the x component of the end tangent in the bezier curve */\r\n public x2: number = 1,\r\n /** Defines the y component of the end tangent in the bezier curve */\r\n public y2: number = 1\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return BezierCurve.Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"easing.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Animations/easing.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAmBjD;;;GAGG;AACH;IAAA;QAgBY,gBAAW,GAAG,cAAc,CAAC,iBAAiB,CAAC;IA+C3D,CAAC;IA7CG;;;OAGG;IACI,sCAAa,GAApB,UAAqB,UAAkB;QACnC,IAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IACzB,CAAC;IACD;;;OAGG;IACI,sCAAa,GAApB;QACI,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,6DAA6D;IACtD,mCAAU,GAAjB,UAAkB,QAAgB;QAC9B,MAAM,IAAI,KAAK,CAAC,g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easing function should follow.\r\n * Easing functions are used throughout the animation system.\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport interface IEasingFunction {\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * The link below provides some of the most common examples of easing functions.\r\n * @see https://easings.net/\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n ease(gradient: number): number;\r\n}\r\n\r\n/**\r\n * Base class used for every default easing function.\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class EasingFunction implements IEasingFunction {\r\n /**\r\n * Interpolation follows the mathematical formula associated with the easing function.\r\n */\r\n public static readonly EASINGMODE_EASEIN = 0;\r\n\r\n /**\r\n * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function.\r\n */\r\n public static readonly EASINGMODE_EASEOUT = 1;\r\n\r\n /**\r\n * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half.\r\n */\r\n public static readonly EASINGMODE_EASEINOUT = 2;\r\n\r\n private _easingMode = EasingFunction.EASINGMODE_EASEIN;\r\n\r\n /**\r\n * Sets the easing mode of the current function.\r\n * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT)\r\n */\r\n public setEasingMode(easingMode: number) {\r\n const n = Math.min(Math.max(easingMode, 0), 2);\r\n this._easingMode = n;\r\n }\r\n /**\r\n * Gets the current easing mode.\r\n * @returns the easing mode\r\n */\r\n public getEasingMode(): number {\r\n return this._easingMode;\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public easeInCore(gradient: number): number {\r\n throw new Error(\"You must implement this method\");\r\n }\r\n\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n public ease(gradient: number): number {\r\n switch (this._easingMode) {\r\n case EasingFunction.EASINGMODE_EASEIN:\r\n return this.easeInCore(gradient);\r\n case EasingFunction.EASINGMODE_EASEOUT:\r\n return 1 - this.easeInCore(1 - gradient);\r\n }\r\n\r\n if (gradient >= 0.5) {\r\n return (1 - this.easeInCore((1 - gradient) * 2)) * 0.5 + 0.5;\r\n }\r\n\r\n return this.easeInCore(gradient * 2) * 0.5;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a circle shape (see link below).\r\n * @see https://easings.net/#easeInCirc\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class CircleEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n gradient = Math.max(0, Math.min(1, gradient));\r\n return 1.0 - Math.sqrt(1.0 - gradient * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a ease back shape (see link below).\r\n * @see https://easings.net/#easeInBack\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class BackEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a back ease easing\r\n * @see https://easings.net/#easeInBack\r\n * @param amplitude Defines the amplitude of the function\r\n */\r\n constructor(\r\n /** Defines the amplitude of the function */\r\n public amplitude: number = 1\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n const num = Math.max(0, this.amplitude);\r\n return Math.pow(gradient, 3.0) - gradient * num * Math.sin(3.1415926535897931 * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a bouncing shape (see link below).\r\n * @see https://easings.net/#easeInBounce\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class BounceEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a bounce easing\r\n * @see https://easings.net/#easeInBounce\r\n * @param bounces Defines the number of bounces\r\n * @param bounciness Defines the amplitude of the bounce\r\n */\r\n constructor(\r\n /** Defines the number of bounces */\r\n public bounces: number = 3,\r\n /** Defines the amplitude of the bounce */\r\n public bounciness: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n const y = Math.max(0.0, this.bounces);\r\n let bounciness = this.bounciness;\r\n if (bounciness <= 1.0) {\r\n bounciness = 1.001;\r\n }\r\n const num9 = Math.pow(bounciness, y);\r\n const num5 = 1.0 - bounciness;\r\n const num4 = (1.0 - num9) / num5 + num9 * 0.5;\r\n const num15 = gradient * num4;\r\n const num65 = Math.log(-num15 * (1.0 - bounciness) + 1.0) / Math.log(bounciness);\r\n const num3 = Math.floor(num65);\r\n const num13 = num3 + 1.0;\r\n const num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);\r\n const num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);\r\n const num7 = (num8 + num12) * 0.5;\r\n const num6 = gradient - num7;\r\n const num2 = num7 - num8;\r\n return (-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2) * (num6 + num2);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 3 shape (see link below).\r\n * @see https://easings.net/#easeInCubic\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class CubicEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with an elastic shape (see link below).\r\n * @see https://easings.net/#easeInElastic\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class ElasticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an elastic easing function\r\n * @see https://easings.net/#easeInElastic\r\n * @param oscillations Defines the number of oscillations\r\n * @param springiness Defines the amplitude of the oscillations\r\n */\r\n constructor(\r\n /** Defines the number of oscillations*/\r\n public oscillations: number = 3,\r\n /** Defines the amplitude of the oscillations*/\r\n public springiness: number = 3\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n let num2;\r\n const num3 = Math.max(0.0, this.oscillations);\r\n const num = Math.max(0.0, this.springiness);\r\n\r\n if (num == 0) {\r\n num2 = gradient;\r\n } else {\r\n num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);\r\n }\r\n return num2 * Math.sin((6.2831853071795862 * num3 + 1.5707963267948966) * gradient);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with an exponential shape (see link below).\r\n * @see https://easings.net/#easeInExpo\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class ExponentialEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an exponential easing function\r\n * @see https://easings.net/#easeInExpo\r\n * @param exponent Defines the exponent of the function\r\n */\r\n constructor(\r\n /** Defines the exponent of the function */\r\n public exponent: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n if (this.exponent <= 0) {\r\n return gradient;\r\n }\r\n\r\n return (Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class PowerEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates an power base easing function\r\n * @see https://easings.net/#easeInQuad\r\n * @param power Defines the power of the function\r\n */\r\n constructor(\r\n /** Defines the power of the function */\r\n public power: number = 2\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n const y = Math.max(0.0, this.power);\r\n return Math.pow(gradient, y);\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 2 shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class QuadraticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 4 shape (see link below).\r\n * @see https://easings.net/#easeInQuart\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class QuarticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a power of 5 shape (see link below).\r\n * @see https://easings.net/#easeInQuint\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class QuinticEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return gradient * gradient * gradient * gradient * gradient;\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a sin shape (see link below).\r\n * @see https://easings.net/#easeInSine\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class SineEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return 1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient));\r\n }\r\n}\r\n\r\n/**\r\n * Easing function with a bezier shape (see link below).\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/advanced_animations#easing-functions\r\n */\r\nexport class BezierCurveEase extends EasingFunction implements IEasingFunction {\r\n /**\r\n * Instantiates a bezier function\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @param x1 Defines the x component of the start tangent in the bezier curve\r\n * @param y1 Defines the y component of the start tangent in the bezier curve\r\n * @param x2 Defines the x component of the end tangent in the bezier curve\r\n * @param y2 Defines the y component of the end tangent in the bezier curve\r\n */\r\n constructor(\r\n /** Defines the x component of the start tangent in the bezier curve */\r\n public x1: number = 0,\r\n /** Defines the y component of the start tangent in the bezier curve */\r\n public y1: number = 0,\r\n /** Defines the x component of the end tangent in the bezier curve */\r\n public x2: number = 1,\r\n /** Defines the y component of the end tangent in the bezier curve */\r\n public y2: number = 1\r\n ) {\r\n super();\r\n }\r\n\r\n /**\r\n * @param gradient\r\n * @hidden\r\n */\r\n public easeInCore(gradient: number): number {\r\n return BezierCurve.Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);\r\n }\r\n}\r\n"]}
|
|
@@ -55,8 +55,8 @@ var FreeCameraTouchInput = /** @class */ (function () {
|
|
|
55
55
|
};
|
|
56
56
|
this._pointerInput = function (p) {
|
|
57
57
|
var evt = p.event;
|
|
58
|
-
var isMouseEvent =
|
|
59
|
-
if (!_this.allowMouse &&
|
|
58
|
+
var isMouseEvent = evt.pointerType === "mouse";
|
|
59
|
+
if (!_this.allowMouse && isMouseEvent) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
if (p.type === PointerEventTypes.POINTERDOWN) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"freeCameraTouchInput.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Cameras/Inputs/freeCameraTouchInput.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;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,CAAC;YAEzF,MAAM,CAAC,yBAAyB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC;YACxG,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC;SAC5G;IACL,CAAC;IAED;;;OAGG;IACI,2CAAY,GAAnB;QACI,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED;;;OAGG;IACI,4CAAa,GAApB;QACI,OAAO,OAAO,CAAC;IACnB,CAAC;IA3LD;QADC,SAAS,EAAE;yEACsC;IAOlD;QADC,SAAS,EAAE;sEACgC;IAqLhD,2BAAC;CAAA,AAvMD,IAuMC;SAvMY,oBAAoB;AAyM3B,gBAAiB,CAAC,sBAAsB,CAAC,GAAG,oBAAoB,CAAC","sourcesContent":["import { serialize } from \"../../Misc/decorators\";\r\nimport type { Observer, EventState } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICameraInput } from \"../../Cameras/cameraInputsManager\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport type { FreeCamera } from \"../../Cameras/freeCamera\";\r\nimport type { PointerInfo } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { IPointerEvent } from \"../../Events/deviceInputEvents\";\r\n/**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nexport class FreeCameraTouchInput implements ICameraInput<FreeCamera> {\r\n /**\r\n * Defines the camera the input is attached to.\r\n */\r\n public camera: FreeCamera;\r\n\r\n /**\r\n * Defines the touch sensibility for rotation.\r\n * The lower the faster.\r\n */\r\n @serialize()\r\n public touchAngularSensibility: number = 200000.0;\r\n\r\n /**\r\n * Defines the touch sensibility for move.\r\n * The lower the faster.\r\n */\r\n @serialize()\r\n public touchMoveSensibility: number = 250.0;\r\n\r\n /**\r\n * Swap touch actions so that one touch is used for rotation and multiple for movement\r\n */\r\n public singleFingerRotate: boolean = false;\r\n\r\n private _offsetX: Nullable<number> = null;\r\n private _offsetY: Nullable<number> = null;\r\n\r\n private _pointerPressed = new Array<number>();\r\n private _pointerInput?: (p: PointerInfo, s: EventState) => void;\r\n private _observer: Nullable<Observer<PointerInfo>>;\r\n private _onLostFocus: Nullable<(e: FocusEvent) => any>;\r\n\r\n /**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param allowMouse Defines if mouse events can be treated as touch events\r\n */\r\n constructor(\r\n /**\r\n * Define if mouse events can be treated as touch events\r\n */\r\n public allowMouse = false\r\n ) {}\r\n\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n public attachControl(noPreventDefault?: boolean): void {\r\n // eslint-disable-next-line prefer-rest-params\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n let previousPosition: Nullable<{ x: number; y: number }> = null;\r\n\r\n if (this._pointerInput === undefined) {\r\n this._onLostFocus = () => {\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n };\r\n\r\n this._pointerInput = (p) => {\r\n const evt = <IPointerEvent>p.event;\r\n\r\n const isMouseEvent = !this.camera.getEngine().hostInformation.isMobile && evt instanceof MouseEvent;\r\n\r\n if (!this.allowMouse && (evt.pointerType === \"mouse\" || isMouseEvent)) {\r\n return;\r\n }\r\n\r\n if (p.type === PointerEventTypes.POINTERDOWN) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n\r\n this._pointerPressed.push(evt.pointerId);\r\n\r\n if (this._pointerPressed.length !== 1) {\r\n return;\r\n }\r\n\r\n previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n } else if (p.type === PointerEventTypes.POINTERUP) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n\r\n const index: number = this._pointerPressed.indexOf(evt.pointerId);\r\n\r\n if (index === -1) {\r\n return;\r\n }\r\n this._pointerPressed.splice(index, 1);\r\n\r\n if (index != 0) {\r\n return;\r\n }\r\n previousPosition = null;\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n } else if (p.type === PointerEventTypes.POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n\r\n if (!previousPosition) {\r\n return;\r\n }\r\n\r\n const index: number = this._pointerPressed.indexOf(evt.pointerId);\r\n\r\n if (index != 0) {\r\n return;\r\n }\r\n\r\n this._offsetX = evt.clientX - previousPosition.x;\r\n this._offsetY = -(evt.clientY - previousPosition.y);\r\n }\r\n };\r\n }\r\n\r\n this._observer = this.camera\r\n .getScene()\r\n .onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\r\n\r\n if (this._onLostFocus) {\r\n const engine = this.camera.getEngine();\r\n const element = engine.getInputElement();\r\n element && element.addEventListener(\"blur\", this._onLostFocus);\r\n }\r\n }\r\n\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n */\r\n public detachControl(): void {\r\n if (this._pointerInput) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n }\r\n\r\n if (this._onLostFocus) {\r\n const engine = this.camera.getEngine();\r\n const element = engine.getInputElement();\r\n element && element.removeEventListener(\"blur\", this._onLostFocus);\r\n this._onLostFocus = null;\r\n }\r\n this._pointerPressed = [];\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n }\r\n }\r\n\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n public checkInputs(): void {\r\n if (this._offsetX === null || this._offsetY === null) {\r\n return;\r\n }\r\n if (this._offsetX === 0 && this._offsetY === 0) {\r\n return;\r\n }\r\n\r\n const camera = this.camera;\r\n camera.cameraRotation.y = this._offsetX / this.touchAngularSensibility;\r\n\r\n const rotateCamera = (this.singleFingerRotate && this._pointerPressed.length === 1) || (!this.singleFingerRotate && this._pointerPressed.length > 1);\r\n\r\n if (rotateCamera) {\r\n camera.cameraRotation.x = -this._offsetY / this.touchAngularSensibility;\r\n } else {\r\n const speed = camera._computeLocalCameraSpeed();\r\n const direction = new Vector3(0, 0, (speed * this._offsetY) / this.touchMoveSensibility);\r\n\r\n Matrix.RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, camera._cameraRotationMatrix);\r\n camera.cameraDirection.addInPlace(Vector3.TransformCoordinates(direction, camera._cameraRotationMatrix));\r\n }\r\n }\r\n\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"FreeCameraTouchInput\";\r\n }\r\n\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n public getSimpleName(): string {\r\n return \"touch\";\r\n }\r\n}\r\n\r\n(<any>CameraInputTypes)[\"FreeCameraTouchInput\"] = FreeCameraTouchInput;\r\n"]}
|
|
1
|
+
{"version":3,"file":"freeCameraTouchInput.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Cameras/Inputs/freeCameraTouchInput.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yB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AC,CAAC;SAC5G;IACL,CAAC;IAED;;;OAGG;IACI,2CAAY,GAAnB;QACI,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED;;;OAGG;IACI,4CAAa,GAApB;QACI,OAAO,OAAO,CAAC;IACnB,CAAC;IA3LD;QADC,SAAS,EAAE;yEACsC;IAOlD;QADC,SAAS,EAAE;sEACgC;IAqLhD,2BAAC;CAAA,AAvMD,IAuMC;SAvMY,oBAAoB;AAyM3B,gBAAiB,CAAC,sBAAsB,CAAC,GAAG,oBAAoB,CAAC","sourcesContent":["import { serialize } from \"../../Misc/decorators\";\r\nimport type { Observer, EventState } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICameraInput } from \"../../Cameras/cameraInputsManager\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport type { FreeCamera } from \"../../Cameras/freeCamera\";\r\nimport type { PointerInfo } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { IPointerEvent } from \"../../Events/deviceInputEvents\";\r\n/**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nexport class FreeCameraTouchInput implements ICameraInput<FreeCamera> {\r\n /**\r\n * Defines the camera the input is attached to.\r\n */\r\n public camera: FreeCamera;\r\n\r\n /**\r\n * Defines the touch sensibility for rotation.\r\n * The lower the faster.\r\n */\r\n @serialize()\r\n public touchAngularSensibility: number = 200000.0;\r\n\r\n /**\r\n * Defines the touch sensibility for move.\r\n * The lower the faster.\r\n */\r\n @serialize()\r\n public touchMoveSensibility: number = 250.0;\r\n\r\n /**\r\n * Swap touch actions so that one touch is used for rotation and multiple for movement\r\n */\r\n public singleFingerRotate: boolean = false;\r\n\r\n private _offsetX: Nullable<number> = null;\r\n private _offsetY: Nullable<number> = null;\r\n\r\n private _pointerPressed = new Array<number>();\r\n private _pointerInput?: (p: PointerInfo, s: EventState) => void;\r\n private _observer: Nullable<Observer<PointerInfo>>;\r\n private _onLostFocus: Nullable<(e: FocusEvent) => any>;\r\n\r\n /**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param allowMouse Defines if mouse events can be treated as touch events\r\n */\r\n constructor(\r\n /**\r\n * Define if mouse events can be treated as touch events\r\n */\r\n public allowMouse = false\r\n ) {}\r\n\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n public attachControl(noPreventDefault?: boolean): void {\r\n // eslint-disable-next-line prefer-rest-params\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n let previousPosition: Nullable<{ x: number; y: number }> = null;\r\n\r\n if (this._pointerInput === undefined) {\r\n this._onLostFocus = () => {\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n };\r\n\r\n this._pointerInput = (p) => {\r\n const evt = <IPointerEvent>p.event;\r\n\r\n const isMouseEvent = evt.pointerType === \"mouse\";\r\n\r\n if (!this.allowMouse && isMouseEvent) {\r\n return;\r\n }\r\n\r\n if (p.type === PointerEventTypes.POINTERDOWN) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n\r\n this._pointerPressed.push(evt.pointerId);\r\n\r\n if (this._pointerPressed.length !== 1) {\r\n return;\r\n }\r\n\r\n previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n } else if (p.type === PointerEventTypes.POINTERUP) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n\r\n const index: number = this._pointerPressed.indexOf(evt.pointerId);\r\n\r\n if (index === -1) {\r\n return;\r\n }\r\n this._pointerPressed.splice(index, 1);\r\n\r\n if (index != 0) {\r\n return;\r\n }\r\n previousPosition = null;\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n } else if (p.type === PointerEventTypes.POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n\r\n if (!previousPosition) {\r\n return;\r\n }\r\n\r\n const index: number = this._pointerPressed.indexOf(evt.pointerId);\r\n\r\n if (index != 0) {\r\n return;\r\n }\r\n\r\n this._offsetX = evt.clientX - previousPosition.x;\r\n this._offsetY = -(evt.clientY - previousPosition.y);\r\n }\r\n };\r\n }\r\n\r\n this._observer = this.camera\r\n .getScene()\r\n .onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\r\n\r\n if (this._onLostFocus) {\r\n const engine = this.camera.getEngine();\r\n const element = engine.getInputElement();\r\n element && element.addEventListener(\"blur\", this._onLostFocus);\r\n }\r\n }\r\n\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n */\r\n public detachControl(): void {\r\n if (this._pointerInput) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n }\r\n\r\n if (this._onLostFocus) {\r\n const engine = this.camera.getEngine();\r\n const element = engine.getInputElement();\r\n element && element.removeEventListener(\"blur\", this._onLostFocus);\r\n this._onLostFocus = null;\r\n }\r\n this._pointerPressed = [];\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n }\r\n }\r\n\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n public checkInputs(): void {\r\n if (this._offsetX === null || this._offsetY === null) {\r\n return;\r\n }\r\n if (this._offsetX === 0 && this._offsetY === 0) {\r\n return;\r\n }\r\n\r\n const camera = this.camera;\r\n camera.cameraRotation.y = this._offsetX / this.touchAngularSensibility;\r\n\r\n const rotateCamera = (this.singleFingerRotate && this._pointerPressed.length === 1) || (!this.singleFingerRotate && this._pointerPressed.length > 1);\r\n\r\n if (rotateCamera) {\r\n camera.cameraRotation.x = -this._offsetY / this.touchAngularSensibility;\r\n } else {\r\n const speed = camera._computeLocalCameraSpeed();\r\n const direction = new Vector3(0, 0, (speed * this._offsetY) / this.touchMoveSensibility);\r\n\r\n Matrix.RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, camera._cameraRotationMatrix);\r\n camera.cameraDirection.addInPlace(Vector3.TransformCoordinates(direction, camera._cameraRotationMatrix));\r\n }\r\n }\r\n\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"FreeCameraTouchInput\";\r\n }\r\n\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n public getSimpleName(): string {\r\n return \"touch\";\r\n }\r\n}\r\n\r\n(<any>CameraInputTypes)[\"FreeCameraTouchInput\"] = FreeCameraTouchInput;\r\n"]}
|
|
@@ -178,7 +178,7 @@ var WebDeviceInputSystem = /** @class */ (function () {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
// If the device in use has mouse capabilities, pre-register mouse
|
|
181
|
-
if (matchMedia("(pointer:fine)").matches) {
|
|
181
|
+
if (typeof matchMedia === "function" && matchMedia("(pointer:fine)").matches) {
|
|
182
182
|
// This will provide a dummy value for the cursor position and is expected to be overridden when the first mouse event happens.
|
|
183
183
|
// There isn't any good way to get the current position outside of a pointer event so that's why this was done.
|
|
184
184
|
this._addPointerDevice(DeviceType.Mouse, 0, 0, 0);
|