Webgl buffer / add utility getSize function

Saves checking whether the buffer was initialized with
an array already
This commit is contained in:
Olivier Guyot
2019-08-30 10:38:02 +02:00
parent e57e660819
commit c48350b666
3 changed files with 28 additions and 2 deletions

View File

@@ -344,7 +344,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
* @inheritDoc
*/
renderFrame(frameState) {
const renderCount = this.indicesBuffer_.getArray() ? this.indicesBuffer_.getArray().length : 0;
const renderCount = this.indicesBuffer_.getSize();
this.helper.drawElements(0, renderCount);
this.helper.finalizeDraw(frameState);
const canvas = this.helper.getCanvas();
@@ -561,7 +561,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
this.helper.enableAttributeArray(DefaultAttrib.ROTATE_WITH_VIEW, 1, FLOAT, bytesPerFloat * stride, bytesPerFloat * 7);
this.helper.enableAttributeArray(DefaultAttrib.COLOR, 4, FLOAT, bytesPerFloat * stride, bytesPerFloat * 8);
const renderCount = this.indicesBuffer_.getArray() ? this.indicesBuffer_.getArray().length : 0;
const renderCount = this.indicesBuffer_.getSize();
this.helper.drawElements(0, renderCount);
}
}