-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender_docs.py
More file actions
26 lines (25 loc) · 1.06 KB
/
Copy pathrender_docs.py
File metadata and controls
26 lines (25 loc) · 1.06 KB
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
"""Reproduce README renders. Optional documentation tool; requires Pillow."""
import argparse
from pathlib import Path
import subprocess
from PIL import Image
root = Path(__file__).resolve().parents[1]
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('renderer', type=Path, help='path to the built renderer executable')
args = parser.parse_args()
executable = args.renderer.resolve()
work = root/'build'/'docs'
work.mkdir(parents=True, exist_ok=True)
(root/'docs'/'images').mkdir(parents=True, exist_ok=True)
for name, extra, width, height in [
('orbital', [], 1400, 1000),
('solid', ['--solid'], 700, 600),
('alternate-light', ['--light', '1', '-0.2', '0.5'], 700, 600),
]:
output = work/(name+'.tga')
subprocess.run([str(executable), str(root/'assets'/'orbital.obj'),
'--output', str(output), '--width', str(width),
'--height', str(height), *extra], check=True, cwd=root)
with Image.open(output) as image:
image.save(root/'docs'/'images'/(name+'.png'))
print('Wrote', name+'.png')