|
@@ -147,7 +147,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
var extendStatics = function(d, b) {
|
|
|
extendStatics = Object.setPrototypeOf ||
|
|
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
|
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
|
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
|
return extendStatics(d, b);
|
|
|
};
|
|
|
|
|
@@ -241,8 +241,8 @@ var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
|
o[k2] = m[k];
|
|
|
});
|
|
|
|
|
|
-function __exportStar(m, exports) {
|
|
|
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
|
+function __exportStar(m, o) {
|
|
|
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
|
}
|
|
|
|
|
|
function __values(o) {
|
|
@@ -332,7 +332,7 @@ var __setModuleDefault = Object.create ? (function(o, v) {
|
|
|
function __importStar(mod) {
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
var result = {};
|
|
|
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
__setModuleDefault(result, mod);
|
|
|
return result;
|
|
|
}
|
|
@@ -4908,7 +4908,7 @@ var AnimationGroup = /** @class */ (function () {
|
|
|
var newKey = {
|
|
|
frame: endFrame,
|
|
|
value: endKey.value,
|
|
|
- inTangent: endKey.outTangent,
|
|
|
+ inTangent: endKey.inTangent,
|
|
|
outTangent: endKey.outTangent,
|
|
|
interpolation: endKey.interpolation
|
|
|
};
|
|
@@ -40715,7 +40715,7 @@ var ThinEngine = /** @class */ (function () {
|
|
|
*/
|
|
|
// Not mixed with Version for tooling purpose.
|
|
|
get: function () {
|
|
|
- return "babylonjs@4.2.0-beta.17";
|
|
|
+ return "babylonjs@4.2.0-beta.18";
|
|
|
},
|
|
|
enumerable: false,
|
|
|
configurable: true
|
|
@@ -40725,7 +40725,7 @@ var ThinEngine = /** @class */ (function () {
|
|
|
* Returns the current version of the framework
|
|
|
*/
|
|
|
get: function () {
|
|
|
- return "4.2.0-beta.17";
|
|
|
+ return "4.2.0-beta.18";
|
|
|
},
|
|
|
enumerable: false,
|
|
|
configurable: true
|
|
@@ -48329,16 +48329,10 @@ var AxisScaleGizmo = /** @class */ (function (_super) {
|
|
|
var linePosition = arrowTail.position.clone();
|
|
|
var lineScale = arrowTail.scaling.clone();
|
|
|
var increaseGizmoMesh = function (dragDistance) {
|
|
|
- var dragStrength = _this.sensitivity * dragDistance * ((_this.scaleRatio * 3) / _this._rootMesh.scaling.length());
|
|
|
- var scalar = 1; // This will increase the rate of gizmo size on drag
|
|
|
- var originalScale = arrowTail.scaling.y;
|
|
|
- var newScale = originalScale + dragStrength * scalar;
|
|
|
- var newMeshPosition = arrowMesh.position.z + ((newScale - originalScale) / 4);
|
|
|
- if (newMeshPosition >= 0) {
|
|
|
- arrowMesh.position.z = newMeshPosition;
|
|
|
- arrowTail.scaling.y = newScale;
|
|
|
- arrowTail.position.z = arrowMesh.position.z / 2;
|
|
|
- }
|
|
|
+ var dragStrength = (dragDistance * (3 / _this._rootMesh.scaling.length())) * 6;
|
|
|
+ arrowMesh.position.z += dragStrength / 3.5;
|
|
|
+ arrowTail.scaling.y += dragStrength;
|
|
|
+ arrowTail.position.z = arrowMesh.position.z / 2;
|
|
|
};
|
|
|
var resetGizmoMesh = function () {
|
|
|
arrowMesh.position.set(nodePosition.x, nodePosition.y, nodePosition.z);
|
|
@@ -70403,6 +70397,10 @@ var InputBlock = /** @class */ (function (_super) {
|
|
|
_this.groupInInspector = "";
|
|
|
/** Gets an observable raised when the value is changed */
|
|
|
_this.onValueChangedObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_10__["Observable"]();
|
|
|
+ /** Gets or sets a boolean indicating if content needs to be converted to gamma space (for color3/4 only) */
|
|
|
+ _this.convertToGammaSpace = false;
|
|
|
+ /** Gets or sets a boolean indicating if content needs to be converted to linear space (for color3/4 only) */
|
|
|
+ _this.convertToLinearSpace = false;
|
|
|
_this._type = type;
|
|
|
_this.setDefaultValue();
|
|
|
_this.registerOutput("output", type);
|
|
@@ -70753,9 +70751,23 @@ var InputBlock = /** @class */ (function (_super) {
|
|
|
case _Enums_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__["NodeMaterialBlockConnectionPointTypes"].Vector4:
|
|
|
return "vec4(" + this.value.x + ", " + this.value.y + ", " + this.value.z + ", " + this.value.w + ")";
|
|
|
case _Enums_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__["NodeMaterialBlockConnectionPointTypes"].Color3:
|
|
|
- return "vec3(" + this.value.r + ", " + this.value.g + ", " + this.value.b + ")";
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0].set(this.value.r, this.value.g, this.value.b);
|
|
|
+ if (this.convertToGammaSpace) {
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0].toGammaSpaceToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0]);
|
|
|
+ }
|
|
|
+ if (this.convertToLinearSpace) {
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0].toLinearSpaceToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0]);
|
|
|
+ }
|
|
|
+ return "vec3(" + _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0].r + ", " + _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0].g + ", " + _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0].b + ")";
|
|
|
case _Enums_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__["NodeMaterialBlockConnectionPointTypes"].Color4:
|
|
|
- return "vec4(" + this.value.r + ", " + this.value.g + ", " + this.value.b + ", " + this.value.a + ")";
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].set(this.value.r, this.value.g, this.value.b, this.value.a);
|
|
|
+ if (this.convertToGammaSpace) {
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].toGammaSpaceToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0]);
|
|
|
+ }
|
|
|
+ if (this.convertToLinearSpace) {
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].toLinearSpaceToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0]);
|
|
|
+ }
|
|
|
+ return "vec4(" + _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].r + ", " + _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].g + ", " + _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].b + ", " + _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].a + ")";
|
|
|
}
|
|
|
return "";
|
|
|
};
|
|
@@ -70914,10 +70926,24 @@ var InputBlock = /** @class */ (function (_super) {
|
|
|
effect.setInt(variableName, value);
|
|
|
break;
|
|
|
case _Enums_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__["NodeMaterialBlockConnectionPointTypes"].Color3:
|
|
|
- effect.setColor3(variableName, value);
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0].set(this.value.r, this.value.g, this.value.b);
|
|
|
+ if (this.convertToGammaSpace) {
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0].toGammaSpaceToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0]);
|
|
|
+ }
|
|
|
+ if (this.convertToLinearSpace) {
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0].toLinearSpaceToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0]);
|
|
|
+ }
|
|
|
+ effect.setColor3(variableName, _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color3[0]);
|
|
|
break;
|
|
|
case _Enums_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__["NodeMaterialBlockConnectionPointTypes"].Color4:
|
|
|
- effect.setDirectColor4(variableName, value);
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].set(this.value.r, this.value.g, this.value.b, this.value.a);
|
|
|
+ if (this.convertToGammaSpace) {
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].toGammaSpaceToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0]);
|
|
|
+ }
|
|
|
+ if (this.convertToLinearSpace) {
|
|
|
+ _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0].toLinearSpaceToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0]);
|
|
|
+ }
|
|
|
+ effect.setDirectColor4(variableName, _Maths_math__WEBPACK_IMPORTED_MODULE_8__["TmpColors"].Color4[0]);
|
|
|
break;
|
|
|
case _Enums_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__["NodeMaterialBlockConnectionPointTypes"].Vector2:
|
|
|
effect.setVector2(variableName, value);
|
|
@@ -70966,9 +70992,21 @@ var InputBlock = /** @class */ (function (_super) {
|
|
|
break;
|
|
|
case _Enums_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__["NodeMaterialBlockConnectionPointTypes"].Color3:
|
|
|
valueString = "new BABYLON.Color3(" + this.value.r + ", " + this.value.g + ", " + this.value.b + ")";
|
|
|
+ if (this.convertToGammaSpace) {
|
|
|
+ valueString += ".toGammaSpace()";
|
|
|
+ }
|
|
|
+ if (this.convertToLinearSpace) {
|
|
|
+ valueString += ".toLinearSpace()";
|
|
|
+ }
|
|
|
break;
|
|
|
case _Enums_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__["NodeMaterialBlockConnectionPointTypes"].Color4:
|
|
|
valueString = "new BABYLON.Color4(" + this.value.r + ", " + this.value.g + ", " + this.value.b + ", " + this.value.a + ")";
|
|
|
+ if (this.convertToGammaSpace) {
|
|
|
+ valueString += ".toGammaSpace()";
|
|
|
+ }
|
|
|
+ if (this.convertToLinearSpace) {
|
|
|
+ valueString += ".toLinearSpace()";
|
|
|
+ }
|
|
|
break;
|
|
|
case _Enums_nodeMaterialBlockConnectionPointTypes__WEBPACK_IMPORTED_MODULE_2__["NodeMaterialBlockConnectionPointTypes"].Matrix:
|
|
|
valueString = "BABYLON.Matrix.FromArray([" + this.value.m + "])";
|
|
@@ -71003,6 +71041,8 @@ var InputBlock = /** @class */ (function (_super) {
|
|
|
serializationObject.matrixMode = this.matrixMode;
|
|
|
serializationObject.isConstant = this.isConstant;
|
|
|
serializationObject.groupInInspector = this.groupInInspector;
|
|
|
+ serializationObject.convertToGammaSpace = this.convertToGammaSpace;
|
|
|
+ serializationObject.convertToLinearSpace = this.convertToLinearSpace;
|
|
|
if (this._storedValue != null && this._mode === _Enums_nodeMaterialBlockConnectionPointMode__WEBPACK_IMPORTED_MODULE_3__["NodeMaterialBlockConnectionPointMode"].Uniform) {
|
|
|
if (this._storedValue.asArray) {
|
|
|
serializationObject.valueType = "BABYLON." + this._storedValue.getClassName();
|
|
@@ -71027,6 +71067,8 @@ var InputBlock = /** @class */ (function (_super) {
|
|
|
this.matrixMode = serializationObject.matrixMode || 0;
|
|
|
this.isConstant = !!serializationObject.isConstant;
|
|
|
this.groupInInspector = serializationObject.groupInInspector || "";
|
|
|
+ this.convertToGammaSpace = !!serializationObject.convertToGammaSpace;
|
|
|
+ this.convertToLinearSpace = !!serializationObject.convertToLinearSpace;
|
|
|
if (!serializationObject.valueType) {
|
|
|
return;
|
|
|
}
|
|
@@ -92674,29 +92716,23 @@ var BaseTexture = /** @class */ (function (_super) {
|
|
|
callback();
|
|
|
return;
|
|
|
}
|
|
|
- var _loop_1 = function () {
|
|
|
- texture = textures[i];
|
|
|
+ for (var i = 0; i < textures.length; i++) {
|
|
|
+ var texture = textures[i];
|
|
|
if (texture.isReady()) {
|
|
|
if (--numRemaining === 0) {
|
|
|
callback();
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- onLoadObservable = texture.onLoadObservable;
|
|
|
+ var onLoadObservable = texture.onLoadObservable;
|
|
|
if (onLoadObservable) {
|
|
|
- var onLoadCallback_1 = function () {
|
|
|
- onLoadObservable.removeCallback(onLoadCallback_1);
|
|
|
+ onLoadObservable.addOnce(function () {
|
|
|
if (--numRemaining === 0) {
|
|
|
callback();
|
|
|
}
|
|
|
- };
|
|
|
- onLoadObservable.add(onLoadCallback_1);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
- var texture, onLoadObservable;
|
|
|
- for (var i = 0; i < textures.length; i++) {
|
|
|
- _loop_1();
|
|
|
}
|
|
|
};
|
|
|
BaseTexture._isScene = function (sceneOrEngine) {
|
|
@@ -126361,6 +126397,10 @@ var Geometry = /** @class */ (function () {
|
|
|
*/
|
|
|
Geometry.prototype.setVerticesData = function (kind, data, updatable, stride) {
|
|
|
if (updatable === void 0) { updatable = false; }
|
|
|
+ if (updatable && Array.isArray(data)) {
|
|
|
+ // to avoid converting to Float32Array at each draw call in engine.updateDynamicVertexBuffer, we make the conversion a single time here
|
|
|
+ data = new Float32Array(data);
|
|
|
+ }
|
|
|
var buffer = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__["VertexBuffer"](this._engine, data, kind, updatable, this._meshes.length === 0, stride);
|
|
|
this.setVerticesBuffer(buffer);
|
|
|
};
|
|
@@ -135448,11 +135488,9 @@ var PolygonPoints = /** @class */ (function () {
|
|
|
var _this = this;
|
|
|
var result = new Array();
|
|
|
originalPoints.forEach(function (point) {
|
|
|
- if (result.length === 0 || !point.equalsWithEpsilon(result[0])) {
|
|
|
- var newPoint = new IndexedVector2(point, _this.elements.length);
|
|
|
- result.push(newPoint);
|
|
|
- _this.elements.push(newPoint);
|
|
|
- }
|
|
|
+ var newPoint = new IndexedVector2(point, _this.elements.length);
|
|
|
+ result.push(newPoint);
|
|
|
+ _this.elements.push(newPoint);
|
|
|
});
|
|
|
return result;
|
|
|
};
|
|
@@ -188548,32 +188586,44 @@ var Sprite = /** @class */ (function (_super) {
|
|
|
};
|
|
|
Object.defineProperty(Sprite.prototype, "fromIndex", {
|
|
|
/** Gets or sets the initial key for the animation (setting it will restart the animation) */
|
|
|
+ get: function () {
|
|
|
+ return this._fromIndex;
|
|
|
+ },
|
|
|
set: function (value) {
|
|
|
- this.playAnimation(value, this.toIndex, this.loopAnimation, this.delay, this._onAnimationEnd);
|
|
|
+ this.playAnimation(value, this._toIndex, this._loopAnimation, this._delay, this._onAnimationEnd);
|
|
|
},
|
|
|
enumerable: false,
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(Sprite.prototype, "toIndex", {
|
|
|
/** Gets or sets the end key for the animation (setting it will restart the animation) */
|
|
|
+ get: function () {
|
|
|
+ return this._toIndex;
|
|
|
+ },
|
|
|
set: function (value) {
|
|
|
- this.playAnimation(this.fromIndex, value, this.loopAnimation, this.delay, this._onAnimationEnd);
|
|
|
+ this.playAnimation(this._fromIndex, value, this._loopAnimation, this._delay, this._onAnimationEnd);
|
|
|
},
|
|
|
enumerable: false,
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(Sprite.prototype, "loopAnimation", {
|
|
|
/** Gets or sets a boolean indicating if the animation is looping (setting it will restart the animation) */
|
|
|
+ get: function () {
|
|
|
+ return this._loopAnimation;
|
|
|
+ },
|
|
|
set: function (value) {
|
|
|
- this.playAnimation(this.fromIndex, this.toIndex, value, this.delay, this._onAnimationEnd);
|
|
|
+ this.playAnimation(this._fromIndex, this._toIndex, value, this._delay, this._onAnimationEnd);
|
|
|
},
|
|
|
enumerable: false,
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(Sprite.prototype, "delay", {
|
|
|
/** Gets or sets the delay between cell changes (setting it will restart the animation) */
|
|
|
+ get: function () {
|
|
|
+ return Math.max(this._delay, 1);
|
|
|
+ },
|
|
|
set: function (value) {
|
|
|
- this.playAnimation(this.fromIndex, this.toIndex, this.loopAnimation, value, this._onAnimationEnd);
|
|
|
+ this.playAnimation(this._fromIndex, this._toIndex, this._loopAnimation, value, this._onAnimationEnd);
|
|
|
},
|
|
|
enumerable: false,
|
|
|
configurable: true
|
|
@@ -188684,13 +188734,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Textures/texture */ "./Materials/Textures/texture.ts");
|
|
|
/* harmony import */ var _sceneComponent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../sceneComponent */ "./sceneComponent.ts");
|
|
|
/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Misc/logger */ "./Misc/logger.ts");
|
|
|
-/* harmony import */ var _Shaders_sprites_fragment__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Shaders/sprites.fragment */ "./Shaders/sprites.fragment.ts");
|
|
|
-/* harmony import */ var _Shaders_sprites_vertex__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Shaders/sprites.vertex */ "./Shaders/sprites.vertex.ts");
|
|
|
-/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Engines/engine */ "./Engines/engine.ts");
|
|
|
-/* harmony import */ var _Misc_webRequest__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Misc/webRequest */ "./Misc/webRequest.ts");
|
|
|
-/* harmony import */ var _spriteRenderer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./spriteRenderer */ "./Sprites/spriteRenderer.ts");
|
|
|
-
|
|
|
-
|
|
|
+/* harmony import */ var _Engines_engine__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Engines/engine */ "./Engines/engine.ts");
|
|
|
+/* harmony import */ var _Misc_webRequest__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/webRequest */ "./Misc/webRequest.ts");
|
|
|
+/* harmony import */ var _spriteRenderer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./spriteRenderer */ "./Sprites/spriteRenderer.ts");
|
|
|
|
|
|
|
|
|
|
|
@@ -188761,7 +188807,7 @@ var SpriteManager = /** @class */ (function () {
|
|
|
sprite._ySize = _this._cellData[sprite.cellRef].frame.h;
|
|
|
};
|
|
|
if (!scene) {
|
|
|
- scene = _Engines_engine__WEBPACK_IMPORTED_MODULE_10__["Engine"].LastCreatedScene;
|
|
|
+ scene = _Engines_engine__WEBPACK_IMPORTED_MODULE_8__["Engine"].LastCreatedScene;
|
|
|
}
|
|
|
if (!scene._getComponent(_sceneComponent__WEBPACK_IMPORTED_MODULE_6__["SceneComponentConstants"].NAME_SPRITE)) {
|
|
|
scene._addComponent(new _spriteSceneComponent__WEBPACK_IMPORTED_MODULE_3__["SpriteSceneComponent"](scene));
|
|
@@ -188769,7 +188815,7 @@ var SpriteManager = /** @class */ (function () {
|
|
|
this._fromPacked = fromPacked;
|
|
|
this._scene = scene;
|
|
|
var engine = this._scene.getEngine();
|
|
|
- this._spriteRenderer = new _spriteRenderer__WEBPACK_IMPORTED_MODULE_12__["SpriteRenderer"](engine, capacity, epsilon, scene);
|
|
|
+ this._spriteRenderer = new _spriteRenderer__WEBPACK_IMPORTED_MODULE_10__["SpriteRenderer"](engine, capacity, epsilon, scene);
|
|
|
if (cellSize.width && cellSize.height) {
|
|
|
this.cellWidth = cellSize.width;
|
|
|
this.cellHeight = cellSize.height;
|
|
@@ -188785,7 +188831,7 @@ var SpriteManager = /** @class */ (function () {
|
|
|
this._scene.spriteManagers.push(this);
|
|
|
this.uniqueId = this.scene.getUniqueId();
|
|
|
if (imgUrl) {
|
|
|
- this._spriteRenderer.texture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__["Texture"](imgUrl, scene, true, false, samplingMode);
|
|
|
+ this.texture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_5__["Texture"](imgUrl, scene, true, false, samplingMode);
|
|
|
}
|
|
|
if (this._fromPacked) {
|
|
|
this._makePacked(imgUrl, spriteJSON);
|
|
@@ -189211,12 +189257,12 @@ var SpriteManager = /** @class */ (function () {
|
|
|
SpriteManager.ParseFromFileAsync = function (name, url, scene, rootUrl) {
|
|
|
if (rootUrl === void 0) { rootUrl = ""; }
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- var request = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_11__["WebRequest"]();
|
|
|
+ var request = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_9__["WebRequest"]();
|
|
|
request.addEventListener("readystatechange", function () {
|
|
|
if (request.readyState == 4) {
|
|
|
if (request.status == 200) {
|
|
|
var serializationObject = JSON.parse(request.responseText);
|
|
|
- var output = SpriteManager.Parse(serializationObject, scene || _Engines_engine__WEBPACK_IMPORTED_MODULE_10__["Engine"].LastCreatedScene, rootUrl);
|
|
|
+ var output = SpriteManager.Parse(serializationObject, scene || _Engines_engine__WEBPACK_IMPORTED_MODULE_8__["Engine"].LastCreatedScene, rootUrl);
|
|
|
if (name) {
|
|
|
output.name = name;
|
|
|
}
|
|
@@ -189245,13 +189291,13 @@ var SpriteManager = /** @class */ (function () {
|
|
|
return Promise.resolve(new SpriteManager("Default sprite manager", "//playground.babylonjs.com/textures/player.png", 500, 64, scene));
|
|
|
}
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- var request = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_11__["WebRequest"]();
|
|
|
+ var request = new _Misc_webRequest__WEBPACK_IMPORTED_MODULE_9__["WebRequest"]();
|
|
|
request.addEventListener("readystatechange", function () {
|
|
|
if (request.readyState == 4) {
|
|
|
if (request.status == 200) {
|
|
|
var snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);
|
|
|
var serializationObject = JSON.parse(snippet.spriteManager);
|
|
|
- var output = SpriteManager.Parse(serializationObject, scene || _Engines_engine__WEBPACK_IMPORTED_MODULE_10__["Engine"].LastCreatedScene, rootUrl);
|
|
|
+ var output = SpriteManager.Parse(serializationObject, scene || _Engines_engine__WEBPACK_IMPORTED_MODULE_8__["Engine"].LastCreatedScene, rootUrl);
|
|
|
output.snippetId = snippetId;
|
|
|
resolve(output);
|
|
|
}
|
|
@@ -190028,6 +190074,9 @@ var SpriteRenderer = /** @class */ (function () {
|
|
|
customSpriteUpdate(sprite, baseSize);
|
|
|
}
|
|
|
else {
|
|
|
+ if (!sprite.cellIndex) {
|
|
|
+ sprite.cellIndex = 0;
|
|
|
+ }
|
|
|
var rowSize = baseSize.width / this.cellWidth;
|
|
|
var offset = (sprite.cellIndex / rowSize) >> 0;
|
|
|
sprite._xOffset = (sprite.cellIndex - offset * rowSize) * this.cellWidth / baseSize.width;
|
|
@@ -190392,8 +190441,6 @@ var ThinSprite = /** @class */ (function () {
|
|
|
* Creates a new Thin Sprite
|
|
|
*/
|
|
|
function ThinSprite() {
|
|
|
- /** Gets or sets the cell index in the sprite sheet */
|
|
|
- this.cellIndex = 0;
|
|
|
/** Gets or sets the width */
|
|
|
this.width = 1.0;
|
|
|
/** Gets or sets the height */
|
|
@@ -191307,30 +191354,43 @@ var WebXRAnchorSystem = /** @class */ (function (_super) {
|
|
|
* @param hitTestResult The hit test result to use for this anchor creation
|
|
|
* @param position an optional position offset for this anchor
|
|
|
* @param rotationQuaternion an optional rotation offset for this anchor
|
|
|
- * @returns A promise that fulfills when the XR anchor was registered in the system (but not necessarily added to the tracked anchors)
|
|
|
+ * @returns A promise that fulfills when babylon has created the corresponding WebXRAnchor object and tracking has begun
|
|
|
*/
|
|
|
WebXRAnchorSystem.prototype.addAnchorPointUsingHitTestResultAsync = function (hitTestResult, position, rotationQuaternion) {
|
|
|
if (position === void 0) { position = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Vector3"](); }
|
|
|
if (rotationQuaternion === void 0) { rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Quaternion"](); }
|
|
|
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
|
|
|
- var m;
|
|
|
+ var m, nativeAnchor_1, error_1;
|
|
|
+ var _this = this;
|
|
|
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) {
|
|
|
- // convert to XR space (right handed) if needed
|
|
|
- this._populateTmpTransformation(position, rotationQuaternion);
|
|
|
- m = new XRRigidTransform({ x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z }, { x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w });
|
|
|
- if (!hitTestResult.xrHitResult.createAnchor) {
|
|
|
- this.detach();
|
|
|
- throw new Error('Anchors not enabled in this environment/browser');
|
|
|
- }
|
|
|
- else {
|
|
|
- try {
|
|
|
- return [2 /*return*/, hitTestResult.xrHitResult.createAnchor(m)];
|
|
|
- }
|
|
|
- catch (error) {
|
|
|
- throw new Error(error);
|
|
|
- }
|
|
|
+ switch (_a.label) {
|
|
|
+ case 0:
|
|
|
+ // convert to XR space (right handed) if needed
|
|
|
+ this._populateTmpTransformation(position, rotationQuaternion);
|
|
|
+ m = new XRRigidTransform({ x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z }, { x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w });
|
|
|
+ if (!!hitTestResult.xrHitResult.createAnchor) return [3 /*break*/, 1];
|
|
|
+ this.detach();
|
|
|
+ throw new Error("Anchors not enabled in this environment/browser");
|
|
|
+ case 1:
|
|
|
+ _a.trys.push([1, 3, , 4]);
|
|
|
+ return [4 /*yield*/, hitTestResult.xrHitResult.createAnchor(m)];
|
|
|
+ case 2:
|
|
|
+ nativeAnchor_1 = _a.sent();
|
|
|
+ return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
|
+ _this._futureAnchors.push({
|
|
|
+ nativeAnchor: nativeAnchor_1,
|
|
|
+ resolved: false,
|
|
|
+ submitted: true,
|
|
|
+ xrTransformation: m,
|
|
|
+ resolve: resolve,
|
|
|
+ reject: reject,
|
|
|
+ });
|
|
|
+ })];
|
|
|
+ case 3:
|
|
|
+ error_1 = _a.sent();
|
|
|
+ throw new Error(error_1);
|
|
|
+ case 4: return [2 /*return*/];
|
|
|
}
|
|
|
- return [2 /*return*/];
|
|
|
});
|
|
|
});
|
|
|
};
|
|
@@ -191344,30 +191404,55 @@ var WebXRAnchorSystem = /** @class */ (function (_super) {
|
|
|
* @param position the position in which to add an anchor
|
|
|
* @param rotationQuaternion an optional rotation for the anchor transformation
|
|
|
* @param forceCreateInCurrentFrame force the creation of this anchor in the current frame. Must be called inside xrFrame loop!
|
|
|
- * @returns A promise that fulfills when the XR anchor was registered in the system (but not necessarily added to the tracked anchors)
|
|
|
+ * @returns A promise that fulfills when babylon has created the corresponding WebXRAnchor object and tracking has begun
|
|
|
*/
|
|
|
WebXRAnchorSystem.prototype.addAnchorAtPositionAndRotationAsync = function (position, rotationQuaternion, forceCreateInCurrentFrame) {
|
|
|
- var _this = this;
|
|
|
if (rotationQuaternion === void 0) { rotationQuaternion = new _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Quaternion"](); }
|
|
|
if (forceCreateInCurrentFrame === void 0) { forceCreateInCurrentFrame = false; }
|
|
|
- // convert to XR space (right handed) if needed
|
|
|
- this._populateTmpTransformation(position, rotationQuaternion);
|
|
|
- // the matrix that we'll use
|
|
|
- var xrTransformation = new XRRigidTransform({ x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z }, { x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w });
|
|
|
- if (forceCreateInCurrentFrame && this.attached && this._xrSessionManager.currentFrame) {
|
|
|
- return this._createAnchorAtTransformation(xrTransformation, this._xrSessionManager.currentFrame);
|
|
|
- }
|
|
|
- else {
|
|
|
- // add the transformation to the future anchors list
|
|
|
- return new Promise(function (resolve, reject) {
|
|
|
- _this._futureAnchors.push({
|
|
|
- xrTransformation: xrTransformation,
|
|
|
- resolve: resolve,
|
|
|
- reject: reject,
|
|
|
- });
|
|
|
+ return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
|
|
|
+ var xrTransformation, xrAnchor, _a;
|
|
|
+ var _this = this;
|
|
|
+ return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_b) {
|
|
|
+ switch (_b.label) {
|
|
|
+ case 0:
|
|
|
+ // convert to XR space (right handed) if needed
|
|
|
+ this._populateTmpTransformation(position, rotationQuaternion);
|
|
|
+ xrTransformation = new XRRigidTransform({ x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z }, { x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w });
|
|
|
+ if (!(forceCreateInCurrentFrame && this.attached && this._xrSessionManager.currentFrame)) return [3 /*break*/, 2];
|
|
|
+ return [4 /*yield*/, this._createAnchorAtTransformation(xrTransformation, this._xrSessionManager.currentFrame)];
|
|
|
+ case 1:
|
|
|
+ _a = _b.sent();
|
|
|
+ return [3 /*break*/, 3];
|
|
|
+ case 2:
|
|
|
+ _a = undefined;
|
|
|
+ _b.label = 3;
|
|
|
+ case 3:
|
|
|
+ xrAnchor = _a;
|
|
|
+ // add the transformation to the future anchors list
|
|
|
+ return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
|
+ _this._futureAnchors.push({
|
|
|
+ nativeAnchor: xrAnchor,
|
|
|
+ resolved: false,
|
|
|
+ submitted: false,
|
|
|
+ xrTransformation: xrTransformation,
|
|
|
+ resolve: resolve,
|
|
|
+ reject: reject,
|
|
|
+ });
|
|
|
+ })];
|
|
|
+ }
|
|
|
});
|
|
|
- }
|
|
|
+ });
|
|
|
};
|
|
|
+ Object.defineProperty(WebXRAnchorSystem.prototype, "anchors", {
|
|
|
+ /**
|
|
|
+ * Get the list of anchors currently being tracked by the system
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._trackedAnchors;
|
|
|
+ },
|
|
|
+ enumerable: false,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
/**
|
|
|
* detach this feature.
|
|
|
* Will usually be called by the features manager
|
|
@@ -191382,6 +191467,14 @@ var WebXRAnchorSystem = /** @class */ (function (_super) {
|
|
|
while (this._trackedAnchors.length) {
|
|
|
var toRemove = this._trackedAnchors.pop();
|
|
|
if (toRemove) {
|
|
|
+ try {
|
|
|
+ // try to natively remove it as well
|
|
|
+ toRemove.remove();
|
|
|
+ }
|
|
|
+ catch (e) {
|
|
|
+ // no-op
|
|
|
+ }
|
|
|
+ // as the xr frame loop is removed, we need to notify manually
|
|
|
this.onAnchorRemovedObservable.notifyObservers(toRemove);
|
|
|
}
|
|
|
}
|
|
@@ -191392,6 +191485,7 @@ var WebXRAnchorSystem = /** @class */ (function (_super) {
|
|
|
* Dispose this feature and all of the resources attached
|
|
|
*/
|
|
|
WebXRAnchorSystem.prototype.dispose = function () {
|
|
|
+ this._futureAnchors.length = 0;
|
|
|
_super.prototype.dispose.call(this);
|
|
|
this.onAnchorAddedObservable.clear();
|
|
|
this.onAnchorRemovedObservable.clear();
|
|
@@ -191414,7 +191508,7 @@ var WebXRAnchorSystem = /** @class */ (function (_super) {
|
|
|
toRemove.forEach(function (index) {
|
|
|
var anchor = _this._trackedAnchors.splice(index - idxTracker_1, 1)[0];
|
|
|
_this.onAnchorRemovedObservable.notifyObservers(anchor);
|
|
|
- idxTracker_1--;
|
|
|
+ idxTracker_1++;
|
|
|
});
|
|
|
// now check for new ones
|
|
|
trackedAnchors.forEach(function (xrAnchor) {
|
|
@@ -191422,10 +191516,18 @@ var WebXRAnchorSystem = /** @class */ (function (_super) {
|
|
|
var newAnchor = {
|
|
|
id: anchorIdProvider++,
|
|
|
xrAnchor: xrAnchor,
|
|
|
+ remove: xrAnchor.delete,
|
|
|
};
|
|
|
var anchor = _this._updateAnchorWithXRFrame(xrAnchor, newAnchor, frame);
|
|
|
_this._trackedAnchors.push(anchor);
|
|
|
_this.onAnchorAddedObservable.notifyObservers(anchor);
|
|
|
+ // search for the future anchor promise that matches this
|
|
|
+ var results = _this._futureAnchors.filter(function (futureAnchor) { return futureAnchor.nativeAnchor === xrAnchor; });
|
|
|
+ var result = results[0];
|
|
|
+ if (result) {
|
|
|
+ result.resolve(anchor);
|
|
|
+ result.resolved = true;
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
var index = _this._findIndexInAnchorArray(xrAnchor);
|
|
@@ -191447,16 +191549,17 @@ var WebXRAnchorSystem = /** @class */ (function (_super) {
|
|
|
this._lastFrameDetected = trackedAnchors;
|
|
|
}
|
|
|
// process future anchors
|
|
|
- while (this._futureAnchors.length) {
|
|
|
- var futureAnchor = this._futureAnchors.pop();
|
|
|
- if (!futureAnchor) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!frame.createAnchor) {
|
|
|
- futureAnchor.reject("Anchors not enabled in this browser");
|
|
|
+ this._futureAnchors.forEach(function (futureAnchor) {
|
|
|
+ if (!futureAnchor.resolved && !futureAnchor.submitted) {
|
|
|
+ _this._createAnchorAtTransformation(futureAnchor.xrTransformation, frame).then(function (nativeAnchor) {
|
|
|
+ futureAnchor.nativeAnchor = nativeAnchor;
|
|
|
+ }, function (error) {
|
|
|
+ futureAnchor.resolved = true;
|
|
|
+ futureAnchor.reject(error);
|
|
|
+ });
|
|
|
+ futureAnchor.submitted = true;
|
|
|
}
|
|
|
- this._createAnchorAtTransformation(futureAnchor.xrTransformation, frame).then(futureAnchor.resolve, futureAnchor.reject);
|
|
|
- }
|
|
|
+ });
|
|
|
};
|
|
|
/**
|
|
|
* avoiding using Array.find for global support.
|
|
@@ -192621,16 +192724,17 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
*/
|
|
|
_this.parabolicRayEnabled = true;
|
|
|
/**
|
|
|
- * How much rotation should be applied when rotating right and left
|
|
|
+ * The second type of ray - straight line.
|
|
|
+ * Should it be enabled or should the parabolic line be the only one.
|
|
|
*/
|
|
|
- _this.rotationAngle = Math.PI / 8;
|
|
|
+ _this.straightRayEnabled = true;
|
|
|
/**
|
|
|
- * Is rotation enabled when moving forward?
|
|
|
- * Disabling this feature will prevent the user from deciding the direction when teleporting
|
|
|
+ * How much rotation should be applied when rotating right and left
|
|
|
*/
|
|
|
- _this.rotationEnabled = true;
|
|
|
+ _this.rotationAngle = Math.PI / 8;
|
|
|
+ _this._rotationEnabled = true;
|
|
|
_this._attachController = function (xrController) {
|
|
|
- if (_this._controllers[xrController.uniqueId]) {
|
|
|
+ if (_this._controllers[xrController.uniqueId] || (_this._options.forceHandedness && xrController.inputSource.handedness !== _this._options.forceHandedness)) {
|
|
|
// already attached
|
|
|
return;
|
|
|
}
|
|
@@ -192648,7 +192752,7 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
// motion controller only available to gamepad-enabled input sources.
|
|
|
if (controllerData.xrController.inputSource.targetRayMode === "tracked-pointer" && controllerData.xrController.inputSource.gamepad) {
|
|
|
// motion controller support
|
|
|
- xrController.onMotionControllerInitObservable.addOnce(function () {
|
|
|
+ var initMotionController_1 = function () {
|
|
|
if (xrController.motionController) {
|
|
|
var movementController = xrController.motionController.getComponentOfType(_motionController_webXRControllerComponent__WEBPACK_IMPORTED_MODULE_2__["WebXRControllerComponent"].THUMBSTICK_TYPE) || xrController.motionController.getComponentOfType(_motionController_webXRControllerComponent__WEBPACK_IMPORTED_MODULE_2__["WebXRControllerComponent"].TOUCHPAD_TYPE);
|
|
|
if (!movementController || _this._options.useMainComponentOnly) {
|
|
@@ -192657,6 +192761,7 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
if (!mainComponent_1) {
|
|
|
return;
|
|
|
}
|
|
|
+ controllerData.teleportationComponent = mainComponent_1;
|
|
|
controllerData.onButtonChangedObserver = mainComponent_1.onButtonStateChangedObservable.add(function () {
|
|
|
// did "pressed" changed?
|
|
|
if (mainComponent_1.changes.pressed) {
|
|
@@ -192686,6 +192791,7 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
+ controllerData.teleportationComponent = movementController;
|
|
|
// use thumbstick (or touchpad if thumbstick not available)
|
|
|
controllerData.onAxisChangedObserver = movementController.onAxisValueChangedObservable.add(function (axesData) {
|
|
|
if (axesData.y <= 0.7 && controllerData.teleportationState.backwards) {
|
|
@@ -192764,7 +192870,15 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ };
|
|
|
+ if (xrController.motionController) {
|
|
|
+ initMotionController_1();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ xrController.onMotionControllerInitObservable.addOnce(function () {
|
|
|
+ initMotionController_1();
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
_this._xrSessionManager.scene.onPointerObservable.add(function (pointerInfo) {
|
|
@@ -192800,6 +192914,40 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
_this._setTargetMeshVisibility(false);
|
|
|
return _this;
|
|
|
}
|
|
|
+ Object.defineProperty(WebXRMotionControllerTeleportation.prototype, "rotationEnabled", {
|
|
|
+ /**
|
|
|
+ * Is rotation enabled when moving forward?
|
|
|
+ * Disabling this feature will prevent the user from deciding the direction when teleporting
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._rotationEnabled;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * Sets wether rotation is enabled or not
|
|
|
+ * @param enabled is rotation enabled when teleportation is shown
|
|
|
+ */
|
|
|
+ set: function (enabled) {
|
|
|
+ this._rotationEnabled = enabled;
|
|
|
+ if (this._options.teleportationTargetMesh) {
|
|
|
+ var children = this._options.teleportationTargetMesh.getChildMeshes(false, function (node) { return node.name === "rotationCone"; });
|
|
|
+ if (children[0]) {
|
|
|
+ children[0].setEnabled(enabled);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ enumerable: false,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ Object.defineProperty(WebXRMotionControllerTeleportation.prototype, "teleportationTargetMesh", {
|
|
|
+ /**
|
|
|
+ * Exposes the currently set teleportation target mesh.
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._options.teleportationTargetMesh || null;
|
|
|
+ },
|
|
|
+ enumerable: false,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
Object.defineProperty(WebXRMotionControllerTeleportation.prototype, "snapPointsOnly", {
|
|
|
/**
|
|
|
* Get the snapPointsOnly flag
|
|
@@ -192856,6 +193004,7 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
});
|
|
|
this._setTargetMeshVisibility(false);
|
|
|
this._currentTeleportationControllerId = "";
|
|
|
+ this._controllers = {};
|
|
|
return true;
|
|
|
};
|
|
|
WebXRMotionControllerTeleportation.prototype.dispose = function () {
|
|
@@ -192936,57 +193085,58 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
_Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Quaternion"].RotationYawPitchRollToRef(controllerData.teleportationState.currentRotation + controllerData.teleportationState.baseRotation, 0, 0, targetMesh.rotationQuaternion);
|
|
|
// set the ray and position
|
|
|
var hitPossible = false;
|
|
|
- // first check if direct ray possible
|
|
|
controllerData.xrController.getWorldPointerRayToRef(this._tmpRay);
|
|
|
- // pick grounds that are LOWER only. upper will use parabolic path
|
|
|
- var pick = scene.pickWithRay(this._tmpRay, function (o) {
|
|
|
- // check for mesh-blockers
|
|
|
- if (_this._options.pickBlockerMeshes && _this._options.pickBlockerMeshes.indexOf(o) !== -1) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- var index = _this._floorMeshes.indexOf(o);
|
|
|
- if (index === -1) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return _this._floorMeshes[index].absolutePosition.y < _this._options.xrInput.xrCamera.position.y;
|
|
|
- });
|
|
|
- if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (pick && pick.pickedPoint) {
|
|
|
- hitPossible = true;
|
|
|
- this._setTargetMeshPosition(pick.pickedPoint);
|
|
|
- this._setTargetMeshVisibility(true);
|
|
|
- this._showParabolicPath(pick);
|
|
|
- }
|
|
|
- else {
|
|
|
- if (this.parabolicRayEnabled) {
|
|
|
- // radius compensation according to pointer rotation around X
|
|
|
- var xRotation = controllerData.xrController.pointer.rotationQuaternion.toEulerAngles().x;
|
|
|
- var compensation = 1 + (Math.PI / 2 - Math.abs(xRotation));
|
|
|
- // check parabolic ray
|
|
|
- var radius = this.parabolicCheckRadius * compensation;
|
|
|
- this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(radius * 2), this._tmpVector);
|
|
|
- this._tmpVector.y = this._tmpRay.origin.y;
|
|
|
- this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(radius));
|
|
|
- this._tmpVector.subtractToRef(this._tmpRay.origin, this._tmpRay.direction);
|
|
|
- this._tmpRay.direction.normalize();
|
|
|
- var pick_1 = scene.pickWithRay(this._tmpRay, function (o) {
|
|
|
- // check for mesh-blockers
|
|
|
- if (_this._options.pickBlockerMeshes && _this._options.pickBlockerMeshes.indexOf(o) !== -1) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return _this._floorMeshes.indexOf(o) !== -1;
|
|
|
- });
|
|
|
- if (pick_1 && pick_1.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick_1.pickedMesh) !== -1) {
|
|
|
- return;
|
|
|
+ if (this.straightRayEnabled) {
|
|
|
+ // first check if direct ray possible
|
|
|
+ // pick grounds that are LOWER only. upper will use parabolic path
|
|
|
+ var pick = scene.pickWithRay(this._tmpRay, function (o) {
|
|
|
+ // check for mesh-blockers
|
|
|
+ if (_this._options.pickBlockerMeshes && _this._options.pickBlockerMeshes.indexOf(o) !== -1) {
|
|
|
+ return true;
|
|
|
}
|
|
|
- else if (pick_1 && pick_1.pickedPoint) {
|
|
|
- hitPossible = true;
|
|
|
- this._setTargetMeshPosition(pick_1.pickedPoint);
|
|
|
- this._setTargetMeshVisibility(true);
|
|
|
- this._showParabolicPath(pick_1);
|
|
|
+ var index = _this._floorMeshes.indexOf(o);
|
|
|
+ if (index === -1) {
|
|
|
+ return false;
|
|
|
}
|
|
|
+ return _this._floorMeshes[index].absolutePosition.y < _this._options.xrInput.xrCamera.position.y;
|
|
|
+ });
|
|
|
+ if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (pick && pick.pickedPoint) {
|
|
|
+ hitPossible = true;
|
|
|
+ this._setTargetMeshPosition(pick.pickedPoint);
|
|
|
+ this._setTargetMeshVisibility(true);
|
|
|
+ this._showParabolicPath(pick);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // straight ray is still the main ray, but disabling the straight line will force parabolic line.
|
|
|
+ if (this.parabolicRayEnabled && !hitPossible) {
|
|
|
+ // radius compensation according to pointer rotation around X
|
|
|
+ var xRotation = controllerData.xrController.pointer.rotationQuaternion.toEulerAngles().x;
|
|
|
+ var compensation = 1 + (Math.PI / 2 - Math.abs(xRotation));
|
|
|
+ // check parabolic ray
|
|
|
+ var radius = this.parabolicCheckRadius * compensation;
|
|
|
+ this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(radius * 2), this._tmpVector);
|
|
|
+ this._tmpVector.y = this._tmpRay.origin.y;
|
|
|
+ this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(radius));
|
|
|
+ this._tmpVector.subtractToRef(this._tmpRay.origin, this._tmpRay.direction);
|
|
|
+ this._tmpRay.direction.normalize();
|
|
|
+ var pick = scene.pickWithRay(this._tmpRay, function (o) {
|
|
|
+ // check for mesh-blockers
|
|
|
+ if (_this._options.pickBlockerMeshes && _this._options.pickBlockerMeshes.indexOf(o) !== -1) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return _this._floorMeshes.indexOf(o) !== -1;
|
|
|
+ });
|
|
|
+ if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (pick && pick.pickedPoint) {
|
|
|
+ hitPossible = true;
|
|
|
+ this._setTargetMeshPosition(pick.pickedPoint);
|
|
|
+ this._setTargetMeshVisibility(true);
|
|
|
+ this._showParabolicPath(pick);
|
|
|
}
|
|
|
}
|
|
|
// if needed, set visible:
|
|
@@ -193055,7 +193205,7 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
torus.animations.push(animationInnerCircle);
|
|
|
sceneToRenderTo.beginAnimation(torus, 0, 60, true);
|
|
|
}
|
|
|
- var cone = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_6__["CylinderBuilder"].CreateCylinder("cone", { diameterTop: 0, tessellation: 4 }, sceneToRenderTo);
|
|
|
+ var cone = _Meshes_Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_6__["CylinderBuilder"].CreateCylinder("rotationCone", { diameterTop: 0, tessellation: 4 }, sceneToRenderTo);
|
|
|
cone.isPickable = false;
|
|
|
cone.scaling.set(0.5, 0.12, 0.2);
|
|
|
cone.rotate(_Maths_math_axis__WEBPACK_IMPORTED_MODULE_9__["Axis"].X, Math.PI / 2);
|
|
@@ -193147,6 +193297,7 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
if (!visible) {
|
|
|
if (this._quadraticBezierCurve) {
|
|
|
this._quadraticBezierCurve.dispose();
|
|
|
+ this._quadraticBezierCurve = null;
|
|
|
}
|
|
|
if (this._selectionFeature) {
|
|
|
this._selectionFeature.attach();
|
|
@@ -193164,10 +193315,12 @@ var WebXRMotionControllerTeleportation = /** @class */ (function (_super) {
|
|
|
}
|
|
|
var controllerData = this._controllers[this._currentTeleportationControllerId];
|
|
|
var quadraticBezierVectors = _Maths_math_path__WEBPACK_IMPORTED_MODULE_13__["Curve3"].CreateQuadraticBezier(controllerData.xrController.pointer.absolutePosition, pickInfo.ray.origin, pickInfo.pickedPoint, 25);
|
|
|
- if (this._quadraticBezierCurve) {
|
|
|
- this._quadraticBezierCurve.dispose();
|
|
|
+ if (!this._options.generateRayPathMesh) {
|
|
|
+ this._quadraticBezierCurve = _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_14__["LinesBuilder"].CreateLines("teleportation path line", { points: quadraticBezierVectors.getPoints(), instance: this._quadraticBezierCurve, updatable: true });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this._quadraticBezierCurve = this._options.generateRayPathMesh(quadraticBezierVectors.getPoints());
|
|
|
}
|
|
|
- this._quadraticBezierCurve = _Meshes_Builders_linesBuilder__WEBPACK_IMPORTED_MODULE_14__["LinesBuilder"].CreateLines("path line", { points: quadraticBezierVectors.getPoints() });
|
|
|
this._quadraticBezierCurve.isPickable = false;
|
|
|
};
|
|
|
WebXRMotionControllerTeleportation.prototype._teleportForward = function (controllerId) {
|