1
0

generateTextures.py 751 B

1234567891011121314151617181920212223242526
  1. # Script to precalculate dir and plane values, as this keeps them in sync
  2. # However, this means no dynamic adjustments of the FOV,
  3. # as this is determined by the ratio between dir and plane vectors
  4. # currently resulting in an FOV of 2*atan(0.66/1.0)=66°
  5. from math import cos, sin, pi, pow
  6. import numpy as np
  7. from PIL import Image
  8. TEXTURE_NAME = "colorstone"
  9. # print(str(doubleToFP16(planeY)) + ", ", end='')
  10. im = Image.open("Textures/" + TEXTURE_NAME + ".png")
  11. tex_array = np.array(im)
  12. print("{")
  13. for x in range(tex_array.shape[0]):
  14. for y in range(tex_array.shape[1]):
  15. r = tex_array[x][y][0]
  16. g = tex_array[x][y][1]
  17. b = tex_array[x][y][2]
  18. print(str(r*2**16+g*2**8+b) + ", ", end='')
  19. print()
  20. print("},")