forked from BabylonJS/Babylon.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
1,893 additions
and
1,837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
} | ||
} | ||
} | ||
}; | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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'); | ||
|
@@ -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. | ||
*/ | ||
|
@@ -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); | ||
} | ||
} | ||
|
@@ -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"](); | ||
} | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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) { | ||
|
@@ -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); | ||
|
@@ -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; | ||
}()); | ||
|
@@ -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; | ||
}; | ||
/** | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.