浏览代码

ClearCoat Fix

sebavan 6 年之前
父节点
当前提交
cc135712eb
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/Materials/PBR/pbrClearCoatConfiguration.ts

+ 5 - 3
src/Materials/PBR/pbrClearCoatConfiguration.ts

@@ -29,10 +29,12 @@ export interface IMaterialClearCoatDefines {
  */
  */
 export class PBRClearCoatConfiguration {
 export class PBRClearCoatConfiguration {
 
 
+    @serialize()
+    private _isEnabled = false;
     /**
     /**
      * Defines if the clear coat is enabled in the material.
      * Defines if the clear coat is enabled in the material.
      */
      */
-    @serialize()
+    @expandToProperty("_markAllSubMeshesAsTexturesDirty")
     public isEnabled = false;
     public isEnabled = false;
 
 
     /**
     /**
@@ -114,7 +116,7 @@ export class PBRClearCoatConfiguration {
      * @param scene defines the scene to the material belongs to.
      * @param scene defines the scene to the material belongs to.
      */
      */
     public prepareDefines(defines: IMaterialClearCoatDefines, scene: Scene): void {
     public prepareDefines(defines: IMaterialClearCoatDefines, scene: Scene): void {
-        if (this.isEnabled) {
+        if (this._isEnabled) {
             defines.CLEARCOAT = true;
             defines.CLEARCOAT = true;
 
 
             if (defines._areTexturesDirty) {
             if (defines._areTexturesDirty) {
@@ -158,7 +160,7 @@ export class PBRClearCoatConfiguration {
             }
             }
 
 
             if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatTextureEnabled && !disableBumpMap) {
             if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatTextureEnabled && !disableBumpMap) {
-                uniformBuffer.updateFloat2("vClearCoatBumpInfos", this._bumpTexture.coordinatesIndex, 1.0 / this._bumpTexture.level);
+                uniformBuffer.updateFloat2("vClearCoatBumpInfos", this._bumpTexture.coordinatesIndex, this._bumpTexture.level);
                 MaterialHelper.BindTextureMatrix(this._bumpTexture, uniformBuffer, "clearCoatBump");
                 MaterialHelper.BindTextureMatrix(this._bumpTexture, uniformBuffer, "clearCoatBump");
 
 
                 if (scene._mirroredCameraPosition) {
                 if (scene._mirroredCameraPosition) {