# Depending on if scenery for XP should be made, AND if normal maps should be made, we would\r
# need to make them at this exact point\r
if mstr_xp_genscenery == True:\r
- if mstr_xp_scn_normalmaps == True:\r
+ if mstr_xp_scn_normalmaps == True and self._is_completion == False:\r
nm = False\r
for n in mstr_xp_normal_maps:\r
if n[0] == self._tag and (n[1] == self._value or n[1] == "*"):\r
# Depending on if scenery for XP should be made, AND if normal maps should be made, we would\r
# need to make them at this exact point\r
if mstr_xp_genscenery == True:\r
- if mstr_xp_scn_normalmaps == True:\r
+ if mstr_xp_scn_normalmaps == True and self._is_completion == False:\r
nm = False\r
for n in mstr_xp_normal_maps:\r
if n[0] == self._tag and (n[1] == self._value or n[1] == "*"):\r
os.makedirs(self._output + "/z_orthographic/orthos")\r
mstr_msg("orthographic", "Created tile orthos folder")\r
if not os.path.exists(self._output + "/z_orthographic/orthos" + self._latlngfld):\r
- os.makedirs(self._output + "/z_orthographic/orthos/" + self._latlngfld)\r
+ os.makedirs(self._output + "/z_orthographic/orthos/" + self._latlngfld, exist_ok=True)\r
\r
# Generate the database folder\r
if not os.path.exists(self._output + "/z_orthographic/data"):\r
scn.acquire_xes_data()\r
scn.build_mesh_script()\r
scn.build_mesh()\r
+ scn.build_ter_files()\r
mstr_msg("orthographic", "[X-Plane] Mesh built, and scenery completed")\r
\r
mstr_msg("orthographic", "Final step completed.")\r
# This builds the entire mesh in one go
def build_mesh(self):
+ mstr_msg("xp_scenery", "[X-Plane] Building DSF mesh")
end_bt = self.find_earthnavdata_number()
btlfn = str(self.xplane_latlng_folder(end_bt))
xp_folder = self.xplane_latlng_folder([self._lat, self._lng])
os.system(cmd)
+ mstr_msg("xp_scenery", "[X-Plane] Mesh construction complete")
+
+
+ # This generates all .ter files
+ def build_ter_files(self):
+ mstr_msg("xp_scenery", "[X-Plane] Generating and writing terrain (.ter) files")
+ cur_lat = self._lat
+ cur_lng = self._lng
+ xp_folder = self.xplane_latlng_folder([self._lat, self._lng])
+ for lat in range(1, self._mlat+1):
+ for lng in range(1, self._mlng+1):
+ terstr = ""
+ terstr = terstr + "A\n"
+ terstr = terstr + "800\n"
+ terstr = terstr + "TERRAIN\n"
+ terstr = terstr + "\n"
+ terstr = terstr + "BASE_TEX_NOWRAP ../orthos/"+xp_folder+"/"+str(lat)+"_"+str(lng)+".dds\n"
+ if mstr_xp_scn_normalmaps == True:
+ terstr = terstr + "TEXTURE_NORMAL ../normals/"+xp_folder+"/"+str(lat)+"_"+str(lng)+".dds\n"
+
+ terfln = mstr_datafolder + "z_orthographic/terrain/"+xp_folder+"/"+str(lat)+"_"+str(lng)+".ter"
+
+ with open(terfln, 'w') as textfile:
+ textfile.write(terstr)
+
+ mstr_msg("xp_scenery", "[X-Plane] Terrain files written")
-# Individual testing
-#scn = mstr_xp_scenery(51, 7, 101, 64, 0.010102, "+51+007")
-#scn.acquire_xes_data()
-#scn.build_mesh_script()
-#scn.build_mesh()
\ No newline at end of file