update
This commit is contained in:
0
graphics_settings/Bundled/canvas/MyCanvas.files
Normal file
0
graphics_settings/Bundled/canvas/MyCanvas.files
Normal file
1
graphics_settings/Bundled/canvas/MyCanvas.json
Normal file
1
graphics_settings/Bundled/canvas/MyCanvas.json
Normal file
@ -0,0 +1 @@
|
||||
{"name":"untitled","x":0,"y":0,"width":1280,"height":720,"elements":[{"id":2,"type":6,"name":"SSR","event":"","x":20,"y":260,"width":150,"height":34,"rotation":0,"text":"SSR","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true},{"id":3,"type":6,"name":"SSAO","event":"","x":20,"y":300,"width":150,"height":40,"rotation":0,"text":"SSAO","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true},{"id":4,"type":6,"name":"Fullscreen","event":"","x":20,"y":80,"width":191,"height":14,"rotation":0,"text":"Fullscreen","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true},{"id":6,"type":6,"name":"Bloom","event":"","x":20,"y":220,"width":150,"height":44,"rotation":0,"text":"Bloom","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true},{"id":7,"type":6,"name":"MotionBlur","event":"","x":20,"y":180,"width":177,"height":44,"rotation":0,"text":"Motion Blur","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true},{"id":8,"type":8,"name":"Shadows","event":"","x":20,"y":130,"width":160,"height":60,"rotation":0,"text":"High;Medium;Low","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true},{"id":9,"type":10,"name":"ViewDistance","event":"","x":20,"y":360,"width":250,"height":44,"rotation":0,"text":"View Distance","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true},{"id":11,"type":0,"name":"Title","event":"","x":10,"y":10,"width":540,"height":60,"rotation":0,"text":"Graphics Settings","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true},{"id":12,"type":0,"name":"ShadowsTitle","event":"","x":185,"y":130,"width":184,"height":20,"rotation":0,"text":"Shadows","asset":"","color":-6381922,"anchor":0,"parent":null,"children":[],"visible":true},{"id":13,"type":2,"name":"Apply","event":"apply_settings","x":22,"y":479,"width":80,"height":50,"rotation":0,"text":"Apply","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true},{"id":14,"type":9,"name":"FoV","event":"","x":20,"y":420,"width":249,"height":48,"rotation":0,"text":"FoV","asset":"","progress_at":0,"progress_total":100,"strength":1,"alignment":2,"anchor":0,"parent":null,"children":[],"visible":true,"color_text":null,"color":null,"color_hover":null}],"assets":[],"theme":"Default Light"}
|
||||
1
graphics_settings/Bundled/canvas/_themes.json
Normal file
1
graphics_settings/Bundled/canvas/_themes.json
Normal file
@ -0,0 +1 @@
|
||||
[{"NAME":"Default Light","WINDOW_BG_COL":-1052689,"WINDOW_TINT_COL":-14540254,"ACCENT_COL":-1118482,"ACCENT_HOVER_COL":-4473925,"ACCENT_SELECT_COL":-5592406,"BUTTON_COL":-3355444,"BUTTON_TEXT_COL":-14540254,"BUTTON_HOVER_COL":-5000269,"BUTTON_PRESSED_COL":-5131855,"TEXT_COL":-16645630,"LABEL_COL":-5592406,"SEPARATOR_COL":-6710887,"HIGHLIGHT_COL":-14656100,"CONTEXT_COL":-5592406,"PANEL_BG_COL":-5592406,"FONT_SIZE":26,"ELEMENT_W":200,"ELEMENT_H":48,"ELEMENT_OFFSET":8,"ARROW_SIZE":10,"BUTTON_H":44,"CHECK_SIZE":30,"CHECK_SELECT_SIZE":16,"SCROLL_W":12,"TEXT_OFFSET":16,"TAB_W":24,"FILL_WINDOW_BG":false,"FILL_BUTTON_BG":true,"FILL_ACCENT_BG":false,"LINK_STYLE":0,"FULL_TABS":false}]
|
||||
20
graphics_settings/Bundled/config.lnx
Normal file
20
graphics_settings/Bundled/config.lnx
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"rp_bloom": true,
|
||||
"rp_dynres": false,
|
||||
"rp_gi": false,
|
||||
"rp_motionblur": true,
|
||||
"rp_shadowmap_cascade": 1024,
|
||||
"rp_shadowmap_cube": 512,
|
||||
"rp_ssgi": true,
|
||||
"rp_ssr": true,
|
||||
"rp_supersample": 1.0,
|
||||
"window_h": 540,
|
||||
"window_maximizable": true,
|
||||
"window_minimizable": true,
|
||||
"window_mode": 0,
|
||||
"window_msaa": 1,
|
||||
"window_resizable": true,
|
||||
"window_scale": 1.0,
|
||||
"window_vsync": true,
|
||||
"window_w": 960
|
||||
}
|
||||
3
graphics_settings/README.md
Normal file
3
graphics_settings/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
To generate config.lnx file, enable `Leenkx Project - Write Config`.
|
||||
|
||||
https://api.leenkx3d.org/leenkx/data/Config.html
|
||||
71
graphics_settings/Sources/lnx/MyTrait.hx
Normal file
71
graphics_settings/Sources/lnx/MyTrait.hx
Normal file
@ -0,0 +1,71 @@
|
||||
package lnx;
|
||||
|
||||
import iron.Scene;
|
||||
import leenkx.system.Event;
|
||||
import leenkx.data.Config;
|
||||
import leenkx.trait.internal.CanvasScript;
|
||||
import leenkx.renderpath.RenderPathCreator;
|
||||
|
||||
// WIP
|
||||
// To generate config.lnx file, enable 'Leenkx Project - Write Config'
|
||||
// Fullscreen option will take effect on next game start up (will be resolved)
|
||||
class MyTrait extends iron.Trait {
|
||||
|
||||
var canvas:CanvasScript;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
|
||||
notifyOnInit(function() {
|
||||
canvas = Scene.active.getTrait(CanvasScript);
|
||||
|
||||
// Init UI to values loaded from config.lnx file
|
||||
canvas.notifyOnReady(function() {
|
||||
canvas.getHandle("Fullscreen").selected = Config.raw.window_mode == 1;
|
||||
canvas.getHandle("SSAO").selected = Config.raw.rp_ssgi;
|
||||
canvas.getHandle("SSR").selected = Config.raw.rp_ssr;
|
||||
canvas.getHandle("Bloom").selected = Config.raw.rp_bloom;
|
||||
canvas.getHandle("MotionBlur").selected = Config.raw.rp_motionblur;
|
||||
canvas.getHandle("Shadows").position = getShadowQuality(Config.raw.rp_shadowmap_cascade);
|
||||
var cam = Scene.active.camera;
|
||||
canvas.getHandle("ViewDistance").text = Std.string(Math.round(cam.data.raw.far_plane));
|
||||
canvas.getHandle("FoV").value = cam.data.raw.fov;
|
||||
});
|
||||
|
||||
// Apply button clicked
|
||||
Event.add("apply_settings", applySettings);
|
||||
});
|
||||
}
|
||||
|
||||
function applySettings() {
|
||||
|
||||
// Apply render path settings
|
||||
Config.raw.window_mode = canvas.getHandle("Fullscreen").selected ? 1 : 0;
|
||||
Config.raw.rp_ssgi = canvas.getHandle("SSAO").selected;
|
||||
Config.raw.rp_ssr = canvas.getHandle("SSR").selected;
|
||||
Config.raw.rp_bloom = canvas.getHandle("Bloom").selected;
|
||||
Config.raw.rp_motionblur = canvas.getHandle("MotionBlur").selected;
|
||||
Config.raw.rp_shadowmap_cascade = getShadowMapSize(canvas.getHandle("Shadows").position);
|
||||
Config.raw.rp_shadowmap_cube = getShadowMapSize(canvas.getHandle("Shadows").position);
|
||||
RenderPathCreator.applyConfig();
|
||||
|
||||
// Apply camera settings
|
||||
var cam = Scene.active.camera;
|
||||
cam.data.raw.far_plane = Std.parseFloat(canvas.getHandle("ViewDistance").text);
|
||||
cam.data.raw.fov = canvas.getHandle("FoV").value;
|
||||
cam.buildProjection();
|
||||
|
||||
// Save config.lnx file
|
||||
Config.save();
|
||||
}
|
||||
|
||||
function getShadowQuality(i:Int):Int {
|
||||
// 0 - High, 1 - Medium, 2 - Low
|
||||
return i == 2048 ? 0 : i == 1024 ? 1 : 2;
|
||||
}
|
||||
|
||||
function getShadowMapSize(i:Int):Int {
|
||||
// High - 2048, Medium - 1024, Low - 512
|
||||
return i == 0 ? 2048 : i == 1 ? 1024 : 512;
|
||||
}
|
||||
}
|
||||
BIN
graphics_settings/graphics_settings.blend
Normal file
BIN
graphics_settings/graphics_settings.blend
Normal file
Binary file not shown.
Reference in New Issue
Block a user