fixed sprinting

This commit is contained in:
Hopeless Tyromancy 2026-04-15 20:18:39 -04:00
parent d7e98f9464
commit 68ef854065
2 changed files with 4 additions and 31 deletions

View File

@ -15,36 +15,13 @@ layout(std140, set = 3, binding = 0) uniform UniformBlock {
vec4 cam_pos; vec4 cam_pos;
}; };
float road(float x) { return cos(x); }
vec3 backup(vec2 uv) {
float time = time_padded.x;
float x_scale = time * 12.0;
float y_scale = uv.x;
uv.x *= x_scale;
uv.y *= 2.0;
uv.y -= 1.0;
uv.y /= 0.75;
uv.y /= y_scale;
float y = road(uv.x);
float dist = length(uv.y - y);
vec3 col = vec3(cos(time / 10.0)) - vec3(exp(-dist), cos(dist), sin(dist));
return (0.005 * (1.2 + abs(cos(time)))) / col;
}
const int MAX_MARCH_STEPS = 64; const int MAX_MARCH_STEPS = 64;
const float EPS_DIST = 1e-6; const float EPS_DIST = 1e-6;
float sdf(vec3 point) {
float sdf(vec3 point){
float time = time_padded.x; float time = time_padded.x;
float size = 8.0 + (3.0* sin(time)); return abs(length(point) - (point.x * point.y - point.z));
vec3 s1_local = mod(point, vec3(size)) - vec3(size/2.0);
float s1 = length(s1_local) - 0.3;
return s1;
} }
vec3 getnormal(vec3 p) { vec3 getnormal(vec3 p) {
@ -56,8 +33,6 @@ vec3 getnormal(vec3 p) {
)); ));
} }
vec4 march(vec3 point, vec3 ray, float max_depth) { vec4 march(vec3 point, vec3 ray, float max_depth) {
float totaldist = 0.0; float totaldist = 0.0;
@ -104,8 +79,6 @@ float linearize_depth(vec2 uv) {
} }
void main() { void main() {
vec2 bg = (projection * view * vec4(uv, 1.0, 1.0)).xy;
vec3 b = backup(bg);
float max_depth = linearize_depth(uv); float max_depth = linearize_depth(uv);
vec4 hit = kernel(max_depth); vec4 hit = kernel(max_depth);
if (hit.w > 0.0) { if (hit.w > 0.0) {

View File

@ -44,7 +44,7 @@ void Camera::on_key(SDL_Scancode scancode, bool pressed) {
case SDL_SCANCODE_RIGHT: look_right = pressed; break; case SDL_SCANCODE_RIGHT: look_right = pressed; break;
case SDL_SCANCODE_LSHIFT: case SDL_SCANCODE_LSHIFT:
case SDL_SCANCODE_RSHIFT: case SDL_SCANCODE_RSHIFT:
shifted |= pressed; shifted = pressed;
break; break;
default: break; default: break;
} }