| 1 |
"""Contains glTF examples.""" |
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
import pooch |
| 6 |
|
| 7 |
from .downloads import USER_DATA_PATH |
| 8 |
|
| 9 |
GLTF_FETCHER = pooch.create( # type: ignore[attr-defined] |
| 10 |
path=USER_DATA_PATH, |
| 11 |
base_url='https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/', |
| 12 |
registry={ |
| 13 |
'Avocado/glTF-Binary/Avocado.glb': None, |
| 14 |
'CesiumMilkTruck/glTF-Binary/CesiumMilkTruck.glb': None, |
| 15 |
'DamagedHelmet/glTF-Embedded/DamagedHelmet.gltf': None, |
| 16 |
'GearboxAssy/glTF-Binary/GearboxAssy.glb': None, |
| 17 |
'SheenChair/glTF-Binary/SheenChair.glb': None, |
| 18 |
}, |
| 19 |
retry_if_failed=3, |
| 20 |
) |
| 21 |
|
| 22 |
|
| 23 |
def download_damaged_helmet(): # pragma: no cover |
| 24 |
"""Download the damaged helmet example. |
| 25 |
|
| 26 |
Files hosted at https://github.com/KhronosGroup/glTF-Sample-Models |
| 27 |
|
| 28 |
Returns |
| 29 |
------- |
| 30 |
str |
| 31 |
Filename of the gltf file. |
| 32 |
|
| 33 |
Examples |
| 34 |
-------- |
| 35 |
>>> import pyvista as pv |
| 36 |
>>> from pyvista import examples |
| 37 |
>>> gltf_file = examples.gltf.download_damaged_helmet() |
| 38 |
>>> cubemap = examples.download_sky_box_cube_map() |
| 39 |
>>> pl = pv.Plotter() |
| 40 |
>>> pl.import_gltf(gltf_file) |
| 41 |
>>> pl.set_environment_texture(cubemap) |
| 42 |
>>> pl.show() |
| 43 |
|
| 44 |
""" |
| 45 |
return GLTF_FETCHER.fetch('DamagedHelmet/glTF-Embedded/DamagedHelmet.gltf') |
| 46 |
|
| 47 |
|
| 48 |
def download_sheen_chair(): # pragma: no cover |
| 49 |
"""Download the sheen chair example. |
| 50 |
|
| 51 |
Files hosted at https://github.com/KhronosGroup/glTF-Sample-Models |
| 52 |
|
| 53 |
Returns |
| 54 |
------- |
| 55 |
str |
| 56 |
Filename of the gltf file. |
| 57 |
|
| 58 |
Examples |
| 59 |
-------- |
| 60 |
>>> import pyvista as pv |
| 61 |
>>> from pyvista import examples |
| 62 |
>>> gltf_file = examples.gltf.download_sheen_chair() |
| 63 |
>>> cubemap = examples.download_sky_box_cube_map() |
| 64 |
>>> pl = pv.Plotter() # doctest:+SKIP |
| 65 |
>>> pl.import_gltf(gltf_file) # doctest:+SKIP |
| 66 |
>>> pl.set_environment_texture(cubemap) # doctest:+SKIP |
| 67 |
>>> pl.show() # doctest:+SKIP |
| 68 |
|
| 69 |
""" |
| 70 |
return GLTF_FETCHER.fetch('SheenChair/glTF-Binary/SheenChair.glb') |
| 71 |
|
| 72 |
|
| 73 |
def download_gearbox(): # pragma: no cover |
| 74 |
"""Download the gearbox example. |
| 75 |
|
| 76 |
Files hosted at https://github.com/KhronosGroup/glTF-Sample-Models |
| 77 |
|
| 78 |
Returns |
| 79 |
------- |
| 80 |
str |
| 81 |
Filename of the gltf file. |
| 82 |
|
| 83 |
Examples |
| 84 |
-------- |
| 85 |
>>> import pyvista as pv |
| 86 |
>>> from pyvista import examples |
| 87 |
>>> gltf_file = examples.gltf.download_gearbox() |
| 88 |
>>> pl = pv.Plotter() |
| 89 |
>>> pl.import_gltf(gltf_file) |
| 90 |
>>> pl.show() |
| 91 |
|
| 92 |
""" |
| 93 |
return GLTF_FETCHER.fetch('GearboxAssy/glTF-Binary/GearboxAssy.glb') |
| 94 |
|
| 95 |
|
| 96 |
def download_avocado(): # pragma: no cover |
| 97 |
"""Download the avocado example. |
| 98 |
|
| 99 |
Files hosted at https://github.com/KhronosGroup/glTF-Sample-Models |
| 100 |
|
| 101 |
Returns |
| 102 |
------- |
| 103 |
str |
| 104 |
Filename of the gltf file. |
| 105 |
|
| 106 |
Examples |
| 107 |
-------- |
| 108 |
>>> import pyvista as pv |
| 109 |
>>> from pyvista import examples |
| 110 |
>>> gltf_file = examples.gltf.download_avocado() |
| 111 |
>>> pl = pv.Plotter() |
| 112 |
>>> pl.import_gltf(gltf_file) |
| 113 |
>>> pl.show() |
| 114 |
|
| 115 |
""" |
| 116 |
return GLTF_FETCHER.fetch('Avocado/glTF-Binary/Avocado.glb') |
| 117 |
|
| 118 |
|
| 119 |
def download_milk_truck(): # pragma: no cover |
| 120 |
"""Download the milk truck example. |
| 121 |
|
| 122 |
Files hosted at https://github.com/KhronosGroup/glTF-Sample-Models |
| 123 |
|
| 124 |
Returns |
| 125 |
------- |
| 126 |
str |
| 127 |
Filename of the gltf file. |
| 128 |
|
| 129 |
Examples |
| 130 |
-------- |
| 131 |
>>> import pyvista as pv |
| 132 |
>>> from pyvista import examples |
| 133 |
>>> gltf_file = examples.gltf.download_milk_truck() |
| 134 |
>>> pl = pv.Plotter() |
| 135 |
>>> pl.import_gltf(gltf_file) |
| 136 |
>>> pl.show() |
| 137 |
|
| 138 |
""" |
| 139 |
return GLTF_FETCHER.fetch('CesiumMilkTruck/glTF-Binary/CesiumMilkTruck.glb') |