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