Skip to content

Commit

Permalink
Set far/near to proper values to hide the fog on component removal (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarcos authored and ngokevin committed Feb 6, 2017
1 parent ff16173 commit 6f6d74a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 80 deletions.
73 changes: 0 additions & 73 deletions src/components/fog.js

This file was deleted.

8 changes: 3 additions & 5 deletions src/components/scene/fog.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ module.exports.Component = register('fog', {
*/
remove: function () {
var fog = this.el.object3D.fog;
if (fog) {
fog.density = 0;
fog.far = 0;
fog.near = 0;
}
if (!fog) { return; }
fog.far = 0;
fog.near = 0.1;
}
});

Expand Down
5 changes: 3 additions & 2 deletions tests/components/scene/fog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ suite('fog', function () {
var el = this.el;
el.removeAttribute('fog');
assert.equal(el.object3D.fog.far, 0);
assert.equal(el.object3D.fog.near, 0);
assert.equal(el.object3D.fog.near, 0.1);
});

test('removes exp. fog when detaching fog', function () {
var el = this.el;
el.setAttribute('fog', 'type: exponential');
el.removeAttribute('fog');
assert.equal(el.object3D.fog.density, 0);
assert.equal(el.object3D.fog.far, 0);
assert.equal(el.object3D.fog.near, 0.1);
});
});
});

0 comments on commit 6f6d74a

Please sign in to comment.