quick edit to disable dof in trile editor

This commit is contained in:
Tuomas Katajisto 2026-07-26 14:11:12 +03:00
parent 9b4209b300
commit a5c617d2e4
5 changed files with 1033 additions and 993 deletions

View File

@ -107,8 +107,10 @@ tick_editor_ui :: () {
#if OS != .WASM { #if OS != .WASM {
if in_editor_view { if in_editor_view {
disable_dof_post_process = false;
if current_editor_view == { if current_editor_view == {
case .Trile_Editor; case .Trile_Editor;
disable_dof_post_process = true;
tick_trile_editor(); tick_trile_editor();
case .Level_Editor; case .Level_Editor;
tick_level_editor(); tick_level_editor();

View File

@ -736,6 +736,7 @@ backend_process_command_buckets :: () {
} }
sg_apply_uniforms(UB_post_process_config, *(sg_range.{ ptr = *post_process_config_uniform, size = size_of(type_of(post_process_config_uniform)) })); sg_apply_uniforms(UB_post_process_config, *(sg_range.{ ptr = *post_process_config_uniform, size = size_of(type_of(post_process_config_uniform)) }));
dof_config_uniform : Dof_Config; dof_config_uniform : Dof_Config;
dof_config_uniform.dof_disabled = ifx disable_dof_post_process then cast(s32)1 else cast(s32)0;
dof_config_uniform.dof_max = current_post_process.dof_max; dof_config_uniform.dof_max = current_post_process.dof_max;
dof_config_uniform.dof_point = current_post_process.dof_point; dof_config_uniform.dof_point = current_post_process.dof_point;
sg_apply_uniforms(UB_dof_config, *(sg_range.{ ptr = *dof_config_uniform, size = size_of(type_of(dof_config_uniform)) })); sg_apply_uniforms(UB_dof_config, *(sg_range.{ ptr = *dof_config_uniform, size = size_of(type_of(dof_config_uniform)) }));

View File

@ -1,3 +1,5 @@
disable_dof_post_process : bool = false;
Post_Process :: struct { Post_Process :: struct {
exposure : float = 1.0; @Slider,0,3,0.1; exposure : float = 1.0; @Slider,0,3,0.1;
contrast : float = 1.0; @Slider,0,3,0.1; contrast : float = 1.0; @Slider,0,3,0.1;

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@ layout(binding = 4) uniform texture2D pos_buf;
layout(binding = 4) uniform sampler pos_smp; layout(binding = 4) uniform sampler pos_smp;
layout(binding=1) uniform dof_config { layout(binding=1) uniform dof_config {
int dof_disabled;
float dof_max; float dof_max;
float dof_point; float dof_point;
}; };
@ -131,11 +132,13 @@ void main() {
sampled_color_hdr = texture(sampler2D(pptex, ppsmp), distorted_texcoord).rgb; sampled_color_hdr = texture(sampler2D(pptex, ppsmp), distorted_texcoord).rgb;
} }
if(dof_disabled == 0) {
float view_z = texture(sampler2D(pos_buf, pos_smp), distorted_texcoord).z; float view_z = texture(sampler2D(pos_buf, pos_smp), distorted_texcoord).z;
float depth = abs(view_z); float depth = abs(view_z);
float coc = smoothstep(0.0, 1.0, abs(depth - dof_point) / max(dof_max, 0.0001)); float coc = smoothstep(0.0, 1.0, abs(depth - dof_point) / max(dof_max, 0.0001));
vec3 dof_blurred = texture(sampler2D(dof_tex, dof_smp), distorted_texcoord).rgb; vec3 dof_blurred = texture(sampler2D(dof_tex, dof_smp), distorted_texcoord).rgb;
sampled_color_hdr = mix(sampled_color_hdr, dof_blurred, coc); sampled_color_hdr = mix(sampled_color_hdr, dof_blurred, coc);
}
vec3 bloom_color = texture(sampler2D(bloom_tex, bloom_smp), distorted_texcoord).rgb; vec3 bloom_color = texture(sampler2D(bloom_tex, bloom_smp), distorted_texcoord).rgb;
vec3 color_hdr = (sampled_color_hdr + bloom_color * bloom_amount) * exposure; vec3 color_hdr = (sampled_color_hdr + bloom_color * bloom_amount) * exposure;