-
Hello, I am building a react 3DM viewer of a parametric model, I have a canvas along with a form with controls such as sliders where the user can modify the geometry of the model. Should I prevent the canvas to be re-rendered or find a way to persist the camera position? and how? Here is a sand box, I have not included the form but you can simulate the geometry change by clicking on the change geometry button. https://codesandbox.io/s/elastic-fire-bugbe?file=/src/components/GeometryDisplay.tsx Also I updated the mesh part of my '3dm to threejs' converter to use BufferGeometry but did not find a way yet to convert the quad faces hence the missing faces on the display, but I am thinking that I will deal with this problem at geometry generation stage. Thank you for any help ! Olivier |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
i dont understand the question. what does re-rendering the canvas mean? why is something lost? in react components don't unmount if they don't need to, nothing will be lost unless you unmount components. im not sure, but do you unmount the entire canvas on a geometry change? changing geometry and orbit controls should have nothing to do with one another. you can use cameras and controls from the drei lib btw, i see you have lots of code just for these basics. |
Beta Was this translation helpful? Give feedback.
-
Hello, Thank you for your quick answer, maybe re render is not the correct term. What I need is that the geometry updates, without a change at the camera level. As for your advice on the drei lib thank you I am checking this out, I wrote most of the code one year ago, I did not see this at the time. Olivier |
Beta Was this translation helpful? Give feedback.
i dont understand the question. what does re-rendering the canvas mean? why is something lost? in react components don't unmount if they don't need to, nothing will be lost unless you unmount components. im not sure, but do you unmount the entire canvas on a geometry change? changing geometry and orbit controls should have nothing to do with one another.
you can use cameras and controls from the drei lib btw, i see you have lots of code just for these basics.