WebGL points / rebuild buffers only when extent changed

This commit is contained in:
Olivier Guyot
2019-05-14 15:18:42 +02:00
parent 523097903a
commit 75eb62363a
2 changed files with 20 additions and 1 deletions

View File

@@ -107,6 +107,7 @@ describe('ol.renderer.webgl.PointsLayer', function() {
it('rebuilds the buffers only when not interacting or animating', function() {
const spy = sinon.spy(renderer, 'rebuildBuffers_');
frameState.viewHints[ViewHint.INTERACTING] = 1;
frameState.viewHints[ViewHint.ANIMATING] = 0;
renderer.prepareFrame(frameState);
@@ -123,6 +124,19 @@ describe('ol.renderer.webgl.PointsLayer', function() {
expect(spy.called).to.be(true);
});
it('rebuilds the buffers only when the frame extent changed', function() {
const spy = sinon.spy(renderer, 'rebuildBuffers_');
renderer.prepareFrame(frameState);
expect(spy.callCount).to.be(1);
renderer.prepareFrame(frameState);
expect(spy.callCount).to.be(1);
frameState.extent = [10, 20, 30, 40];
renderer.prepareFrame(frameState);
expect(spy.callCount).to.be(2);
});
});
});