-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LineSegmentsGeometry: Calling "setPositions" twice does not update the lines correctly #21488
Comments
three.js has not supported the resizing of buffers. See https://threejs.org/docs/#manual/en/introduction/How-to-update-things. |
A new buffer is being created when you call three.js/examples/jsm/lines/LineSegmentsGeometry.js Lines 79 to 82 in 3c7d515
Also if you perform the same test with a triangular mesh (create a position buffer with 1 triangle, then 1 second later replace it with a buffer with 2 triangles) then it works. I though resizing buffers meant updating the array within which is why the |
Granted. But it is an example, and the method was only intended to be called once. I think your issue deserves reconsideration, however. Thanks for bringing it up. :) /ping @Mugen87 |
I think we've discussed the same issue in #20933 already. TBH, this is not the intended usage of the API. |
The behavior is a bit different here. Looking deeper it looks like this is due to
Yes apologies I'm reminded you mentioned that in the previous issue. Is this definitive now? Is it the position of the project that setting or removing BufferAttributes on BufferGeometry between renders without calling @WestLangley if the |
You should modify the existing buffers. Not overwrite them (with new sizes). Nowhere in the examples is your pattern demonstrated. If you need to change the size, dispose the geometry (since you can't dispose buffer attributes) and create a new one. Feel free to clarify this in the documentation. |
|
Describe the bug
Calling
LineSegmentsGeometry.setPositions
a second time with more line segments still only renders the amount of line segments specified in the first call. Everything works as expected if you call "dispose" before calling "setPositions" again.I'm not exactly sure why it's happening. Perhaps it's an issue related to instanced geometry rendering?
To Reproduce
Steps to reproduce the behavior:
LineSegments2
objectline.geometry.setPositions
with 1 line segmentline.geometry.setPositions
with 2 line segmentsCode
Live example
https://jsfiddle.net/rhjeL01n/
Expected behavior
The correct amount of lines are rendered after calling "setPositions".
Screenshots
If applicable, add screenshots to help explain your problem (drag and drop the image).
Platform:
The text was updated successfully, but these errors were encountered: