-
Notifications
You must be signed in to change notification settings - Fork 59
Add support for mesh and surface #953
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
Conversation
|
I cannot find the new screenshots. Do I need to whitelist the new |
|
📚 Docs preview built and uploaded! https://www.fastplotlib.org/ver/mesh |
|
Good start!
Working on figuring out how to make the surface data dynamically settable so we can have a For general mesh:
For surface:
Are morph targets useful for this? Or just setting the position directly is the way to go? I'm not sure if any of the existing "2D" selectors are useful here, in the future we could make a "cube selector", maybe based on the pygfx gizmo example using an expandable cube that can be used to select the triangles inside the cube? Other than that that #545 might be useful here when it's available, and we could also make a selector that just allows selecting faces on a mesh (I think pygfx has an example for this, but we could maybe make a easy way to Cntrl + Click to build a selection?). Anyways not a priority for now, just thoughts. |
|
I'm going to add a few commits to this branch based on #953 (comment) |
fastplotlib/layouts/_plot_area.py
Outdated
| self.scene.add(pygfx.AmbientLight()) | ||
| self.scene.add(self._camera.add(pygfx.DirectionalLight())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these can be settable properties of the PlotArea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm ... Having an ambient light and one directional light on the camera is a sweet default that makes sure phong-shaded meshes look good. A user that wants custom lights will probably want to add more lights to the scene, and control on which objects they are attached. That would be tricky to expose as a prop, I think?
FWIW these lights add negligible overhead for objects that don't use lights.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's useful to have easy access to them though, and if a new camera is set on the PlotArea it needs to get the directional light. This is what I mean:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. Nice fix!
example dirs for tests are listed here: fastplotlib/examples/tests/testutils.py Lines 18 to 34 in 7b4c687
Did you automate finding them in pygfx? Similarly for docs that dir needs a readme, making these changes in #954 |
Edit: I see But this can be arbitrary, we often use it to indicate things like velocity along a 2d trajectory.
a comma was also missing, added it , slipped by in the vectors PR |
* mesh with gfeatures * surface graphic works * update, add PolygonGraphic, works * black * for docs and test screenshots * black * polygon data updating works * update * black * more examples * update add_graphic mixin * code review changes * fix * better polygon example
Ah, If I understand correctly, the current line's edit: easy as in not that complex. Still quite a bit of work, I imagine. |
Yes! Thanks I understand it better now :) |
|
@almarklein I think this is done 🥳 . Let me know what you think |
|
I was getting ready to update the buffer resizing logic for the poly data, but saw you already fixed that too. Awesome! Ready from my end then! 👍 |
Closes #487, closes #917, ref #959
MeshGraphgicplot.add_mesh()andplot.add_surface().Possible upstream (pygfx) improvements: