Skip to content

Commit

Permalink
fix: irisdescence value
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhhkrx committed Nov 19, 2024
1 parent 9fb543f commit 647b8a9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/material/PBRMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,16 @@ export class PBRMaterial extends PBRBaseMaterial {
}

Check warning on line 145 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L144-L145

Added lines #L144 - L145 were not covered by tests

set iridescence(value: number) {
value = Math.max(0, Math.min(1, value));
const iridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceInfoProp);
if (!!iridescenceInfo.x !== !!value) {
if (value === 0) {
this.shaderData.disableMacro("MATERIAL_ENABLE_IRIDESCENCE");
} else {
this.shaderData.enableMacro("MATERIAL_ENABLE_IRIDESCENCE");
}
iridescenceInfo.x = value;
}
iridescenceInfo.x = value;
}

Check warning on line 158 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L148-L158

Added lines #L148 - L158 were not covered by tests

/**
Expand All @@ -166,7 +167,7 @@ export class PBRMaterial extends PBRBaseMaterial {

set iridescenceIor(value: number) {
const iridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceInfoProp);
iridescenceInfo.y = value;
iridescenceInfo.y = Math.max(value, 1.0);
}

Check warning on line 171 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L169-L171

Added lines #L169 - L171 were not covered by tests

/**
Expand Down

0 comments on commit 647b8a9

Please sign in to comment.