Skip to content

Commit db49c62

Browse files
Add support for mesh and surface (#953)
* Add support for mesh and surface * restore line example * Implement image-surface example * Fix 3D camera for mesh examples * Just remove selector logic for now * new examples in gallery * mesh with graphic features (#954) * 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 * remove unused import * update graphics mixin * docs * black * don't need to set limit for docs gen * add missing comma * dont run terrain example * new screenshots * remove (i expect) unnecessary check * lights as properties * just use VertexPositions * update PolyData * I need to use precommit * update api docs --------- Co-authored-by: Kushal Kolar <kushalkolar@gmail.com>
1 parent 9abe236 commit db49c62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2345
-14
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.. _api.MeshCmap:
2+
3+
MeshCmap
4+
********
5+
6+
========
7+
MeshCmap
8+
========
9+
.. currentmodule:: fastplotlib.graphics.features
10+
11+
Constructor
12+
~~~~~~~~~~~
13+
.. autosummary::
14+
:toctree: MeshCmap_api
15+
16+
MeshCmap
17+
18+
Properties
19+
~~~~~~~~~~
20+
.. autosummary::
21+
:toctree: MeshCmap_api
22+
23+
MeshCmap.value
24+
25+
Methods
26+
~~~~~~~
27+
.. autosummary::
28+
:toctree: MeshCmap_api
29+
30+
MeshCmap.add_event_handler
31+
MeshCmap.block_events
32+
MeshCmap.clear_event_handlers
33+
MeshCmap.remove_event_handler
34+
MeshCmap.set_value
35+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. _api.MeshIndices:
2+
3+
MeshIndices
4+
***********
5+
6+
===========
7+
MeshIndices
8+
===========
9+
.. currentmodule:: fastplotlib.graphics.features
10+
11+
Constructor
12+
~~~~~~~~~~~
13+
.. autosummary::
14+
:toctree: MeshIndices_api
15+
16+
MeshIndices
17+
18+
Properties
19+
~~~~~~~~~~
20+
.. autosummary::
21+
:toctree: MeshIndices_api
22+
23+
MeshIndices.buffer
24+
MeshIndices.value
25+
26+
Methods
27+
~~~~~~~
28+
.. autosummary::
29+
:toctree: MeshIndices_api
30+
31+
MeshIndices.add_event_handler
32+
MeshIndices.block_events
33+
MeshIndices.clear_event_handlers
34+
MeshIndices.remove_event_handler
35+
MeshIndices.set_value
36+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.. _api.SurfaceData:
2+
3+
SurfaceData
4+
***********
5+
6+
===========
7+
SurfaceData
8+
===========
9+
.. currentmodule:: fastplotlib.graphics.features
10+
11+
Constructor
12+
~~~~~~~~~~~
13+
.. autosummary::
14+
:toctree: SurfaceData_api
15+
16+
SurfaceData
17+
18+
Properties
19+
~~~~~~~~~~
20+
.. autosummary::
21+
:toctree: SurfaceData_api
22+
23+
SurfaceData.value
24+
25+
Methods
26+
~~~~~~~
27+
.. autosummary::
28+
:toctree: SurfaceData_api
29+
30+
SurfaceData.add_event_handler
31+
SurfaceData.block_events
32+
SurfaceData.clear_event_handlers
33+
SurfaceData.remove_event_handler
34+
SurfaceData.set_value
35+

docs/source/api/graphic_features/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Graphic Features
99
SizeSpace
1010
VertexPositions
1111
VertexCmap
12+
MeshIndices
13+
MeshCmap
14+
SurfaceData
1215
Thickness
1316
VertexMarkers
1417
UniformMarker
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
.. _api.MeshGraphic:
2+
3+
MeshGraphic
4+
***********
5+
6+
===========
7+
MeshGraphic
8+
===========
9+
.. currentmodule:: fastplotlib
10+
11+
Constructor
12+
~~~~~~~~~~~
13+
.. autosummary::
14+
:toctree: MeshGraphic_api
15+
16+
MeshGraphic
17+
18+
Properties
19+
~~~~~~~~~~
20+
.. autosummary::
21+
:toctree: MeshGraphic_api
22+
23+
MeshGraphic.alpha
24+
MeshGraphic.alpha_mode
25+
MeshGraphic.axes
26+
MeshGraphic.block_events
27+
MeshGraphic.clim
28+
MeshGraphic.cmap
29+
MeshGraphic.colors
30+
MeshGraphic.deleted
31+
MeshGraphic.event_handlers
32+
MeshGraphic.indices
33+
MeshGraphic.mapcoords
34+
MeshGraphic.mode
35+
MeshGraphic.name
36+
MeshGraphic.offset
37+
MeshGraphic.plane
38+
MeshGraphic.positions
39+
MeshGraphic.right_click_menu
40+
MeshGraphic.rotation
41+
MeshGraphic.supported_events
42+
MeshGraphic.visible
43+
MeshGraphic.world_object
44+
45+
Methods
46+
~~~~~~~
47+
.. autosummary::
48+
:toctree: MeshGraphic_api
49+
50+
MeshGraphic.add_axes
51+
MeshGraphic.add_event_handler
52+
MeshGraphic.clear_event_handlers
53+
MeshGraphic.remove_event_handler
54+
MeshGraphic.rotate
55+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
.. _api.PolygonGraphic:
2+
3+
PolygonGraphic
4+
**************
5+
6+
==============
7+
PolygonGraphic
8+
==============
9+
.. currentmodule:: fastplotlib
10+
11+
Constructor
12+
~~~~~~~~~~~
13+
.. autosummary::
14+
:toctree: PolygonGraphic_api
15+
16+
PolygonGraphic
17+
18+
Properties
19+
~~~~~~~~~~
20+
.. autosummary::
21+
:toctree: PolygonGraphic_api
22+
23+
PolygonGraphic.alpha
24+
PolygonGraphic.alpha_mode
25+
PolygonGraphic.axes
26+
PolygonGraphic.block_events
27+
PolygonGraphic.clim
28+
PolygonGraphic.cmap
29+
PolygonGraphic.colors
30+
PolygonGraphic.data
31+
PolygonGraphic.deleted
32+
PolygonGraphic.event_handlers
33+
PolygonGraphic.indices
34+
PolygonGraphic.mapcoords
35+
PolygonGraphic.mode
36+
PolygonGraphic.name
37+
PolygonGraphic.offset
38+
PolygonGraphic.plane
39+
PolygonGraphic.positions
40+
PolygonGraphic.right_click_menu
41+
PolygonGraphic.rotation
42+
PolygonGraphic.supported_events
43+
PolygonGraphic.visible
44+
PolygonGraphic.world_object
45+
46+
Methods
47+
~~~~~~~
48+
.. autosummary::
49+
:toctree: PolygonGraphic_api
50+
51+
PolygonGraphic.add_axes
52+
PolygonGraphic.add_event_handler
53+
PolygonGraphic.clear_event_handlers
54+
PolygonGraphic.remove_event_handler
55+
PolygonGraphic.rotate
56+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
.. _api.SurfaceGraphic:
2+
3+
SurfaceGraphic
4+
**************
5+
6+
==============
7+
SurfaceGraphic
8+
==============
9+
.. currentmodule:: fastplotlib
10+
11+
Constructor
12+
~~~~~~~~~~~
13+
.. autosummary::
14+
:toctree: SurfaceGraphic_api
15+
16+
SurfaceGraphic
17+
18+
Properties
19+
~~~~~~~~~~
20+
.. autosummary::
21+
:toctree: SurfaceGraphic_api
22+
23+
SurfaceGraphic.alpha
24+
SurfaceGraphic.alpha_mode
25+
SurfaceGraphic.axes
26+
SurfaceGraphic.block_events
27+
SurfaceGraphic.clim
28+
SurfaceGraphic.cmap
29+
SurfaceGraphic.colors
30+
SurfaceGraphic.data
31+
SurfaceGraphic.deleted
32+
SurfaceGraphic.event_handlers
33+
SurfaceGraphic.indices
34+
SurfaceGraphic.mapcoords
35+
SurfaceGraphic.mode
36+
SurfaceGraphic.name
37+
SurfaceGraphic.offset
38+
SurfaceGraphic.plane
39+
SurfaceGraphic.positions
40+
SurfaceGraphic.right_click_menu
41+
SurfaceGraphic.rotation
42+
SurfaceGraphic.supported_events
43+
SurfaceGraphic.visible
44+
SurfaceGraphic.world_object
45+
46+
Methods
47+
~~~~~~~
48+
.. autosummary::
49+
:toctree: SurfaceGraphic_api
50+
51+
SurfaceGraphic.add_axes
52+
SurfaceGraphic.add_event_handler
53+
SurfaceGraphic.clear_event_handlers
54+
SurfaceGraphic.remove_event_handler
55+
SurfaceGraphic.rotate
56+

docs/source/api/graphics/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Graphics
1010
ImageGraphic
1111
ImageVolumeGraphic
1212
VectorsGraphic
13+
MeshGraphic
14+
SurfaceGraphic
15+
PolygonGraphic
1316
TextGraphic
1417
LineCollection
1518
LineStack

docs/source/api/layouts/subplot.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ Properties
2020
.. autosummary::
2121
:toctree: Subplot_api
2222

23+
Subplot.ambient_light
2324
Subplot.animations
2425
Subplot.axes
2526
Subplot.background_color
2627
Subplot.camera
2728
Subplot.canvas
2829
Subplot.controller
30+
Subplot.directional_light
2931
Subplot.docks
3032
Subplot.frame
3133
Subplot.graphics
@@ -52,7 +54,10 @@ Methods
5254
Subplot.add_line
5355
Subplot.add_line_collection
5456
Subplot.add_line_stack
57+
Subplot.add_mesh
58+
Subplot.add_polygon
5559
Subplot.add_scatter
60+
Subplot.add_surface
5661
Subplot.add_text
5762
Subplot.add_vectors
5863
Subplot.auto_scale

docs/source/conf.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@
1010
os.environ["WGPU_FORCE_OFFSCREEN"] = "1"
1111

1212
import fastplotlib
13-
import pygfx
1413
from pygfx.utils.gallery_scraper import find_examples_for_gallery
1514
from pathlib import Path
1615
import sys
1716
from sphinx_gallery.sorting import ExplicitOrder
1817
import imageio.v3 as iio
1918

20-
MAX_TEXTURE_SIZE = 2048
21-
pygfx.renderers.wgpu.set_wgpu_limits(**{"max-texture-dimension-2d": MAX_TEXTURE_SIZE})
2219

2320
ROOT_DIR = Path(__file__).parents[1].parents[0] # repo root
2421
EXAMPLES_DIR = Path.joinpath(ROOT_DIR, "examples")
@@ -44,7 +41,7 @@
4441
"sphinx.ext.viewcode",
4542
"sphinx_copybutton",
4643
"sphinx_design",
47-
"sphinx_gallery.gen_gallery"
44+
"sphinx_gallery.gen_gallery",
4845
]
4946

5047
sphinx_gallery_conf = {
@@ -65,6 +62,7 @@
6562
"../../examples/controllers",
6663
"../../examples/line",
6764
"../../examples/line_collection",
65+
"../../examples/mesh",
6866
"../../examples/scatter",
6967
"../../examples/vectors",
7068
"../../examples/text",
@@ -77,9 +75,9 @@
7775
"../../examples/qt",
7876
]
7977
),
80-
"ignore_pattern": r'__init__\.py',
78+
"ignore_pattern": r"__init__\.py",
8179
"nested_sections": False,
82-
"thumbnail_size": (250, 250)
80+
"thumbnail_size": (250, 250),
8381
}
8482

8583
extra_conf = find_examples_for_gallery(EXAMPLES_DIR)
@@ -107,15 +105,15 @@
107105
"check_switcher": True,
108106
"switcher": {
109107
"json_url": "http://www.fastplotlib.org/_static/switcher.json",
110-
"version_match": release
108+
"version_match": release,
111109
},
112110
"icon_links": [
113111
{
114112
"name": "Github",
115113
"url": "https://github.com/fastplotlib/fastplotlib",
116114
"icon": "fa-brands fa-github",
117115
}
118-
]
116+
],
119117
}
120118

121119
html_static_path = ["_static"]

0 commit comments

Comments
 (0)