time based lighting

This commit is contained in:
Felix Pankratz 2025-07-24 23:09:40 +02:00
parent 9bddcfaa7e
commit 1107a7f2bb

View File

@ -12,6 +12,7 @@ import argparse
import asyncio import asyncio
import os import os
import IP2Location import IP2Location
from datetime import timezone, datetime
from terminalplotter import TerminalPlotter from terminalplotter import TerminalPlotter
@ -157,7 +158,7 @@ async def main():
width, height = args.size width, height = args.size
else: else:
height, width = await kitty.get_terminal_size_pixel() height, width = await kitty.get_terminal_size_pixel()
plotter = TerminalPlotter(width, height) plotter = TerminalPlotter(width, height, lighting='none')
plotter.add_mesh( plotter.add_mesh(
globe, color="tan", smooth_shading=False, texture=tex, show_edges=False globe, color="tan", smooth_shading=False, texture=tex, show_edges=False
) )
@ -185,6 +186,12 @@ async def main():
color = "red" color = "red"
plotter.add_mesh(line, color=color, line_width=2) plotter.add_mesh(line, color=color, line_width=2)
now = datetime.now(timezone.utc)
sun_angle = (now.hour - 12) * (360/24)
light = pv.Light()
light.set_direction_angle(0.55864, sun_angle)
plotter.add_light(light)
kitty.hide_cursor() kitty.hide_cursor()
try: try:
await plotter.run() await plotter.run()