|
@@ -11700,8 +11700,8 @@ var BABYLON;
|
|
|
// establish the file extension, if possible
|
|
|
var lastDot = url.lastIndexOf('.');
|
|
|
var extension = (lastDot > 0) ? url.substring(lastDot).toLowerCase() : "";
|
|
|
- var isDDS = this.getCaps().s3tc && (extension === ".dds");
|
|
|
- var isTGA = (extension === ".tga");
|
|
|
+ var isDDS = this.getCaps().s3tc && (extension.indexOf(".dds") === 0);
|
|
|
+ var isTGA = (extension.indexOf(".tga") === 0);
|
|
|
// determine if a ktx file should be substituted
|
|
|
var isKTX = false;
|
|
|
if (this._textureFormatInUse && !isBase64 && !fallBack) {
|
|
@@ -15688,7 +15688,7 @@ var BABYLON;
|
|
|
_this._occlusionInternalRetryCounter = 0;
|
|
|
_this._isOccluded = false;
|
|
|
_this._isOcclusionQueryInProgress = false;
|
|
|
- _this.visibility = 1.0;
|
|
|
+ _this._visibility = 1.0;
|
|
|
_this.alphaIndex = Number.MAX_VALUE;
|
|
|
_this.isVisible = true;
|
|
|
_this.isPickable = true;
|
|
@@ -15923,6 +15923,26 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ Object.defineProperty(AbstractMesh.prototype, "visibility", {
|
|
|
+ /**
|
|
|
+ * Gets or sets mesh visibility between 0 and 1 (defult is 1)
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ return this._visibility;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * Gets or sets mesh visibility between 0 and 1 (defult is 1)
|
|
|
+ */
|
|
|
+ set: function (value) {
|
|
|
+ if (this._visibility === value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this._visibility = value;
|
|
|
+ this._markSubMeshesAsMiscDirty();
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
Object.defineProperty(AbstractMesh.prototype, "material", {
|
|
|
get: function () {
|
|
|
return this._material;
|
|
@@ -15970,6 +15990,7 @@ var BABYLON;
|
|
|
}
|
|
|
this._hasVertexAlpha = value;
|
|
|
this._markSubMeshesAsAttributesDirty();
|
|
|
+ this._markSubMeshesAsMiscDirty();
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -24606,7 +24627,7 @@ var BABYLON;
|
|
|
}
|
|
|
this._hasAlpha = value;
|
|
|
if (this._scene) {
|
|
|
- this._scene.markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag);
|
|
|
+ this._scene.markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag | BABYLON.Material.MiscDirtyFlag);
|
|
|
}
|
|
|
},
|
|
|
enumerable: true,
|
|
@@ -28933,7 +28954,7 @@ var BABYLON;
|
|
|
this.checkReadyOnEveryCall = false;
|
|
|
this.checkReadyOnlyOnce = false;
|
|
|
this.state = "";
|
|
|
- this.alpha = 1.0;
|
|
|
+ this._alpha = 1.0;
|
|
|
this._backFaceCulling = true;
|
|
|
this.doNotSerialize = false;
|
|
|
this.storeEffectOnSubMeshes = false;
|
|
@@ -29089,6 +29110,20 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ Object.defineProperty(Material.prototype, "alpha", {
|
|
|
+ get: function () {
|
|
|
+ return this._alpha;
|
|
|
+ },
|
|
|
+ set: function (value) {
|
|
|
+ if (this._alpha === value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this._alpha = value;
|
|
|
+ this.markAsDirty(Material.MiscDirtyFlag);
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
Object.defineProperty(Material.prototype, "backFaceCulling", {
|
|
|
get: function () {
|
|
|
return this._backFaceCulling;
|
|
@@ -29427,6 +29462,12 @@ var BABYLON;
|
|
|
Material.prototype._markAllSubMeshesAsFresnelDirty = function () {
|
|
|
this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsFresnelDirty(); });
|
|
|
};
|
|
|
+ Material.prototype._markAllSubMeshesAsFresnelAndMiscDirty = function () {
|
|
|
+ this._markAllSubMeshesAsDirty(function (defines) {
|
|
|
+ defines.markAsFresnelDirty();
|
|
|
+ defines.markAsMiscDirty();
|
|
|
+ });
|
|
|
+ };
|
|
|
Material.prototype._markAllSubMeshesAsLightsDirty = function () {
|
|
|
this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsLightDirty(); });
|
|
|
};
|
|
@@ -29436,6 +29477,12 @@ var BABYLON;
|
|
|
Material.prototype._markAllSubMeshesAsMiscDirty = function () {
|
|
|
this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsMiscDirty(); });
|
|
|
};
|
|
|
+ Material.prototype._markAllSubMeshesAsTexturesAndMiscDirty = function () {
|
|
|
+ this._markAllSubMeshesAsDirty(function (defines) {
|
|
|
+ defines.markAsTexturesDirty();
|
|
|
+ defines.markAsMiscDirty();
|
|
|
+ });
|
|
|
+ };
|
|
|
Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
|
|
|
// Animations
|
|
|
this.getScene().stopAnimation(this);
|
|
@@ -29549,8 +29596,8 @@ var BABYLON;
|
|
|
BABYLON.serialize()
|
|
|
], Material.prototype, "state", void 0);
|
|
|
__decorate([
|
|
|
- BABYLON.serialize()
|
|
|
- ], Material.prototype, "alpha", void 0);
|
|
|
+ BABYLON.serialize("alpha")
|
|
|
+ ], Material.prototype, "_alpha", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serialize("backFaceCulling")
|
|
|
], Material.prototype, "_backFaceCulling", void 0);
|
|
@@ -35886,32 +35933,39 @@ var BABYLON;
|
|
|
uniformBuffer.updateMatrix(key + "Matrix", matrix);
|
|
|
}
|
|
|
};
|
|
|
- MaterialHelper.PrepareDefinesForMisc = function (mesh, scene, useLogarithmicDepth, pointsCloud, fogEnabled, defines) {
|
|
|
+ /**
|
|
|
+ * Helper used to prepare the list of defines associated with misc. values for shader compilation
|
|
|
+ * @param mesh defines the current mesh
|
|
|
+ * @param scene defines the current scene
|
|
|
+ * @param useLogarithmicDepth defines if logarithmic depth has to be turned on
|
|
|
+ * @param pointsCloud defines if point cloud rendering has to be turned on
|
|
|
+ * @param fogEnabled defines if fog has to be turned on
|
|
|
+ * @param alphaTest defines if alpha testing has to be turned on
|
|
|
+ * @param defines defines the current list of defines
|
|
|
+ */
|
|
|
+ MaterialHelper.PrepareDefinesForMisc = function (mesh, scene, useLogarithmicDepth, pointsCloud, fogEnabled, alphaTest, defines) {
|
|
|
if (defines._areMiscDirty) {
|
|
|
defines["LOGARITHMICDEPTH"] = useLogarithmicDepth;
|
|
|
defines["POINTSIZE"] = (pointsCloud || scene.forcePointsCloud);
|
|
|
defines["FOG"] = (scene.fogEnabled && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && fogEnabled);
|
|
|
defines["NONUNIFORMSCALING"] = mesh.nonUniformScaling;
|
|
|
+ defines["ALPHATEST"] = alphaTest;
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
|
- * Helper used to prepare the list of defines for shader compilation
|
|
|
+ * Helper used to prepare the list of defines associated with frame values for shader compilation
|
|
|
* @param scene defines the current scene
|
|
|
* @param engine defines the current engine
|
|
|
* @param defines specifies the list of active defines
|
|
|
* @param useInstances defines if instances have to be turned on
|
|
|
* @param alphaTest defines if alpha testing has to be turned on
|
|
|
*/
|
|
|
- MaterialHelper.PrepareDefinesForFrameBoundValues = function (scene, engine, defines, useInstances, alphaTest) {
|
|
|
+ MaterialHelper.PrepareDefinesForFrameBoundValues = function (scene, engine, defines, useInstances) {
|
|
|
var changed = false;
|
|
|
if (defines["CLIPPLANE"] !== (scene.clipPlane !== undefined && scene.clipPlane !== null)) {
|
|
|
defines["CLIPPLANE"] = !defines["CLIPPLANE"];
|
|
|
changed = true;
|
|
|
}
|
|
|
- if (defines["ALPHATEST"] !== alphaTest) {
|
|
|
- defines["ALPHATEST"] = !defines["ALPHATEST"];
|
|
|
- changed = true;
|
|
|
- }
|
|
|
if (defines["DEPTHPREPASS"] !== !engine.getColorWrite()) {
|
|
|
defines["DEPTHPREPASS"] = !defines["DEPTHPREPASS"];
|
|
|
changed = true;
|
|
@@ -36887,11 +36941,11 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
// Misc.
|
|
|
- BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, defines);
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
|
|
|
// Attribs
|
|
|
BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true);
|
|
|
// Values that need to be evaluated on every frame
|
|
|
- BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances, this._shouldTurnAlphaTestOn(mesh));
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);
|
|
|
// Get correct effect
|
|
|
if (defines.isDirty) {
|
|
|
defines.markAsProcessed();
|
|
@@ -37543,7 +37597,7 @@ var BABYLON;
|
|
|
BABYLON.serializeAsTexture("diffuseTexture")
|
|
|
], StandardMaterial.prototype, "_diffuseTexture", void 0);
|
|
|
__decorate([
|
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
|
], StandardMaterial.prototype, "diffuseTexture", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serializeAsTexture("ambientTexture")
|
|
@@ -37555,7 +37609,7 @@ var BABYLON;
|
|
|
BABYLON.serializeAsTexture("opacityTexture")
|
|
|
], StandardMaterial.prototype, "_opacityTexture", void 0);
|
|
|
__decorate([
|
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
|
], StandardMaterial.prototype, "opacityTexture", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serializeAsTexture("reflectionTexture")
|
|
@@ -37687,7 +37741,7 @@ var BABYLON;
|
|
|
BABYLON.serializeAsFresnelParameters("opacityFresnelParameters")
|
|
|
], StandardMaterial.prototype, "_opacityFresnelParameters", void 0);
|
|
|
__decorate([
|
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsFresnelDirty")
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsFresnelAndMiscDirty")
|
|
|
], StandardMaterial.prototype, "opacityFresnelParameters", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serializeAsFresnelParameters("reflectionFresnelParameters")
|
|
@@ -38157,7 +38211,7 @@ var BABYLON;
|
|
|
}
|
|
|
this._transparencyMode = value;
|
|
|
this._forceAlphaTest = (value === BABYLON.PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND);
|
|
|
- this._markAllSubMeshesAsTexturesDirty();
|
|
|
+ this._markAllSubMeshesAsTexturesAndMiscDirty();
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -38484,9 +38538,9 @@ var BABYLON;
|
|
|
defines.RADIANCEOCCLUSION = this._useRadianceOcclusion;
|
|
|
defines.HORIZONOCCLUSION = this._useHorizonOcclusion;
|
|
|
// Misc.
|
|
|
- BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, defines);
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines);
|
|
|
// Values that need to be evaluated on every frame
|
|
|
- BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest);
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
|
|
|
// Attribs
|
|
|
if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE) && mesh) {
|
|
|
var bufferMesh = null;
|
|
@@ -39719,7 +39773,7 @@ var BABYLON;
|
|
|
], PBRMaterial.prototype, "ambientTextureStrength", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serializeAsTexture(),
|
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
|
], PBRMaterial.prototype, "opacityTexture", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serializeAsTexture(),
|
|
@@ -39803,15 +39857,15 @@ var BABYLON;
|
|
|
], PBRMaterial.prototype, "useLightmapAsShadowmap", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serialize(),
|
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
|
], PBRMaterial.prototype, "useAlphaFromAlbedoTexture", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serialize(),
|
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
|
], PBRMaterial.prototype, "forceAlphaTest", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serialize(),
|
|
|
- BABYLON.expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
+ BABYLON.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")
|
|
|
], PBRMaterial.prototype, "alphaCutOff", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serialize(),
|
|
@@ -58847,7 +58901,7 @@ var BABYLON;
|
|
|
return;
|
|
|
}
|
|
|
this._isEnabled = value;
|
|
|
- BABYLON.Engine.MarkAllMaterialsAsDirty(BABYLON.Material.FresnelDirtyFlag);
|
|
|
+ BABYLON.Engine.MarkAllMaterialsAsDirty(BABYLON.Material.FresnelDirtyFlag | BABYLON.Material.MiscDirtyFlag);
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -77065,9 +77119,8 @@ var BABYLON;
|
|
|
if (this._teleportationInitialized && this._isTeleportationFloor(hit.pickedMesh) && hit.pickedPoint) {
|
|
|
// Moving the teleportation area to this targetted point
|
|
|
//Raise onSelectedMeshUnselected observable if ray collided floor mesh/meshes and a non floor mesh was previously selected
|
|
|
- if (this._currentMeshSelected &&
|
|
|
- !this._isTeleportationFloor(this._currentMeshSelected)) {
|
|
|
- this.onSelectedMeshUnselected.notifyObservers(this._currentMeshSelected);
|
|
|
+ if (this._currentMeshSelected && !this._isTeleportationFloor(this._currentMeshSelected)) {
|
|
|
+ this._notifySelectedMeshUnselected();
|
|
|
}
|
|
|
this._currentMeshSelected = null;
|
|
|
this._moveTeleportationSelectorTo(hit);
|
|
@@ -77098,9 +77151,7 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- if (this._currentMeshSelected) {
|
|
|
- this.onSelectedMeshUnselected.notifyObservers(this._currentMeshSelected);
|
|
|
- }
|
|
|
+ this._notifySelectedMeshUnselected();
|
|
|
this._currentMeshSelected = null;
|
|
|
this.changeGazeColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
|
this.changeLaserColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
@@ -77109,6 +77160,7 @@ var BABYLON;
|
|
|
}
|
|
|
else {
|
|
|
this._currentHit = null;
|
|
|
+ this._notifySelectedMeshUnselected();
|
|
|
this._currentMeshSelected = null;
|
|
|
this._teleportationAllowed = false;
|
|
|
this._hideTeleportationTarget();
|
|
@@ -77116,6 +77168,11 @@ var BABYLON;
|
|
|
this.changeLaserColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
|
}
|
|
|
};
|
|
|
+ VRExperienceHelper.prototype._notifySelectedMeshUnselected = function () {
|
|
|
+ if (this._currentMeshSelected) {
|
|
|
+ this.onSelectedMeshUnselected.notifyObservers(this._currentMeshSelected);
|
|
|
+ }
|
|
|
+ };
|
|
|
/**
|
|
|
* Sets the color of the laser ray from the vr controllers.
|
|
|
* @param color new color for the ray.
|
|
@@ -83633,9 +83690,9 @@ var BABYLON;
|
|
|
this._imageProcessingConfiguration.prepareDefines(defines);
|
|
|
}
|
|
|
// Misc.
|
|
|
- BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, defines);
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
|
|
|
// Values that need to be evaluated on every frame
|
|
|
- BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances, this._shouldTurnAlphaTestOn(mesh));
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);
|
|
|
// Attribs
|
|
|
if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true, false)) {
|
|
|
if (mesh) {
|
|
@@ -84628,7 +84685,7 @@ var BABYLON;
|
|
|
defines.PREMULTIPLYALPHA = !defines.PREMULTIPLYALPHA;
|
|
|
defines.markAsUnprocessed();
|
|
|
}
|
|
|
- BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, false, this.fogEnabled, defines);
|
|
|
+ BABYLON.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, false, this.fogEnabled, false, defines);
|
|
|
// Get correct effect
|
|
|
if (defines.isDirty) {
|
|
|
defines.markAsProcessed();
|