|
@@ -48,6 +48,7 @@ module BABYLON {
|
|
public REFLECTIONFRESNELFROMSPECULAR = false;
|
|
public REFLECTIONFRESNELFROMSPECULAR = false;
|
|
public LIGHTMAP = false;
|
|
public LIGHTMAP = false;
|
|
public LIGHTMAPDIRECTUV = 0;
|
|
public LIGHTMAPDIRECTUV = 0;
|
|
|
|
+ public OBJECTSPACE_NORMALMAP = false;
|
|
public USELIGHTMAPASSHADOWMAP = false;
|
|
public USELIGHTMAPASSHADOWMAP = false;
|
|
public REFLECTIONMAP_3D = false;
|
|
public REFLECTIONMAP_3D = false;
|
|
public REFLECTIONMAP_SPHERICAL = false;
|
|
public REFLECTIONMAP_SPHERICAL = false;
|
|
@@ -198,6 +199,14 @@ module BABYLON {
|
|
@expandToProperty("_markAllSubMeshesAsLightsDirty")
|
|
@expandToProperty("_markAllSubMeshesAsLightsDirty")
|
|
public disableLighting: boolean;
|
|
public disableLighting: boolean;
|
|
|
|
|
|
|
|
+ @serialize("useObjectSpaceNormalMap")
|
|
|
|
+ private _useObjectSpaceNormalMap = false;
|
|
|
|
+ @expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
|
|
+ /**
|
|
|
|
+ * Allows using an object space normal map (instead of tangent space).
|
|
|
|
+ */
|
|
|
|
+ public useObjectSpaceNormalMap: boolean;
|
|
|
|
+
|
|
@serialize("useParallax")
|
|
@serialize("useParallax")
|
|
private _useParallax = false;
|
|
private _useParallax = false;
|
|
@expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
@expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
@@ -667,6 +676,8 @@ module BABYLON {
|
|
defines.PARALLAX = this._useParallax;
|
|
defines.PARALLAX = this._useParallax;
|
|
defines.PARALLAXOCCLUSION = this._useParallaxOcclusion;
|
|
defines.PARALLAXOCCLUSION = this._useParallaxOcclusion;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;
|
|
} else {
|
|
} else {
|
|
defines.BUMP = false;
|
|
defines.BUMP = false;
|
|
}
|
|
}
|
|
@@ -849,7 +860,7 @@ module BABYLON {
|
|
"vFogInfos", "vFogColor", "pointSize",
|
|
"vFogInfos", "vFogColor", "pointSize",
|
|
"vDiffuseInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vSpecularInfos", "vBumpInfos", "vLightmapInfos", "vRefractionInfos",
|
|
"vDiffuseInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vSpecularInfos", "vBumpInfos", "vLightmapInfos", "vRefractionInfos",
|
|
"mBones",
|
|
"mBones",
|
|
- "vClipPlane", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "lightmapMatrix", "refractionMatrix",
|
|
|
|
|
|
+ "vClipPlane", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "normalMatrix", "lightmapMatrix", "refractionMatrix",
|
|
"diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor", "refractionLeftColor", "refractionRightColor",
|
|
"diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor", "refractionLeftColor", "refractionRightColor",
|
|
"vReflectionPosition", "vReflectionSize",
|
|
"vReflectionPosition", "vReflectionSize",
|
|
"logarithmicDepthConstant", "vTangentSpaceParams"
|
|
"logarithmicDepthConstant", "vTangentSpaceParams"
|
|
@@ -973,6 +984,13 @@ module BABYLON {
|
|
// Matrices
|
|
// Matrices
|
|
this.bindOnlyWorldMatrix(world);
|
|
this.bindOnlyWorldMatrix(world);
|
|
|
|
|
|
|
|
+ // Normal Matrix
|
|
|
|
+ if (defines.OBJECTSPACE_NORMALMAP)
|
|
|
|
+ {
|
|
|
|
+ world.toNormalMatrix(this._normalMatrix);
|
|
|
|
+ this.bindOnlyNormalMatrix(this._normalMatrix);
|
|
|
|
+ }
|
|
|
|
+
|
|
let mustRebind = this._mustRebind(scene, effect, mesh.visibility);
|
|
let mustRebind = this._mustRebind(scene, effect, mesh.visibility);
|
|
|
|
|
|
// Bones
|
|
// Bones
|
|
@@ -1160,7 +1178,7 @@ module BABYLON {
|
|
// View
|
|
// View
|
|
if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE || this._reflectionTexture || this._refractionTexture) {
|
|
if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE || this._reflectionTexture || this._refractionTexture) {
|
|
this.bindView(effect);
|
|
this.bindView(effect);
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
// Fog
|
|
// Fog
|
|
MaterialHelper.BindFogParameters(scene, mesh, effect);
|
|
MaterialHelper.BindFogParameters(scene, mesh, effect);
|