Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/effects/DotScreenEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ export class DotScreenEffect extends Effect {

get angle() {

return Math.acos(this.uniforms.get("angle").value.y);
return this._angle;

}

set angle(value) {

this.uniforms.get("angle").value.set(Math.sin(value), Math.cos(value));
this._angle = value;

}

Expand Down
4 changes: 2 additions & 2 deletions src/effects/HueSaturationEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ export class HueSaturationEffect extends Effect {

get hue() {

const hue = this.uniforms.get("hue").value;
return Math.acos((hue.x * 3.0 - 1.0) / 2.0);
return this._hue;

}

Expand All @@ -101,6 +100,7 @@ export class HueSaturationEffect extends Effect {
(-Math.sqrt(3.0) * s - c + 1.0) / 3.0,
(Math.sqrt(3.0) * s - c + 1.0) / 3.0
);
this._hue = value;

}

Expand Down
3 changes: 2 additions & 1 deletion src/effects/TiltShiftEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,15 @@ export class TiltShiftEffect extends Effect {

get rotation() {

return Math.acos(this.uniforms.get("rotation").value.x);
return this._rotation;

}

set rotation(value) {

this.uniforms.get("rotation").value.set(Math.cos(value), Math.sin(value));
this.blurPass.blurMaterial.rotation = value;
this._rotation = value;

}

Expand Down
3 changes: 2 additions & 1 deletion src/materials/TiltShiftBlurMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ export class TiltShiftBlurMaterial extends KawaseBlurMaterial {

get rotation() {

return Math.acos(this.uniforms.rotation.value.x);
return this._rotation;

}

set rotation(value) {

this.uniforms.rotation.value.set(Math.cos(value), Math.sin(value));
this._rotation = value;

}

Expand Down
15 changes: 15 additions & 0 deletions test/effects/DotScreenEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,18 @@ test("can be created and destroyed", t => {
t.pass();

});

test("returns the angle it was set to, including negative angles", t => {

const object = new DotScreenEffect();

for(const value of [-2.5, -0.5, 0, 0.5, 2.5]) {

object.angle = value;
t.true(Math.abs(object.angle - value) < 1e-6, `set ${value}, got ${object.angle}`);

}

object.dispose();

});
15 changes: 15 additions & 0 deletions test/effects/HueSaturationEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,18 @@ test("can be created and destroyed", t => {
t.pass();

});

test("returns the hue it was set to, including negative angles", t => {

const object = new HueSaturationEffect();

for(const value of [-2.5, -0.5, 0, 0.5, 2.5]) {

object.hue = value;
t.true(Math.abs(object.hue - value) < 1e-6, `set ${value}, got ${object.hue}`);

}

object.dispose();

});
15 changes: 15 additions & 0 deletions test/effects/TiltShiftEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,18 @@ test("can be created and destroyed", t => {
t.pass();

});

test("returns the rotation it was set to, including negative angles", t => {

const object = new TiltShiftEffect();

for(const value of [-2.5, -0.5, 0, 0.5, 2.5]) {

object.rotation = value;
t.true(Math.abs(object.rotation - value) < 1e-6, `set ${value}, got ${object.rotation}`);

}

object.dispose();

});
15 changes: 15 additions & 0 deletions test/materials/TiltShiftBlurMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@ test("can be created", t => {
t.truthy(new TiltShiftBlurMaterial());

});

test("returns the rotation it was set to, including negative angles", t => {

const object = new TiltShiftBlurMaterial();

for(const value of [-2.5, -0.5, 0, 0.5, 2.5]) {

object.rotation = value;
t.true(Math.abs(object.rotation - value) < 1e-6, `set ${value}, got ${object.rotation}`);

}

object.dispose();

});