pyrender2 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. pyrender2-0.2.0/LICENSE +21 -0
  2. pyrender2-0.2.0/PKG-INFO +152 -0
  3. pyrender2-0.2.0/README.md +92 -0
  4. pyrender2-0.2.0/pyproject.toml +60 -0
  5. pyrender2-0.2.0/pyrender/__init__.py +24 -0
  6. pyrender2-0.2.0/pyrender/camera.py +435 -0
  7. pyrender2-0.2.0/pyrender/constants.py +149 -0
  8. pyrender2-0.2.0/pyrender/font.py +272 -0
  9. pyrender2-0.2.0/pyrender/fonts/OpenSans-Bold.ttf +0 -0
  10. pyrender2-0.2.0/pyrender/fonts/OpenSans-BoldItalic.ttf +0 -0
  11. pyrender2-0.2.0/pyrender/fonts/OpenSans-ExtraBold.ttf +0 -0
  12. pyrender2-0.2.0/pyrender/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  13. pyrender2-0.2.0/pyrender/fonts/OpenSans-Italic.ttf +0 -0
  14. pyrender2-0.2.0/pyrender/fonts/OpenSans-Light.ttf +0 -0
  15. pyrender2-0.2.0/pyrender/fonts/OpenSans-LightItalic.ttf +0 -0
  16. pyrender2-0.2.0/pyrender/fonts/OpenSans-Regular.ttf +0 -0
  17. pyrender2-0.2.0/pyrender/fonts/OpenSans-Semibold.ttf +0 -0
  18. pyrender2-0.2.0/pyrender/fonts/OpenSans-SemiboldItalic.ttf +0 -0
  19. pyrender2-0.2.0/pyrender/light.py +382 -0
  20. pyrender2-0.2.0/pyrender/material.py +705 -0
  21. pyrender2-0.2.0/pyrender/mesh.py +328 -0
  22. pyrender2-0.2.0/pyrender/node.py +263 -0
  23. pyrender2-0.2.0/pyrender/offscreen.py +160 -0
  24. pyrender2-0.2.0/pyrender/platforms/__init__.py +6 -0
  25. pyrender2-0.2.0/pyrender/platforms/base.py +73 -0
  26. pyrender2-0.2.0/pyrender/platforms/egl.py +219 -0
  27. pyrender2-0.2.0/pyrender/platforms/osmesa.py +59 -0
  28. pyrender2-0.2.0/pyrender/platforms/pyglet_platform.py +90 -0
  29. pyrender2-0.2.0/pyrender/primitive.py +489 -0
  30. pyrender2-0.2.0/pyrender/renderer.py +1328 -0
  31. pyrender2-0.2.0/pyrender/sampler.py +102 -0
  32. pyrender2-0.2.0/pyrender/scene.py +585 -0
  33. pyrender2-0.2.0/pyrender/shader_program.py +283 -0
  34. pyrender2-0.2.0/pyrender/shaders/debug_quad.frag +23 -0
  35. pyrender2-0.2.0/pyrender/shaders/debug_quad.vert +25 -0
  36. pyrender2-0.2.0/pyrender/shaders/flat.frag +126 -0
  37. pyrender2-0.2.0/pyrender/shaders/flat.vert +86 -0
  38. pyrender2-0.2.0/pyrender/shaders/mesh.frag +456 -0
  39. pyrender2-0.2.0/pyrender/shaders/mesh.vert +86 -0
  40. pyrender2-0.2.0/pyrender/shaders/mesh_depth.frag +8 -0
  41. pyrender2-0.2.0/pyrender/shaders/mesh_depth.vert +13 -0
  42. pyrender2-0.2.0/pyrender/shaders/segmentation.frag +13 -0
  43. pyrender2-0.2.0/pyrender/shaders/segmentation.vert +14 -0
  44. pyrender2-0.2.0/pyrender/shaders/text.frag +12 -0
  45. pyrender2-0.2.0/pyrender/shaders/text.vert +12 -0
  46. pyrender2-0.2.0/pyrender/shaders/vertex_normals.frag +10 -0
  47. pyrender2-0.2.0/pyrender/shaders/vertex_normals.geom +74 -0
  48. pyrender2-0.2.0/pyrender/shaders/vertex_normals.vert +27 -0
  49. pyrender2-0.2.0/pyrender/shaders/vertex_normals_pc.geom +29 -0
  50. pyrender2-0.2.0/pyrender/texture.py +259 -0
  51. pyrender2-0.2.0/pyrender/trackball.py +216 -0
  52. pyrender2-0.2.0/pyrender/utils.py +115 -0
  53. pyrender2-0.2.0/pyrender/version.py +1 -0
  54. pyrender2-0.2.0/pyrender/viewer.py +1160 -0
  55. pyrender2-0.2.0/pyrender2.egg-info/PKG-INFO +152 -0
  56. pyrender2-0.2.0/pyrender2.egg-info/SOURCES.txt +58 -0
  57. pyrender2-0.2.0/pyrender2.egg-info/dependency_links.txt +1 -0
  58. pyrender2-0.2.0/pyrender2.egg-info/requires.txt +20 -0
  59. pyrender2-0.2.0/pyrender2.egg-info/top_level.txt +1 -0
  60. pyrender2-0.2.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Matthew Matl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyrender2
3
+ Version: 0.2.0
4
+ Summary: Easy-to-use Python renderer for 3D visualization
5
+ Author-email: Matthew Matl <matthewcmatl@gmail.com>
6
+ Maintainer-email: Jasper Phelps <jasper.s.phelps@gmail.com>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2019 Matthew Matl
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Repository, https://github.com/jasper-tms/pyrender
30
+ Keywords: rendering,graphics,opengl,3d,visualization,pbr,gltf
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Operating System :: POSIX :: Linux
34
+ Classifier: Operating System :: MacOS :: MacOS X
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Natural Language :: English
37
+ Classifier: Topic :: Scientific/Engineering
38
+ Requires-Python: >=3.6
39
+ Description-Content-Type: text/markdown
40
+ License-File: LICENSE
41
+ Requires-Dist: freetype-py
42
+ Requires-Dist: imageio
43
+ Requires-Dist: networkx
44
+ Requires-Dist: numpy
45
+ Requires-Dist: Pillow
46
+ Requires-Dist: pyglet
47
+ Requires-Dist: PyOpenGL>=3.1.9
48
+ Requires-Dist: trimesh
49
+ Provides-Extra: dev
50
+ Requires-Dist: flake8; extra == "dev"
51
+ Requires-Dist: pre-commit; extra == "dev"
52
+ Requires-Dist: pytest; extra == "dev"
53
+ Requires-Dist: pytest-cov; extra == "dev"
54
+ Requires-Dist: tox; extra == "dev"
55
+ Provides-Extra: docs
56
+ Requires-Dist: sphinx; extra == "docs"
57
+ Requires-Dist: sphinx_rtd_theme; extra == "docs"
58
+ Requires-Dist: sphinx-automodapi; extra == "docs"
59
+ Dynamic: license-file
60
+
61
+ # Pyrender
62
+
63
+ [![Build Status](https://travis-ci.org/mmatl/pyrender.svg?branch=master)](https://travis-ci.org/mmatl/pyrender)
64
+ [![Documentation Status](https://readthedocs.org/projects/pyrender/badge/?version=latest)](https://pyrender.readthedocs.io/en/latest/?badge=latest)
65
+ [![Coverage Status](https://coveralls.io/repos/github/mmatl/pyrender/badge.svg?branch=master)](https://coveralls.io/github/mmatl/pyrender?branch=master)
66
+ [![PyPI version](https://badge.fury.io/py/pyrender.svg)](https://badge.fury.io/py/pyrender)
67
+ [![Downloads](https://pepy.tech/badge/pyrender)](https://pepy.tech/project/pyrender)
68
+
69
+ Pyrender is a pure Python (2.7, 3.4, 3.5, 3.6) library for physically-based
70
+ rendering and visualization.
71
+ It is designed to meet the [glTF 2.0 specification from Khronos](https://www.khronos.org/gltf/).
72
+
73
+ Pyrender is lightweight, easy to install, and simple to use.
74
+ It comes packaged with both an intuitive scene viewer and a headache-free
75
+ offscreen renderer with support for GPU-accelerated rendering on headless
76
+ servers, which makes it perfect for machine learning applications.
77
+
78
+ Extensive documentation, including a quickstart guide, is provided [here](https://pyrender.readthedocs.io/en/latest/).
79
+
80
+ For a minimal working example of GPU-accelerated offscreen rendering using EGL,
81
+ check out the [EGL Google CoLab Notebook](https://colab.research.google.com/drive/1pcndwqeY8vker3bLKQNJKr3B-7-SYenE?usp=sharing).
82
+
83
+
84
+ <p align="center">
85
+ <img width="48%" src="https://github.com/mmatl/pyrender/blob/master/docs/source/_static/rotation.gif?raw=true" alt="GIF of Viewer"/>
86
+ <img width="48%" src="https://github.com/mmatl/pyrender/blob/master/docs/source/_static/damaged_helmet.png?raw=true" alt="Damaged Helmet"/>
87
+ </p>
88
+
89
+ ## Installation
90
+ You can install pyrender directly from pip.
91
+
92
+ ```bash
93
+ pip install pyrender
94
+ ```
95
+
96
+ ## Features
97
+
98
+ Despite being lightweight, pyrender has lots of features, including:
99
+
100
+ * Simple interoperation with the amazing [trimesh](https://github.com/mikedh/trimesh) project,
101
+ which enables out-of-the-box support for dozens of mesh types, including OBJ,
102
+ STL, DAE, OFF, PLY, and GLB.
103
+ * An easy-to-use scene viewer with support for animation, showing face and vertex
104
+ normals, toggling lighting conditions, and saving images and GIFs.
105
+ * An offscreen rendering module that supports OSMesa and EGL backends.
106
+ * Shadow mapping for directional and spot lights.
107
+ * Metallic-roughness materials for physically-based rendering, including several
108
+ types of texture and normal mapping.
109
+ * Transparency.
110
+ * Depth and color image generation.
111
+
112
+ ## Sample Usage
113
+
114
+ For sample usage, check out the [quickstart
115
+ guide](https://pyrender.readthedocs.io/en/latest/examples/index.html) or one of
116
+ the Google CoLab Notebooks:
117
+
118
+ * [EGL Google CoLab Notebook](https://colab.research.google.com/drive/1pcndwqeY8vker3bLKQNJKr3B-7-SYenE?usp=sharing)
119
+
120
+ ## Viewer Keyboard and Mouse Controls
121
+
122
+ When using the viewer, the basic controls for moving about the scene are as follows:
123
+
124
+ * To rotate the camera about the center of the scene, hold the left mouse button and drag the cursor.
125
+ * To rotate the camera about its viewing axis, hold `CTRL` left mouse button and drag the cursor.
126
+ * To pan the camera, do one of the following:
127
+ * Hold `SHIFT`, then hold the left mouse button and drag the cursor.
128
+ * Hold the middle mouse button and drag the cursor.
129
+ * To zoom the camera in or out, do one of the following:
130
+ * Scroll the mouse wheel.
131
+ * Hold the right mouse button and drag the cursor.
132
+
133
+ The available keyboard commands are as follows:
134
+
135
+ * `a`: Toggles rotational animation mode.
136
+ * `c`: Toggles backface culling.
137
+ * `f`: Toggles fullscreen mode.
138
+ * `h`: Toggles shadow rendering.
139
+ * `i`: Toggles axis display mode (no axes, world axis, mesh axes, all axes).
140
+ * `l`: Toggles lighting mode (scene lighting, Raymond lighting, or direct lighting).
141
+ * `m`: Toggles face normal visualization.
142
+ * `n`: Toggles vertex normal visualization.
143
+ * `o`: Toggles orthographic camera mode.
144
+ * `q`: Quits the viewer.
145
+ * `r`: Starts recording a GIF, and pressing again stops recording and opens a file dialog.
146
+ * `s`: Opens a file dialog to save the current view as an image.
147
+ * `w`: Toggles wireframe mode (scene default, flip wireframes, all wireframe, or all solid).
148
+ * `z`: Resets the camera to the default view.
149
+
150
+ As a note, displaying shadows significantly slows down rendering, so if you're
151
+ experiencing low framerates, just kill shadows or reduce the number of lights in
152
+ your scene.
@@ -0,0 +1,92 @@
1
+ # Pyrender
2
+
3
+ [![Build Status](https://travis-ci.org/mmatl/pyrender.svg?branch=master)](https://travis-ci.org/mmatl/pyrender)
4
+ [![Documentation Status](https://readthedocs.org/projects/pyrender/badge/?version=latest)](https://pyrender.readthedocs.io/en/latest/?badge=latest)
5
+ [![Coverage Status](https://coveralls.io/repos/github/mmatl/pyrender/badge.svg?branch=master)](https://coveralls.io/github/mmatl/pyrender?branch=master)
6
+ [![PyPI version](https://badge.fury.io/py/pyrender.svg)](https://badge.fury.io/py/pyrender)
7
+ [![Downloads](https://pepy.tech/badge/pyrender)](https://pepy.tech/project/pyrender)
8
+
9
+ Pyrender is a pure Python (2.7, 3.4, 3.5, 3.6) library for physically-based
10
+ rendering and visualization.
11
+ It is designed to meet the [glTF 2.0 specification from Khronos](https://www.khronos.org/gltf/).
12
+
13
+ Pyrender is lightweight, easy to install, and simple to use.
14
+ It comes packaged with both an intuitive scene viewer and a headache-free
15
+ offscreen renderer with support for GPU-accelerated rendering on headless
16
+ servers, which makes it perfect for machine learning applications.
17
+
18
+ Extensive documentation, including a quickstart guide, is provided [here](https://pyrender.readthedocs.io/en/latest/).
19
+
20
+ For a minimal working example of GPU-accelerated offscreen rendering using EGL,
21
+ check out the [EGL Google CoLab Notebook](https://colab.research.google.com/drive/1pcndwqeY8vker3bLKQNJKr3B-7-SYenE?usp=sharing).
22
+
23
+
24
+ <p align="center">
25
+ <img width="48%" src="https://github.com/mmatl/pyrender/blob/master/docs/source/_static/rotation.gif?raw=true" alt="GIF of Viewer"/>
26
+ <img width="48%" src="https://github.com/mmatl/pyrender/blob/master/docs/source/_static/damaged_helmet.png?raw=true" alt="Damaged Helmet"/>
27
+ </p>
28
+
29
+ ## Installation
30
+ You can install pyrender directly from pip.
31
+
32
+ ```bash
33
+ pip install pyrender
34
+ ```
35
+
36
+ ## Features
37
+
38
+ Despite being lightweight, pyrender has lots of features, including:
39
+
40
+ * Simple interoperation with the amazing [trimesh](https://github.com/mikedh/trimesh) project,
41
+ which enables out-of-the-box support for dozens of mesh types, including OBJ,
42
+ STL, DAE, OFF, PLY, and GLB.
43
+ * An easy-to-use scene viewer with support for animation, showing face and vertex
44
+ normals, toggling lighting conditions, and saving images and GIFs.
45
+ * An offscreen rendering module that supports OSMesa and EGL backends.
46
+ * Shadow mapping for directional and spot lights.
47
+ * Metallic-roughness materials for physically-based rendering, including several
48
+ types of texture and normal mapping.
49
+ * Transparency.
50
+ * Depth and color image generation.
51
+
52
+ ## Sample Usage
53
+
54
+ For sample usage, check out the [quickstart
55
+ guide](https://pyrender.readthedocs.io/en/latest/examples/index.html) or one of
56
+ the Google CoLab Notebooks:
57
+
58
+ * [EGL Google CoLab Notebook](https://colab.research.google.com/drive/1pcndwqeY8vker3bLKQNJKr3B-7-SYenE?usp=sharing)
59
+
60
+ ## Viewer Keyboard and Mouse Controls
61
+
62
+ When using the viewer, the basic controls for moving about the scene are as follows:
63
+
64
+ * To rotate the camera about the center of the scene, hold the left mouse button and drag the cursor.
65
+ * To rotate the camera about its viewing axis, hold `CTRL` left mouse button and drag the cursor.
66
+ * To pan the camera, do one of the following:
67
+ * Hold `SHIFT`, then hold the left mouse button and drag the cursor.
68
+ * Hold the middle mouse button and drag the cursor.
69
+ * To zoom the camera in or out, do one of the following:
70
+ * Scroll the mouse wheel.
71
+ * Hold the right mouse button and drag the cursor.
72
+
73
+ The available keyboard commands are as follows:
74
+
75
+ * `a`: Toggles rotational animation mode.
76
+ * `c`: Toggles backface culling.
77
+ * `f`: Toggles fullscreen mode.
78
+ * `h`: Toggles shadow rendering.
79
+ * `i`: Toggles axis display mode (no axes, world axis, mesh axes, all axes).
80
+ * `l`: Toggles lighting mode (scene lighting, Raymond lighting, or direct lighting).
81
+ * `m`: Toggles face normal visualization.
82
+ * `n`: Toggles vertex normal visualization.
83
+ * `o`: Toggles orthographic camera mode.
84
+ * `q`: Quits the viewer.
85
+ * `r`: Starts recording a GIF, and pressing again stops recording and opens a file dialog.
86
+ * `s`: Opens a file dialog to save the current view as an image.
87
+ * `w`: Toggles wireframe mode (scene default, flip wireframes, all wireframe, or all solid).
88
+ * `z`: Resets the camera to the default view.
89
+
90
+ As a note, displaying shadows significantly slows down rendering, so if you're
91
+ experiencing low framerates, just kill shadows or reduce the number of lights in
92
+ your scene.
@@ -0,0 +1,60 @@
1
+ # Originally authored by Matthew Matl.
2
+ # Adapted for compatibility with numpy v2 by Jasper Phelps <jasper.s.phelps@gmail.com>
3
+
4
+ [build-system]
5
+ requires = ['setuptools', 'wheel']
6
+ build-backend = 'setuptools.build_meta'
7
+
8
+ [project]
9
+ name = 'pyrender2'
10
+ dynamic = ['version']
11
+ description = 'Easy-to-use Python renderer for 3D visualization'
12
+ readme = {file = 'README.md', content-type = 'text/markdown'}
13
+ requires-python = '>=3.6'
14
+ license = {file = 'LICENSE'}
15
+ keywords = ['rendering', 'graphics', 'opengl', '3d', 'visualization', 'pbr', 'gltf']
16
+ authors = [{name = 'Matthew Matl', email = 'matthewcmatl@gmail.com'}]
17
+ maintainers = [{name = 'Jasper Phelps', email = 'jasper.s.phelps@gmail.com'}]
18
+ classifiers = [
19
+ 'Development Status :: 4 - Beta',
20
+ 'License :: OSI Approved :: MIT License',
21
+ 'Operating System :: POSIX :: Linux',
22
+ 'Operating System :: MacOS :: MacOS X',
23
+ 'Programming Language :: Python :: 3',
24
+ 'Natural Language :: English',
25
+ 'Topic :: Scientific/Engineering',
26
+ ]
27
+ urls = {Repository = 'https://github.com/jasper-tms/pyrender'}
28
+ dependencies = [
29
+ 'freetype-py',
30
+ 'imageio',
31
+ 'networkx',
32
+ 'numpy',
33
+ 'Pillow',
34
+ 'pyglet',
35
+ 'PyOpenGL>=3.1.9',
36
+ 'trimesh',
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ dev = [
41
+ 'flake8',
42
+ 'pre-commit',
43
+ 'pytest',
44
+ 'pytest-cov',
45
+ 'tox',
46
+ ]
47
+ docs = [
48
+ 'sphinx',
49
+ 'sphinx_rtd_theme',
50
+ 'sphinx-automodapi',
51
+ ]
52
+
53
+ [tool.setuptools.dynamic]
54
+ version = {attr = 'pyrender.version.__version__'}
55
+
56
+ [tool.setuptools.packages.find]
57
+ include = ['pyrender', 'pyrender.*']
58
+
59
+ [tool.setuptools.package-data]
60
+ pyrender = ['fonts/*', 'shaders/*']
@@ -0,0 +1,24 @@
1
+ from .camera import (Camera, PerspectiveCamera, OrthographicCamera,
2
+ IntrinsicsCamera)
3
+ from .light import Light, PointLight, DirectionalLight, SpotLight
4
+ from .sampler import Sampler
5
+ from .texture import Texture
6
+ from .material import Material, MetallicRoughnessMaterial
7
+ from .primitive import Primitive
8
+ from .mesh import Mesh
9
+ from .node import Node
10
+ from .scene import Scene
11
+ from .renderer import Renderer
12
+ from .viewer import Viewer
13
+ from .offscreen import OffscreenRenderer
14
+ from .version import __version__
15
+ from .constants import RenderFlags, TextAlign, GLTF
16
+
17
+ __all__ = [
18
+ 'Camera', 'PerspectiveCamera', 'OrthographicCamera', 'IntrinsicsCamera',
19
+ 'Light', 'PointLight', 'DirectionalLight', 'SpotLight',
20
+ 'Sampler', 'Texture', 'Material', 'MetallicRoughnessMaterial',
21
+ 'Primitive', 'Mesh', 'Node', 'Scene', 'Renderer', 'Viewer',
22
+ 'OffscreenRenderer', '__version__', 'RenderFlags', 'TextAlign',
23
+ 'GLTF'
24
+ ]