Skip to content

Commit

Permalink
5.0.0-alpha.58
Browse files Browse the repository at this point in the history
  • Loading branch information
RaananW committed Oct 26, 2021
1 parent b812428 commit 0e06867
Show file tree
Hide file tree
Showing 95 changed files with 1,893 additions and 1,837 deletions.
2 changes: 2 additions & 0 deletions dist/preview release/babylon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5929,6 +5929,8 @@ declare module BABYLON {
get uid(): string;
/** @hidden */
_prefiltered: boolean;
/** @hidden */
_forceSerialize: boolean;
/**
* Return a string representation of the texture.
* @returns the texture as a string
Expand Down
4 changes: 2 additions & 2 deletions dist/preview release/babylon.js

Large diffs are not rendered by default.

100 changes: 58 additions & 42 deletions dist/preview release/babylon.max.js
Original file line number Diff line number Diff line change
Expand Up @@ -19647,31 +19647,30 @@ var FreeCameraMouseInput = /** @class */ (function () {
}
}
else if (p.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_4__["PointerEventTypes"].POINTERMOVE) {
if (!_this.previousPosition) {
if (engine.isPointerLock && _this._onMouseMove) {
_this._onMouseMove(p.event);
}
return;
}
var offsetX = evt.clientX - _this.previousPosition.x;
var offsetY = evt.clientY - _this.previousPosition.y;
if (_this.camera.getScene().useRightHandedSystem) {
offsetX *= -1;
}
if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {
offsetX *= -1;
}
if (_this._allowCameraRotation) {
_this.camera.cameraRotation.y += offsetX / _this.angularSensibility;
_this.camera.cameraRotation.x += offsetY / _this.angularSensibility;
if (engine.isPointerLock && _this._onMouseMove) {
_this._onMouseMove(p.event);
}
_this.onPointerMovedObservable.notifyObservers({ offsetX: offsetX, offsetY: offsetY });
_this.previousPosition = {
x: evt.clientX,
y: evt.clientY,
};
if (!noPreventDefault) {
evt.preventDefault();
else if (_this.previousPosition) {
var offsetX = evt.clientX - _this.previousPosition.x;
var offsetY = evt.clientY - _this.previousPosition.y;
if (_this.camera.getScene().useRightHandedSystem) {
offsetX *= -1;
}
if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {
offsetX *= -1;
}
if (_this._allowCameraRotation) {
_this.camera.cameraRotation.y += offsetX / _this.angularSensibility;
_this.camera.cameraRotation.x += offsetY / _this.angularSensibility;
}
_this.onPointerMovedObservable.notifyObservers({ offsetX: offsetX, offsetY: offsetY });
_this.previousPosition = {
x: evt.clientX,
y: evt.clientY,
};
if (!noPreventDefault) {
evt.preventDefault();
}
}
}
};
Expand Down Expand Up @@ -56910,7 +56909,7 @@ var ThinEngine = /** @class */ (function () {
*/
// Not mixed with Version for tooling purpose.
get: function () {
return "[email protected].57";
return "[email protected].58";
},
enumerable: false,
configurable: true
Expand All @@ -56920,7 +56919,7 @@ var ThinEngine = /** @class */ (function () {
* Returns the current version of the framework
*/
get: function () {
return "5.0.0-alpha.57";
return "5.0.0-alpha.58";
},
enumerable: false,
configurable: true
Expand Down Expand Up @@ -97275,8 +97274,8 @@ var CloudBlock = /** @class */ (function (_super) {
if (!this._outputs[0].hasEndpoints) {
return;
}
var functionString = "float cloudRandom (in vec2 st) {\n return fract(sin(dot(st.xy,\n vec2(12.9898,78.233)))*\n 43758.5453123);\n }\n\n float cloudRandom(in float p) { p = fract(p * 0.011); p *= p + 7.5; p *= p + p; return fract(p); }\n\n // Based on Morgan McGuire @morgan3d\n // https://www.shadertoy.com/view/4dS3Wd\n float cloudNoise(in vec2 st) {\n vec2 i = floor(st);\n vec2 f = fract(st);\n\n // Four corners in 2D of a tile\n float a = cloudRandom(i);\n float b = cloudRandom(i + vec2(1.0, 0.0));\n float c = cloudRandom(i + vec2(0.0, 1.0));\n float d = cloudRandom(i + vec2(1.0, 1.0));\n\n vec2 u = f * f * (3.0 - 2.0 * f);\n\n return mix(a, b, u.x) +\n (c - a)* u.y * (1.0 - u.x) +\n (d - b) * u.x * u.y;\n }\n\n float cloudNoise(in vec3 x, in vec3 chaos) {\n vec3 step = chaos * vec3(60., 120., 75.) + vec3(60., 120., 75.);\n\n vec3 i = floor(x);\n vec3 f = fract(x);\n\n float n = dot(i, step);\n\n vec3 u = f * f * (3.0 - 2.0 * f);\n return mix(mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 0))), cloudRandom(n + dot(step, vec3(1, 0, 0))), u.x),\n mix( cloudRandom(n + dot(step, vec3(0, 1, 0))), cloudRandom(n + dot(step, vec3(1, 1, 0))), u.x), u.y),\n mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 1))), cloudRandom(n + dot(step, vec3(1, 0, 1))), u.x),\n mix( cloudRandom(n + dot(step, vec3(0, 1, 1))), cloudRandom(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);\n }";
var fractalBrownianString = "\n float fbm(in vec2 st, in vec2 chaos) {\n // Initial values\n float value = 0.0;\n float amplitude = .5;\n float frequency = 0.;\n\n // Loop of octaves\n for (int i = 0; i < OCTAVES; i++) {\n value += amplitude * cloudNoise(st);\n st *= 2.0;\n amplitude *= 0.5;\n }\n return value;\n }\n\n float fbm(in vec3 x, in vec3 chaos) {\n // Initial values\n float value = 0.0;\n float amplitude = 0.5;\n for (int i = 0; i < OCTAVES; ++i) {\n value += amplitude * cloudNoise(x, chaos);\n x = x * 2.0;\n amplitude *= 0.5;\n }\n return value;\n }";
var functionString = "\n\n float cloudRandom(in float p) { p = fract(p * 0.011); p *= p + 7.5; p *= p + p; return fract(p); }\n\n // Based on Morgan McGuire @morgan3d\n // https://www.shadertoy.com/view/4dS3Wd\n float cloudNoise(in vec2 x, in vec2 chaos) {\n vec2 step = chaos * vec2(75., 120.) + vec2(75., 120.);\n\n vec2 i = floor(x);\n vec2 f = fract(x);\n\n float n = dot(i, step);\n\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(\n mix(cloudRandom(n + dot(step, vec2(0, 0))), cloudRandom(n + dot(step, vec2(1, 0))), u.x),\n mix(cloudRandom(n + dot(step, vec2(0, 1))), cloudRandom(n + dot(step, vec2(1, 1))), u.x),\n u.y\n );\n }\n\n float cloudNoise(in vec3 x, in vec3 chaos) {\n vec3 step = chaos * vec3(60., 120., 75.) + vec3(60., 120., 75.);\n\n vec3 i = floor(x);\n vec3 f = fract(x);\n\n float n = dot(i, step);\n\n vec3 u = f * f * (3.0 - 2.0 * f);\n return mix(mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 0))), cloudRandom(n + dot(step, vec3(1, 0, 0))), u.x),\n mix( cloudRandom(n + dot(step, vec3(0, 1, 0))), cloudRandom(n + dot(step, vec3(1, 1, 0))), u.x), u.y),\n mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 1))), cloudRandom(n + dot(step, vec3(1, 0, 1))), u.x),\n mix( cloudRandom(n + dot(step, vec3(0, 1, 1))), cloudRandom(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);\n }";
var fractalBrownianString = "\n float fbm(in vec2 st, in vec2 chaos) {\n // Initial values\n float value = 0.0;\n float amplitude = .5;\n float frequency = 0.;\n\n // Loop of octaves\n for (int i = 0; i < OCTAVES; i++) {\n value += amplitude * cloudNoise(st, chaos);\n st *= 2.0;\n amplitude *= 0.5;\n }\n return value;\n }\n\n float fbm(in vec3 x, in vec3 chaos) {\n // Initial values\n float value = 0.0;\n float amplitude = 0.5;\n for (int i = 0; i < OCTAVES; ++i) {\n value += amplitude * cloudNoise(x, chaos);\n x = x * 2.0;\n amplitude *= 0.5;\n }\n return value;\n }";
var fbmNewName = "fbm" + this.octaves;
state._emitFunction('CloudBlockCode', functionString, '// CloudBlockCode');
state._emitFunction('CloudBlockCodeFBM' + this.octaves, fractalBrownianString.replace(/fbm/gi, fbmNewName).replace(/OCTAVES/gi, (this.octaves | 0).toString()), '// CloudBlockCode FBM');
Expand Down Expand Up @@ -115181,6 +115180,8 @@ var BaseTexture = /** @class */ (function (_super) {
_this.isRenderTarget = false;
/** @hidden */
_this._prefiltered = false;
/** @hidden */
_this._forceSerialize = false;
/**
* Define the list of animation attached to the texture.
*/
Expand Down Expand Up @@ -121312,7 +121313,7 @@ var Texture = /** @class */ (function (_super) {
else if (this.url && Object(_Misc_stringTools__WEBPACK_IMPORTED_MODULE_11__["StartsWith"])(this.url, "data:") && this._buffer instanceof Uint8Array) {
serializationObject.base64String = "data:image/png;base64," + Object(_Misc_stringTools__WEBPACK_IMPORTED_MODULE_11__["EncodeArrayBufferToBase64"])(this._buffer);
}
else if (Texture.ForceSerializeBuffers || (this.url && Object(_Misc_stringTools__WEBPACK_IMPORTED_MODULE_11__["StartsWith"])(this.url, "blob:"))) {
else if (Texture.ForceSerializeBuffers || (this.url && Object(_Misc_stringTools__WEBPACK_IMPORTED_MODULE_11__["StartsWith"])(this.url, "blob:")) || this._forceSerialize) {
serializationObject.base64String = !this._engine || this._engine._features.supportSyncTextureRead ? Object(_Misc_copyTools__WEBPACK_IMPORTED_MODULE_12__["GenerateBase64StringFromTexture"])(this) : Object(_Misc_copyTools__WEBPACK_IMPORTED_MODULE_12__["GenerateBase64StringFromTextureAsync"])(this);
}
}
Expand Down Expand Up @@ -230960,7 +230961,7 @@ var CircleBuffer = /** @class */ (function () {
}());
var FirstStepDetector = /** @class */ (function () {
function FirstStepDetector() {
this._samples = new CircleBuffer(60);
this._samples = new CircleBuffer(20);
this._entropy = 0;
this.onFirstStepDetected = new _Misc_observable__WEBPACK_IMPORTED_MODULE_3__["Observable"]();
}
Expand Down Expand Up @@ -231039,7 +231040,7 @@ var FirstStepDetector = /** @class */ (function () {
};
Object.defineProperty(FirstStepDetector.prototype, "_samePointCheckStartIdx", {
get: function () {
return this._samples.length / 3;
return Math.floor(this._samples.length / 3);
},
enumerable: false,
configurable: true
Expand Down Expand Up @@ -231081,14 +231082,14 @@ var FirstStepDetector = /** @class */ (function () {
});
Object.defineProperty(FirstStepDetector.prototype, "_entropyDecayFactor", {
get: function () {
return 0.98;
return 0.93;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FirstStepDetector.prototype, "_entropyThreshold", {
get: function () {
return 0.25;
return 0.4;
},
enumerable: false,
configurable: true
Expand Down Expand Up @@ -231144,7 +231145,7 @@ var WalkingTracker = /** @class */ (function () {
this._t = dot / (this._axisLength * this._axisLength);
var projDistSquared = this._currentPosition.lengthSquared() - (dot / this._axisLength) * (dot / this._axisLength);
// TODO: Extricate the magic.
this._vitality *= (0.95 - 100 * Math.max(projDistSquared - 0.0016, 0) + Math.max(this._t - priorT, 0));
this._vitality *= (0.92 - 100 * Math.max(projDistSquared - 0.0016, 0) + Math.max(this._t - priorT, 0));
};
WalkingTracker.prototype.update = function (x, y) {
if (this._vitality < this._vitalityThreshold) {
Expand Down Expand Up @@ -231197,12 +231198,14 @@ var WalkingTracker = /** @class */ (function () {
return WalkingTracker;
}());
var Walker = /** @class */ (function () {
function Walker() {
function Walker(engine) {
var _this = this;
this._detector = new FirstStepDetector();
this._walker = null;
this._movement = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Vector2"]();
this._millisecondsSinceLastUpdate = Walker._MillisecondsPerUpdate;
this.movementThisFrame = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Vector3"].Zero();
this._engine = engine;
this._detector.onFirstStepDetected.add(function (event) {
if (!_this._walker) {
_this._walker = new WalkingTracker(event.leftApex, event.rightApex, event.currentPosition, event.currentStepDirection);
Expand All @@ -231215,18 +231218,31 @@ var Walker = /** @class */ (function () {
}
});
}
Object.defineProperty(Walker, "_MillisecondsPerUpdate", {
get: function () {
// 15 FPS
return 1000 / 15;
},
enumerable: false,
configurable: true
});
Walker.prototype.update = function (position, forward) {
forward.y = 0;
forward.normalize();
this._detector.update(position.x, position.z, forward.x, forward.z);
if (this._walker) {
var updated = this._walker.update(position.x, position.z);
if (!updated) {
this._walker = null;
// Enforce reduced framerate
this._millisecondsSinceLastUpdate += this._engine.getDeltaTime();
if (this._millisecondsSinceLastUpdate >= Walker._MillisecondsPerUpdate) {
this._millisecondsSinceLastUpdate -= Walker._MillisecondsPerUpdate;
this._detector.update(position.x, position.z, forward.x, forward.z);
if (this._walker) {
var updated = this._walker.update(position.x, position.z);
if (!updated) {
this._walker = null;
}
}
this._movement.scaleInPlace(0.85);
}
this.movementThisFrame.set(this._movement.x, 0, this._movement.y);
this._movement.scaleInPlace(0.96);
};
return Walker;
}());
Expand Down Expand Up @@ -231319,7 +231335,7 @@ var WebXRWalkingLocomotion = /** @class */ (function (_super) {
if (!this.isCompatible || !_super.prototype.attach.call(this)) {
return false;
}
this._walker = new Walker();
this._walker = new Walker(this._sessionManager.scene.getEngine());
return true;
};
/**
Expand Down
2 changes: 1 addition & 1 deletion dist/preview release/babylon.max.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions dist/preview release/babylon.module.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6000,6 +6000,8 @@ declare module "babylonjs/Materials/Textures/baseTexture" {
get uid(): string;
/** @hidden */
_prefiltered: boolean;
/** @hidden */
_forceSerialize: boolean;
/**
* Return a string representation of the texture.
* @returns the texture as a string
Expand Down Expand Up @@ -100724,6 +100726,8 @@ declare module BABYLON {
get uid(): string;
/** @hidden */
_prefiltered: boolean;
/** @hidden */
_forceSerialize: boolean;
/**
* Return a string representation of the texture.
* @returns the texture as a string
Expand Down
2 changes: 1 addition & 1 deletion dist/preview release/glTF2Interface/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "babylonjs-gltf2interface",
"description": "A typescript declaration of babylon's gltf2 inteface.",
"version": "5.0.0-alpha.57",
"version": "5.0.0-alpha.58",
"repository": {
"type": "git",
"url": "https://github.com/BabylonJS/Babylon.js.git"
Expand Down
6 changes: 6 additions & 0 deletions dist/preview release/gui/babylon.gui.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,12 @@ declare module BABYLON.GUI {
*/
getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
/**
* Will return all controls with the given type name
* @param typeName defines the type name to search for
* @returns an array of all controls found
*/
getControlsByType(typeName: string): Control[];
/**
* Will return the first control with the given name
* @param name defines the name to search for
* @return the first control found or null
Expand Down
Loading

0 comments on commit 0e06867

Please sign in to comment.