@babylonjs/core 7.14.0 → 7.15.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/Buffers/buffer.js +4 -2
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/bufferUtils.js +6 -2
- package/Buffers/bufferUtils.js.map +1 -1
- package/Cameras/arcRotateCamera.js +10 -8
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/Textures/Loaders/ddsTextureLoader.js +1 -1
- package/Materials/Textures/Loaders/ddsTextureLoader.js.map +1 -1
- package/Maths/math.vector.d.ts +9 -2
- package/Maths/math.vector.js +28 -2
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +1 -1
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/instancedMesh.js +1 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Misc/asyncLock.d.ts +11 -2
- package/Misc/asyncLock.js +37 -3
- package/Misc/asyncLock.js.map +1 -1
- package/Misc/fileTools.js +1 -1
- package/Misc/fileTools.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +3 -0
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/XR/webXRManagedOutputCanvas.js +4 -5
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/package.json +1 -1
|
@@ -86,7 +86,7 @@ export class _DDSTextureLoader {
|
|
|
86
86
|
*/
|
|
87
87
|
loadData(data, texture, callback) {
|
|
88
88
|
const info = DDSTools.GetDDSInfo(data);
|
|
89
|
-
const loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps && info.width >> (info.mipmapCount - 1) === 1;
|
|
89
|
+
const loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps && Math.max(info.width, info.height) >> (info.mipmapCount - 1) === 1;
|
|
90
90
|
callback(info.width, info.height, loadMipmap, info.isFourCC, () => {
|
|
91
91
|
DDSTools.UploadDDSLevels(texture.getEngine(), texture, data, info, loadMipmap, 1);
|
|
92
92
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ddsTextureLoader.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Loaders/ddsTextureLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAIjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,gDAAgD,CAAC;AAExD;;;GAGG;AACH,gEAAgE;AAChE,MAAM,OAAO,iBAAiB;IAA9B;QACI;;WAEG;QACa,oBAAe,GAAG,IAAI,CAAC;IA8F3C,CAAC;IA5FG;;;;OAIG;IACI,OAAO,CAAC,SAAiB;QAC5B,OAAO,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACI,YAAY,CAAC,IAAyC,EAAE,OAAwB,EAAE,iBAA0B,EAAE,MAAsC;QACvJ,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAY,CAAC;QAC7C,IAAI,IAAyB,CAAC;QAC9B,IAAI,UAAU,GAAY,KAAK,CAAC;QAChC,IAAI,QAAQ,GAAW,IAAI,CAAC;QAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;gBACzB,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBAEjC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;gBAC3B,OAAO,CA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IAAI,CAAC;QACvB,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACpD,OAAO,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAEnC,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;SAC5E;IACL,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CACX,IAAqB,EACrB,OAAwB,EACxB,QAA+G;QAE/G,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEvC,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5K,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;YAC9D,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QACtF,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,uBAAuB;AACvB,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport { SphericalPolynomial } from \"../../../Maths/sphericalPolynomial\";\r\nimport { Engine } from \"../../../Engines/engine\";\r\nimport type { InternalTexture } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IInternalTextureLoader } from \"../../../Materials/Textures/internalTextureLoader\";\r\nimport type { DDSInfo } from \"../../../Misc/dds\";\r\nimport { DDSTools } from \"../../../Misc/dds\";\r\n\r\nimport \"../../../Engines/Extensions/engine.cubeTexture\";\r\n\r\n/**\r\n * Implementation of the DDS Texture Loader.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _DDSTextureLoader implements IInternalTextureLoader {\r\n /**\r\n * Defines whether the loader supports cascade loading the different faces.\r\n */\r\n public readonly supportCascades = true;\r\n\r\n /**\r\n * This returns if the loader support the current file information.\r\n * @param extension defines the file extension of the file being loaded\r\n * @returns true if the loader can load the specified file\r\n */\r\n public canLoad(extension: string): boolean {\r\n return extension.endsWith(\".dds\");\r\n }\r\n\r\n /**\r\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\r\n * @param imgs contains the cube maps\r\n * @param texture defines the BabylonJS internal texture\r\n * @param createPolynomials will be true if polynomials have been requested\r\n * @param onLoad defines the callback to trigger once the texture is ready\r\n */\r\n public loadCubeData(imgs: ArrayBufferView | ArrayBufferView[], texture: InternalTexture, createPolynomials: boolean, onLoad: Nullable<(data?: any) => void>): void {\r\n const engine = texture.getEngine() as Engine;\r\n let info: DDSInfo | undefined;\r\n let loadMipmap: boolean = false;\r\n let maxLevel: number = 1000;\r\n if (Array.isArray(imgs)) {\r\n for (let index = 0; index < imgs.length; index++) {\r\n const data = imgs[index];\r\n info = DDSTools.GetDDSInfo(data);\r\n\r\n texture.width = info.width;\r\n texture.height = info.height;\r\n\r\n loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps;\r\n\r\n engine._unpackFlipY(info.isCompressed);\r\n\r\n DDSTools.UploadDDSLevels(engine, texture, data, info, loadMipmap, 6, -1, index);\r\n\r\n if (!info.isFourCC && info.mipmapCount === 1) {\r\n engine.generateMipMapsForCubemap(texture);\r\n } else {\r\n maxLevel = info.mipmapCount - 1;\r\n }\r\n }\r\n } else {\r\n const data = imgs;\r\n info = DDSTools.GetDDSInfo(data);\r\n\r\n texture.width = info.width;\r\n texture.height = info.height;\r\n\r\n if (createPolynomials) {\r\n info.sphericalPolynomial = new SphericalPolynomial();\r\n }\r\n\r\n loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps;\r\n engine._unpackFlipY(info.isCompressed);\r\n\r\n DDSTools.UploadDDSLevels(engine, texture, data, info, loadMipmap, 6);\r\n\r\n if (!info.isFourCC && info.mipmapCount === 1) {\r\n // Do not unbind as we still need to set the parameters.\r\n engine.generateMipMapsForCubemap(texture, false);\r\n } else {\r\n maxLevel = info.mipmapCount - 1;\r\n }\r\n }\r\n engine._setCubeMapTextureParams(texture, loadMipmap, maxLevel);\r\n texture.isReady = true;\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (onLoad) {\r\n onLoad({ isDDS: true, width: texture.width, info, data: imgs, texture });\r\n }\r\n }\r\n\r\n /**\r\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\r\n * @param data contains the texture data\r\n * @param texture defines the BabylonJS internal texture\r\n * @param callback defines the method to call once ready to upload\r\n */\r\n public loadData(\r\n data: ArrayBufferView,\r\n texture: InternalTexture,\r\n callback: (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void) => void\r\n ): void {\r\n const info = DDSTools.GetDDSInfo(data);\r\n\r\n const loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && texture.generateMipMaps && Math.max(info.width, info.height) >> (info.mipmapCount - 1) === 1;\r\n callback(info.width, info.height, loadMipmap, info.isFourCC, () => {\r\n DDSTools.UploadDDSLevels(texture.getEngine(), texture, data, info, loadMipmap, 1);\r\n });\r\n }\r\n}\r\n\r\n// Register the loader.\r\nEngine._TextureLoaders.push(new _DDSTextureLoader());\r\n"]}
|
package/Maths/math.vector.d.ts
CHANGED
|
@@ -2797,6 +2797,13 @@ export declare class Quaternion implements Tensor<Tuple<number, 4>, Quaternion>,
|
|
|
2797
2797
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/rotation_conventions
|
|
2798
2798
|
*/
|
|
2799
2799
|
toEulerAnglesToRef<T extends Vector3>(result: T): T;
|
|
2800
|
+
/**
|
|
2801
|
+
* Sets the given vector3 "result" with the Alpha, Beta, Gamma Euler angles translated from the current quaternion
|
|
2802
|
+
* @param result defines the vector which will be filled with the Euler angles
|
|
2803
|
+
* @returns result input
|
|
2804
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/rotation_conventions
|
|
2805
|
+
*/
|
|
2806
|
+
toAlphaBetaGammaToRef<T extends Vector3>(result: T): T;
|
|
2800
2807
|
/**
|
|
2801
2808
|
* Updates the given rotation matrix with the current quaternion values
|
|
2802
2809
|
* Example Playground https://playground.babylonjs.com/#L49EJ7#67
|
|
@@ -4301,8 +4308,8 @@ export declare class TmpVectors {
|
|
|
4301
4308
|
static Vector3: [Vector3, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3];
|
|
4302
4309
|
/** 3 temp Vector4 at once should be enough */
|
|
4303
4310
|
static Vector4: [Vector4, Vector4, Vector4];
|
|
4304
|
-
/**
|
|
4305
|
-
static Quaternion: [Quaternion, Quaternion];
|
|
4311
|
+
/** 3 temp Quaternion at once should be enough */
|
|
4312
|
+
static Quaternion: [Quaternion, Quaternion, Quaternion];
|
|
4306
4313
|
/** 8 temp Matrices at once should be enough */
|
|
4307
4314
|
static Matrix: [Matrix, Matrix, Matrix, Matrix, Matrix, Matrix, Matrix, Matrix];
|
|
4308
4315
|
}
|
package/Maths/math.vector.js
CHANGED
|
@@ -4416,6 +4416,32 @@ export class Quaternion {
|
|
|
4416
4416
|
}
|
|
4417
4417
|
return result;
|
|
4418
4418
|
}
|
|
4419
|
+
/**
|
|
4420
|
+
* Sets the given vector3 "result" with the Alpha, Beta, Gamma Euler angles translated from the current quaternion
|
|
4421
|
+
* @param result defines the vector which will be filled with the Euler angles
|
|
4422
|
+
* @returns result input
|
|
4423
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/rotation_conventions
|
|
4424
|
+
*/
|
|
4425
|
+
toAlphaBetaGammaToRef(result) {
|
|
4426
|
+
const qz = this._z;
|
|
4427
|
+
const qx = this._x;
|
|
4428
|
+
const qy = this._y;
|
|
4429
|
+
const qw = this._w;
|
|
4430
|
+
// Compute intermediate values
|
|
4431
|
+
const sinHalfBeta = Math.sqrt(qx * qx + qy * qy);
|
|
4432
|
+
const cosHalfBeta = Math.sqrt(qz * qz + qw * qw);
|
|
4433
|
+
// Calculate beta
|
|
4434
|
+
const beta = 2 * Math.atan2(sinHalfBeta, cosHalfBeta);
|
|
4435
|
+
// Calculate gamma + alpha
|
|
4436
|
+
const gammaPlusAlpha = 2 * Math.atan2(qz, qw);
|
|
4437
|
+
// Calculate gamma - alpha
|
|
4438
|
+
const gammaMinusAlpha = 2 * Math.atan2(qy, qx);
|
|
4439
|
+
// Calculate gamma and alpha
|
|
4440
|
+
const gamma = (gammaPlusAlpha + gammaMinusAlpha) / 2;
|
|
4441
|
+
const alpha = (gammaPlusAlpha - gammaMinusAlpha) / 2;
|
|
4442
|
+
result.set(alpha, beta, gamma);
|
|
4443
|
+
return result;
|
|
4444
|
+
}
|
|
4419
4445
|
/**
|
|
4420
4446
|
* Updates the given rotation matrix with the current quaternion values
|
|
4421
4447
|
* Example Playground https://playground.babylonjs.com/#L49EJ7#67
|
|
@@ -7479,8 +7505,8 @@ TmpVectors.Vector2 = ArrayTools.BuildTuple(3, Vector2.Zero);
|
|
|
7479
7505
|
TmpVectors.Vector3 = ArrayTools.BuildTuple(13, Vector3.Zero);
|
|
7480
7506
|
/** 3 temp Vector4 at once should be enough */
|
|
7481
7507
|
TmpVectors.Vector4 = ArrayTools.BuildTuple(3, Vector4.Zero);
|
|
7482
|
-
/**
|
|
7483
|
-
TmpVectors.Quaternion = ArrayTools.BuildTuple(
|
|
7508
|
+
/** 3 temp Quaternion at once should be enough */
|
|
7509
|
+
TmpVectors.Quaternion = ArrayTools.BuildTuple(3, Quaternion.Zero);
|
|
7484
7510
|
/** 8 temp Matrices at once should be enough */
|
|
7485
7511
|
TmpVectors.Matrix = ArrayTools.BuildTuple(8, Matrix.Identity);
|
|
7486
7512
|
RegisterClass("BABYLON.Vector2", Vector2);
|