@@ -68,9 +68,9 @@ export const Attributes = {
6868
6969/**
7070 * @typedef {Object } WebGLBuffers
71- * @property {WebGLArrayBufferSet } polygonBuffers Array containing indices and vertices buffers for polygons
72- * @property {WebGLArrayBufferSet } lineStringBuffers Array containing indices and vertices buffers for line strings
73- * @property {WebGLArrayBufferSet } pointBuffers Array containing indices and vertices buffers for points
71+ * @property {WebGLArrayBufferSet|null } polygonBuffers Array containing indices and vertices buffers for polygons
72+ * @property {WebGLArrayBufferSet|null } lineStringBuffers Array containing indices and vertices buffers for line strings
73+ * @property {WebGLArrayBufferSet|null } pointBuffers Array containing indices and vertices buffers for points
7474 * @property {import("../../transform.js").Transform } invertVerticesTransform Inverse of the transform applied when generating buffers
7575 */
7676
@@ -325,11 +325,22 @@ class VectorStyleRenderer {
325325 /**
326326 * @param {import('./MixedGeometryBatch.js').default } geometryBatch Geometry batch
327327 * @param {import("../../transform.js").Transform } transform Transform to apply to coordinates
328- * @return {Promise<WebGLBuffers|null > } A promise resolving to WebGL buffers; returns null if buffers are empty
328+ * @return {Promise<WebGLBuffers> } A promise resolving to WebGL buffers; buffer sets are set to ` null` if nothing to render
329329 */
330330 async generateBuffers ( geometryBatch , transform ) {
331+ // also return the inverse of the transform that was applied when generating buffers
332+ const invertVerticesTransform = makeInverseTransform (
333+ createTransform ( ) ,
334+ transform ,
335+ ) ;
336+
331337 if ( geometryBatch . isEmpty ( ) ) {
332- return null ;
338+ return {
339+ polygonBuffers : null ,
340+ lineStringBuffers : null ,
341+ pointBuffers : null ,
342+ invertVerticesTransform : invertVerticesTransform ,
343+ } ;
333344 }
334345 const renderInstructions = this . generateRenderInstructions_ (
335346 geometryBatch ,
@@ -354,11 +365,6 @@ class VectorStyleRenderer {
354365 ) ,
355366 ] ,
356367 ) ;
357- // also return the inverse of the transform that was applied when generating buffers
358- const invertVerticesTransform = makeInverseTransform (
359- createTransform ( ) ,
360- transform ,
361- ) ;
362368 return {
363369 polygonBuffers : polygonBuffers ,
364370 lineStringBuffers : lineStringBuffers ,
@@ -505,6 +511,7 @@ class VectorStyleRenderer {
505511 render ( buffers , frameState , preRenderCallback ) {
506512 for ( const renderPass of this . renderPasses_ ) {
507513 renderPass . fillRenderPass &&
514+ buffers . polygonBuffers &&
508515 this . renderInternal_ (
509516 buffers . polygonBuffers [ 0 ] ,
510517 buffers . polygonBuffers [ 1 ] ,
@@ -514,6 +521,7 @@ class VectorStyleRenderer {
514521 preRenderCallback ,
515522 ) ;
516523 renderPass . strokeRenderPass &&
524+ buffers . lineStringBuffers &&
517525 this . renderInternal_ (
518526 buffers . lineStringBuffers [ 0 ] ,
519527 buffers . lineStringBuffers [ 1 ] ,
@@ -523,6 +531,7 @@ class VectorStyleRenderer {
523531 preRenderCallback ,
524532 ) ;
525533 renderPass . symbolRenderPass &&
534+ buffers . pointBuffers &&
526535 this . renderInternal_ (
527536 buffers . pointBuffers [ 0 ] ,
528537 buffers . pointBuffers [ 1 ] ,
0 commit comments