Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Variable explanations:
- # HEIGHT = window height
- # line_height = calculated height of line (from raycast)
- # pixels = amount of pixels to draw (to prevent drawing off-screen or wasting time)
- pixels = int(min(HEIGHT, line_height))
- draw_start = int(HEIGHT // 2 - pixels // 2)
- # Loop through pixels
- for y in range(pixels):
- # Get texel Y
- texel_y = (wall_width - 1) * ((y - (pixels - line_height) / 2) / line_height)
- # Draw pixel (using PyGame's pixel array)
- pixel_array[x, draw_start + y] = wall_image_pil[texel_x, texel_y] # texel_x is calculated earlier and doesn't have any problems
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement