Skip to content

Commit d7f89f5

Browse files
authored
fix for picking buffer generation with custom buffer over alloc (visgl#5729)
1 parent 0275d74 commit d7f89f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/core/src/lib/layer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ export default class Layer extends Component {
488488

489489
// calculateInstancePickingColors always generates the same sequence.
490490
// pickingColorCache saves the largest generated sequence for reuse
491-
const cacheSize = pickingColorCache.length / 3;
491+
const cacheSize = Math.floor(pickingColorCache.length / 3);
492492

493493
// Record when using the picking buffer cache, so that layers can always point at the most recently allocated cache
494494
this.internalState.usesPickingColorCache = true;
@@ -507,7 +507,7 @@ export default class Layer extends Component {
507507
});
508508

509509
// If the attribute is larger than the cache, resize the cache and populate the missing chunk
510-
const newCacheSize = pickingColorCache.length / 3;
510+
const newCacheSize = Math.floor(pickingColorCache.length / 3);
511511
const pickingColor = [];
512512
for (let i = cacheSize; i < newCacheSize; i++) {
513513
this.encodePickingColor(i, pickingColor);

0 commit comments

Comments
 (0)