1
0
Files

52 lines
1.3 KiB
Python
Raw Permalink Normal View History

2026-01-08 19:37:25 +08:00
from cmd_server import CmdServer, HandshakePayload, PixelKind
2026-01-08 20:04:24 +08:00
from while_stopper import INSTANCE as STOPPER
2026-01-10 20:59:54 +08:00
import cli
2026-01-06 21:24:47 +08:00
import logging
def receive_data() -> None:
2026-01-08 20:04:24 +08:00
logging.info("Data received")
2026-01-06 21:24:47 +08:00
2025-11-25 13:38:17 +08:00
def main():
2026-01-10 20:59:54 +08:00
# parse argument
2026-01-10 21:35:59 +08:00
#opts = cli.parse()
2026-01-06 21:24:47 +08:00
2026-01-10 20:59:54 +08:00
server = CmdServer()
2026-01-08 20:04:24 +08:00
print("Please launch BasaltPresenter now.")
print("Then press Enter to continue...")
2026-01-06 21:24:47 +08:00
input()
2026-01-08 20:04:24 +08:00
logging.info("Waiting BasaltPresenter...")
2026-01-10 16:39:16 +08:00
server.wait_handshake(HandshakePayload(
headless=False,
pixel_kind=PixelKind.GRAY_U8,
width=600,
height=600,
engine_name="BasaltDirectX11Engine",
2026-01-10 21:35:59 +08:00
engine_device=1,
2026-01-10 16:39:16 +08:00
deliver_name="BasaltPipeDeliver",
deliver_device=0,
object_loader_name="BasaltObjObjectLoader",
2026-01-10 20:02:50 +08:00
object_loader_file="D:\\Repo\\BasaltMeter\\BasaltPresenter\\out\\scene.obj",
2026-01-10 16:39:16 +08:00
anime_loader_name="BasaltChickenNuggetAnimeLoader",
anime_loader_file="",
))
2026-01-06 21:24:47 +08:00
2026-01-08 20:04:24 +08:00
logging.info("Start to running.")
STOPPER.register()
2026-01-06 21:24:47 +08:00
while True:
2026-01-08 20:04:24 +08:00
if server.tick(receive_data, STOPPER.is_stop_requested()):
2026-01-06 21:24:47 +08:00
break
2026-01-08 20:04:24 +08:00
STOPPER.unregister()
2026-01-06 21:24:47 +08:00
2026-01-08 20:04:24 +08:00
logging.info("Program stop.")
2026-01-06 22:04:52 +08:00
2025-11-25 13:38:17 +08:00
if __name__ == "__main__":
2026-01-08 20:04:24 +08:00
logging.basicConfig(
level=logging.DEBUG,
format="[%(asctime)s] [%(levelname)s] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
2025-11-25 13:38:17 +08:00
main()