Skip to content

Commit

Permalink
fix: constrain min shininess to 1e-4 (#749)
Browse files Browse the repository at this point in the history
* fix: constrain min shininess  to `1e-4`
  • Loading branch information
susiwen8 authored Apr 22, 2022
1 parent f077f1b commit e528ee3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/material/BlinnPhongMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class BlinnPhongMaterial extends BaseMaterial {
}

set shininess(value: number) {
this.shaderData.setFloat(BlinnPhongMaterial._shininessProp, value);
this.shaderData.setFloat(BlinnPhongMaterial._shininessProp, Math.max(value, 1e-4));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/core/tests/material/BlinnPhongMaterial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ describe("BlinnPhongMaterial", () => {
material.specularTexture = null;
material.emissiveTexture = null;
material.normalTexture = null;
material.shininess = 0;

expect(material.baseTexture).toBeNull();
expect(material.specularTexture).toBeNull();
expect(material.emissiveTexture).toBeNull();
expect(material.normalTexture).toBeNull();
expect(material.shininess).toBe(1e-4);
});

it("clone", () => {
Expand Down

0 comments on commit e528ee3

Please sign in to comment.