feat: establish android particle field rendering loop
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
OpenAI Codex
2026-08-31 10:41:12 +08:00
parent 1ec4470114
commit 0b076c6d52
25 changed files with 816 additions and 63 deletions

View File

@@ -7,6 +7,8 @@ layout (std140) uniform ParticleGpuValidationUBO {
uniform sampler2D u_previous;
uniform sampler2D u_mask_texture;
uniform sampler2D u_field_texture;
uniform sampler2D u_state_texture;
in vec2 v_uv;
in vec2 v_world;
@@ -15,15 +17,27 @@ void main() {
float mode = u_pass.x;
if (mode < 0.5) {
// State pass: deterministic GPU-only state evolution.
fragColor = vec4(fract(previous.r + 0.03125), v_uv, 1.0);
// 40-01: State A/B samples the uploaded OfflineFixture Particle Field.
// RG stores field-normalized position, B stores age, and the Field
// texture encodes canonical U-east/V-north at that geographic sample.
vec2 position = previous.rg;
if (previous.a < 0.5) position = v_uv;
vec2 velocity = texture(u_field_texture, position).rg * 2.0 - 1.0;
position = fract(position + velocity * u_pass.y * 0.004);
if (any(isnan(velocity))) position = v_uv;
fragColor = vec4(position, fract(previous.b + 0.03125 * u_pass.y), 1.0);
} else if (mode < 1.5) {
// Trail pass: fade the previous trail and add a moving validation marker.
float marker = 1.0 - smoothstep(0.0, u_marker.z, distance(v_uv, u_marker.xy));
// The trail consumes State B/A written by the real field-sampling pass.
// Four deterministic texels are enough for the Stage A visual proof.
float marker = 0.0;
marker = max(marker, 1.0 - smoothstep(0.0, u_marker.z, distance(v_uv, texture(u_state_texture, vec2(0.125, 0.125)).rg)));
marker = max(marker, 1.0 - smoothstep(0.0, u_marker.z, distance(v_uv, texture(u_state_texture, vec2(0.375, 0.375)).rg)));
marker = max(marker, 1.0 - smoothstep(0.0, u_marker.z, distance(v_uv, texture(u_state_texture, vec2(0.625, 0.625)).rg)));
marker = max(marker, 1.0 - smoothstep(0.0, u_marker.z, distance(v_uv, texture(u_state_texture, vec2(0.875, 0.875)).rg)));
vec3 color = previous.rgb * u_marker.w + marker * vec3(0.08, 0.55, 1.0);
fragColor = vec4(min(color, vec3(1.0)), 1.0);
} else {
// VALIDATION ONLY: canonical world-space pattern and shared mask.
// Current-frame canonical world composite and shared Mask.
float intensity = max(previous.r, max(previous.g, previous.b));
float ocean = texture(u_mask_texture, v_world).a;
if (u_pass.z > 0.5 && ocean < 0.5) discard;