File size: 1,572 Bytes
da43581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# E-OS v6 — visual test of the liquid-glass renderer.
import sys, os, time
import numpy as np
sys.path.insert(0, os.path.dirname(__file__))
from os6_spec import *
from os6_draw import render_frame, rasterize_hint
from PIL import Image

rng = np.random.default_rng(42)
OUT = "/home/z/my-project/download/e-os-v6/eval"
os.makedirs(OUT, exist_ok=True)

t0 = time.time()
# 4 themes x home layout, one with a big ripple
rows = []
for th in range(4):
    sh = lay_home(rng)
    rip = (0.5, 0.55, 0.30) if th % 2 == 0 else (0.3, 0.35, 0.55)
    fr = render_frame(sh, th, 0.45, 0.25, [rip], pressed=1, seed=th)
    rows.append(fr)
dt = time.time() - t0
print("4 frames in %.2fs (%.0f ms/frame)" % (dt, dt / 4 * 1000))

grid = np.concatenate(rows, axis=1)
Image.fromarray(grid).save(os.path.join(OUT, "os6_glass_preview.png"))

# random layout + early/late ripple + day phases
sh = lay_random(rng)
frames = []
for (day, sh_t, rip) in [(0.5, 0.1, (0.35, 0.5, 0.12)), (0.95, 0.5, (0.6, 0.7, 0.45)),
                         (0.2, 0.9, (0.75, 0.3, 0.75)), (0.5, 0.5, (0, 0, -1))]:
    frames.append(render_frame(sh, 2, day, sh_t, [rip] if rip[2] >= 0 else [], seed=7))
Image.fromarray(np.concatenate(frames, axis=1)).save(
    os.path.join(OUT, "os6_variants_preview.png"))

# hint check: render hint as RGB for eyeballing
hint = rasterize_hint(lay_home(rng), [(0.5, 0.55, 0.3)])
himg = np.stack([hint[0], hint[1], hint[2] + hint[3]], -1)
Image.fromarray((himg * 255).astype(np.uint8)).resize((256, 544)).save(
    os.path.join(OUT, "os6_hint_preview.png"))
print("previews saved")