Replay fixes (#17)

Fixes to work with our game.
Replay fixes and improvements.
Removed shape names (save memory).
B3_DEFAULT_CATEGORY_BITS  is now UINT64_MAX to make selection easier.
This commit is contained in:
Erin Catto 2026-06-26 21:10:10 -07:00 • committed by GitHub
commit 0c8ef46931
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 5653 additions and 3853 deletions

View file

@ -135,12 +135,26 @@ vec3 preethamSky(vec3 view_dir, vec3 sun_dir, float turbidity)
return max(rgb, vec3(0.0));
}
// Rotate a sky direction from simulation space into the model's Y-up
// frame. Y-up sims pass through. Z-up sims need Rx(-90), (x,y,z) ->
// (x, z, -y), the same map the renderer folds into its view transform so
// sim +Z becomes view up. zUp is 0.0 or 1.0. View ray and sun rotate
// together so their relative angle is preserved, only horizon and zenith
// reorient.
vec3 preethamToYUp(vec3 v, float zUp)
{
return mix(v, vec3(v.x, v.z, - v.y), zUp);
}
// Convenience wrapper: raw Preetham scaled by the empirical luminance
// factor and the caller's below-horizon fade weight (1 above horizon,
// 0 below). The sky backdrop shader and the IBL sky cubemap both call
// this so they're guaranteed to agree pixel-for-pixel.
vec3 preethamSkyScaled(vec3 view_dir, vec3 sun_dir, float turbidity, float fade)
// this so they're guaranteed to agree pixel-for-pixel. zUp reorients the
// model for a z-up simulation, see preethamToYUp.
vec3 preethamSkyScaled(vec3 view_dir, vec3 sun_dir, float turbidity, float fade, float zUp)
{
return preethamSky(view_dir, sun_dir, turbidity) * PREETHAM_LUMINANCE_SCALE * fade;
vec3 v = preethamToYUp(view_dir, zUp);
vec3 s = preethamToYUp(sun_dir, zUp);
return preethamSky(v, s, turbidity) * PREETHAM_LUMINANCE_SCALE * fade;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -72,7 +72,7 @@ void main()
layout(binding = 1)uniform sky_ub_pass
{
vec4 sun_dir_world; // .xyz = world dir TO sun (normalized), .w = below-horizon fade weight [0,1]
vec4 sky_params; // .x = turbidity (Preetham T), .yzw = reserved
vec4 sky_params; // .x = turbidity (Preetham T), .y = z-up flag (0 or 1), .zw = reserved
vec4 camera_pos; // .xyz = world camera position, .w = unused
};
@ -94,7 +94,7 @@ void main()
// preethamSkyScaled so the IBL sky cubemap (sky_to_cube.glsl) sees
// the same backdrop. Fade weight comes from the C side via
// sun_dir_world.w (1 above horizon, 0 below).
vec3 rgb = preethamSkyScaled(view_dir, sun_dir, sky_params.x, sun_dir_world.w);
vec3 rgb = preethamSkyScaled(view_dir, sun_dir, sky_params.x, sun_dir_world.w, sky_params.y);
out_color = vec4(rgb, 1.0);
}

View file

@ -46,10 +46,10 @@ void main()
layout(binding = 0)uniform ub_face
{
// Three rows of a mat3 basis. Stored as vec4 for std140 alignment,
// .xyz are the axis vectors, .w is unused (.w on face_forward
// doubles as the below-horizon fade weight to save a UBO slot).
// .xyz are the axis vectors. The .w lanes carry scalars to save UBO
// slots: face_up.w = z-up flag, face_forward.w = below-horizon fade.
vec4 face_right; // .xyz = world-space face right axis
vec4 face_up; // .xyz = world-space face up axis
vec4 face_up; // .xyz = world-space face up axis, .w = z-up flag (0 or 1)
vec4 face_forward; // .xyz = world-space face forward axis, .w = fade weight
vec4 sun_dir_world; // .xyz = world-space direction TO sun, .w = turbidity
};
@ -62,7 +62,7 @@ void main()
vec2 uv = v_uv * 2.0 - 1.0; // [-1, +1] across the face
vec3 dir = normalize(face_forward.xyz + uv.x * face_right.xyz + uv.y * face_up.xyz);
vec3 rgb = preethamSkyScaled(dir, sun_dir_world.xyz, sun_dir_world.w, face_forward.w);
vec3 rgb = preethamSkyScaled(dir, sun_dir_world.xyz, sun_dir_world.w, face_forward.w, face_up.w);
out_color = vec4(rgb, 1.0);
}
#pragma sokol @end