A cloth that waves: edit, flag, recompute
Every frame edits all 625 vertices. In the status bar the draw call count is 1. Set SET_NEEDS_UPDATE to false and run again.
A geometry is not frozen. You can change vertices every frame (and must tell the GPU with needsUpdate), draw only part of a shape with setDrawRange, and merge many shapes into one so the GPU draws them in a single call.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 4 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Make the cloth's wave stop when the user prefers reduced motion. Which line changes?
Write a function that grows a polyline: it keeps a big Float32Array for 1,000 points and draws only the first n.
Explain it without notes
Why must you set needsUpdate = true after editing a position array?
When would you use setDrawRange and when mergeGeometries?
Console
Nothing logged yet.Expected console output
vertices: 625 | numbers uploaded each time: 1875
version before: 1
version after 3 edits: 4