From d4b559555bb6f8d7012c81fb4ada78b5c9bca6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Wed, 3 Apr 2024 17:47:27 +0500 Subject: [PATCH] A commit. --- main.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 9695542..3153790 100755 --- a/main.py +++ b/main.py @@ -20,6 +20,8 @@ IROT = 1/ROT F = 5 * 10**7 F_ = 10**9 +SKY = (127,127,255) +GROUND = (102, 51, 0) class Segment: def __init__(self,bA,cA,cB,trColor): @@ -34,10 +36,10 @@ class DrawnSegment: self.color = color level = [ - Segment(False,.5,I*.5,(255,0,0)), - Segment(False,.5,-I*.5,(0,255,0)), - Segment(False,-.5,-I*.5,(0,0,255)), - Segment(False,-.5,I*.5,(255,255,0)) + Segment(False,.7,I*.7,(255,0,0)), + Segment(False,.7,-I*.7,(0,255,0)), + Segment(False,-.7,-I*.7,(0,0,255)), + Segment(False,-.7,I*.7,(255,255,0)) ] def draw(level,gPlayer,fov,res): @@ -54,7 +56,7 @@ def draw(level,gPlayer,fov,res): cInt = cLineIntersection(tA,tB,complex(0),rot) except ZeroDivisionError: continue - rDist = cDist(0,cInt) + rDist = cDist(0,cInt) * irot.real if cDot(cInt,rot) > 0: continue if (1 - m.height) > rDist: @@ -92,9 +94,11 @@ def mainLoop(): display.fill(WHITE) #pygame.draw.rect(display,BLACK, c_tr(Poincare2Klein(gPlayer.cPos) * -100) + (100,100),0) drawn = draw(level,gPlayer,PI/2,640) + pygame.draw.rect(display,SKY, (0,0,1280,360)) + pygame.draw.rect(display,GROUND, (0,360,1280,360)) n = 0 for i in drawn: - pygame.draw.rect(display,i.color, (n,360 - (cap(i.height) * 500),10,cap(i.height) * 1000)) + pygame.draw.rect(display,i.color, (n,360 - (cap(i.height) * 360),10,cap(i.height) * 1000)) n += 2 font.render_to(display, (20, 150), str(gPlayer.cPos), (0, 0, 0)) font.render_to(display, (20, 250), str(gPlayer.cRot), (0, 0, 0))