small improvements

This commit is contained in:
Tuomas Katajisto 2025-10-25 10:17:44 +03:00
parent 19803720a6
commit 2ddff03189
6 changed files with 116 additions and 65 deletions

View File

@ -65,6 +65,7 @@ draw_editor_ui :: (theme: *GR.Overall_Theme) {
draw_console(theme);
draw_profiler();
draw_texture_debugger(theme);
draw_postprocess_popup(theme);
GR.draw_popups();
immediate_flush();
}

View File

@ -2,6 +2,9 @@
subwindow : GR.Subwindow_Info;
subwindow_initted : bool = false;
pp_subwindow : GR.Subwindow_Info;
pp_subwindow_initted : bool = false;
// @Hack: This is probably kinda a bad idea, I don't really know atm how else to get the theme into the subwindow.
theme_ptr : GR.Overall_Theme;
@ -42,6 +45,24 @@ draw_subwindow_texture_debug :: (state: *GR.Subwindow_State, r: GR.Rect, data: *
immediate_flush();
}
draw_subwindow_post_process :: (state: *GR.Subwindow_State, r: GR.Rect, data: *void) {
r2 := r;
ui_add_mouse_occluder(r);
r3 := r;
r3.h = ui_h(5,0);
r2.h -= r3.h;
r2.y += r3.h;
if GR.button(r3, "Save postprocessing", *theme_ptr.button_theme) {
#if OS != .WASM {
file :: #import "File";
json := Jaison.json_write_string(current_post_process, " ");
file.write_entire_file("./game/resources/postprocess.json", json);
}
}
autoedit(r2, *current_post_process, *theme_ptr);
}
#scope_export
draw_texture_debug :: () {
@ -51,6 +72,26 @@ toggle_texdebug :: () {
subwindow.open = !subwindow.open;
} @Command
toggle_pp :: () {
pp_subwindow.open = !pp_subwindow.open;
} @Command
draw_postprocess_popup :: (theme: *GR.Overall_Theme) {
if !pp_subwindow.open then return;
if !pp_subwindow_initted {
theme_ptr = theme;
r := GR.get_rect(ui_w(40, 0), ui_w(40, 0), ui_h(50,0), ui_h(50,0));
pp_subwindow.rect = r;
pp_subwindow.draw = draw_subwindow_post_process;
pp_subwindow.title_text = "Post Process";
pp_subwindow.open = false;
pp_subwindow_initted = true;
}
if pp_subwindow.open { // The Subwindow starts open, but pressing the Close button can close it.
pp_subwindow_state := GR.add_subwindow(*pp_subwindow, *theme.subwindow_theme);
}
}
draw_texture_debugger :: (theme: *GR.Overall_Theme) {
if !subwindow.open then return;
if !subwindow_initted {

View File

@ -118,10 +118,12 @@ init_after_asset_pack :: () {
}
}
init_editor();
game_init();
lworlds();
init_rendering();
load_post_process_from_pack();
// We want to do this last.
game_init();
}
is_in_reflection_pass : bool = false;

View File

@ -260,14 +260,14 @@ vs_plane_source_glsl430 := u8.[
_367.y = 1.0 - _367.y;
vec3 param_1 = normalize(pos.xyz);
vec3 param_2 = _146.sunPosition;
float _419 = smoothstep(750.0, 1000.0, length(pos.xz));
frag_color = vec4(mix((mix(((_146.waterColor * (dot(_274, _290) + ((9.9999999747524270787835121154785e-07 * float(_309.is_reflection)) * _278.shininess))) * _146.sunLightColor) * _146.sunIntensity, texture(reftex_refsmp, _367).xyz, vec3(_335)) + ((_146.sunLightColor * _146.sunIntensity) * pow(max(0.0, dot(normalize(_290 + _285), _274)), 32.0))) * 1.0, sky(param_1, param_2) * _146.skyIntensity, vec3(_419)), mix(mix(0.300000011920928955078125, 0.5, _335), 1.0, _419));
float _421 = smoothstep(750.0, 1000.0, length(pos.xz));
frag_color = vec4(mix((mix(((_146.waterColor * (dot(_274, _290) + ((9.9999999747524270787835121154785e-07 * float(_309.is_reflection)) * _278.shininess))) * _146.sunLightColor) * _146.sunIntensity, texture(reftex_refsmp, _367).xyz, vec3(min(1.0, _335 * 3.0))) + ((_146.sunLightColor * _146.sunIntensity) * pow(max(0.0, dot(normalize(_290 + _285), _274)), 32.0))) * 1.0, sky(param_1, param_2) * _146.skyIntensity, vec3(_421)), mix(mix(0.300000011920928955078125, 0.5, _335), 1.0, _421));
}
else
{
vec2 param_3 = (pos.xz * 0.0500000007450580596923828125) + vec2(_146.time * 0.00999999977648258209228515625);
float _449 = fbm(param_3);
frag_color = vec4(_146.deepColor * mix(0.800000011920928955078125, 1.2000000476837158203125, _449), 1.0);
float _451 = fbm(param_3);
frag_color = vec4(_146.deepColor * mix(0.800000011920928955078125, 1.2000000476837158203125, _451), 1.0);
}
}
@ -469,7 +469,7 @@ fs_plane_source_glsl430 := u8.[
0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,
0x3d,0x20,0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,0x50,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x20,0x5f,0x34,0x31,0x39,0x20,0x3d,0x20,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,
0x74,0x20,0x5f,0x34,0x32,0x31,0x20,0x3d,0x20,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,
0x74,0x65,0x70,0x28,0x37,0x35,0x30,0x2e,0x30,0x2c,0x20,0x31,0x30,0x30,0x30,0x2e,
0x30,0x2c,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28,0x70,0x6f,0x73,0x2e,0x78,0x7a,
0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,
@ -487,7 +487,8 @@ fs_plane_source_glsl430 := u8.[
0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,
0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x72,0x65,0x66,0x74,0x65,0x78,
0x5f,0x72,0x65,0x66,0x73,0x6d,0x70,0x2c,0x20,0x5f,0x33,0x36,0x37,0x29,0x2e,0x78,
0x79,0x7a,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x33,0x33,0x35,0x29,0x29,0x20,
0x79,0x7a,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x6d,0x69,0x6e,0x28,0x31,0x2e,0x30,
0x2c,0x20,0x5f,0x33,0x33,0x35,0x20,0x2a,0x20,0x33,0x2e,0x30,0x29,0x29,0x29,0x20,
0x2b,0x20,0x28,0x28,0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,0x4c,0x69,0x67,0x68,
0x74,0x43,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,
0x6e,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x29,0x20,0x2a,0x20,0x70,0x6f,
@ -498,10 +499,10 @@ fs_plane_source_glsl430 := u8.[
0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,
0x5f,0x32,0x29,0x20,0x2a,0x20,0x5f,0x31,0x34,0x36,0x2e,0x73,0x6b,0x79,0x49,0x6e,
0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x34,
0x31,0x39,0x29,0x29,0x2c,0x20,0x6d,0x69,0x78,0x28,0x6d,0x69,0x78,0x28,0x30,0x2e,
0x32,0x31,0x29,0x29,0x2c,0x20,0x6d,0x69,0x78,0x28,0x6d,0x69,0x78,0x28,0x30,0x2e,
0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,
0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x5f,
0x33,0x33,0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x34,0x31,0x39,0x29,
0x33,0x33,0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x34,0x32,0x31,0x29,
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,
0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x28,
@ -511,7 +512,7 @@ fs_plane_source_glsl430 := u8.[
0x5f,0x31,0x34,0x36,0x2e,0x74,0x69,0x6d,0x65,0x20,0x2a,0x20,0x30,0x2e,0x30,0x30,
0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,
0x30,0x39,0x32,0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x34,0x39,
0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x35,0x31,
0x20,0x3d,0x20,0x66,0x62,0x6d,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,
0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,0x34,0x36,0x2e,
@ -519,7 +520,7 @@ fs_plane_source_glsl430 := u8.[
0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,
0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,0x2e,0x32,0x30,
0x30,0x30,0x30,0x30,0x30,0x34,0x37,0x36,0x38,0x33,0x37,0x31,0x35,0x38,0x32,0x30,
0x33,0x31,0x32,0x35,0x2c,0x20,0x5f,0x34,0x34,0x39,0x29,0x2c,0x20,0x31,0x2e,0x30,
0x33,0x31,0x32,0x35,0x2c,0x20,0x5f,0x34,0x35,0x31,0x29,0x2c,0x20,0x31,0x2e,0x30,
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x00,
];
/*
@ -684,14 +685,14 @@ vs_plane_source_glsl300es := u8.[
_367.y = 1.0 - _367.y;
highp vec3 param_1 = normalize(pos.xyz);
highp vec3 param_2 = _146.sunPosition;
highp float _419 = smoothstep(750.0, 1000.0, length(pos.xz));
frag_color = vec4(mix((mix(((_146.waterColor * (dot(_274, _290) + ((9.9999999747524270787835121154785e-07 * float(_309.is_reflection)) * _278.shininess))) * _146.sunLightColor) * _146.sunIntensity, texture(reftex_refsmp, _367).xyz, vec3(_335)) + ((_146.sunLightColor * _146.sunIntensity) * pow(max(0.0, dot(normalize(_290 + _285), _274)), 32.0))) * 1.0, sky(param_1, param_2) * _146.skyIntensity, vec3(_419)), mix(mix(0.300000011920928955078125, 0.5, _335), 1.0, _419));
highp float _421 = smoothstep(750.0, 1000.0, length(pos.xz));
frag_color = vec4(mix((mix(((_146.waterColor * (dot(_274, _290) + ((9.9999999747524270787835121154785e-07 * float(_309.is_reflection)) * _278.shininess))) * _146.sunLightColor) * _146.sunIntensity, texture(reftex_refsmp, _367).xyz, vec3(min(1.0, _335 * 3.0))) + ((_146.sunLightColor * _146.sunIntensity) * pow(max(0.0, dot(normalize(_290 + _285), _274)), 32.0))) * 1.0, sky(param_1, param_2) * _146.skyIntensity, vec3(_421)), mix(mix(0.300000011920928955078125, 0.5, _335), 1.0, _421));
}
else
{
highp vec2 param_3 = (pos.xz * 0.0500000007450580596923828125) + vec2(_146.time * 0.00999999977648258209228515625);
highp float _449 = fbm(param_3);
frag_color = vec4(_146.deepColor * mix(0.800000011920928955078125, 1.2000000476837158203125, _449), 1.0);
highp float _451 = fbm(param_3);
frag_color = vec4(_146.deepColor * mix(0.800000011920928955078125, 1.2000000476837158203125, _451), 1.0);
}
}
@ -910,7 +911,7 @@ fs_plane_source_glsl300es := u8.[
0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,
0x31,0x39,0x20,0x3d,0x20,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,
0x32,0x31,0x20,0x3d,0x20,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,
0x37,0x35,0x30,0x2e,0x30,0x2c,0x20,0x31,0x30,0x30,0x30,0x2e,0x30,0x2c,0x20,0x6c,
0x65,0x6e,0x67,0x74,0x68,0x28,0x70,0x6f,0x73,0x2e,0x78,0x7a,0x29,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
@ -928,7 +929,8 @@ fs_plane_source_glsl300es := u8.[
0x73,0x75,0x6e,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x74,0x65,
0x78,0x74,0x75,0x72,0x65,0x28,0x72,0x65,0x66,0x74,0x65,0x78,0x5f,0x72,0x65,0x66,
0x73,0x6d,0x70,0x2c,0x20,0x5f,0x33,0x36,0x37,0x29,0x2e,0x78,0x79,0x7a,0x2c,0x20,
0x76,0x65,0x63,0x33,0x28,0x5f,0x33,0x33,0x35,0x29,0x29,0x20,0x2b,0x20,0x28,0x28,
0x76,0x65,0x63,0x33,0x28,0x6d,0x69,0x6e,0x28,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x33,
0x33,0x35,0x20,0x2a,0x20,0x33,0x2e,0x30,0x29,0x29,0x29,0x20,0x2b,0x20,0x28,0x28,
0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,0x4c,0x69,0x67,0x68,0x74,0x43,0x6f,0x6c,
0x6f,0x72,0x20,0x2a,0x20,0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,0x49,0x6e,0x74,
0x65,0x6e,0x73,0x69,0x74,0x79,0x29,0x20,0x2a,0x20,0x70,0x6f,0x77,0x28,0x6d,0x61,
@ -938,11 +940,11 @@ fs_plane_source_glsl300es := u8.[
0x29,0x29,0x20,0x2a,0x20,0x31,0x2e,0x30,0x2c,0x20,0x73,0x6b,0x79,0x28,0x70,0x61,
0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x20,
0x2a,0x20,0x5f,0x31,0x34,0x36,0x2e,0x73,0x6b,0x79,0x49,0x6e,0x74,0x65,0x6e,0x73,
0x69,0x74,0x79,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x34,0x31,0x39,0x29,0x29,
0x69,0x74,0x79,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x34,0x32,0x31,0x29,0x29,
0x2c,0x20,0x6d,0x69,0x78,0x28,0x6d,0x69,0x78,0x28,0x30,0x2e,0x33,0x30,0x30,0x30,
0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,
0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x5f,0x33,0x33,0x35,0x29,
0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x34,0x31,0x39,0x29,0x29,0x3b,0x0a,0x20,
0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x34,0x32,0x31,0x29,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,
0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,
@ -953,7 +955,7 @@ fs_plane_source_glsl300es := u8.[
0x30,0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,
0x38,0x32,0x30,0x39,0x32,0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x20,0x5f,0x34,0x34,0x39,0x20,0x3d,0x20,0x66,0x62,0x6d,0x28,0x70,
0x6f,0x61,0x74,0x20,0x5f,0x34,0x35,0x31,0x20,0x3d,0x20,0x66,0x62,0x6d,0x28,0x70,
0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,
0x63,0x34,0x28,0x5f,0x31,0x34,0x36,0x2e,0x64,0x65,0x65,0x70,0x43,0x6f,0x6c,0x6f,
@ -961,7 +963,7 @@ fs_plane_source_glsl300es := u8.[
0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,
0x32,0x35,0x2c,0x20,0x31,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x34,0x37,0x36,
0x38,0x33,0x37,0x31,0x35,0x38,0x32,0x30,0x33,0x31,0x32,0x35,0x2c,0x20,0x5f,0x34,
0x34,0x39,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,
0x35,0x31,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,
0x0a,0x7d,0x0a,0x0a,0x00,
];
/*
@ -1172,14 +1174,14 @@ vs_plane_source_metal_macos := u8.[
_367.y = 1.0 - _367.y;
float3 param_1 = fast::normalize(in.pos.xyz);
float3 param_2 = float3(_146.sunPosition);
float _419 = smoothstep(750.0, 1000.0, length(in.pos.xz));
out.frag_color = float4(mix((mix(((_146.waterColor * (dot(_274, _290) + ((9.9999999747524270787835121154785e-07 * float(_309.is_reflection)) * _278.shininess))) * _146.sunLightColor) * _146.sunIntensity, reftex.sample(refsmp, _367).xyz, float3(_335)) + ((_146.sunLightColor * _146.sunIntensity) * powr(fast::max(0.0, dot(fast::normalize(_290 + _285), _274)), 32.0))) * 1.0, sky(param_1, param_2, _146) * _146.skyIntensity, float3(_419)), mix(mix(0.300000011920928955078125, 0.5, _335), 1.0, _419));
float _421 = smoothstep(750.0, 1000.0, length(in.pos.xz));
out.frag_color = float4(mix((mix(((_146.waterColor * (dot(_274, _290) + ((9.9999999747524270787835121154785e-07 * float(_309.is_reflection)) * _278.shininess))) * _146.sunLightColor) * _146.sunIntensity, reftex.sample(refsmp, _367).xyz, float3(fast::min(1.0, _335 * 3.0))) + ((_146.sunLightColor * _146.sunIntensity) * powr(fast::max(0.0, dot(fast::normalize(_290 + _285), _274)), 32.0))) * 1.0, sky(param_1, param_2, _146) * _146.skyIntensity, float3(_421)), mix(mix(0.300000011920928955078125, 0.5, _335), 1.0, _421));
}
else
{
float2 param_3 = (in.pos.xz * 0.0500000007450580596923828125) + float2(_146.time * 0.00999999977648258209228515625);
float _449 = fbm(param_3);
out.frag_color = float4(float3(_146.deepColor) * mix(0.800000011920928955078125, 1.2000000476837158203125, _449), 1.0);
float _451 = fbm(param_3);
out.frag_color = float4(float3(_146.deepColor) * mix(0.800000011920928955078125, 1.2000000476837158203125, _451), 1.0);
}
return out;
}
@ -1434,7 +1436,7 @@ fs_plane_source_metal_macos := u8.[
0x61,0x74,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x33,0x28,0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,0x50,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x31,0x39,0x20,0x3d,0x20,0x73,0x6d,0x6f,
0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x32,0x31,0x20,0x3d,0x20,0x73,0x6d,0x6f,
0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x37,0x35,0x30,0x2e,0x30,0x2c,0x20,0x31,
0x30,0x30,0x30,0x2e,0x30,0x2c,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28,0x69,0x6e,
0x2e,0x70,0x6f,0x73,0x2e,0x78,0x7a,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
@ -1453,44 +1455,45 @@ fs_plane_source_metal_macos := u8.[
0x2e,0x73,0x75,0x6e,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x72,
0x65,0x66,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x72,0x65,0x66,
0x73,0x6d,0x70,0x2c,0x20,0x5f,0x33,0x36,0x37,0x29,0x2e,0x78,0x79,0x7a,0x2c,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x33,0x33,0x35,0x29,0x29,0x20,0x2b,0x20,
0x28,0x28,0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,0x4c,0x69,0x67,0x68,0x74,0x43,
0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,0x49,
0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x29,0x20,0x2a,0x20,0x70,0x6f,0x77,0x72,
0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x30,0x2e,0x30,0x2c,0x20,
0x64,0x6f,0x74,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
0x69,0x7a,0x65,0x28,0x5f,0x32,0x39,0x30,0x20,0x2b,0x20,0x5f,0x32,0x38,0x35,0x29,
0x2c,0x20,0x5f,0x32,0x37,0x34,0x29,0x29,0x2c,0x20,0x33,0x32,0x2e,0x30,0x29,0x29,
0x29,0x20,0x2a,0x20,0x31,0x2e,0x30,0x2c,0x20,0x73,0x6b,0x79,0x28,0x70,0x61,0x72,
0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x5f,
0x31,0x34,0x36,0x29,0x20,0x2a,0x20,0x5f,0x31,0x34,0x36,0x2e,0x73,0x6b,0x79,0x49,
0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,
0x28,0x5f,0x34,0x31,0x39,0x29,0x29,0x2c,0x20,0x6d,0x69,0x78,0x28,0x6d,0x69,0x78,
0x28,0x30,0x2e,0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,
0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,
0x2c,0x20,0x5f,0x33,0x33,0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x34,
0x31,0x39,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,
0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,
0x33,0x20,0x3d,0x20,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2e,0x78,0x7a,0x20,0x2a,
0x20,0x30,0x2e,0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x37,0x34,0x35,0x30,
0x35,0x38,0x30,0x35,0x39,0x36,0x39,0x32,0x33,0x38,0x32,0x38,0x31,0x32,0x35,0x29,
0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x5f,0x31,0x34,0x36,0x2e,0x74,
0x69,0x6d,0x65,0x20,0x2a,0x20,0x30,0x2e,0x30,0x30,0x39,0x39,0x39,0x39,0x39,0x39,
0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,0x39,0x32,0x32,0x38,0x35,
0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x34,0x39,0x20,0x3d,0x20,0x66,0x62,0x6d,
0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x66,0x6c,0x6f,0x61,0x74,
0x33,0x28,0x5f,0x31,0x34,0x36,0x2e,0x64,0x65,0x65,0x70,0x43,0x6f,0x6c,0x6f,0x72,
0x29,0x20,0x2a,0x20,0x6d,0x69,0x78,0x28,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,
0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,
0x32,0x35,0x2c,0x20,0x31,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,0x34,0x37,0x36,
0x38,0x33,0x37,0x31,0x35,0x38,0x32,0x30,0x33,0x31,0x32,0x35,0x2c,0x20,0x5f,0x34,
0x34,0x39,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,
0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,
0x0a,0x7d,0x0a,0x0a,0x00,
0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x69,0x6e,
0x28,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x33,0x33,0x35,0x20,0x2a,0x20,0x33,0x2e,0x30,
0x29,0x29,0x29,0x20,0x2b,0x20,0x28,0x28,0x5f,0x31,0x34,0x36,0x2e,0x73,0x75,0x6e,
0x4c,0x69,0x67,0x68,0x74,0x43,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,0x5f,0x31,0x34,
0x36,0x2e,0x73,0x75,0x6e,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x29,0x20,
0x2a,0x20,0x70,0x6f,0x77,0x72,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,
0x28,0x30,0x2e,0x30,0x2c,0x20,0x64,0x6f,0x74,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x32,0x39,0x30,0x20,0x2b,
0x20,0x5f,0x32,0x38,0x35,0x29,0x2c,0x20,0x5f,0x32,0x37,0x34,0x29,0x29,0x2c,0x20,
0x33,0x32,0x2e,0x30,0x29,0x29,0x29,0x20,0x2a,0x20,0x31,0x2e,0x30,0x2c,0x20,0x73,
0x6b,0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,
0x6d,0x5f,0x32,0x2c,0x20,0x5f,0x31,0x34,0x36,0x29,0x20,0x2a,0x20,0x5f,0x31,0x34,
0x36,0x2e,0x73,0x6b,0x79,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x34,0x32,0x31,0x29,0x29,0x2c,0x20,0x6d,
0x69,0x78,0x28,0x6d,0x69,0x78,0x28,0x30,0x2e,0x33,0x30,0x30,0x30,0x30,0x30,0x30,
0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,
0x35,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x5f,0x33,0x33,0x35,0x29,0x2c,0x20,0x31,
0x2e,0x30,0x2c,0x20,0x5f,0x34,0x32,0x31,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,
0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x28,0x69,0x6e,0x2e,0x70,0x6f,
0x73,0x2e,0x78,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x30,0x35,0x30,0x30,0x30,0x30,0x30,
0x30,0x30,0x37,0x34,0x35,0x30,0x35,0x38,0x30,0x35,0x39,0x36,0x39,0x32,0x33,0x38,
0x32,0x38,0x31,0x32,0x35,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,
0x5f,0x31,0x34,0x36,0x2e,0x74,0x69,0x6d,0x65,0x20,0x2a,0x20,0x30,0x2e,0x30,0x30,
0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,
0x30,0x39,0x32,0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x35,0x31,
0x20,0x3d,0x20,0x66,0x62,0x6d,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x31,0x34,0x36,0x2e,0x64,0x65,0x65,
0x70,0x43,0x6f,0x6c,0x6f,0x72,0x29,0x20,0x2a,0x20,0x6d,0x69,0x78,0x28,0x30,0x2e,
0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,
0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x31,0x2e,0x32,0x30,0x30,0x30,
0x30,0x30,0x30,0x34,0x37,0x36,0x38,0x33,0x37,0x31,0x35,0x38,0x32,0x30,0x33,0x31,
0x32,0x35,0x2c,0x20,0x5f,0x34,0x35,0x31,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
];
plane_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc: sg_shader_desc;

View File

@ -141,7 +141,7 @@ void main() {
screen_uv.y = 1.0 - screen_uv.y;
vec3 reflected_color = texture(sampler2D(reftex, refsmp), screen_uv).rgb;
vec3 surface_color = mix(refracted_color, reflected_color, fresnel);
vec3 surface_color = mix(refracted_color, reflected_color, min(1.0, fresnel * 3));
vec3 final_color = (surface_color + specular_highlight) * shadow_factor;
float refraction_alpha = 0.3;
float reflection_alpha = 0.5;

View File

@ -27,6 +27,10 @@ lworld :: (name: string) {
}
worldptr := table_find_pointer(*world_table, name);
if !worldptr {
print("Did not find world: %...\n", name);
return;
}
current_world.world = worldptr;
current_world.valid = true;
} @Command;