forked from LeenkxTeam/LNXSDK
Repe [T3DU] Update - 31f26d171bba0355ce2a77031e3aad4c64dbc7e9
This commit is contained in:
@ -246,6 +246,9 @@ let project = new Project('""" + lnx.utils.safesrc(wrd.lnx_project_name + '-' +
|
||||
khafile.write(add_leenkx_library(sdk_path, 'leenkx', rel_path=do_relpath_sdk))
|
||||
if not os.path.exists(os.path.join('Libraries', 'iron')):
|
||||
khafile.write(add_leenkx_library(sdk_path, 'iron', rel_path=do_relpath_sdk))
|
||||
if not os.path.exists(os.path.join('Libraries', 'lib/hscript')):
|
||||
khafile.write(add_leenkx_library(sdk_path, 'lib/hscript', rel_path=do_relpath_sdk))
|
||||
khafile.write("project.addDefine('" + 'hscript' + "');\n")
|
||||
|
||||
# Project libraries
|
||||
if os.path.exists('Libraries'):
|
||||
@ -266,6 +269,7 @@ let project = new Project('""" + lnx.utils.safesrc(wrd.lnx_project_name + '-' +
|
||||
|
||||
if export_physics:
|
||||
assets.add_khafile_def('lnx_physics')
|
||||
assets.add_khafile_def('lnx_physics_soft')
|
||||
if wrd.lnx_physics_engine == 'Bullet':
|
||||
assets.add_khafile_def('lnx_bullet')
|
||||
if not os.path.exists('Libraries/haxebullet'):
|
||||
@ -329,14 +333,15 @@ let project = new Project('""" + lnx.utils.safesrc(wrd.lnx_project_name + '-' +
|
||||
recastjs_path = recastjs_path.replace('\\', '/').replace('//', '/')
|
||||
khafile.write(add_assets(recastjs_path, rel_path=do_relpath_sdk))
|
||||
|
||||
if wrd.lnx_dce:
|
||||
khafile.write("project.addParameter('-dce full');\n")
|
||||
if wrd.lnx_no_traces:
|
||||
khafile.write("project.addParameter('--no-traces');\n")
|
||||
if wrd.lnx_asset_compression:
|
||||
assets.add_khafile_def('lnx_compress')
|
||||
|
||||
if is_publish:
|
||||
assets.add_khafile_def('lnx_published')
|
||||
if wrd.lnx_dce:
|
||||
khafile.write("project.addParameter('-dce full');\n")
|
||||
if wrd.lnx_no_traces:
|
||||
khafile.write("project.addParameter('--no-traces');\n")
|
||||
if wrd.lnx_asset_compression:
|
||||
assets.add_khafile_def('lnx_compress')
|
||||
|
||||
else:
|
||||
assets.add_khafile_def(f'lnx_assert_level={wrd.lnx_assert_level}')
|
||||
@ -455,6 +460,10 @@ let project = new Project('""" + lnx.utils.safesrc(wrd.lnx_project_name + '-' +
|
||||
khafile.write(add_shaders(sdk_path + "/leenkx/Shaders/debug_draw/line.frag.glsl", rel_path=do_relpath_sdk))
|
||||
khafile.write(add_shaders(sdk_path + "/leenkx/Shaders/debug_draw/line.vert.glsl", rel_path=do_relpath_sdk))
|
||||
|
||||
if rpdat.rp_renderer == 'Forward':
|
||||
khafile.write(add_shaders(sdk_path + "/leenkx/Shaders/render_draw/render_line.frag.glsl", rel_path=do_relpath_sdk))
|
||||
khafile.write(add_shaders(sdk_path + "/leenkx/Shaders/render_draw/render_line.vert.glsl", rel_path=do_relpath_sdk))
|
||||
|
||||
if not is_publish and state.target == 'html5':
|
||||
khafile.write("project.addParameter('--debug');\n")
|
||||
|
||||
@ -515,7 +524,7 @@ let project = new Project('""" + lnx.utils.safesrc(wrd.lnx_project_name + '-' +
|
||||
if os.path.exists(project_path + '/Bundled/config.lnx'):
|
||||
assets.add_khafile_def('lnx_config')
|
||||
|
||||
if is_publish and wrd.lnx_loadscreen:
|
||||
if wrd.lnx_loadscreen:
|
||||
assets.add_khafile_def('lnx_loadscreen')
|
||||
|
||||
if wrd.lnx_winresize or state.target == 'html5':
|
||||
@ -632,7 +641,7 @@ def write_config(resx, resy):
|
||||
def write_mainhx(scene_name, resx, resy, is_play, is_publish):
|
||||
wrd = bpy.data.worlds['Lnx']
|
||||
rpdat = lnx.utils.get_rp()
|
||||
scene_ext = '.lz4' if (wrd.lnx_asset_compression and is_publish) else ''
|
||||
scene_ext = '.lz4' if (wrd.lnx_asset_compression) else ''
|
||||
if scene_ext == '' and not wrd.lnx_minimize:
|
||||
scene_ext = '.json'
|
||||
winmode = get_winmode(wrd.lnx_winmode)
|
||||
@ -706,13 +715,20 @@ class Main {
|
||||
if rpdat.lnx_shadowmap_bounds != 1.0:
|
||||
f.write("\n" + content_indent + "iron.object.LightObject.cascadeBounds = " + str(rpdat.lnx_shadowmap_bounds) + ";")
|
||||
|
||||
if is_publish and wrd.lnx_loadscreen:
|
||||
asset_references = list(set(assets.assets))
|
||||
asset_references = list(set(assets.assets))
|
||||
|
||||
if wrd.lnx_loadscreen:
|
||||
loadscreen_class = 'leenkx.trait.internal.LoadingScreen'
|
||||
if os.path.isfile(lnx.utils.get_fp() + '/Sources/' + wrd.lnx_project_package + '/LoadingScreen.hx'):
|
||||
loadscreen_class = wrd.lnx_project_package + '.LoadingScreen'
|
||||
f.write("\n" + content_indent + "leenkx.system.Starter.numAssets = " + str(len(asset_references)) + ";")
|
||||
f.write("\n" + content_indent + "leenkx.system.Starter.drawLoading = " + loadscreen_class + ".render;")
|
||||
f.write("\n" + content_indent + "leenkx.system.Starter.assets = " + str([os.path.basename(path) for path in asset_references if 'Bundled' in path]) + ";")
|
||||
|
||||
scenes_list = [f"'{scene.name}'" for scene in bpy.data.scenes if getattr(scene, 'lnx_export', True)]
|
||||
scenes_array = "[" + ", ".join(scenes_list) + "]"
|
||||
|
||||
f.write("\n" + content_indent + "leenkx.system.Starter.scenes = " + scenes_array + ";")
|
||||
|
||||
if wrd.lnx_ui == 'Enabled':
|
||||
if wrd.lnx_canvas_img_scaling_quality == 'low':
|
||||
@ -759,6 +775,7 @@ def write_indexhtml(w, h, is_publish):
|
||||
if wrd.lnx_project_html5_popupmenu_in_browser:
|
||||
popupmenu_in_browser = ' oncontextmenu="return false"'
|
||||
with open(lnx.utils.build_dir() + dest + '/index.html', 'w') as f:
|
||||
icon = """<link rel="icon" href="favicon.ico" type="image/x-icon">""" if wrd.lnx_project_icon != '' else ''
|
||||
f.write(
|
||||
"""<!DOCTYPE html>
|
||||
<html>
|
||||
@ -769,6 +786,7 @@ def write_indexhtml(w, h, is_publish):
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, user-scalable=no'>""")
|
||||
f.write("""
|
||||
<title>"""+html.escape( wrd.lnx_project_name)+"""</title>
|
||||
"""+icon+"""
|
||||
</head>
|
||||
<body style='margin: 0; padding: 0'>
|
||||
""")
|
||||
@ -964,6 +982,11 @@ const vec3 compoLetterboxColor = vec3(""" + str(round(rpdat.lnx_letterbox_color[
|
||||
if rpdat.lnx_distort:
|
||||
f.write(
|
||||
"""const float compoDistortStrength = """ + str(round(rpdat.lnx_distort_strength * 100) / 100) + """;
|
||||
""")
|
||||
|
||||
if rpdat.lnx_fisheye:
|
||||
f.write(
|
||||
"""const float compoFisheyeStrength = """ + str(round(rpdat.lnx_fisheye_strength * 100) / 100) + """;
|
||||
""")
|
||||
|
||||
if rpdat.lnx_grain:
|
||||
@ -1054,17 +1077,13 @@ const float voxelgiRefr = """ + str(round(rpdat.lnx_voxelgi_refr * 100) / 100) +
|
||||
"""const int skinMaxBones = """ + str(rpdat.lnx_skin_max_bones) + """;
|
||||
""")
|
||||
|
||||
if '_Clusters' in wrd.world_defs:
|
||||
max_lights = "4"
|
||||
max_lights_clusters = "4"
|
||||
if rpdat.rp_shadowmap_atlas:
|
||||
max_lights = str(rpdat.rp_max_lights)
|
||||
max_lights_clusters = str(rpdat.rp_max_lights_cluster)
|
||||
# prevent max lights cluster being higher than max lights
|
||||
if (int(max_lights_clusters) > int(max_lights)):
|
||||
max_lights_clusters = max_lights
|
||||
max_lights = str(rpdat.rp_max_lights)
|
||||
max_lights_clusters = str(rpdat.rp_max_lights_cluster)
|
||||
# prevent max lights cluster being higher than max lights
|
||||
if (int(max_lights_clusters) > int(max_lights)):
|
||||
max_lights_clusters = max_lights
|
||||
|
||||
f.write(
|
||||
f.write(
|
||||
"""const int maxLights = """ + max_lights + """;
|
||||
const int maxLightsCluster = """ + max_lights_clusters + """;
|
||||
const float clusterNear = 3.0;
|
||||
|
||||
Reference in New Issue
Block a user