Deal with higher-resolution textures
This commit is contained in:
16
textures.py
16
textures.py
@@ -92,13 +92,19 @@ def _get_terrain_image():
|
|||||||
def _split_terrain(terrain):
|
def _split_terrain(terrain):
|
||||||
"""Builds and returns a length 256 array of each 16x16 chunk of texture"""
|
"""Builds and returns a length 256 array of each 16x16 chunk of texture"""
|
||||||
textures = []
|
textures = []
|
||||||
|
(terrain_width, terrain_height) = terrain.size
|
||||||
|
texture_resolution = terrain_width / 16
|
||||||
for y in xrange(16):
|
for y in xrange(16):
|
||||||
for x in xrange(16):
|
for x in xrange(16):
|
||||||
left = x*16
|
left = x*texture_resolution
|
||||||
upper = y*16
|
upper = y*texture_resolution
|
||||||
right = left+16
|
right = left+texture_resolution
|
||||||
lower = upper+16
|
lower = upper+texture_resolution
|
||||||
region = terrain.crop((left,upper,right,lower))
|
region = terrain.transform(
|
||||||
|
(16, 16),
|
||||||
|
Image.EXTENT,
|
||||||
|
(left,upper,right,lower),
|
||||||
|
Image.BICUBIC)
|
||||||
textures.append(region)
|
textures.append(region)
|
||||||
|
|
||||||
return textures
|
return textures
|
||||||
|
|||||||
Reference in New Issue
Block a user