I have no idea what I'm doing lol
This commit is contained in:
48
main_scene.py
Normal file
48
main_scene.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import pygame
|
||||
import numpy as np
|
||||
|
||||
import raytracer # raytracer.py
|
||||
|
||||
##### CONFIG #####
|
||||
window_size = (1280, 720)
|
||||
|
||||
# raytracer config
|
||||
vertical_fov = 90 # fov in degrees
|
||||
|
||||
##################
|
||||
|
||||
|
||||
# convert fov to radians
|
||||
vertical_fov = np.radians(vertical_fov)
|
||||
|
||||
|
||||
# pygame init
|
||||
pygame.init()
|
||||
window = pygame.display.set_mode(window_size)
|
||||
clock = pygame.time.Clock()
|
||||
|
||||
|
||||
# raytracer init
|
||||
focal_length = 1 / np.tan(vertical_fov / 2)
|
||||
rt = raytracer.Raytracer(window_size, focal_length)
|
||||
|
||||
rt.update_cam_rot((np.radians(70), np.radians(-27), 0))
|
||||
|
||||
|
||||
|
||||
|
||||
# main loop
|
||||
while True:
|
||||
# events
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
pygame.quit()
|
||||
quit()
|
||||
|
||||
window.fill((0, 0, 0))
|
||||
|
||||
|
||||
|
||||
# update
|
||||
pygame.display.update()
|
||||
clock.tick(60)
|
||||
Reference in New Issue
Block a user