|
@@ -75,8 +75,6 @@ var BABYLON;
|
|
_this.REFRACTION = false;
|
|
_this.REFRACTION = false;
|
|
_this.REFRACTIONMAP_3D = false;
|
|
_this.REFRACTIONMAP_3D = false;
|
|
_this.REFLECTIONOVERALPHA = false;
|
|
_this.REFLECTIONOVERALPHA = false;
|
|
- _this.INVERTNORMALMAPX = false;
|
|
|
|
- _this.INVERTNORMALMAPY = false;
|
|
|
|
_this.TWOSIDEDLIGHTING = false;
|
|
_this.TWOSIDEDLIGHTING = false;
|
|
_this.SHADOWFLOAT = false;
|
|
_this.SHADOWFLOAT = false;
|
|
_this.MORPHTARGETS = false;
|
|
_this.MORPHTARGETS = false;
|
|
@@ -498,8 +496,6 @@ var BABYLON;
|
|
else {
|
|
else {
|
|
defines._needUVs = true;
|
|
defines._needUVs = true;
|
|
defines.BUMP = true;
|
|
defines.BUMP = true;
|
|
- defines.INVERTNORMALMAPX = this.invertNormalMapX;
|
|
|
|
- defines.INVERTNORMALMAPY = this.invertNormalMapY;
|
|
|
|
defines.PARALLAX = this._useParallax;
|
|
defines.PARALLAX = this._useParallax;
|
|
defines.PARALLAXOCCLUSION = this._useParallaxOcclusion;
|
|
defines.PARALLAXOCCLUSION = this._useParallaxOcclusion;
|
|
}
|
|
}
|
|
@@ -569,11 +565,6 @@ var BABYLON;
|
|
BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true);
|
|
BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true);
|
|
// Values that need to be evaluated on every frame
|
|
// Values that need to be evaluated on every frame
|
|
BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);
|
|
BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances);
|
|
- if (scene._mirroredCameraPosition && defines.BUMP) {
|
|
|
|
- defines.INVERTNORMALMAPX = !this.invertNormalMapX;
|
|
|
|
- defines.INVERTNORMALMAPY = !this.invertNormalMapY;
|
|
|
|
- defines.markAsUnprocessed();
|
|
|
|
- }
|
|
|
|
// Get correct effect
|
|
// Get correct effect
|
|
if (defines.isDirty) {
|
|
if (defines.isDirty) {
|
|
defines.markAsProcessed();
|
|
defines.markAsProcessed();
|
|
@@ -650,7 +641,7 @@ var BABYLON;
|
|
"mBones",
|
|
"mBones",
|
|
"vClipPlane", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "lightmapMatrix", "refractionMatrix",
|
|
"vClipPlane", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "lightmapMatrix", "refractionMatrix",
|
|
"diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor", "refractionLeftColor", "refractionRightColor",
|
|
"diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor", "refractionLeftColor", "refractionRightColor",
|
|
- "logarithmicDepthConstant"
|
|
|
|
|
|
+ "logarithmicDepthConstant", "vNormalReoderParams"
|
|
];
|
|
];
|
|
var samplers = ["diffuseSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "specularSampler", "bumpSampler", "lightmapSampler", "refractionCubeSampler", "refraction2DSampler"];
|
|
var samplers = ["diffuseSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "specularSampler", "bumpSampler", "lightmapSampler", "refractionCubeSampler", "refraction2DSampler"];
|
|
var uniformBuffers = ["Material", "Scene"];
|
|
var uniformBuffers = ["Material", "Scene"];
|
|
@@ -714,6 +705,7 @@ var BABYLON;
|
|
this._uniformBuffer.addUniform("lightmapMatrix", 16);
|
|
this._uniformBuffer.addUniform("lightmapMatrix", 16);
|
|
this._uniformBuffer.addUniform("specularMatrix", 16);
|
|
this._uniformBuffer.addUniform("specularMatrix", 16);
|
|
this._uniformBuffer.addUniform("bumpMatrix", 16);
|
|
this._uniformBuffer.addUniform("bumpMatrix", 16);
|
|
|
|
+ this._uniformBuffer.addUniform("vNormalReoderParams", 4);
|
|
this._uniformBuffer.addUniform("refractionMatrix", 16);
|
|
this._uniformBuffer.addUniform("refractionMatrix", 16);
|
|
this._uniformBuffer.addUniform("vRefractionInfos", 4);
|
|
this._uniformBuffer.addUniform("vRefractionInfos", 4);
|
|
this._uniformBuffer.addUniform("vSpecularColor", 4);
|
|
this._uniformBuffer.addUniform("vSpecularColor", 4);
|
|
@@ -804,6 +796,12 @@ var BABYLON;
|
|
if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial_OldVer.BumpTextureEnabled) {
|
|
if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial_OldVer.BumpTextureEnabled) {
|
|
this._uniformBuffer.updateFloat3("vBumpInfos", this._bumpTexture.coordinatesIndex, 1.0 / this._bumpTexture.level, this.parallaxScaleBias);
|
|
this._uniformBuffer.updateFloat3("vBumpInfos", this._bumpTexture.coordinatesIndex, 1.0 / this._bumpTexture.level, this.parallaxScaleBias);
|
|
this._uniformBuffer.updateMatrix("bumpMatrix", this._bumpTexture.getTextureMatrix());
|
|
this._uniformBuffer.updateMatrix("bumpMatrix", this._bumpTexture.getTextureMatrix());
|
|
|
|
+ if (scene._mirroredCameraPosition) {
|
|
|
|
+ this._uniformBuffer.updateFloat4("vNormalReoderParams", this.invertNormalMapX ? 0 : 1.0, this.invertNormalMapX ? 1.0 : -1.0, this.invertNormalMapY ? 0 : 1.0, this.invertNormalMapY ? 1.0 : -1.0);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this._uniformBuffer.updateFloat4("vNormalReoderParams", this.invertNormalMapX ? 1.0 : 0, this.invertNormalMapX ? -1.0 : 1.0, this.invertNormalMapY ? 1.0 : 0, this.invertNormalMapY ? -1.0 : 1.0);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (this._refractionTexture && StandardMaterial_OldVer.RefractionTextureEnabled) {
|
|
if (this._refractionTexture && StandardMaterial_OldVer.RefractionTextureEnabled) {
|
|
var depth = 1.0;
|
|
var depth = 1.0;
|