diff options
| author | yum <yum.food.vr@gmail.com> | 2023-08-11 10:40:05 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-08-11 10:40:05 -0700 |
| commit | 6a851e393e02cea8943115db46295d1858338b42 (patch) | |
| tree | 09a4950e310ddf35e2c7b9176228aea57ac5489f | |
| parent | 4efd2f3990e692a56b604c9e0deb735215ea6edc (diff) | |
Add animated ellipsis to shader
Not yet done:
* Animator toggle
* OSC integration
| -rw-r--r-- | GUI/GUI/GUI/Config.cpp | 2 | ||||
| -rw-r--r-- | Shaders/STT_text.cginc | 14 | ||||
| -rw-r--r-- | Shaders/TaSTT_template.shader | 4 | ||||
| -rw-r--r-- | Shaders/ray_march.cginc | 31 |
4 files changed, 39 insertions, 12 deletions
diff --git a/GUI/GUI/GUI/Config.cpp b/GUI/GUI/GUI/Config.cpp index 34e7fd5..3ba6be5 100644 --- a/GUI/GUI/GUI/Config.cpp +++ b/GUI/GUI/GUI/Config.cpp @@ -72,7 +72,7 @@ AppConfig::AppConfig(wxTextCtrl* out) enable_local_beep(true),
enable_browser_src(false),
browser_src_port(8097),
- commit_fuzz_threshold(8),
+ commit_fuzz_threshold(4),
use_cpu(false),
use_builtin(false),
enable_uwu_filter(false),
diff --git a/Shaders/STT_text.cginc b/Shaders/STT_text.cginc index 1e7a96e..b7b4578 100644 --- a/Shaders/STT_text.cginc +++ b/Shaders/STT_text.cginc @@ -71,13 +71,11 @@ float2 GetLetterUV(float2 uv, int nth_letter, // (AddMarginToUV), resulting in long lines on the edge of the display. float lo = margin / 2; float hi = 1.0 - margin / 2; - if (margin != 0 && - (CHAR_FRAC_ROW < lo || - CHAR_FRAC_COL < lo || - CHAR_FRAC_ROW > hi || - CHAR_FRAC_COL > hi)) { - return float2(-1, -1); - } + bool skip_result = (margin != 0) * + !(CHAR_FRAC_ROW > lo * + CHAR_FRAC_COL > lo * + CHAR_FRAC_ROW < hi * + CHAR_FRAC_COL < hi); float LETTER_COL = fmod(nth_letter, floor(texture_cols)); float LETTER_ROW = floor(texture_rows) - floor(nth_letter / floor(texture_cols)); @@ -89,7 +87,7 @@ float2 GetLetterUV(float2 uv, int nth_letter, result.x = LETTER_UV_COL; result.y = LETTER_UV_ROW; - return result; + return lerp(result, -1, skip_result);; } float4 GetLetter(float2 uv) { diff --git a/Shaders/TaSTT_template.shader b/Shaders/TaSTT_template.shader index cf658ea..d97bf1e 100644 --- a/Shaders/TaSTT_template.shader +++ b/Shaders/TaSTT_template.shader @@ -18,9 +18,7 @@ _Frame_Emissive ("Frame emission", Range(0, 1)) = 0.2
_Emerge("Emerge animation time", Range(0, 1)) = 1.0
-
- [MaterialToggle] Enable_Custom_Cubemap("Enable custom cubemap", float) = 0
- Custom_Cubemap("Custom cubemap", Cube) = "" {}
+ [MaterialToggle] _Ellipsis("Show ellipsis", float) = 0
_Font_0x0000_0x1FFF ("_Font 0 (unicode 0x0000 - 0x1FFFF)", 2D) = "white" {}
_Font_0x2000_0x3FFF ("_Font 1 (unicode 0x2000 - 0x3FFFF)", 2D) = "white" {}
diff --git a/Shaders/ray_march.cginc b/Shaders/ray_march.cginc index 5a9524a..d44036f 100644 --- a/Shaders/ray_march.cginc +++ b/Shaders/ray_march.cginc @@ -11,6 +11,7 @@ #include "stt_text.cginc" float _Emerge; +float _Ellipsis; float4 _Text_Color; float _Text_Metallic; @@ -176,6 +177,36 @@ float stt_map(float3 p, out int obj_id, out float2 text_uv) obj_id = lerp(obj_id, OBJ_ID_FRAME, d < dist); dist = min(dist, d); } + { + float3 pp = p; + + float3 xoff = float3(.003, 0, 0); + + float r_small = .0005; + float r_big = .001; + float r_phase = glsl_mod(_Time[1], 1.0); + + float r0_p0r = get_phase_fraction(r_phase, 0, 8); + float r0_p2r = get_phase_fraction(r_phase, 3, 8); + float r1_p0r = get_phase_fraction(glsl_mod(r_phase + .25, 1.0), 0, 8); + float r1_p2r = get_phase_fraction(glsl_mod(r_phase + .25, 1.0), 3, 8); + float r2_p0r = get_phase_fraction(glsl_mod(r_phase + .50, 1.0), 0, 8); + float r2_p2r = get_phase_fraction(glsl_mod(r_phase + .50, 1.0), 3, 8); + + float r0 = lerp(r_small, r_big, r0_p0r * (1 - r0_p2r)); + float r1 = lerp(r_small, r_big, r1_p0r * (1 - r1_p2r)); + float r2 = lerp(r_small, r_big, r2_p0r * (1 - r2_p2r)); + + pp -= box_center_g; + + float d = distance_from_sphere(pp - xoff, 0, r0); + d = min(d, distance_from_sphere(pp, 0, r1)); + d = min(d, distance_from_sphere(pp + xoff, 0, r2)); + d = lerp(1000, d, _Ellipsis); + + obj_id = lerp(obj_id, OBJ_ID_FRAME, d < dist); + dist = min(dist, d); + } return dist; } |
