|
@@ -19853,18 +19853,6 @@ var BABYLON;
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
/** @hidden */
|
|
/** @hidden */
|
|
- var _OcclusionDataStorage = /** @class */ (function () {
|
|
|
|
- function _OcclusionDataStorage() {
|
|
|
|
- /** @hidden */
|
|
|
|
- this.occlusionInternalRetryCounter = 0;
|
|
|
|
- /** @hidden */
|
|
|
|
- this.isOccluded = false;
|
|
|
|
- /** @hidden */
|
|
|
|
- this.isOcclusionQueryInProgress = false;
|
|
|
|
- }
|
|
|
|
- return _OcclusionDataStorage;
|
|
|
|
- }());
|
|
|
|
- /** @hidden */
|
|
|
|
var _FacetDataStorage = /** @class */ (function () {
|
|
var _FacetDataStorage = /** @class */ (function () {
|
|
function _FacetDataStorage() {
|
|
function _FacetDataStorage() {
|
|
this.facetNb = 0; // facet number
|
|
this.facetNb = 0; // facet number
|
|
@@ -19919,27 +19907,6 @@ var BABYLON;
|
|
* Gets or sets the orientation for POV movement & rotation
|
|
* Gets or sets the orientation for POV movement & rotation
|
|
*/
|
|
*/
|
|
_this.definedFacingForward = true;
|
|
_this.definedFacingForward = true;
|
|
- /**
|
|
|
|
- * This property determines the type of occlusion query algorithm to run in WebGl, you can use:
|
|
|
|
- * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.
|
|
|
|
- * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.
|
|
|
|
- * @see http://doc.babylonjs.com/features/occlusionquery
|
|
|
|
- */
|
|
|
|
- _this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
|
|
|
|
- /**
|
|
|
|
- * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:
|
|
|
|
- * * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query whith the Mesh.
|
|
|
|
- * * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.
|
|
|
|
- * * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.
|
|
|
|
- * @see http://doc.babylonjs.com/features/occlusionquery
|
|
|
|
- */
|
|
|
|
- _this.occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
|
|
|
|
- /**
|
|
|
|
- * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retireved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decideds to show or hide the object.
|
|
|
|
- * The default value is -1 which means don't break the query and wait till the result
|
|
|
|
- * @see http://doc.babylonjs.com/features/occlusionquery
|
|
|
|
- */
|
|
|
|
- _this.occlusionRetryCount = -1;
|
|
|
|
_this._visibility = 1.0;
|
|
_this._visibility = 1.0;
|
|
/** Gets or sets the alpha index used to sort transparent meshes
|
|
/** Gets or sets the alpha index used to sort transparent meshes
|
|
* @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#alpha-index
|
|
* @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#alpha-index
|
|
@@ -20213,31 +20180,6 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
- Object.defineProperty(AbstractMesh.prototype, "isOccluded", {
|
|
|
|
- /**
|
|
|
|
- * Gets or sets whether the mesh is occluded or not, it is used also to set the intial state of the mesh to be occluded or not
|
|
|
|
- * @see http://doc.babylonjs.com/features/occlusionquery
|
|
|
|
- */
|
|
|
|
- get: function () {
|
|
|
|
- return this._occlusionDataStorage.isOccluded;
|
|
|
|
- },
|
|
|
|
- set: function (value) {
|
|
|
|
- this._occlusionDataStorage.isOccluded = value;
|
|
|
|
- },
|
|
|
|
- enumerable: true,
|
|
|
|
- configurable: true
|
|
|
|
- });
|
|
|
|
- Object.defineProperty(AbstractMesh.prototype, "isOcclusionQueryInProgress", {
|
|
|
|
- /**
|
|
|
|
- * Flag to check the progress status of the query
|
|
|
|
- * @see http://doc.babylonjs.com/features/occlusionquery
|
|
|
|
- */
|
|
|
|
- get: function () {
|
|
|
|
- return this._occlusionDataStorage.isOcclusionQueryInProgress;
|
|
|
|
- },
|
|
|
|
- enumerable: true,
|
|
|
|
- configurable: true
|
|
|
|
- });
|
|
|
|
Object.defineProperty(AbstractMesh.prototype, "visibility", {
|
|
Object.defineProperty(AbstractMesh.prototype, "visibility", {
|
|
/**
|
|
/**
|
|
* Gets or sets mesh visibility between 0 and 1 (default is 1)
|
|
* Gets or sets mesh visibility between 0 and 1 (default is 1)
|
|
@@ -21217,7 +21159,7 @@ var BABYLON;
|
|
// Query
|
|
// Query
|
|
var engine = this.getScene().getEngine();
|
|
var engine = this.getScene().getEngine();
|
|
if (this._occlusionQuery) {
|
|
if (this._occlusionQuery) {
|
|
- this._occlusionDataStorage.isOcclusionQueryInProgress = false;
|
|
|
|
|
|
+ this.isOcclusionQueryInProgress = false;
|
|
engine.deleteQuery(this._occlusionQuery);
|
|
engine.deleteQuery(this._occlusionQuery);
|
|
this._occlusionQuery = null;
|
|
this._occlusionQuery = null;
|
|
}
|
|
}
|
|
@@ -21657,7 +21599,7 @@ var BABYLON;
|
|
};
|
|
};
|
|
/** @hidden */
|
|
/** @hidden */
|
|
AbstractMesh.prototype._checkOcclusionQuery = function () {
|
|
AbstractMesh.prototype._checkOcclusionQuery = function () {
|
|
- this._occlusionDataStorage.isOccluded = false;
|
|
|
|
|
|
+ return false;
|
|
};
|
|
};
|
|
/** No occlusion */
|
|
/** No occlusion */
|
|
AbstractMesh.OCCLUSION_TYPE_NONE = 0;
|
|
AbstractMesh.OCCLUSION_TYPE_NONE = 0;
|
|
@@ -32367,8 +32309,7 @@ var BABYLON;
|
|
* @returns the current mesh
|
|
* @returns the current mesh
|
|
*/
|
|
*/
|
|
Mesh.prototype.render = function (subMesh, enableAlphaMode) {
|
|
Mesh.prototype.render = function (subMesh, enableAlphaMode) {
|
|
- this._checkOcclusionQuery();
|
|
|
|
- if (this._occlusionDataStorage.isOccluded) {
|
|
|
|
|
|
+ if (this._checkOcclusionQuery()) {
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
var scene = this.getScene();
|
|
var scene = this.getScene();
|
|
@@ -62157,7 +62098,7 @@ var BABYLON;
|
|
_this._intersectionThreshold = 0.1;
|
|
_this._intersectionThreshold = 0.1;
|
|
var defines = [];
|
|
var defines = [];
|
|
var options = {
|
|
var options = {
|
|
- attributes: [BABYLON.VertexBuffer.PositionKind],
|
|
|
|
|
|
+ attributes: [BABYLON.VertexBuffer.PositionKind, "world0", "world1", "world2", "world3"],
|
|
uniforms: ["world", "viewProjection"],
|
|
uniforms: ["world", "viewProjection"],
|
|
needAlphaBlending: true,
|
|
needAlphaBlending: true,
|
|
defines: defines
|
|
defines: defines
|
|
@@ -62254,7 +62195,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
var engine = this.getScene().getEngine();
|
|
var engine = this.getScene().getEngine();
|
|
// Draw order
|
|
// Draw order
|
|
- engine.drawElementsType(BABYLON.Material.LineListDrawMode, subMesh.indexStart, subMesh.indexCount);
|
|
|
|
|
|
+ engine.drawElementsType(BABYLON.Material.LineListDrawMode, subMesh.indexStart, subMesh.indexCount, instancesCount);
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
LinesMesh.prototype.dispose = function (doNotRecurse) {
|
|
LinesMesh.prototype.dispose = function (doNotRecurse) {
|
|
@@ -113340,6 +113281,24 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
|
|
+ /** @hidden */
|
|
|
|
+ var _OcclusionDataStorage = /** @class */ (function () {
|
|
|
|
+ function _OcclusionDataStorage() {
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this.occlusionInternalRetryCounter = 0;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this.isOcclusionQueryInProgress = false;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this.isOccluded = false;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this.occlusionRetryCount = -1;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this.occlusionType = BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this.occlusionQueryAlgorithmType = BABYLON.AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
|
|
|
|
+ }
|
|
|
|
+ return _OcclusionDataStorage;
|
|
|
|
+ }());
|
|
BABYLON.Engine.prototype.createQuery = function () {
|
|
BABYLON.Engine.prototype.createQuery = function () {
|
|
return this._gl.createQuery();
|
|
return this._gl.createQuery();
|
|
};
|
|
};
|
|
@@ -113485,21 +113444,78 @@ var BABYLON;
|
|
BABYLON.Engine.prototype._getGlAlgorithmType = function (algorithmType) {
|
|
BABYLON.Engine.prototype._getGlAlgorithmType = function (algorithmType) {
|
|
return algorithmType === BABYLON.AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;
|
|
return algorithmType === BABYLON.AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;
|
|
};
|
|
};
|
|
|
|
+ Object.defineProperty(BABYLON.AbstractMesh.prototype, "isOcclusionQueryInProgress", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._occlusionDataStorage.isOcclusionQueryInProgress;
|
|
|
|
+ },
|
|
|
|
+ enumerable: false,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(BABYLON.AbstractMesh.prototype, "_occlusionDataStorage", {
|
|
|
|
+ get: function () {
|
|
|
|
+ if (!this.__occlusionDataStorage) {
|
|
|
|
+ this.__occlusionDataStorage = new _OcclusionDataStorage();
|
|
|
|
+ }
|
|
|
|
+ return this.__occlusionDataStorage;
|
|
|
|
+ },
|
|
|
|
+ enumerable: false,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(BABYLON.AbstractMesh.prototype, "isOccluded", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._occlusionDataStorage.isOccluded;
|
|
|
|
+ },
|
|
|
|
+ set: function (value) {
|
|
|
|
+ this._occlusionDataStorage.isOccluded = value;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(BABYLON.AbstractMesh.prototype, "occlusionQueryAlgorithmType", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._occlusionDataStorage.occlusionQueryAlgorithmType;
|
|
|
|
+ },
|
|
|
|
+ set: function (value) {
|
|
|
|
+ this._occlusionDataStorage.occlusionQueryAlgorithmType = value;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(BABYLON.AbstractMesh.prototype, "occlusionType", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._occlusionDataStorage.occlusionType;
|
|
|
|
+ },
|
|
|
|
+ set: function (value) {
|
|
|
|
+ this._occlusionDataStorage.occlusionType = value;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(BABYLON.AbstractMesh.prototype, "occlusionRetryCount", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._occlusionDataStorage.occlusionRetryCount;
|
|
|
|
+ },
|
|
|
|
+ set: function (value) {
|
|
|
|
+ this._occlusionDataStorage.occlusionRetryCount = value;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
// We also need to update AbstractMesh as there is a portion of the code there
|
|
// We also need to update AbstractMesh as there is a portion of the code there
|
|
BABYLON.AbstractMesh.prototype._checkOcclusionQuery = function () {
|
|
BABYLON.AbstractMesh.prototype._checkOcclusionQuery = function () {
|
|
var dataStorage = this._occlusionDataStorage;
|
|
var dataStorage = this._occlusionDataStorage;
|
|
- if (this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
|
|
|
|
|
|
+ if (dataStorage.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
|
|
dataStorage.isOccluded = false;
|
|
dataStorage.isOccluded = false;
|
|
- return;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
var engine = this.getEngine();
|
|
var engine = this.getEngine();
|
|
if (engine.webGLVersion < 2) {
|
|
if (engine.webGLVersion < 2) {
|
|
dataStorage.isOccluded = false;
|
|
dataStorage.isOccluded = false;
|
|
- return;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
|
|
if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
|
|
dataStorage.isOccluded = false;
|
|
dataStorage.isOccluded = false;
|
|
- return;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
if (this.isOcclusionQueryInProgress && this._occlusionQuery) {
|
|
if (this.isOcclusionQueryInProgress && this._occlusionQuery) {
|
|
var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);
|
|
var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);
|
|
@@ -113511,15 +113527,15 @@ var BABYLON;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
dataStorage.occlusionInternalRetryCounter++;
|
|
dataStorage.occlusionInternalRetryCounter++;
|
|
- if (this.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > this.occlusionRetryCount) {
|
|
|
|
|
|
+ if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {
|
|
dataStorage.isOcclusionQueryInProgress = false;
|
|
dataStorage.isOcclusionQueryInProgress = false;
|
|
dataStorage.occlusionInternalRetryCounter = 0;
|
|
dataStorage.occlusionInternalRetryCounter = 0;
|
|
// if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
|
|
// if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
|
|
// if strict continue the last state of the object.
|
|
// if strict continue the last state of the object.
|
|
- dataStorage.isOccluded = this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;
|
|
|
|
|
|
+ dataStorage.isOccluded = dataStorage.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- return;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -113529,11 +113545,12 @@ var BABYLON;
|
|
if (!this._occlusionQuery) {
|
|
if (!this._occlusionQuery) {
|
|
this._occlusionQuery = engine.createQuery();
|
|
this._occlusionQuery = engine.createQuery();
|
|
}
|
|
}
|
|
- engine.beginOcclusionQuery(this.occlusionQueryAlgorithmType, this._occlusionQuery);
|
|
|
|
|
|
+ engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery);
|
|
occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
|
|
occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
|
|
- engine.endOcclusionQuery(this.occlusionQueryAlgorithmType);
|
|
|
|
|
|
+ engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);
|
|
this._occlusionDataStorage.isOcclusionQueryInProgress = true;
|
|
this._occlusionDataStorage.isOcclusionQueryInProgress = true;
|
|
}
|
|
}
|
|
|
|
+ return dataStorage.isOccluded;
|
|
};
|
|
};
|
|
})(BABYLON || (BABYLON = {}));
|
|
})(BABYLON || (BABYLON = {}));
|
|
|
|
|