Corrected color in normal map to standard color but zero alpha, file access call in POSIX systems revised to clear _cache folder. Changes in defines.py to reflect my project folder on Linux

This commit is contained in:
Marcus 2024-09-13 13:17:36 +02:00
parent 85352308be
commit 2b30e1241f
4 changed files with 70 additions and 76 deletions

View File

@ -13,7 +13,10 @@
# Your data folder - meaning where the cache is stored, and where the finished
# tiles will go. This is also the folder where the image generation sources are
# stored.
mstr_datafolder = "M:/Developer/Projects/orthographic/"
#mstr_datafolder = "M:/Developer/Projects/orthographic/"
mstr_datafolder = "/home/marcus/Data/Developer/Projects/orthographic/"
# Switched to Linux, so path is amended
# API endpoint to acquire OSM data (bonus: I have my own)
mstr_osm_endpoint = "https://marstr.online/osm/v1/"

View File

@ -53,19 +53,10 @@ class mstr_orthographic:
# Need a same call for POSIX
def _isFileAccessiblePosix(self, src):
wildcard = "/proc/*/fd/*"
lfds = glob.glob(wildcard)
for fds in lfds:
try:
file = os.readlink(fds)
if file == src:
return True
except OSError as err:
if err.errno == 2:
file = None
else:
raise(err)
return False
a = True
if os.access(src, os.W_OK) == False:
a = False
return a
# This will determine the vertical stepping in degrees in order to generate
@ -171,7 +162,7 @@ class mstr_orthographic:
mstr_msg("orthographic", "Adjusted bounding box for XML object")
# Determine what to do... maybe work was interrupted
if os.path.isfile(mstr_datafolder + "Tiles/" + self._latlngfld + "/orthos/" + str(cur_tile_y) + "_" + str(cur_tile_x) + ".dds") == False:
if os.path.isfile(mstr_datafolder + "Tiles/z_orthographic_" + self._latlngfld + "/orthos/" + str(cur_tile_y) + "_" + str(cur_tile_x) + ".dds") == False:
# Let the user know
mstr_msg("orthographic", "Generating missing orthophoto " + str(cur_tile_y) + "-" + str(cur_tile_x))

View File

@ -84,8 +84,8 @@ class mstr_xp_normalmap:
# The Big Mac. Generate the normal map
def generate_normal_map_for_layer(self, image):
mstr_msg("xp_normalmap", "[X-Plane] Beginning normal map generation")
#nmp = Image.new("RGBA", (image.width, image.height), (128,128,255,255))
nmp = Image.new("RGBA", (image.width, image.height), (0,0,0,0))
nmp = Image.new("RGBA", (image.width, image.height), (128,128,255,0)) # no specularity, but default color
#nmp = Image.new("RGBA", (image.width, image.height), (0,0,0,0))
org = image.load()
nmp_pix = nmp.load()