-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from pygfx import Geometry, Mesh | ||
|
||
|
||
def buffer_to_geometry(positions, **kwargs): | ||
""" | ||
Convert a buffer to a geometry object. | ||
Parameters | ||
---------- | ||
positions : array_like | ||
The positions buffer. | ||
kwargs : dict | ||
A dict of attributes to define on the geometry object. Keys can be "colors", "normals", "texcoords", | ||
"indices", ... | ||
""" | ||
geo = Geometry(positions=positions, **kwargs) | ||
return geo | ||
|
||
|
||
def create_mesh(geometry, material): | ||
""" | ||
Create a mesh object. | ||
Parameters | ||
---------- | ||
geometry : Geometry | ||
The geometry object. | ||
material : Material | ||
The material object. | ||
""" | ||
mesh = Mesh(geometry=geometry, material=material) | ||
return mesh |