|
@@ -64,7 +64,7 @@ var BABYLON = BABYLON || {};
|
|
|
|
|
|
// Textures
|
|
|
if (this._scene.texturesEnabled) {
|
|
|
- if (this.diffuseTexture && BABYLON.StandardMaterial.diffuseTextureEnabled) {
|
|
|
+ if (this.diffuseTexture && BABYLON.StandardMaterial.DiffuseTextureEnabled) {
|
|
|
if (!this.diffuseTexture.isReady()) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -72,7 +72,7 @@ var BABYLON = BABYLON || {};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.ambientTexture && BABYLON.StandardMaterial.ambientTextureEnabled) {
|
|
|
+ if (this.ambientTexture && BABYLON.StandardMaterial.AmbientTextureEnabled) {
|
|
|
if (!this.ambientTexture.isReady()) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -80,7 +80,7 @@ var BABYLON = BABYLON || {};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.opacityTexture && BABYLON.StandardMaterial.opacityTextureEnabled) {
|
|
|
+ if (this.opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
|
|
|
if (!this.opacityTexture.isReady()) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -88,7 +88,7 @@ var BABYLON = BABYLON || {};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.reflectionTexture && BABYLON.StandardMaterial.reflectionTextureEnabled) {
|
|
|
+ if (this.reflectionTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
|
|
|
if (!this.reflectionTexture.isReady()) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -96,7 +96,7 @@ var BABYLON = BABYLON || {};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.emissiveTexture && BABYLON.StandardMaterial.emissiveTextureEnabled) {
|
|
|
+ if (this.emissiveTexture && BABYLON.StandardMaterial.EmissiveTextureEnabled) {
|
|
|
if (!this.emissiveTexture.isReady()) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -104,7 +104,7 @@ var BABYLON = BABYLON || {};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.specularTexture && BABYLON.StandardMaterial.specularTextureEnabled) {
|
|
|
+ if (this.specularTexture && BABYLON.StandardMaterial.SpecularTextureEnabled) {
|
|
|
if (!this.specularTexture.isReady()) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -114,7 +114,7 @@ var BABYLON = BABYLON || {};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this._scene.getEngine().getCaps().standardDerivatives && this.bumpTexture && BABYLON.StandardMaterial.bumpTextureEnabled) {
|
|
|
+ if (this._scene.getEngine().getCaps().standardDerivatives && this.bumpTexture && BABYLON.StandardMaterial.BumpTextureEnabled) {
|
|
|
if (!this.bumpTexture.isReady()) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -290,7 +290,7 @@ var BABYLON = BABYLON || {};
|
|
|
}
|
|
|
|
|
|
// Textures
|
|
|
- if (this.diffuseTexture) {
|
|
|
+ if (this.diffuseTexture && BABYLON.StandardMaterial.DiffuseTextureEnabled) {
|
|
|
this._effect.setTexture("diffuseSampler", this.diffuseTexture);
|
|
|
|
|
|
this._effect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
|
|
@@ -299,21 +299,21 @@ var BABYLON = BABYLON || {};
|
|
|
this._baseColor.copyFromFloats(1, 1, 1);
|
|
|
}
|
|
|
|
|
|
- if (this.ambientTexture) {
|
|
|
+ if (this.ambientTexture && BABYLON.StandardMaterial.AmbientTextureEnabled) {
|
|
|
this._effect.setTexture("ambientSampler", this.ambientTexture);
|
|
|
|
|
|
this._effect.setFloat2("vAmbientInfos", this.ambientTexture.coordinatesIndex, this.ambientTexture.level);
|
|
|
this._effect.setMatrix("ambientMatrix", this.ambientTexture._computeTextureMatrix());
|
|
|
}
|
|
|
|
|
|
- if (this.opacityTexture) {
|
|
|
+ if (this.opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
|
|
|
this._effect.setTexture("opacitySampler", this.opacityTexture);
|
|
|
|
|
|
this._effect.setFloat2("vOpacityInfos", this.opacityTexture.coordinatesIndex, this.opacityTexture.level);
|
|
|
this._effect.setMatrix("opacityMatrix", this.opacityTexture._computeTextureMatrix());
|
|
|
}
|
|
|
|
|
|
- if (this.reflectionTexture) {
|
|
|
+ if (this.reflectionTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
|
|
|
if (this.reflectionTexture.isCube) {
|
|
|
this._effect.setTexture("reflectionCubeSampler", this.reflectionTexture);
|
|
|
} else {
|
|
@@ -324,21 +324,21 @@ var BABYLON = BABYLON || {};
|
|
|
this._effect.setFloat3("vReflectionInfos", this.reflectionTexture.coordinatesMode, this.reflectionTexture.level, this.reflectionTexture.isCube ? 1 : 0);
|
|
|
}
|
|
|
|
|
|
- if (this.emissiveTexture) {
|
|
|
+ if (this.emissiveTexture && BABYLON.StandardMaterial.EmissiveTextureEnabled) {
|
|
|
this._effect.setTexture("emissiveSampler", this.emissiveTexture);
|
|
|
|
|
|
this._effect.setFloat2("vEmissiveInfos", this.emissiveTexture.coordinatesIndex, this.emissiveTexture.level);
|
|
|
this._effect.setMatrix("emissiveMatrix", this.emissiveTexture._computeTextureMatrix());
|
|
|
}
|
|
|
|
|
|
- if (this.specularTexture) {
|
|
|
+ if (this.specularTexture && BABYLON.StandardMaterial.SpecularTextureEnabled) {
|
|
|
this._effect.setTexture("specularSampler", this.specularTexture);
|
|
|
|
|
|
this._effect.setFloat2("vSpecularInfos", this.specularTexture.coordinatesIndex, this.specularTexture.level);
|
|
|
this._effect.setMatrix("specularMatrix", this.specularTexture._computeTextureMatrix());
|
|
|
}
|
|
|
|
|
|
- if (this.bumpTexture && this._scene.getEngine().getCaps().standardDerivatives) {
|
|
|
+ if (this.bumpTexture && this._scene.getEngine().getCaps().standardDerivatives && BABYLON.StandardMaterial.BumpTextureEnabled) {
|
|
|
this._effect.setTexture("bumpSampler", this.bumpTexture);
|
|
|
|
|
|
this._effect.setFloat2("vBumpInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
|
|
@@ -525,13 +525,15 @@ var BABYLON = BABYLON || {};
|
|
|
return newStandardMaterial;
|
|
|
};
|
|
|
|
|
|
+ // Statics
|
|
|
+
|
|
|
// Flags used to enable or disable a type of texture for all Standard Materials
|
|
|
- BABYLON.StandardMaterial.diffuseTextureEnabled = true;
|
|
|
- BABYLON.StandardMaterial.ambientTextureEnabled = true;
|
|
|
- BABYLON.StandardMaterial.opacityTextureEnabled = true;
|
|
|
- BABYLON.StandardMaterial.reflectionTextureEnabled = true;
|
|
|
- BABYLON.StandardMaterial.emissiveTextureEnabled = true;
|
|
|
- BABYLON.StandardMaterial.specularTextureEnabled = true;
|
|
|
- BABYLON.StandardMaterial.bumpTextureEnabled = true;
|
|
|
+ BABYLON.StandardMaterial.DiffuseTextureEnabled = true;
|
|
|
+ BABYLON.StandardMaterial.AmbientTextureEnabled = true;
|
|
|
+ BABYLON.StandardMaterial.OpacityTextureEnabled = true;
|
|
|
+ BABYLON.StandardMaterial.ReflectionTextureEnabled = true;
|
|
|
+ BABYLON.StandardMaterial.EmissiveTextureEnabled = true;
|
|
|
+ BABYLON.StandardMaterial.SpecularTextureEnabled = true;
|
|
|
+ BABYLON.StandardMaterial.BumpTextureEnabled = true;
|
|
|
|
|
|
})();
|