From 480c261f391a6896ba3f4f83092c9d2c5105b337 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 16:34:57 +0200 Subject: [PATCH] fix sdf sample for wgpu (shader used a reserved keyword) --- sapp/CMakeLists.txt | 28 ++++++++++++++-------------- sapp/sdf-sapp.glsl | 2 -- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/sapp/CMakeLists.txt b/sapp/CMakeLists.txt index 1151d5b8..a4111549 100644 --- a/sapp/CMakeLists.txt +++ b/sapp/CMakeLists.txt @@ -486,20 +486,20 @@ fips_end_app() # fips_deps(sokol) #fips_end_app() # -#fips_ide_group(Samples) -#fips_begin_app(sdf-sapp windowed) -# fips_files(sdf-sapp.c) -# sokol_shader(sdf-sapp.glsl ${slang}) -# fips_deps(sokol) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(sdf-sapp-ui windowed) -# fips_files(sdf-sapp.c) -# sokol_shader(sdf-sapp.glsl ${slang}) -# fips_deps(sokol dbgui) -# target_compile_definitions(sdf-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# +fips_ide_group(Samples) +fips_begin_app(sdf-sapp windowed) + fips_files(sdf-sapp.c) + sokol_shader(sdf-sapp.glsl ${slang}) + fips_deps(sokol) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(sdf-sapp-ui windowed) + fips_files(sdf-sapp.c) + sokol_shader(sdf-sapp.glsl ${slang}) + fips_deps(sokol dbgui) + target_compile_definitions(sdf-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + #fips_ide_group(Samples) #fips_begin_app(shapes-sapp windowed) # fips_files(shapes-sapp.c) diff --git a/sapp/sdf-sapp.glsl b/sapp/sdf-sapp.glsl index 5ef6bbfc..c0bd6984 100644 --- a/sapp/sdf-sapp.glsl +++ b/sapp/sdf-sapp.glsl @@ -120,7 +120,6 @@ vec3 calc_color(vec3 ro, vec3 rd, float t, vec4 tra) { vec3 pos = ro + rd * t; vec3 nrm = surface_normal(pos, t); vec3 hal = normalize(light1 - rd); - vec3 ref = reflect(rd, nrm); float occ = clamp(0.05 * log(tra.x), 0.0, 1.0); float fac = clamp(1.0 + dot(rd, nrm), 0.0, 1.0); @@ -183,4 +182,3 @@ void main() { @end @program sdf vs fs -