|
@@ -1117,6 +1117,22 @@ var BABYLON;
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Clamps the rgb values by the min and max values and stores the result into "result".
|
|
|
|
+ * Returns the unmodified current Color3.
|
|
|
|
+ * @param min - minimum clamping value. Defaults to 0
|
|
|
|
+ * @param max - maximum clamping value. Defaults to 1
|
|
|
|
+ * @param result - color to store the result into.
|
|
|
|
+ * @returns - the original Color3
|
|
|
|
+ */
|
|
|
|
+ Color3.prototype.clampToRef = function (min, max, result) {
|
|
|
|
+ if (min === void 0) { min = 0; }
|
|
|
|
+ if (max === void 0) { max = 1; }
|
|
|
|
+ result.r = BABYLON.Scalar.Clamp(this.r, min, max);
|
|
|
|
+ result.g = BABYLON.Scalar.Clamp(this.g, min, max);
|
|
|
|
+ result.b = BABYLON.Scalar.Clamp(this.b, min, max);
|
|
|
|
+ return this;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Returns a new Color3 set with the added values of the current Color3 and of the passed one.
|
|
* Returns a new Color3 set with the added values of the current Color3 and of the passed one.
|
|
*/
|
|
*/
|
|
Color3.prototype.add = function (otherColor) {
|
|
Color3.prototype.add = function (otherColor) {
|
|
@@ -1365,6 +1381,23 @@ var BABYLON;
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Clamps the rgb values by the min and max values and stores the result into "result".
|
|
|
|
+ * Returns the unmodified current Color4.
|
|
|
|
+ * @param min - minimum clamping value. Defaults to 0
|
|
|
|
+ * @param max - maximum clamping value. Defaults to 1
|
|
|
|
+ * @param result - color to store the result into.
|
|
|
|
+ * @returns - the original Color4
|
|
|
|
+ */
|
|
|
|
+ Color4.prototype.clampToRef = function (min, max, result) {
|
|
|
|
+ if (min === void 0) { min = 0; }
|
|
|
|
+ if (max === void 0) { max = 1; }
|
|
|
|
+ result.r = BABYLON.Scalar.Clamp(this.r, min, max);
|
|
|
|
+ result.g = BABYLON.Scalar.Clamp(this.g, min, max);
|
|
|
|
+ result.b = BABYLON.Scalar.Clamp(this.b, min, max);
|
|
|
|
+ result.a = BABYLON.Scalar.Clamp(this.a, min, max);
|
|
|
|
+ return this;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Multipy an RGBA Color4 value by another and return a new Color4 object
|
|
* Multipy an RGBA Color4 value by another and return a new Color4 object
|
|
* @param color The Color4 (RGBA) value to multiply by
|
|
* @param color The Color4 (RGBA) value to multiply by
|
|
* @returns A new Color4.
|
|
* @returns A new Color4.
|
|
@@ -2357,6 +2390,23 @@ var BABYLON;
|
|
return s;
|
|
return s;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Get angle between two vectors.
|
|
|
|
+ * @param vector0 angle between vector0 and vector1
|
|
|
|
+ * @param vector1 angle between vector0 and vector1
|
|
|
|
+ * @param normal direction of the normal.
|
|
|
|
+ * @return the angle between vector0 and vector1.
|
|
|
|
+ */
|
|
|
|
+ Vector3.GetAngleBetweenVectors = function (vector0, vector1, normal) {
|
|
|
|
+ var v0 = vector0.clone().normalize();
|
|
|
|
+ var v1 = vector1.clone().normalize();
|
|
|
|
+ var dot = Vector3.Dot(v0, v1);
|
|
|
|
+ var n = Vector3.Cross(v0, v1);
|
|
|
|
+ if (Vector3.Dot(n, normal) > 0) {
|
|
|
|
+ return Math.acos(dot);
|
|
|
|
+ }
|
|
|
|
+ return -Math.acos(dot);
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Returns a new Vector3 set from the index "offset" of the passed array.
|
|
* Returns a new Vector3 set from the index "offset" of the passed array.
|
|
*/
|
|
*/
|
|
Vector3.FromArray = function (array, offset) {
|
|
Vector3.FromArray = function (array, offset) {
|
|
@@ -12707,7 +12757,7 @@ var BABYLON;
|
|
this._currentEffect = null;
|
|
this._currentEffect = null;
|
|
};
|
|
};
|
|
Engine.prototype._moveBoundTextureOnTop = function (internalTexture) {
|
|
Engine.prototype._moveBoundTextureOnTop = function (internalTexture) {
|
|
- if (this._lastBoundInternalTextureTracker.previous === internalTexture) {
|
|
|
|
|
|
+ if (this.disableTextureBindingOptimization || this._lastBoundInternalTextureTracker.previous === internalTexture) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// Remove
|
|
// Remove
|
|
@@ -15874,6 +15924,7 @@ var BABYLON;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._lightSources.splice(index, 1);
|
|
this._lightSources.splice(index, 1);
|
|
|
|
+ this._markSubMeshesAsLightDirty();
|
|
};
|
|
};
|
|
AbstractMesh.prototype._markSubMeshesAsDirty = function (func) {
|
|
AbstractMesh.prototype._markSubMeshesAsDirty = function (func) {
|
|
if (!this.subMeshes) {
|
|
if (!this.subMeshes) {
|
|
@@ -17769,14 +17820,17 @@ var BABYLON;
|
|
__extends(Camera, _super);
|
|
__extends(Camera, _super);
|
|
function Camera(name, position, scene) {
|
|
function Camera(name, position, scene) {
|
|
var _this = _super.call(this, name, scene) || this;
|
|
var _this = _super.call(this, name, scene) || this;
|
|
|
|
+ /**
|
|
|
|
+ * The vector the camera should consider as up.
|
|
|
|
+ * (default is Vector3(0, 1, 0) aka Vector3.Up())
|
|
|
|
+ */
|
|
_this.upVector = BABYLON.Vector3.Up();
|
|
_this.upVector = BABYLON.Vector3.Up();
|
|
_this.orthoLeft = null;
|
|
_this.orthoLeft = null;
|
|
_this.orthoRight = null;
|
|
_this.orthoRight = null;
|
|
_this.orthoBottom = null;
|
|
_this.orthoBottom = null;
|
|
_this.orthoTop = null;
|
|
_this.orthoTop = null;
|
|
/**
|
|
/**
|
|
- * default : 0.8
|
|
|
|
- * FOV is set in Radians.
|
|
|
|
|
|
+ * FOV is set in Radians. (default is 0.8)
|
|
*/
|
|
*/
|
|
_this.fov = 0.8;
|
|
_this.fov = 0.8;
|
|
_this.minZ = 1;
|
|
_this.minZ = 1;
|
|
@@ -17786,14 +17840,13 @@ var BABYLON;
|
|
_this.isIntermediate = false;
|
|
_this.isIntermediate = false;
|
|
_this.viewport = new BABYLON.Viewport(0, 0, 1.0, 1.0);
|
|
_this.viewport = new BABYLON.Viewport(0, 0, 1.0, 1.0);
|
|
/**
|
|
/**
|
|
- * Restricts the camera to viewing objects with the same layerMask.
|
|
|
|
- * A camera with a layerMask of 1 will render meshes with no layerMask and meshes with a layerMask of 1.
|
|
|
|
- */
|
|
|
|
|
|
+ * Restricts the camera to viewing objects with the same layerMask.
|
|
|
|
+ * A camera with a layerMask of 1 will render mesh.layerMask & camera.layerMask!== 0
|
|
|
|
+ */
|
|
_this.layerMask = 0x0FFFFFFF;
|
|
_this.layerMask = 0x0FFFFFFF;
|
|
/**
|
|
/**
|
|
- * default : FOVMODE_VERTICAL_FIXED
|
|
|
|
- * fovMode sets the camera frustum bounds to the viewport bounds.
|
|
|
|
- */
|
|
|
|
|
|
+ * fovMode sets the camera frustum bounds to the viewport bounds. (default is FOVMODE_VERTICAL_FIXED)
|
|
|
|
+ */
|
|
_this.fovMode = Camera.FOVMODE_VERTICAL_FIXED;
|
|
_this.fovMode = Camera.FOVMODE_VERTICAL_FIXED;
|
|
// Camera rig members
|
|
// Camera rig members
|
|
_this.cameraRigMode = Camera.RIG_MODE_NONE;
|
|
_this.cameraRigMode = Camera.RIG_MODE_NONE;
|
|
@@ -19988,6 +20041,24 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ Object.defineProperty(Scene.prototype, "geometryBufferRenderer", {
|
|
|
|
+ /**
|
|
|
|
+ * Gets the current geometry buffer associated to the scene.
|
|
|
|
+ */
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._geometryBufferRenderer;
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * Sets the current geometry buffer for the scene.
|
|
|
|
+ */
|
|
|
|
+ set: function (geometryBufferRenderer) {
|
|
|
|
+ if (geometryBufferRenderer && geometryBufferRenderer.isSupported) {
|
|
|
|
+ this._geometryBufferRenderer = geometryBufferRenderer;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
Object.defineProperty(Scene.prototype, "debugLayer", {
|
|
Object.defineProperty(Scene.prototype, "debugLayer", {
|
|
// Properties
|
|
// Properties
|
|
get: function () {
|
|
get: function () {
|
|
@@ -39125,6 +39196,12 @@ var BABYLON;
|
|
this.camera = camera;
|
|
this.camera = camera;
|
|
this.checkInputs = function () { };
|
|
this.checkInputs = function () { };
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Add an input method to a camera.
|
|
|
|
+ * builtin inputs example: camera.inputs.addGamepad();
|
|
|
|
+ * custom inputs example: camera.inputs.add(new BABYLON.FreeCameraGamepadInput());
|
|
|
|
+ * @param input camera input method
|
|
|
|
+ */
|
|
CameraInputsManager.prototype.add = function (input) {
|
|
CameraInputsManager.prototype.add = function (input) {
|
|
var type = input.getSimpleName();
|
|
var type = input.getSimpleName();
|
|
if (this.attached[type]) {
|
|
if (this.attached[type]) {
|
|
@@ -39142,6 +39219,11 @@ var BABYLON;
|
|
input.attachControl(this.attachedElement);
|
|
input.attachControl(this.attachedElement);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Remove a specific input method from a camera
|
|
|
|
+ * example: camera.inputs.remove(camera.inputs.attached.mouse);
|
|
|
|
+ * @param inputToRemove camera input method
|
|
|
|
+ */
|
|
CameraInputsManager.prototype.remove = function (inputToRemove) {
|
|
CameraInputsManager.prototype.remove = function (inputToRemove) {
|
|
for (var cam in this.attached) {
|
|
for (var cam in this.attached) {
|
|
var input = this.attached[cam];
|
|
var input = this.attached[cam];
|
|
@@ -39210,6 +39292,9 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Remove all attached input methods from a camera
|
|
|
|
+ */
|
|
CameraInputsManager.prototype.clear = function () {
|
|
CameraInputsManager.prototype.clear = function () {
|
|
if (this.attachedElement) {
|
|
if (this.attachedElement) {
|
|
this.detachElement(this.attachedElement, true);
|
|
this.detachElement(this.attachedElement, true);
|
|
@@ -39914,12 +39999,20 @@ var BABYLON;
|
|
}
|
|
}
|
|
Object.defineProperty(FreeCamera.prototype, "angularSensibility", {
|
|
Object.defineProperty(FreeCamera.prototype, "angularSensibility", {
|
|
//-- begin properties for backward compatibility for inputs
|
|
//-- begin properties for backward compatibility for inputs
|
|
|
|
+ /**
|
|
|
|
+ * Gets the input sensibility for a mouse input. (default is 2000.0)
|
|
|
|
+ * Higher values reduce sensitivity.
|
|
|
|
+ */
|
|
get: function () {
|
|
get: function () {
|
|
var mouse = this.inputs.attached["mouse"];
|
|
var mouse = this.inputs.attached["mouse"];
|
|
if (mouse)
|
|
if (mouse)
|
|
return mouse.angularSensibility;
|
|
return mouse.angularSensibility;
|
|
return 0;
|
|
return 0;
|
|
},
|
|
},
|
|
|
|
+ /**
|
|
|
|
+ * Sets the input sensibility for a mouse input. (default is 2000.0)
|
|
|
|
+ * Higher values reduce sensitivity.
|
|
|
|
+ */
|
|
set: function (value) {
|
|
set: function (value) {
|
|
var mouse = this.inputs.attached["mouse"];
|
|
var mouse = this.inputs.attached["mouse"];
|
|
if (mouse)
|
|
if (mouse)
|
|
@@ -44482,6 +44575,24 @@ var BABYLON;
|
|
return action;
|
|
return action;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Unregisters an action to this action manager
|
|
|
|
+ * @param action The action to be unregistered
|
|
|
|
+ * @return whether the action has been unregistered
|
|
|
|
+ */
|
|
|
|
+ ActionManager.prototype.unregisterAction = function (action) {
|
|
|
|
+ var index = this.actions.indexOf(action);
|
|
|
|
+ if (index !== -1) {
|
|
|
|
+ this.actions.splice(index, 1);
|
|
|
|
+ ActionManager.Triggers[action.trigger] -= 1;
|
|
|
|
+ if (ActionManager.Triggers[action.trigger] === 0) {
|
|
|
|
+ delete ActionManager.Triggers[action.trigger];
|
|
|
|
+ }
|
|
|
|
+ delete action._actionManager;
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Process a specific trigger
|
|
* Process a specific trigger
|
|
* @param {number} trigger - the trigger to process
|
|
* @param {number} trigger - the trigger to process
|
|
* @param evt {BABYLON.ActionEvent} the event details to be processed
|
|
* @param evt {BABYLON.ActionEvent} the event details to be processed
|
|
@@ -53792,104 +53903,167 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
|
|
+ var getName = function (src) {
|
|
|
|
+ if (src instanceof HTMLVideoElement) {
|
|
|
|
+ return src.currentSrc;
|
|
|
|
+ }
|
|
|
|
+ if (typeof src === "object") {
|
|
|
|
+ return src.toString();
|
|
|
|
+ }
|
|
|
|
+ return src;
|
|
|
|
+ };
|
|
|
|
+ var getVideo = function (src) {
|
|
|
|
+ if (src instanceof HTMLVideoElement) {
|
|
|
|
+ return src;
|
|
|
|
+ }
|
|
|
|
+ var video = document.createElement("video");
|
|
|
|
+ if (typeof src === "string") {
|
|
|
|
+ video.src = src;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ src.forEach(function (url) {
|
|
|
|
+ var source = document.createElement("source");
|
|
|
|
+ source.src = url;
|
|
|
|
+ video.appendChild(source);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return video;
|
|
|
|
+ };
|
|
var VideoTexture = /** @class */ (function (_super) {
|
|
var VideoTexture = /** @class */ (function (_super) {
|
|
__extends(VideoTexture, _super);
|
|
__extends(VideoTexture, _super);
|
|
/**
|
|
/**
|
|
* Creates a video texture.
|
|
* Creates a video texture.
|
|
- * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
|
|
|
|
- * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
|
|
|
|
|
|
+ * Sample : https://doc.babylonjs.com/how_to/video_texture
|
|
|
|
+ * @param {string | null} name optional name, will detect from video source, if not defined
|
|
|
|
+ * @param {(string | string[] | HTMLVideoElement)} src can be used to provide an url, array of urls or an already setup HTML video element.
|
|
* @param {BABYLON.Scene} scene is obviously the current scene.
|
|
* @param {BABYLON.Scene} scene is obviously the current scene.
|
|
* @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
|
|
* @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
|
|
* @param {boolean} invertY is false by default but can be used to invert video on Y axis
|
|
* @param {boolean} invertY is false by default but can be used to invert video on Y axis
|
|
* @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
|
|
* @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
|
|
|
|
+ * @param {VideoTextureSettings} [settings] allows finer control over video usage
|
|
*/
|
|
*/
|
|
- function VideoTexture(name, urlsOrVideo, scene, generateMipMaps, invertY, samplingMode) {
|
|
|
|
|
|
+ function VideoTexture(name, src, scene, generateMipMaps, invertY, samplingMode, settings) {
|
|
if (generateMipMaps === void 0) { generateMipMaps = false; }
|
|
if (generateMipMaps === void 0) { generateMipMaps = false; }
|
|
if (invertY === void 0) { invertY = false; }
|
|
if (invertY === void 0) { invertY = false; }
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
|
|
+ if (settings === void 0) { settings = {
|
|
|
|
+ autoPlay: true,
|
|
|
|
+ loop: true,
|
|
|
|
+ autoUpdateTexture: true,
|
|
|
|
+ }; }
|
|
var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
|
|
var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
|
|
- _this._autoLaunch = true;
|
|
|
|
- var urls = null;
|
|
|
|
- _this.name = name;
|
|
|
|
- if (urlsOrVideo instanceof HTMLVideoElement) {
|
|
|
|
- _this.video = urlsOrVideo;
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- urls = urlsOrVideo;
|
|
|
|
- _this.video = document.createElement("video");
|
|
|
|
- _this.video.autoplay = false;
|
|
|
|
- _this.video.loop = true;
|
|
|
|
- BABYLON.Tools.SetCorsBehavior(urls, _this.video);
|
|
|
|
- }
|
|
|
|
|
|
+ _this._createInternalTexture = function () {
|
|
|
|
+ if (_this._texture != null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!_this._engine.needPOTTextures ||
|
|
|
|
+ (BABYLON.Tools.IsExponentOfTwo(_this.video.videoWidth) && BABYLON.Tools.IsExponentOfTwo(_this.video.videoHeight))) {
|
|
|
|
+ _this.wrapU = BABYLON.Texture.WRAP_ADDRESSMODE;
|
|
|
|
+ _this.wrapV = BABYLON.Texture.WRAP_ADDRESSMODE;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ _this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
+ _this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
+ _this._generateMipMaps = false;
|
|
|
|
+ }
|
|
|
|
+ _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this._samplingMode);
|
|
|
|
+ _this._texture.width;
|
|
|
|
+ _this._updateInternalTexture();
|
|
|
|
+ _this._texture.isReady = true;
|
|
|
|
+ };
|
|
|
|
+ _this.reset = function () {
|
|
|
|
+ if (_this._texture == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ _this._texture.dispose();
|
|
|
|
+ _this._texture = null;
|
|
|
|
+ };
|
|
|
|
+ _this._updateInternalTexture = function (e) {
|
|
|
|
+ if (_this._texture == null || !_this._texture.isReady) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (_this.video.readyState < _this.video.HAVE_CURRENT_DATA) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ _this._engine.updateVideoTexture(_this._texture, _this.video, _this._invertY);
|
|
|
|
+ };
|
|
_this._engine = _this.getScene().getEngine();
|
|
_this._engine = _this.getScene().getEngine();
|
|
_this._generateMipMaps = generateMipMaps;
|
|
_this._generateMipMaps = generateMipMaps;
|
|
_this._samplingMode = samplingMode;
|
|
_this._samplingMode = samplingMode;
|
|
- if (!_this._engine.needPOTTextures || (BABYLON.Tools.IsExponentOfTwo(_this.video.videoWidth) && BABYLON.Tools.IsExponentOfTwo(_this.video.videoHeight))) {
|
|
|
|
- _this.wrapU = BABYLON.Texture.WRAP_ADDRESSMODE;
|
|
|
|
- _this.wrapV = BABYLON.Texture.WRAP_ADDRESSMODE;
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- _this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
- _this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
- _this._generateMipMaps = false;
|
|
|
|
|
|
+ _this.autoUpdateTexture = settings.autoUpdateTexture;
|
|
|
|
+ _this.name = name || getName(src);
|
|
|
|
+ _this.video = getVideo(src);
|
|
|
|
+ if (settings.autoPlay !== undefined) {
|
|
|
|
+ _this.video.autoplay = settings.autoPlay;
|
|
|
|
+ }
|
|
|
|
+ if (settings.loop !== undefined) {
|
|
|
|
+ _this.video.loop = settings.loop;
|
|
|
|
+ }
|
|
|
|
+ _this.video.addEventListener("canplay", _this._createInternalTexture);
|
|
|
|
+ _this.video.addEventListener("paused", _this._updateInternalTexture);
|
|
|
|
+ _this.video.addEventListener("seeked", _this._updateInternalTexture);
|
|
|
|
+ _this.video.addEventListener("emptied", _this.reset);
|
|
|
|
+ if (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA) {
|
|
|
|
+ _this._createInternalTexture();
|
|
}
|
|
}
|
|
- if (urls) {
|
|
|
|
- _this.video.addEventListener("canplay", function () {
|
|
|
|
- if (_this._texture === undefined) {
|
|
|
|
- _this._createTexture();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- urls.forEach(function (url) {
|
|
|
|
- var source = document.createElement("source");
|
|
|
|
- source.src = url;
|
|
|
|
- _this.video.appendChild(source);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- _this._createTexture();
|
|
|
|
- }
|
|
|
|
- _this._lastUpdate = BABYLON.Tools.Now;
|
|
|
|
return _this;
|
|
return _this;
|
|
}
|
|
}
|
|
- VideoTexture.prototype.__setTextureReady = function () {
|
|
|
|
- if (this._texture) {
|
|
|
|
- this._texture.isReady = true;
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- VideoTexture.prototype._createTexture = function () {
|
|
|
|
- this._texture = this._engine.createDynamicTexture(this.video.videoWidth, this.video.videoHeight, this._generateMipMaps, this._samplingMode);
|
|
|
|
- if (this._autoLaunch) {
|
|
|
|
- this._autoLaunch = false;
|
|
|
|
- this.video.play();
|
|
|
|
- }
|
|
|
|
- this._setTextureReady = this.__setTextureReady.bind(this);
|
|
|
|
- this.video.addEventListener("playing", this._setTextureReady);
|
|
|
|
- };
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Internal method to initiate `update`.
|
|
|
|
+ */
|
|
VideoTexture.prototype._rebuild = function () {
|
|
VideoTexture.prototype._rebuild = function () {
|
|
this.update();
|
|
this.update();
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Update Texture in the `auto` mode. Does not do anything if `settings.autoUpdateTexture` is false.
|
|
|
|
+ */
|
|
VideoTexture.prototype.update = function () {
|
|
VideoTexture.prototype.update = function () {
|
|
- var now = BABYLON.Tools.Now;
|
|
|
|
- if (now - this._lastUpdate < 15 || this.video.readyState !== this.video.HAVE_ENOUGH_DATA) {
|
|
|
|
- return false;
|
|
|
|
|
|
+ if (!this.autoUpdateTexture) {
|
|
|
|
+ // Expecting user to call `updateTexture` manually
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- this._lastUpdate = now;
|
|
|
|
- this._engine.updateVideoTexture(this._texture, this.video, this._invertY);
|
|
|
|
- return true;
|
|
|
|
|
|
+ this.updateTexture(true);
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Update Texture in `manual` mode. Does not do anything if not visible or paused.
|
|
|
|
+ * @param isVisible Visibility state, detected by user using `scene.getActiveMeshes()` or othervise.
|
|
|
|
+ */
|
|
|
|
+ VideoTexture.prototype.updateTexture = function (isVisible) {
|
|
|
|
+ if (!isVisible) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (this.video.paused) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this._updateInternalTexture();
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Change video content. Changing video instance or setting multiple urls (as in constructor) is not supported.
|
|
|
|
+ * @param url New url.
|
|
|
|
+ */
|
|
|
|
+ VideoTexture.prototype.updateURL = function (url) {
|
|
|
|
+ this.video.src = url;
|
|
};
|
|
};
|
|
VideoTexture.prototype.dispose = function () {
|
|
VideoTexture.prototype.dispose = function () {
|
|
_super.prototype.dispose.call(this);
|
|
_super.prototype.dispose.call(this);
|
|
- this.video.removeEventListener("playing", this._setTextureReady);
|
|
|
|
|
|
+ this.video.removeEventListener("canplay", this._createInternalTexture);
|
|
|
|
+ this.video.removeEventListener("paused", this._updateInternalTexture);
|
|
|
|
+ this.video.removeEventListener("seeked", this._updateInternalTexture);
|
|
|
|
+ this.video.removeEventListener("emptied", this.reset);
|
|
};
|
|
};
|
|
VideoTexture.CreateFromWebCam = function (scene, onReady, constraints) {
|
|
VideoTexture.CreateFromWebCam = function (scene, onReady, constraints) {
|
|
var video = document.createElement("video");
|
|
var video = document.createElement("video");
|
|
var constraintsDeviceId;
|
|
var constraintsDeviceId;
|
|
if (constraints && constraints.deviceId) {
|
|
if (constraints && constraints.deviceId) {
|
|
constraintsDeviceId = {
|
|
constraintsDeviceId = {
|
|
- exact: constraints.deviceId
|
|
|
|
|
|
+ exact: constraints.deviceId,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
- navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
|
|
|
|
|
|
+ navigator.getUserMedia =
|
|
|
|
+ navigator.getUserMedia ||
|
|
|
|
+ navigator.webkitGetUserMedia ||
|
|
|
|
+ navigator.mozGetUserMedia ||
|
|
|
|
+ navigator.msGetUserMedia;
|
|
window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
|
|
window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
|
|
if (navigator.getUserMedia) {
|
|
if (navigator.getUserMedia) {
|
|
navigator.getUserMedia({
|
|
navigator.getUserMedia({
|
|
@@ -53897,15 +54071,16 @@ var BABYLON;
|
|
deviceId: constraintsDeviceId,
|
|
deviceId: constraintsDeviceId,
|
|
width: {
|
|
width: {
|
|
min: (constraints && constraints.minWidth) || 256,
|
|
min: (constraints && constraints.minWidth) || 256,
|
|
- max: (constraints && constraints.maxWidth) || 640
|
|
|
|
|
|
+ max: (constraints && constraints.maxWidth) || 640,
|
|
},
|
|
},
|
|
height: {
|
|
height: {
|
|
min: (constraints && constraints.minHeight) || 256,
|
|
min: (constraints && constraints.minHeight) || 256,
|
|
- max: (constraints && constraints.maxHeight) || 480
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ max: (constraints && constraints.maxHeight) || 480,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
}, function (stream) {
|
|
}, function (stream) {
|
|
if (video.mozSrcObject !== undefined) {
|
|
if (video.mozSrcObject !== undefined) {
|
|
|
|
+ // hack for Firefox < 19
|
|
video.mozSrcObject = stream;
|
|
video.mozSrcObject = stream;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -63011,7 +63186,15 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
|
|
+ /**
|
|
|
|
+ * This renderer is helpfull to fill one of the render target with a geometry buffer.
|
|
|
|
+ */
|
|
var GeometryBufferRenderer = /** @class */ (function () {
|
|
var GeometryBufferRenderer = /** @class */ (function () {
|
|
|
|
+ /**
|
|
|
|
+ * Creates a new G Buffer for the scene. @see GeometryBufferRenderer
|
|
|
|
+ * @param scene The scene the buffer belongs to
|
|
|
|
+ * @param ratio How big is the buffer related to the main canvas.
|
|
|
|
+ */
|
|
function GeometryBufferRenderer(scene, ratio) {
|
|
function GeometryBufferRenderer(scene, ratio) {
|
|
if (ratio === void 0) { ratio = 1; }
|
|
if (ratio === void 0) { ratio = 1; }
|
|
this._enablePosition = false;
|
|
this._enablePosition = false;
|
|
@@ -63021,6 +63204,9 @@ var BABYLON;
|
|
this._createRenderTargets();
|
|
this._createRenderTargets();
|
|
}
|
|
}
|
|
Object.defineProperty(GeometryBufferRenderer.prototype, "renderList", {
|
|
Object.defineProperty(GeometryBufferRenderer.prototype, "renderList", {
|
|
|
|
+ /**
|
|
|
|
+ * Set the render list (meshes to be rendered) used in the G buffer.
|
|
|
|
+ */
|
|
set: function (meshes) {
|
|
set: function (meshes) {
|
|
this._multiRenderTarget.renderList = meshes;
|
|
this._multiRenderTarget.renderList = meshes;
|
|
},
|
|
},
|
|
@@ -63028,6 +63214,10 @@ var BABYLON;
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
Object.defineProperty(GeometryBufferRenderer.prototype, "isSupported", {
|
|
Object.defineProperty(GeometryBufferRenderer.prototype, "isSupported", {
|
|
|
|
+ /**
|
|
|
|
+ * Gets wether or not G buffer are supported by the running hardware.
|
|
|
|
+ * This requires draw buffer supports
|
|
|
|
+ */
|
|
get: function () {
|
|
get: function () {
|
|
return this._multiRenderTarget.isSupported;
|
|
return this._multiRenderTarget.isSupported;
|
|
},
|
|
},
|
|
@@ -63035,9 +63225,15 @@ var BABYLON;
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
Object.defineProperty(GeometryBufferRenderer.prototype, "enablePosition", {
|
|
Object.defineProperty(GeometryBufferRenderer.prototype, "enablePosition", {
|
|
|
|
+ /**
|
|
|
|
+ * Gets wether or not position are enabled for the G buffer.
|
|
|
|
+ */
|
|
get: function () {
|
|
get: function () {
|
|
return this._enablePosition;
|
|
return this._enablePosition;
|
|
},
|
|
},
|
|
|
|
+ /**
|
|
|
|
+ * Sets wether or not position are enabled for the G buffer.
|
|
|
|
+ */
|
|
set: function (enable) {
|
|
set: function (enable) {
|
|
this._enablePosition = enable;
|
|
this._enablePosition = enable;
|
|
this.dispose();
|
|
this.dispose();
|
|
@@ -63046,6 +63242,33 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ Object.defineProperty(GeometryBufferRenderer.prototype, "scene", {
|
|
|
|
+ /**
|
|
|
|
+ * Gets the scene associated with the buffer.
|
|
|
|
+ */
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._scene;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(GeometryBufferRenderer.prototype, "ratio", {
|
|
|
|
+ /**
|
|
|
|
+ * Gets the ratio used by the buffer during its creation.
|
|
|
|
+ * How big is the buffer related to the main canvas.
|
|
|
|
+ */
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._ratio;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ /**
|
|
|
|
+ * Checks wether everything is ready to render a submesh to the G buffer.
|
|
|
|
+ * @param subMesh the submesh to check readiness for
|
|
|
|
+ * @param useInstances is the mesh drawn using instance or not
|
|
|
|
+ * @returns true if ready otherwise false
|
|
|
|
+ */
|
|
GeometryBufferRenderer.prototype.isReady = function (subMesh, useInstances) {
|
|
GeometryBufferRenderer.prototype.isReady = function (subMesh, useInstances) {
|
|
var material = subMesh.getMaterial();
|
|
var material = subMesh.getMaterial();
|
|
if (material && material.disableDepthWrite) {
|
|
if (material && material.disableDepthWrite) {
|
|
@@ -63100,20 +63323,32 @@ var BABYLON;
|
|
}
|
|
}
|
|
return this._effect.isReady();
|
|
return this._effect.isReady();
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Gets the current underlying G Buffer.
|
|
|
|
+ * @returns the buffer
|
|
|
|
+ */
|
|
GeometryBufferRenderer.prototype.getGBuffer = function () {
|
|
GeometryBufferRenderer.prototype.getGBuffer = function () {
|
|
return this._multiRenderTarget;
|
|
return this._multiRenderTarget;
|
|
};
|
|
};
|
|
Object.defineProperty(GeometryBufferRenderer.prototype, "samples", {
|
|
Object.defineProperty(GeometryBufferRenderer.prototype, "samples", {
|
|
|
|
+ /**
|
|
|
|
+ * Gets the number of samples used to render the buffer (anti aliasing).
|
|
|
|
+ */
|
|
get: function () {
|
|
get: function () {
|
|
return this._multiRenderTarget.samples;
|
|
return this._multiRenderTarget.samples;
|
|
},
|
|
},
|
|
|
|
+ /**
|
|
|
|
+ * Sets the number of samples used to render the buffer (anti aliasing).
|
|
|
|
+ */
|
|
set: function (value) {
|
|
set: function (value) {
|
|
this._multiRenderTarget.samples = value;
|
|
this._multiRenderTarget.samples = value;
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
- // Methods
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Disposes the renderer and frees up associated resources.
|
|
|
|
+ */
|
|
GeometryBufferRenderer.prototype.dispose = function () {
|
|
GeometryBufferRenderer.prototype.dispose = function () {
|
|
this.getGBuffer().dispose();
|
|
this.getGBuffer().dispose();
|
|
};
|
|
};
|
|
@@ -72941,7 +73176,7 @@ var BABYLON;
|
|
engine.setDepthFunctionToLess();
|
|
engine.setDepthFunctionToLess();
|
|
this._scene.resetCachedMaterial();
|
|
this._scene.resetCachedMaterial();
|
|
this._colorShader.bind(worldMatrix);
|
|
this._colorShader.bind(worldMatrix);
|
|
- engine.drawElementsType(BABYLON.Material.TriangleFillMode, 0, 24);
|
|
|
|
|
|
+ engine.drawElementsType(BABYLON.Material.LineListDrawMode, 0, 24);
|
|
this._colorShader.unbind();
|
|
this._colorShader.unbind();
|
|
engine.setDepthFunctionToLessOrEqual();
|
|
engine.setDepthFunctionToLessOrEqual();
|
|
engine.setDepthWrite(true);
|
|
engine.setDepthWrite(true);
|
|
@@ -73562,6 +73797,10 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
|
|
+ /**
|
|
|
|
+ * Takes information about the orientation of the device as reported by the deviceorientation event to orient the camera.
|
|
|
|
+ * Screen rotation is taken into account.
|
|
|
|
+ */
|
|
var FreeCameraDeviceOrientationInput = /** @class */ (function () {
|
|
var FreeCameraDeviceOrientationInput = /** @class */ (function () {
|
|
function FreeCameraDeviceOrientationInput() {
|
|
function FreeCameraDeviceOrientationInput() {
|
|
var _this = this;
|
|
var _this = this;
|
|
@@ -73788,16 +74027,15 @@ var BABYLON;
|
|
_this.onControllersAttachedObservable = new BABYLON.Observable();
|
|
_this.onControllersAttachedObservable = new BABYLON.Observable();
|
|
_this.onControllerMeshLoadedObservable = new BABYLON.Observable();
|
|
_this.onControllerMeshLoadedObservable = new BABYLON.Observable();
|
|
_this.rigParenting = true; // should the rig cameras be used as parent instead of this camera.
|
|
_this.rigParenting = true; // should the rig cameras be used as parent instead of this camera.
|
|
- _this._defaultHeight = 0;
|
|
|
|
|
|
+ _this._defaultHeight = undefined;
|
|
_this.deviceDistanceToRoomGround = function () {
|
|
_this.deviceDistanceToRoomGround = function () {
|
|
- if (_this._standingMatrix) {
|
|
|
|
|
|
+ if (_this._standingMatrix && _this._defaultHeight === undefined) {
|
|
// Add standing matrix offset to get real offset from ground in room
|
|
// Add standing matrix offset to get real offset from ground in room
|
|
_this._standingMatrix.getTranslationToRef(_this._workingVector);
|
|
_this._standingMatrix.getTranslationToRef(_this._workingVector);
|
|
return _this._deviceRoomPosition.y + _this._workingVector.y;
|
|
return _this._deviceRoomPosition.y + _this._workingVector.y;
|
|
}
|
|
}
|
|
- else {
|
|
|
|
- return _this._defaultHeight;
|
|
|
|
- }
|
|
|
|
|
|
+ //If VRDisplay does not inform stage parameters and no default height is set we fallback to zero.
|
|
|
|
+ return _this._defaultHeight || 0;
|
|
};
|
|
};
|
|
_this.useStandingMatrix = function (callback) {
|
|
_this.useStandingMatrix = function (callback) {
|
|
if (callback === void 0) { callback = function (bool) { }; }
|
|
if (callback === void 0) { callback = function (bool) { }; }
|
|
@@ -74209,7 +74447,7 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* Creates a new device orientation camera. @see DeviceOrientationCamera
|
|
* Creates a new device orientation camera. @see DeviceOrientationCamera
|
|
* @param name The name of the camera
|
|
* @param name The name of the camera
|
|
- * @param position The starts position camera
|
|
|
|
|
|
+ * @param position The start position camera
|
|
* @param scene The scene the camera belongs to
|
|
* @param scene The scene the camera belongs to
|
|
*/
|
|
*/
|
|
function DeviceOrientationCamera(name, position, scene) {
|
|
function DeviceOrientationCamera(name, position, scene) {
|
|
@@ -76882,9 +77120,10 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- SceneOptimization.prototype.apply = function (scene) {
|
|
|
|
|
|
+ SceneOptimization.prototype.apply = function (scene, optimizer) {
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
;
|
|
;
|
|
@@ -76935,9 +77174,10 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- TextureOptimization.prototype.apply = function (scene) {
|
|
|
|
|
|
+ TextureOptimization.prototype.apply = function (scene, optimizer) {
|
|
var allDone = true;
|
|
var allDone = true;
|
|
for (var index = 0; index < scene.textures.length; index++) {
|
|
for (var index = 0; index < scene.textures.length; index++) {
|
|
var texture = scene.textures[index];
|
|
var texture = scene.textures[index];
|
|
@@ -77002,9 +77242,10 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- HardwareScalingOptimization.prototype.apply = function (scene) {
|
|
|
|
|
|
+ HardwareScalingOptimization.prototype.apply = function (scene, optimizer) {
|
|
if (this._currentScale === -1) {
|
|
if (this._currentScale === -1) {
|
|
this._currentScale = scene.getEngine().getHardwareScalingLevel();
|
|
this._currentScale = scene.getEngine().getHardwareScalingLevel();
|
|
if (this._currentScale > this.maximumScale) {
|
|
if (this._currentScale > this.maximumScale) {
|
|
@@ -77025,26 +77266,8 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
var ShadowsOptimization = /** @class */ (function (_super) {
|
|
var ShadowsOptimization = /** @class */ (function (_super) {
|
|
__extends(ShadowsOptimization, _super);
|
|
__extends(ShadowsOptimization, _super);
|
|
- /**
|
|
|
|
- * Creates the ShadowsOptimization object
|
|
|
|
- * @param priority defines the priority of this optimization (0 by default which means first in the list)
|
|
|
|
- * @param target defines the value to set the scene.shadowsEnabled property to (false by default)
|
|
|
|
- */
|
|
|
|
- function ShadowsOptimization(
|
|
|
|
- /**
|
|
|
|
- * Defines the priority of this optimization (0 by default which means first in the list)
|
|
|
|
- */
|
|
|
|
- priority,
|
|
|
|
- /**
|
|
|
|
- * Defines the value to set the scene.shadowsEnabled property to (false by default)
|
|
|
|
- */
|
|
|
|
- target) {
|
|
|
|
- if (priority === void 0) { priority = 0; }
|
|
|
|
- if (target === void 0) { target = false; }
|
|
|
|
- var _this = _super.call(this, priority) || this;
|
|
|
|
- _this.priority = priority;
|
|
|
|
- _this.target = target;
|
|
|
|
- return _this;
|
|
|
|
|
|
+ function ShadowsOptimization() {
|
|
|
|
+ return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* Gets a string describing the action executed by the current optimization
|
|
* Gets a string describing the action executed by the current optimization
|
|
@@ -77056,10 +77279,11 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- ShadowsOptimization.prototype.apply = function (scene) {
|
|
|
|
- scene.shadowsEnabled = this.target;
|
|
|
|
|
|
+ ShadowsOptimization.prototype.apply = function (scene, optimizer) {
|
|
|
|
+ scene.shadowsEnabled = optimizer.isInImprovementMode;
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
;
|
|
;
|
|
@@ -77072,26 +77296,8 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
var PostProcessesOptimization = /** @class */ (function (_super) {
|
|
var PostProcessesOptimization = /** @class */ (function (_super) {
|
|
__extends(PostProcessesOptimization, _super);
|
|
__extends(PostProcessesOptimization, _super);
|
|
- /**
|
|
|
|
- * Creates the PostProcessesOptimization object
|
|
|
|
- * @param priority defines the priority of this optimization (0 by default which means first in the list)
|
|
|
|
- * @param target defines the value to set the scene.postProcessesEnabled property to (false by default)
|
|
|
|
- */
|
|
|
|
- function PostProcessesOptimization(
|
|
|
|
- /**
|
|
|
|
- * Defines the priority of this optimization (0 by default which means first in the list)
|
|
|
|
- */
|
|
|
|
- priority,
|
|
|
|
- /**
|
|
|
|
- * Defines the value to set the scene.postProcessesEnabled property to (false by default)
|
|
|
|
- */
|
|
|
|
- target) {
|
|
|
|
- if (priority === void 0) { priority = 0; }
|
|
|
|
- if (target === void 0) { target = false; }
|
|
|
|
- var _this = _super.call(this, priority) || this;
|
|
|
|
- _this.priority = priority;
|
|
|
|
- _this.target = target;
|
|
|
|
- return _this;
|
|
|
|
|
|
+ function PostProcessesOptimization() {
|
|
|
|
+ return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* Gets a string describing the action executed by the current optimization
|
|
* Gets a string describing the action executed by the current optimization
|
|
@@ -77103,10 +77309,11 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- PostProcessesOptimization.prototype.apply = function (scene) {
|
|
|
|
- scene.postProcessesEnabled = this.target;
|
|
|
|
|
|
+ PostProcessesOptimization.prototype.apply = function (scene, optimizer) {
|
|
|
|
+ scene.postProcessesEnabled = optimizer.isInImprovementMode;
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
;
|
|
;
|
|
@@ -77119,26 +77326,8 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
var LensFlaresOptimization = /** @class */ (function (_super) {
|
|
var LensFlaresOptimization = /** @class */ (function (_super) {
|
|
__extends(LensFlaresOptimization, _super);
|
|
__extends(LensFlaresOptimization, _super);
|
|
- /**
|
|
|
|
- * Creates the LensFlaresOptimization object
|
|
|
|
- * @param priority defines the priority of this optimization (0 by default which means first in the list)
|
|
|
|
- * @param target defines the value to set the scene.lensFlaresEnabled property to (false by default)
|
|
|
|
- */
|
|
|
|
- function LensFlaresOptimization(
|
|
|
|
- /**
|
|
|
|
- * Defines the priority of this optimization (0 by default which means first in the list)
|
|
|
|
- */
|
|
|
|
- priority,
|
|
|
|
- /**
|
|
|
|
- * Defines the value to set the scene.lensFlaresEnabled property to (false by default)
|
|
|
|
- */
|
|
|
|
- target) {
|
|
|
|
- if (priority === void 0) { priority = 0; }
|
|
|
|
- if (target === void 0) { target = false; }
|
|
|
|
- var _this = _super.call(this, priority) || this;
|
|
|
|
- _this.priority = priority;
|
|
|
|
- _this.target = target;
|
|
|
|
- return _this;
|
|
|
|
|
|
+ function LensFlaresOptimization() {
|
|
|
|
+ return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* Gets a string describing the action executed by the current optimization
|
|
* Gets a string describing the action executed by the current optimization
|
|
@@ -77150,10 +77339,11 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- LensFlaresOptimization.prototype.apply = function (scene) {
|
|
|
|
- scene.lensFlaresEnabled = this.target;
|
|
|
|
|
|
+ LensFlaresOptimization.prototype.apply = function (scene, optimizer) {
|
|
|
|
+ scene.lensFlaresEnabled = optimizer.isInImprovementMode;
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
;
|
|
;
|
|
@@ -77182,11 +77372,12 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- CustomOptimization.prototype.apply = function (scene) {
|
|
|
|
|
|
+ CustomOptimization.prototype.apply = function (scene, optimizer) {
|
|
if (this.onApply) {
|
|
if (this.onApply) {
|
|
- return this.onApply(scene);
|
|
|
|
|
|
+ return this.onApply(scene, optimizer);
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
@@ -77200,26 +77391,8 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
var ParticlesOptimization = /** @class */ (function (_super) {
|
|
var ParticlesOptimization = /** @class */ (function (_super) {
|
|
__extends(ParticlesOptimization, _super);
|
|
__extends(ParticlesOptimization, _super);
|
|
- /**
|
|
|
|
- * Creates the ParticlesOptimization object
|
|
|
|
- * @param priority defines the priority of this optimization (0 by default which means first in the list)
|
|
|
|
- * @param target defines the value to set the scene.particlesEnabled property to (false by default)
|
|
|
|
- */
|
|
|
|
- function ParticlesOptimization(
|
|
|
|
- /**
|
|
|
|
- * Defines the priority of this optimization (0 by default which means first in the list)
|
|
|
|
- */
|
|
|
|
- priority,
|
|
|
|
- /**
|
|
|
|
- * Defines the value to set the scene.particlesEnabled property to (false by default)
|
|
|
|
- */
|
|
|
|
- target) {
|
|
|
|
- if (priority === void 0) { priority = 0; }
|
|
|
|
- if (target === void 0) { target = false; }
|
|
|
|
- var _this = _super.call(this, priority) || this;
|
|
|
|
- _this.priority = priority;
|
|
|
|
- _this.target = target;
|
|
|
|
- return _this;
|
|
|
|
|
|
+ function ParticlesOptimization() {
|
|
|
|
+ return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* Gets a string describing the action executed by the current optimization
|
|
* Gets a string describing the action executed by the current optimization
|
|
@@ -77231,10 +77404,11 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- ParticlesOptimization.prototype.apply = function (scene) {
|
|
|
|
- scene.particlesEnabled = this.target;
|
|
|
|
|
|
+ ParticlesOptimization.prototype.apply = function (scene, optimizer) {
|
|
|
|
+ scene.particlesEnabled = optimizer.isInImprovementMode;
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
;
|
|
;
|
|
@@ -77260,10 +77434,11 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- RenderTargetsOptimization.prototype.apply = function (scene) {
|
|
|
|
- scene.renderTargetsEnabled = false;
|
|
|
|
|
|
+ RenderTargetsOptimization.prototype.apply = function (scene, optimizer) {
|
|
|
|
+ scene.renderTargetsEnabled = optimizer.isInImprovementMode;
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
;
|
|
;
|
|
@@ -77325,10 +77500,11 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* This function will be called by the SceneOptimizer when its priority is reached in order to apply the change required by the current optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
* @param scene defines the current scene where to apply this optimization
|
|
|
|
+ * @param optimizer defines the current optimizer
|
|
* @param updateSelectionTree defines that the selection octree has to be updated (false by default)
|
|
* @param updateSelectionTree defines that the selection octree has to be updated (false by default)
|
|
* @returns true if everything that can be done was applied
|
|
* @returns true if everything that can be done was applied
|
|
*/
|
|
*/
|
|
- MergeMeshesOptimization.prototype.apply = function (scene, updateSelectionTree) {
|
|
|
|
|
|
+ MergeMeshesOptimization.prototype.apply = function (scene, optimizer, updateSelectionTree) {
|
|
var globalPool = scene.meshes.slice(0);
|
|
var globalPool = scene.meshes.slice(0);
|
|
var globalLength = globalPool.length;
|
|
var globalLength = globalPool.length;
|
|
for (var index = 0; index < globalLength; index++) {
|
|
for (var index = 0; index < globalLength; index++) {
|
|
@@ -77416,7 +77592,7 @@ var BABYLON;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Add a new custom optimization
|
|
* Add a new custom optimization
|
|
- * @param onApply defines the callback called to apply the custom optimization.
|
|
|
|
|
|
+ * @param onApply defines the callback called to apply the custom optimization (true if everything that can be done was applied)
|
|
* @param onGetDescription defines the callback called to get the description attached with the optimization.
|
|
* @param onGetDescription defines the callback called to get the description attached with the optimization.
|
|
* @param priority defines the priority of this optimization (0 by default which means first in the list)
|
|
* @param priority defines the priority of this optimization (0 by default which means first in the list)
|
|
* @returns the current SceneOptimizerOptions
|
|
* @returns the current SceneOptimizerOptions
|
|
@@ -77564,6 +77740,16 @@ var BABYLON;
|
|
_this.dispose();
|
|
_this.dispose();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ Object.defineProperty(SceneOptimizer.prototype, "isInImprovementMode", {
|
|
|
|
+ /**
|
|
|
|
+ * Gets a boolean indicating if the optimizer is in improvement mode
|
|
|
|
+ */
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._improvementMode;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
Object.defineProperty(SceneOptimizer.prototype, "currentPriorityLevel", {
|
|
Object.defineProperty(SceneOptimizer.prototype, "currentPriorityLevel", {
|
|
/**
|
|
/**
|
|
* Gets the current priority level (0 at start)
|
|
* Gets the current priority level (0 at start)
|
|
@@ -77676,7 +77862,7 @@ var BABYLON;
|
|
var optimization = options.optimizations[index];
|
|
var optimization = options.optimizations[index];
|
|
if (optimization.priority === this._currentPriorityLevel) {
|
|
if (optimization.priority === this._currentPriorityLevel) {
|
|
noOptimizationApplied = false;
|
|
noOptimizationApplied = false;
|
|
- allDone = allDone && optimization.apply(scene);
|
|
|
|
|
|
+ allDone = allDone && optimization.apply(scene, this);
|
|
this.onNewOptimizationAppliedObservable.notifyObservers(optimization);
|
|
this.onNewOptimizationAppliedObservable.notifyObservers(optimization);
|
|
}
|
|
}
|
|
}
|
|
}
|