Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertices not updating #33

Closed
martwz opened this issue Mar 17, 2019 · 4 comments
Closed

Vertices not updating #33

martwz opened this issue Mar 17, 2019 · 4 comments

Comments

@martwz
Copy link

martwz commented Mar 17, 2019

Hi, 馃憢

first of all I really enjoy playing around with react-three-fiber and I've even started to write my own thin wrapper around another library using react-three-fiber's reconciler 馃帀.

While playing around with react-three-fiber I've found that my vertices are not updating, that might be an Three.js issue.

Here's a quick example, the button 'Add vertex' dynamically adds a new Vertex on each click, and applyProps gets properly called, but in the end the vertices are not updated: https://codesandbox.io/s/qqq7qpqvo9

@drcmda
Copy link
Member

drcmda commented Mar 17, 2019

Looks odd indeed. I logged the geometry, the vectors are in there. Mutating works, too: https://codesandbox.io/s/m74413rlq8 Could be that the size of the vertices isn't supposed to change in three?

@drcmda
Copy link
Member

drcmda commented Mar 17, 2019

Sorry, looks like it's confirmed: https://stackoverflow.com/questions/14840026/dynamically-adding-vertices-to-a-line-in-three-js

You can only update content of buffers, you cannot resize buffers (this is very costly, basically equivalent to creating new geometry).
You can emulate resizing by pre-allocating a larger buffer and then keeping unneeded vertices collapsed / hidden.

@drcmda drcmda closed this as completed Mar 17, 2019
@drcmda drcmda reopened this Mar 17, 2019
@martwz
Copy link
Author

martwz commented Mar 17, 2019

@drcmda thanks for looking into this, I think it can be closed then.

I've seen that you closed this issue and then reopened shortly after, was the reopening a mistake?

@drcmda
Copy link
Member

drcmda commented Mar 17, 2019

yep, clicked the wrong button, just didn't want to close preemptively.

@martwz martwz closed this as completed Mar 18, 2019
gsimone pushed a commit that referenced this issue Sep 17, 2020
enable optional classname on Stats to allow custom styling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants