This commit is contained in:
2026-05-06 19:12:34 -07:00
parent cf19776262
commit 9a2430edfa
111 changed files with 2085 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
race_track/Assets/grid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

View File

View File

@ -0,0 +1 @@
{"name":"untitled","x":0,"y":0,"width":1280,"height":720,"elements":[{"id":15,"type":9,"name":"MenuContainer","event":"","x":935,"y":61,"width":332,"height":402,"rotation":0,"text":"My Shape","asset":"","color":-1258291200,"anchor":5,"parent":null,"children":[2,3,6,8,11,12,13,14],"visible":true},{"id":2,"type":6,"name":"SSR","event":"","x":24,"y":179,"width":150,"height":44,"rotation":0,"text":"SSR","asset":"","color":-1,"anchor":0,"parent":15,"children":[],"visible":true},{"id":3,"type":6,"name":"SSAO","event":"","x":24,"y":229,"width":150,"height":44,"rotation":0,"text":"SSAO","asset":"","color":-1,"anchor":0,"parent":15,"children":[],"visible":true},{"id":6,"type":6,"name":"Bloom","event":"","x":24,"y":129,"width":150,"height":44,"rotation":0,"text":"Bloom","asset":"","color":-1,"anchor":0,"parent":15,"children":[],"visible":true},{"id":8,"type":8,"name":"Shadows","event":"","x":24,"y":79,"width":150,"height":44,"rotation":0,"text":"High;Medium;Low","asset":"","color":-1,"anchor":0,"parent":15,"children":[],"visible":true},{"id":11,"type":0,"name":"Title","event":"","x":4,"y":9,"width":377,"height":44,"rotation":0,"text":"Graphics Settings","asset":"","color":-1,"anchor":0,"parent":15,"children":[],"visible":true},{"id":12,"type":0,"name":"ShadowsTitle","event":"","x":164,"y":79,"width":184,"height":28,"rotation":0,"text":"Shadows","asset":"","color":-6381922,"anchor":0,"parent":15,"children":[],"visible":true},{"id":13,"type":2,"name":"Apply","event":"apply_settings","x":24,"y":329,"width":150,"height":44,"rotation":0,"text":"Apply","asset":"","color":-1,"anchor":0,"parent":15,"children":[],"visible":true},{"id":14,"type":6,"name":"Voxels","event":"","x":24,"y":279,"width":150,"height":44,"rotation":0,"text":"Voxels","asset":"","color":-1,"anchor":0,"parent":15,"children":[],"visible":true},{"id":16,"type":2,"name":"Menu","event":"toggle_menu","x":1120,"y":5,"width":150,"height":44,"rotation":0,"text":"Menu","asset":"","color":-1,"anchor":2,"parent":null,"children":[],"visible":true},{"id":17,"type":0,"name":"Time","event":"","x":0,"y":0,"width":202,"height":65,"rotation":0,"text":"0:0","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true}],"assets":[]}

View File

@ -0,0 +1,68 @@
package lnx;
import iron.Scene;
import leenkx.system.Event;
import leenkx.data.Config;
import leenkx.trait.internal.CanvasScript;
import leenkx.renderpath.RenderPathCreator;
class SettingsTrait extends iron.Trait {
var canvas:CanvasScript;
var envStrength = 0.0;
public function new() {
super();
notifyOnInit(function() {
canvas = Scene.active.getTrait(CanvasScript);
// Init UI to values loaded from config.lnx file
canvas.notifyOnReady(function() {
canvas.getElement("MenuContainer").visible = false;
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("Voxels").selected = Config.raw.rp_gi;
canvas.getHandle("Shadows").position = getShadowQuality(Config.raw.rp_shadowmap_cascade);
});
// Button events
Event.add("toggle_menu", toggleMenu);
Event.add("apply_settings", applySettings);
});
}
function toggleMenu() {
var e = canvas.getElement("MenuContainer");
e.visible = !e.visible;
}
function applySettings() {
// Apply render path settings
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_gi = canvas.getHandle("Voxels").selected;
Config.raw.rp_shadowmap_cascade = getShadowMapSize(canvas.getHandle("Shadows").position);
RenderPathCreator.applyConfig();
// Lower envmap strength when voxel ao is disabled
var p = iron.Scene.active.world.probe.raw;
if (envStrength == 0) envStrength = p.strength;
p.strength = Config.raw.rp_gi ? envStrength : envStrength / 3;
// Save config.lnx file
Config.save();
}
inline function getShadowQuality(i:Int):Int {
// 0 - High, 1 - Medium, 2 - Low
return i == 4096 ? 0 : i == 2048 ? 1 : 2;
}
inline function getShadowMapSize(i:Int):Int {
return i == 0 ? 4096 : i == 1 ? 2048 : 1024;
}
}

View File

@ -0,0 +1,55 @@
package lnx;
import iron.Scene;
import iron.object.Transform;
using leenkx.object.TransformExtension;
class TrackTimer extends iron.Trait {
var time = 0.0;
var running = false;
var finished = false;
var triggers:Array<Transform> = [];
public function new() {
super();
notifyOnInit(function() {
var canvas = Scene.active.getTrait(leenkx.trait.internal.CanvasScript);
var t = object.transform;
// Retrieve triggers
var t0 = Scene.active.getChild("Trigger0").transform; // Start line
var t1 = Scene.active.getChild("Trigger1").transform;
var t2 = Scene.active.getChild("Trigger2").transform;
var t3 = Scene.active.getChild("Trigger3").transform;
notifyOnUpdate(function() {
if (!running && !finished) {
// Start line crossed, begin lap
running = t.overlap(t0);
}
else {
// Update timer
if (!finished) {
time += iron.system.Time.delta;
var s = Std.int(time);
var ms = Std.int((time - s) * 100);
canvas.getElement("Time").text = s + "." + ms;
}
// Mark touched triggers
if (t.overlap(t1) && triggers.indexOf(t1) == -1) triggers.push(t1);
if (t.overlap(t2) && triggers.indexOf(t2) == -1) triggers.push(t2);
if (t.overlap(t3) && triggers.indexOf(t3) == -1) triggers.push(t3);
// Crossed finish line
if (t.overlap(t0) && triggers.length == 3) {
finished = true;
}
}
});
});
}
}

BIN
race_track/race_track.blend Normal file

Binary file not shown.