Jaanus Varus
Jaanus Varus

Reputation: 3573

How to render a subset of non-indexed BufferedGeometry?

I am dealing with a non-indexed BufferedGeometry. I want to re-use the same BufferedGeometry to once per frame:

  1. Render the entire buffer
  2. Render a subset of the buffer (for example, first 120 vertices)

I tried to use .addDrawCall(start, count), for which I got the following error:

THREE.BufferGeometry: .addDrawCall() is now .addGroup().

Seeing as .addGroup(start, count) uses a similar signature, I changed to it, but to no effect.


Edit: I just noticed this paragraph regarding .drawcalls array, which means this functionality is not available for me:

For geometries that use indexed triangles, this Array can be used to split the object into multiple WebGL draw calls.


Any way to achieve my goal using BufferedGeometry?

three.js r76

Upvotes: 0

Views: 261

Answers (1)

WestLangley
WestLangley

Reputation: 104783

To render a subset of the vertices of non-indexed BufferGeometry use this pattern:

geometry.setDrawRange( startVertex, numVerticesToDraw );

See this answer for related information and a live demo:

three.js r.76

Upvotes: 1

Related Questions