Three.js: InterleavedBufferAttribute has no "needsUpdate" setter

Created on 28 Sep 2016  路  5Comments  路  Source: mrdoob/three.js

Description of the problem

The InterleavedBufferAttribute objects seems to miss the needsUpdate setter/getter for increasing the internal version counter.

To be able to trigger an re-upload of the data to the GPU one will have to increase the Mesh.geometry.attributes.MYBUFFER.data.version counter by hand.

Three.js version
  • [ ] Dev
  • [ x] r81
  • [ ] ...

All 5 comments

Would you like to do a PR with the fix?

Bump up - needsupdate is still not implement on interleavedBuffer but written in his documentation.

For THREE.InterleavedBufferAttribute, this is the pattern to use:

mesh.geometry.attributes.position.data.needsUpdate = true;

Thanks @WestLangley !

I realize the InterleavedBufferAttributes were all link to their THREE.InterleavedBuffer which is the stuffs to actually update and setup drawrange for interleaved, maybe a note about it in the documentation would be good.

This is problematic when using TypeScript types, as the compiler can not know if the buffer attribute has needsUpdate or not:

TS2339: Property 'needsUpdate' does not exist on type 'BufferAttribute | InterleavedBufferAttribute'.
  Property 'needsUpdate' does not exist on type 'InterleavedBufferAttribute'.

There should be a needsUpdate on InterleavedBufferAttribute just as on BufferAttribute.

My only workaround is using an instanceof check:

// Passes TypeScript compiler:
if (positionAttribute instanceof THREE.InterleavedBufferAttribute) {
    positionAttribute.data.needsUpdate = true;
} else {
    positionAttribute.needsUpdate = true;
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Horray picture Horray  路  3Comments

filharvey picture filharvey  路  3Comments

scrubs picture scrubs  路  3Comments

zsitro picture zsitro  路  3Comments

akshaysrin picture akshaysrin  路  3Comments