use super::*;
pub(crate) const WEB_CANVAS_TAG: &str = "canvas";
pub(crate) const WEB_CSS_SAFE_TOP: &str = "--euv-safe-top";
pub(crate) const WEB_CSS_SAFE_RIGHT: &str = "--euv-safe-right";
pub(crate) const WEB_CSS_SAFE_BOTTOM: &str = "--euv-safe-bottom";
pub(crate) const WEB_CSS_SAFE_LEFT: &str = "--euv-safe-left";
pub(crate) const WEB_METHOD_GET_COMPUTED_STYLE: &str = "getComputedStyle";
pub(crate) const WEB_METHOD_GET_PROPERTY_VALUE: &str = "getPropertyValue";
pub(crate) const WEB_PROP_GPU: &str = "gpu";
pub(crate) const WEB_CONTEXT_WEBGL2: &str = "webgl2";
pub(crate) const WEB_GL_OPT_ALPHA: &str = "alpha";
pub(crate) const WEB_GL_OPT_ANTIALIAS: &str = "antialias";
pub(crate) const WEB_GL_OPT_DEPTH: &str = "depth";
pub(crate) const WEB_GL_OPT_DESYNCHRONIZED: &str = "desynchronized";
pub(crate) const WEB_GL_OPT_POWER_PREF: &str = "powerPreference";
pub(crate) const WEB_GL_OPT_HIGH_PERFORMANCE: &str = "high-performance";
pub(crate) const WEB_GL_OPT_PRESERVE_DRAWING: &str = "preserveDrawingBuffer";
pub(crate) const WEB_CTOR_RESIZE_OBSERVER: &str = "ResizeObserver";
pub(crate) const WEB_METHOD_OBSERVE: &str = "observe";
pub(crate) const WEB_METHOD_DISCONNECT: &str = "disconnect";
pub(crate) const WEB_GL_CREATE_TEXTURE: &str = "createTexture";
pub(crate) const WEB_GL_BIND_TEXTURE: &str = "bindTexture";
pub(crate) const WEB_PROP_VISUAL_VIEWPORT: &str = "visualViewport";
pub(crate) const WEB_PROP_WIDTH: &str = "width";
pub(crate) const WEB_PROP_HEIGHT: &str = "height";
pub(crate) const WEB_PROP_SCALE: &str = "scale";
pub(crate) const WEB_DPR_MIN: f32 = 0.25;
pub(crate) const WEB_DPR_MAX: f32 = 16.0;
pub(crate) const WEB_CANVAS_MAX_PHYS_DIM: f64 = 65536.0;
pub(crate) const WEB_TILED_BLIT_CHUNK_DIM: u32 = 4096;
pub(crate) const WEB_PINCH_ZOOM_THRESHOLD: f64 = 1.01;
pub(crate) const WEB_OPEN_TARGET_BLANK: &str = "_blank";
pub(crate) const WEB_OPEN_FEATURES_SAFE: &str = "noopener,noreferrer";
pub(crate) const WEB_GL2_UNIFORM_TEX: &str = "u_tex";
pub(crate) const WEB_GL2_UNIFORM_VIEW: &str = "u_view";
pub(crate) const WEB_REFLECT_ARG0_KEY: &str = "0";
pub(crate) const WEB_ATTR_STYLE: &str = "style";
pub(crate) const WEB_ATTR_ID: &str = "id";
pub(crate) const WEB_STYLE_TAG: &str = "style";
pub(crate) const WEB_HEAD_SELECTOR: &str = "head";
pub(crate) const WEB_RESET_STYLE_ID: &str = "euv-web-reset";
pub(crate) const WEB_RESET_STYLE_CSS: &str = "html,body,canvas{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;user-select:none;-webkit-user-select:none;outline:none;}canvas:focus,canvas:focus-visible{outline:none;}";
pub(crate) const WEB_ATTR_TABINDEX: &str = "tabindex";
pub(crate) const WEB_BODY_STYLE: &str = "margin:0;padding:0;width:100vw;height:100vh;height:100dvh;overflow:hidden;background:#09090b;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;outline:none;";
pub(crate) const WEB_CANVAS_STYLE_PREFIX: &str =
"position:fixed;inset:0;width:100%;height:100%;display:block;outline:none;cursor:";
pub(crate) const WEB_CANVAS_STYLE_SUFFIX: &str = ";margin:0;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;z-index:1;visibility:visible;opacity:1;pointer-events:auto;";
pub(crate) const WEB_STANDBY_CANVAS_STYLE: &str = "position:fixed;inset:0;width:100%;height:100%;display:block;outline:none;margin:0;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;z-index:0;visibility:hidden;opacity:0;pointer-events:none;";
pub(crate) const WEB_ATTR_CANVAS_ROLE: &str = "data-euv-canvas-role";
pub(crate) const WEB_CANVAS_ROLE_ACTIVE: &str = "active";
pub(crate) const WEB_CANVAS_ROLE_STANDBY: &str = "standby";
pub(crate) const WEB_CANVAS_ROLE_TILE: &str = "tile";
pub(crate) const WEB_TILE_CANVAS_STYLE_PREFIX: &str =
"position:fixed;display:block;outline:none;margin:0;pointer-events:none;z-index:2;";
pub(crate) const WEB_GL2_UBER_UNIFORM_TILE_ORIGIN: &str = "u_tile_origin";
pub(crate) const WEB_GL2_BLUR_UNIFORM_TEX: &str = "u_blur_tex";
pub(crate) const WEB_GL2_BLUR_UNIFORM_TEXEL: &str = "u_texel_size";
pub(crate) const WEB_GL2_BLUR_UNIFORM_OFFSET: &str = "u_blur_offset";
pub(crate) const WEB_GL2_BLUR_UNIFORM_MODE: &str = "u_blur_pass_mode";
pub(crate) const WEB_GL2_SCENE_UNIFORM_OCEAN_TIME: &str = "u_time_agit_hor_aspect";
pub(crate) const WEB_GL2_SCENE_UNIFORM_OCEAN_ROLL: &str = "u_roll_boat_uv";
pub(crate) const WEB_GL2_SCENE_UNIFORM_OCEAN_SUN: &str = "u_sun_dir_wake";
pub(crate) const WEB_GL2_SCENE_UNIFORM_WAKE_TEX: &str = "u_wake_tex";
pub(crate) const WEB_GL2_SCENE_UNIFORM_VIEW_PROJ: &str = "u_view_proj";
pub(crate) const WEB_GL2_SCENE_UNIFORM_CAM_POS: &str = "u_camera_pos";
pub(crate) const WEB_GL2_SCENE_UNIFORM_SUN_FOG: &str = "u_sun_dir_fog";
pub(crate) const WEB_GL2_SCENE_UNIFORM_SUN_COL: &str = "u_sun_color_ambient";
pub(crate) const WEB_GL2_SCENE_UNIFORM_SKY_HOR: &str = "u_sky_horizon_tod";
pub(crate) const WEB_GL2_SCENE_UNIFORM_SKY_ZEN: &str = "u_sky_zenith_aspect";
pub(crate) const WEB_GL2_SCENE_FULLSCREEN_VERT: &str = "#version 300 es\n\
precision highp float;\n\
precision highp int;\n\
out highp vec2 v_uv;\n\
void main() {\n\
vec2 p = vec2((gl_VertexID == 1) ? 3.0 : -1.0, (gl_VertexID == 2) ? 3.0 : -1.0);\n\
gl_Position = vec4(p, 0.0, 1.0);\n\
v_uv = vec2(p.x * 0.5 + 0.5, 0.5 - p.y * 0.5);\n\
}\n";
pub(crate) const WEB_GL2_SCENE_OCEAN_FRAG: &str = r#"#version 300 es
precision highp float;
precision highp sampler2D;
in highp vec2 v_uv;
uniform highp vec4 u_time_agit_hor_aspect;
uniform highp vec4 u_roll_boat_uv;
uniform highp vec4 u_sun_dir_wake;
uniform highp sampler2D u_wake_tex;
out vec4 out_color;
vec3 euv_aces(vec3 hdr) {
vec3 x = max(hdr, vec3(0.0));
vec3 num = x * (2.51 * x + 0.03);
vec3 den = x * (2.43 * x + 0.59) + 0.14;
return pow(clamp(num / max(den, vec3(0.0001)), vec3(0.0), vec3(1.0)), vec3(1.0 / 2.2));
}
float euv_hash(vec2 cell) {
vec2 p = fract(cell * vec2(0.1031, 0.1030));
p += dot(p, p.yx + 33.33);
return fract((p.x + p.y) * p.x);
}
float euv_noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
float a = euv_hash(i);
float b = euv_hash(i + vec2(1.0, 0.0));
float c = euv_hash(i + vec2(0.0, 1.0));
float d = euv_hash(i + vec2(1.0, 1.0));
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
float euv_cloud_fbm(vec2 p, int octs) {
float val = 0.0;
float amp = 0.52;
vec2 q = p;
for (int i = 0; i < 5; ++i) {
if (i >= octs) {
break;
}
val += euv_noise(q) * amp;
q = vec2(q.x * 1.92 - q.y * 0.58 + 3.1, q.x * 0.58 + q.y * 1.92 - 1.7);
amp *= 0.50;
}
return clamp(val, 0.0, 1.0);
}
vec3 euv_sky(vec3 ray, vec3 sun_dir, float sim_time, bool high_detail) {
float ry = max(ray.y, 0.0);
float sdot = clamp(dot(ray, sun_dir), 0.0, 1.0);
float sp2 = sdot * sdot;
float sp4 = sp2 * sp2;
float sp16 = sp4 * sp4 * sp4 * sp4;
float sp64 = sp16 * sp16 * sp16 * sp16;
float sun_az_glow = pow(clamp(dot(normalize(vec2(ray.x, ray.z)), normalize(vec2(sun_dir.x, sun_dir.z))), 0.0, 1.0), 4.0);
float disk = smoothstep(0.9990, 0.99965, sdot);
float sky_t = smoothstep(0.0, 0.55, ry);
vec3 horiz = vec3(0.22, 0.17, 0.20) + vec3(0.95, 0.52, 0.22) * sp16 + vec3(1.5, 1.08, 0.62) * sp64;
vec3 zenith = vec3(0.012, 0.024, 0.050);
vec3 base_sky = mix(horiz, zenith, sky_t);
float strat_y = pow(ry, 0.62) * 3.95;
vec2 base_c = vec2(ray.x * (1.68 + 0.42 * (1.0 - min(ry, 1.0))) + sim_time * 0.015, strat_y * 2.28 + sim_time * 0.007);
float warp_a = euv_noise(base_c * vec2(0.62, 0.72) + vec2(3.1, -1.4));
float warp_b = high_detail ? euv_noise(base_c * vec2(1.60, 1.85) + vec2(-2.3, 5.7)) : 0.5;
vec2 c_uv = base_c + vec2((warp_a - 0.5) * 1.15 + (warp_b - 0.5) * 0.42, (warp_a - 0.5) * 0.66 - (warp_b - 0.5) * 0.24);
float cloud_raw = euv_cloud_fbm(c_uv, high_detail ? 5 : 2);
float billow = 0.0;
float wisp_ridge = 0.0;
if (high_detail) {
float g1 = euv_noise(c_uv * vec2(3.10, 4.40) + vec2(8.4, -3.9));
float g2 = euv_noise(c_uv * vec2(7.80, 10.60) + vec2(-4.2, 9.1));
float r_raw = 1.0 - abs(euv_noise(c_uv * vec2(5.2, 8.4) + vec2(1.9, -2.6)) * 2.0 - 1.0);
billow = g1 * 0.14 + g2 * 0.09;
wisp_ridge = r_raw * r_raw * 0.11;
}
float cloud_field = clamp(cloud_raw * 0.77 + billow + wisp_ridge, 0.0, 1.0);
float overhead = smoothstep(0.035, 0.24, ry);
float clearing = sun_az_glow * exp(-ry * 7.2) * 0.58;
float cloud_cov = smoothstep(0.24, 0.66, cloud_field + overhead * 0.36 - clearing);
float cloud_dark = (0.54 + 0.42 * overhead) * cloud_cov;
float rim_sample = high_detail ? euv_cloud_fbm(c_uv + vec2(sun_dir.x * 0.32, 0.18), 3) : (cloud_field * 0.90);
float edge_lacy = 1.0 - abs(cloud_cov * 2.0 - 1.0);
float sun_lit_edge = (clamp((cloud_field - rim_sample) * 3.5 + 0.14, 0.0, 1.0) + edge_lacy * edge_lacy * 0.42) * (0.16 + 0.84 * sun_az_glow) * (1.0 - overhead * 0.60);
float wisp_tex = high_detail ? ((cloud_field - 0.5) * 0.058 + wisp_ridge * 0.18) : 0.0;
vec3 cloud_col = high_detail
? max(vec3(0.005, 0.009, 0.016), vec3(0.010, 0.016, 0.026) + vec3(0.042, 0.052, 0.072) * (1.0 - cloud_dark) + vec3(0.90, 1.06, 1.24) * wisp_tex + vec3(0.86 + 0.58 * sp4, 0.60 + 0.38 * sp4, 0.32 + 0.16 * sp4) * sun_lit_edge)
: (vec3(0.003, 0.018, 0.036) + vec3(0.015, 0.056, 0.094) * (1.0 - cloud_dark) + vec3(0.40 + 0.28 * sp4, 0.34 + 0.22 * sp4, 0.26 + 0.15 * sp4) * sun_lit_edge);
float cloud_alpha = clamp(cloud_cov * (0.74 + 0.24 * overhead), 0.0, 0.98);
vec3 sky = mix(base_sky, cloud_col, cloud_alpha);
if (high_detail) {
sky += vec3(4.5, 3.6, 2.5) * disk;
} else if (sdot > 0.988) {
sky += vec3(1.20, 0.98, 0.66) * (sp64 * sp64 * 1.25);
}
return sky;
}
void main() {
float sim_time = u_time_agit_hor_aspect.x;
float agitation = max(u_time_agit_hor_aspect.y, 1.0);
float horizon_v = u_time_agit_hor_aspect.z;
float aspect = max(u_time_agit_hor_aspect.w, 0.25);
float roll_cos = u_roll_boat_uv.x;
float roll_sin = u_roll_boat_uv.y;
vec2 boat_uv = u_roll_boat_uv.zw;
vec3 sun_dir = normalize(u_sun_dir_wake.xyz);
float wake_active = u_sun_dir_wake.w;
float raw_dx = (v_uv.x - 0.5) * 2.0 * aspect;
float raw_dy = (horizon_v - v_uv.y) * 2.0;
float rx_u = raw_dx * roll_cos + raw_dy * roll_sin;
float ry_u = -raw_dx * roll_sin + raw_dy * roll_cos;
vec3 ray = normalize(vec3(rx_u, ry_u, 1.62));
float neg_ry_raw = max(-ray.y, 0.0024);
vec2 wp_grad_ref = ray.xz * clamp(1.42 / neg_ry_raw, 0.6, 240.0);
float pixel_foot_fw = clamp(length(fwidth(wp_grad_ref)) * 0.68, 0.0, 8.0);
vec3 hdr;
if (ray.y >= 0.0) {
hdr = euv_sky(ray, sun_dir, sim_time, true);
} else {
float neg_ry = neg_ry_raw;
float dist = clamp(1.42 / neg_ry, 0.6, 240.0);
vec2 wp0 = ray.xz * dist;
if (dist < 16.0) {
float ph0 = dot(wp0, vec2(0.18, 0.984)) * 0.62 + sim_time * 0.88;
float h_p = 0.230 * agitation * (exp(-(1.0 - sin(ph0))) - 0.40);
dist = clamp((1.42 - h_p) / neg_ry, 0.6, 240.0);
wp0 = ray.xz * dist;
}
float pixel_foot = max(pixel_foot_fw, dist * 0.0012);
vec4 waves[8];
waves[0] = vec4(0.18, 0.984, 0.62, 0.230);
waves[1] = vec4(-0.36, 0.933, 1.08, 0.160);
waves[2] = vec4(0.52, 0.854, 1.88, 0.098);
waves[3] = vec4(-0.60, 0.800, 3.10, 0.062);
waves[4] = vec4(0.46, 0.888, 5.15, 0.038);
waves[5] = vec4(-0.68, 0.733, 8.40, 0.024);
waves[6] = vec4(0.74, 0.673, 13.80, 0.015);
waves[7] = vec4(-0.76, 0.650, 22.40, 0.009);
float speeds[8];
speeds[0] = 0.88;
speeds[1] = 1.18;
speeds[2] = 1.62;
speeds[3] = 2.08;
speeds[4] = 2.62;
speeds[5] = 3.18;
speeds[6] = 3.85;
speeds[7] = 4.65;
vec2 wp = wp0;
float h = 0.0;
vec2 grad = vec2(0.0);
float crest_acc = 0.0;
for (int wi = 0; wi < 8; ++wi) {
float freq = waves[wi].z;
float aa_arg = pixel_foot * freq * 0.62;
if (aa_arg > 3.6) {
break;
}
float aa_w = 1.0 / (1.0 + aa_arg * aa_arg);
float amp = waves[wi].w * agitation;
float ph = dot(wp, waves[wi].xy) * freq + sim_time * speeds[wi];
float sp = sin(ph);
float cp = cos(ph);
float sharp_e = exp(-(1.0 - sp));
h += amp * (sharp_e - 0.40) * aa_w;
float slope = amp * freq * sharp_e * cp * aa_w;
grad += waves[wi].xy * slope;
crest_acc += sharp_e * amp;
wp += waves[wi].xy * (cp * amp * 0.92 * aa_w);
}
float near_steep = 1.0 + 0.48 * exp(-dist * 0.082);
grad = vec2(grad.x * near_steep, grad.y * near_steep * 1.14);
if (pixel_foot < 0.28) {
float cap_aa = 1.0 / (1.0 + (pixel_foot * 15.0) * (pixel_foot * 15.0));
float c1 = cos(wp0.x * 16.5 + wp0.y * 26.0 + sim_time * 3.8) * 0.068 * cap_aa * agitation;
float c2 = cos(-wp0.x * 22.0 + wp0.y * 31.0 + sim_time * 4.7) * 0.052 * cap_aa * agitation;
grad += vec2(c1 * 0.56 - c2 * 0.62, c1 * 0.82 + c2 * 0.78);
}
float wake_foam = 0.0;
if (wake_active > 0.5) {
vec4 wk = texture(u_wake_tex, v_uv);
vec2 flow = clamp((wk.rg - vec2(0.5)) * 4.0 * 0.22, vec2(-0.20), vec2(0.20));
grad += flow;
wake_foam = wk.b;
}
vec2 raw_bd = vec2((v_uv.x - boat_uv.x) * aspect, v_uv.y - boat_uv.y);
vec2 rot_bd = vec2(raw_bd.x * roll_cos - raw_bd.y * roll_sin, raw_bd.x * roll_sin + raw_bd.y * roll_cos);
vec2 boat_local = vec2(rot_bd.x / 0.145, rot_bd.y / 0.036);
float boat_ring_d2 = dot(boat_local, boat_local);
if (boat_ring_d2 > 0.30 && boat_ring_d2 < 12.8) {
float r_hull = sqrt(boat_ring_d2);
float rip_env = exp(-max(r_hull - 0.85, 0.0) * 1.08) * smoothstep(0.55, 0.92, r_hull);
float rip_wave = cos(r_hull * 16.5 - sim_time * 4.2) * 0.36 * rip_env;
float inv_rh = 1.0 / max(r_hull, 0.1);
grad += vec2(boat_local.x * inv_rh * rip_wave, boat_local.y * inv_rh * rip_wave * 1.38);
}
vec3 norm = normalize(vec3(-grad.x, 1.0, -grad.y));
vec3 view_dir = -ray;
float ndv = clamp(dot(norm, view_dir), 0.002, 1.0);
float fresnel = clamp(0.0204 + 0.9796 * pow(1.0 - ndv, 5.0), 0.022, 0.88);
vec3 refl_dir = reflect(ray, norm);
refl_dir.y = max(refl_dir.y, 0.006);
vec3 sky_refl = euv_sky(normalize(refl_dir), sun_dir, sim_time, false);
vec3 half_vec = normalize(view_dir + sun_dir);
float ndh = max(dot(norm, half_vec), 0.0);
float d1 = ndh * ndh * (0.00018 - 1.0) + 1.0;
float ggx_tight = min(0.00018 / (3.14159265 * d1 * d1), 28.0);
float d2 = ndh * ndh * (0.00036 - 1.0) + 1.0;
float ggx_mid = min(0.00036 / (3.14159265 * d2 * d2), 5.2);
float glint = smoothstep(0.982, 0.9985, ndh);
float sparkle_boost = 0.86 + 0.52 * smoothstep(2.5, 24.0, dist);
vec3 spec = vec3(1.18, 1.02, 0.80) * ((ggx_tight * 0.52 + ggx_mid * 0.10 + glint * 0.48) * sparkle_boost);
float sss = clamp(h * 1.45 + 0.16, 0.0, 1.0) * exp(-dist * 0.048) * (0.35 + 0.65 * pow(clamp(dot(-view_dir, sun_dir), 0.0, 1.0), 3.0));
vec3 deep_body = vec3(0.002, 0.046, 0.078) + vec3(0.008, 0.34, 0.39) * sss;
float refl_weight = clamp(fresnel * 0.58 + 0.022, 0.022, 0.70);
hdr = mix(deep_body, sky_refl, refl_weight) + spec;
if (rot_bd.y > -0.01 && rot_bd.y < 0.24 && abs(rot_bd.x) < 0.22) {
float ripple = sin(rot_bd.y * 95.0 - sim_time * 4.5 + grad.x * 6.0) * 0.012;
float rx_b = abs(rot_bd.x + ripple);
float tri_mask = smoothstep(0.14, 0.02, rx_b + max(rot_bd.y, 0.0) * 0.55) * (1.0 - max(rot_bd.y, 0.0) / 0.24);
hdr = mix(hdr, vec3(0.55, 0.52, 0.48), tri_mask * 0.34);
}
float crest_norm = crest_acc / max(agitation, 1.0);
float steep_foam = smoothstep(0.44, 0.62, crest_norm) * clamp(agitation - 1.02, 0.0, 1.0);
float total_foam = clamp(steep_foam * 0.45 + wake_foam * 0.28, 0.0, 0.54);
hdr = mix(hdr, vec3(0.78, 0.90, 0.96), total_foam);
if (boat_ring_d2 < 4.5) {
if (boat_ring_d2 < 1.12) {
float contact_ao = (1.0 - smoothstep(0.18, 1.06, boat_ring_d2)) * 0.44;
hdr *= vec3(1.0 - contact_ao, 1.0 - contact_ao * 0.82, 1.0 - contact_ao * 0.72);
}
float foam_ny = boat_local.y - 0.16;
float foam_d2 = boat_local.x * boat_local.x * 1.16 + foam_ny * foam_ny * 1.08;
float rim_band = smoothstep(0.42, 0.82, foam_d2) * (1.0 - smoothstep(0.88, 1.54, foam_d2)) * smoothstep(-0.45, 0.24, boat_local.y);
float aft_wake = smoothstep(0.22, 0.82, boat_local.x) * (1.0 - smoothstep(0.88, 1.62, boat_local.x)) * (1.0 - smoothstep(0.18, 1.20, abs(boat_local.y - 0.26))) * 0.46;
float collar_mask = clamp(rim_band + aft_wake, 0.0, 1.0);
if (collar_mask > 0.02) {
float lacy_a = euv_noise(wp0 * 8.2 + vec2(2.3, -1.7));
float lacy_b = euv_noise(wp0 * 21.0 + vec2(-sim_time * 0.85, 4.1));
float flecks = euv_noise(wp0 * 42.0 + vec2(7.1, -sim_time * 1.35));
float foam_pat = smoothstep(0.46, 0.78, lacy_a * 0.42 + lacy_b * 0.36 + flecks * 0.22);
float spray_dots = smoothstep(0.74, 0.88, flecks) * rim_band * 0.72;
float hull_foam = clamp(collar_mask * foam_pat * 0.78 + spray_dots, 0.0, 0.86);
hdr = mix(hdr, vec3(0.92, 0.97, 1.0), hull_foam);
}
}
float horiz_fog = exp(-neg_ry * 38.0);
vec3 fog_col = euv_sky(normalize(vec3(ray.x, 0.01, ray.z)), sun_dir, sim_time, false);
hdr = mix(hdr, fog_col, clamp(horiz_fog * 0.82, 0.0, 0.88));
}
out_color = vec4(euv_aces(hdr), 1.0);
}
"#;
pub(crate) const WEB_GL2_SCENE_BOAT_VERT: &str = "#version 300 es\n\
precision highp float;\n\
layout(location = 0) in vec4 a_pos_ndc;\n\
layout(location = 1) in vec4 a_color;\n\
out vec4 v_color;\n\
void main() {\n\
gl_Position = vec4(a_pos_ndc.xy, 0.0, 1.0);\n\
v_color = a_color;\n\
}\n";
pub(crate) const WEB_GL2_SCENE_BOAT_FRAG: &str = "#version 300 es\n\
precision highp float;\n\
in vec4 v_color;\n\
out vec4 out_color;\n\
void main() {\n\
out_color = v_color;\n\
}\n";
pub(crate) const WEB_GL2_SCENE_3D_SKY_FRAG: &str = r#"#version 300 es
precision highp float;
in highp vec2 v_uv;
uniform highp vec4 u_camera_pos;
uniform highp vec4 u_sun_color_ambient;
uniform highp vec4 u_sky_horizon_tod;
uniform highp vec4 u_sky_zenith_aspect;
out vec4 out_color;
vec3 euv_aces(vec3 hdr) {
vec3 x = max(hdr, vec3(0.0));
vec3 num = x * (2.51 * x + 0.03);
vec3 den = x * (2.43 * x + 0.59) + 0.14;
return pow(clamp(num / max(den, vec3(0.0001)), vec3(0.0), vec3(1.0)), vec3(1.0 / 2.2));
}
void main() {
float sky_t = clamp(1.0 - v_uv.y * 1.15, 0.0, 1.0);
vec3 col = mix(u_sky_horizon_tod.rgb, u_sky_zenith_aspect.rgb, smoothstep(0.0, 0.85, sky_t));
float sun_glow = pow(clamp(1.0 - abs(v_uv.x - 0.55) * 1.6, 0.0, 1.0) * clamp(1.0 - abs(v_uv.y - 0.34) * 2.2, 0.0, 1.0), 3.0);
col += u_sun_color_ambient.rgb * sun_glow * 0.45;
out_color = vec4(euv_aces(col * u_camera_pos.w), 1.0);
}
"#;
pub(crate) const WEB_GL2_SCENE_3D_MESH_VERT: &str = r#"#version 300 es
precision highp float;
layout(location = 0) in vec4 a_pos;
layout(location = 1) in vec4 a_norm;
layout(location = 2) in vec4 a_submat;
layout(location = 3) in vec4 a_m0;
layout(location = 4) in vec4 a_m1;
layout(location = 5) in vec4 a_m2;
layout(location = 6) in vec4 a_m3;
layout(location = 7) in vec4 a_albedo_met;
layout(location = 8) in vec4 a_emissive_rough;
uniform highp mat4 u_view_proj;
out highp vec3 v_world_pos;
out highp vec3 v_world_norm;
out highp vec4 v_base_met;
out highp vec4 v_emissive_rough;
out highp float v_submat_mode;
out highp float v_detail_mode;
void main() {
float detail_mode = a_m3.w;
vec4 m3_fixed = vec4(a_m3.xyz, 1.0);
mat4 model = mat4(a_m0, a_m1, a_m2, m3_fixed);
vec4 wp = model * vec4(a_pos.xyz, 1.0);
gl_Position = u_view_proj * wp;
vec3 c0 = a_m0.xyz;
vec3 c1 = a_m1.xyz;
vec3 c2 = a_m2.xyz;
mat3 cof = mat3(cross(c1, c2), cross(c2, c0), cross(c0, c1));
v_world_pos = wp.xyz;
v_world_norm = normalize(cof * a_norm.xyz);
v_base_met = (a_submat.w > 0.5)
? vec4(a_submat.rgb, a_albedo_met.w)
: vec4(a_albedo_met.rgb * a_submat.rgb, a_albedo_met.w);
v_emissive_rough = a_emissive_rough;
v_submat_mode = a_submat.w;
v_detail_mode = detail_mode;
}
"#;
pub(crate) const WEB_GL2_SCENE_3D_MESH_FRAG: &str = r#"#version 300 es
precision highp float;
in highp vec3 v_world_pos;
in highp vec3 v_world_norm;
in highp vec4 v_base_met;
in highp vec4 v_emissive_rough;
in highp float v_submat_mode;
in highp float v_detail_mode;
uniform highp vec4 u_camera_pos;
uniform highp vec4 u_sun_dir_fog;
uniform highp vec4 u_sun_color_ambient;
uniform highp vec4 u_sky_horizon_tod;
uniform highp vec4 u_sky_zenith_aspect;
out vec4 out_color;
vec3 euv_aces(vec3 hdr) {
vec3 x = max(hdr, vec3(0.0));
vec3 num = x * (2.51 * x + 0.03);
vec3 den = x * (2.43 * x + 0.59) + 0.14;
return pow(clamp(num / max(den, vec3(0.0001)), vec3(0.0), vec3(1.0)), vec3(1.0 / 2.2));
}
float euv_hash(vec2 cell) {
vec2 p = fract(cell * vec2(0.1031, 0.1030));
p += dot(p, p.yx + 33.33);
return fract((p.x + p.y) * p.x);
}
float euv_noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f * f * (3.0 - 2.0 * f);
float a = euv_hash(i);
float b = euv_hash(i + vec2(1.0, 0.0));
float c = euv_hash(i + vec2(0.0, 1.0));
float d = euv_hash(i + vec2(1.0, 1.0));
return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
}
void main() {
vec3 norm = normalize(v_world_norm);
vec3 view_dir = normalize(u_camera_pos.xyz - v_world_pos);
vec3 sun_dir = normalize(u_sun_dir_fog.xyz);
float dist = length(u_camera_pos.xyz - v_world_pos);
float fw_pos = length(fwidth(v_world_pos));
float fw_xz = length(fwidth(v_world_pos.xz));
vec3 base_col = v_base_met.rgb;
float metallic = clamp(v_base_met.w, 0.0, 1.0);
float roughness = clamp(v_emissive_rough.w, 0.05, 1.0);
vec3 emissive = (v_submat_mode > 1.5) ? base_col * 1.15 : v_emissive_rough.rgb;
float env_boost = 0.85;
if (v_detail_mode > 0.5 && v_detail_mode < 1.5 && norm.y > 0.82) {
float wpx = v_world_pos.x;
float wpz = v_world_pos.z;
float abs_x = abs(wpx);
float edge_aa = clamp(fw_xz * 0.9, 0.035, 0.36);
float curb_w = smoothstep(9.9 - edge_aa, 9.9 + edge_aa, abs_x);
float walk_w = smoothstep(10.6 - edge_aa, 10.6 + edge_aa, abs_x);
float micro_fade = 1.0 - smoothstep(22.0, 70.0, dist);
float grain_n = euv_hash(floor(vec2(wpx * 4.3, wpz * 4.3))) - 0.5;
float om_curb = 1.0 - curb_w;
float inner_lin = 1.0 - clamp(abs(abs_x - 3.65) * 0.85, 0.0, 1.0);
float outer_lin = 1.0 - clamp(abs(abs_x - 6.85) * 0.95, 0.0, 1.0);
float tire_wear = clamp(inner_lin * inner_lin + outer_lin * outer_lin, 0.0, 1.0) * om_curb;
float gutter_band = (1.0 - clamp(abs(abs_x - 9.75) * 2.8, 0.0, 1.0)) * om_curb;
float puddle_fade = 1.0 - smoothstep(48.0, 120.0, dist);
float p_coarse = euv_noise(vec2(wpx * 0.14 + 3.1, wpz * 0.08 - 1.7));
float p_fine = euv_noise(vec2(wpx * 0.38 - 5.4, wpz * 0.24 + 2.9));
float center_crown = (1.0 - clamp(abs_x * 0.65, 0.0, 1.0)) * om_curb;
float puddle_raw = p_coarse * 0.66 + p_fine * 0.34 + tire_wear * 0.14 + gutter_band * 0.16 - center_crown * 0.24;
float puddle = smoothstep(0.44, 0.90, puddle_raw) * om_curb * puddle_fade;
float tarmac_scale = (1.0 + grain_n * 0.24 * micro_fade * (1.0 - puddle)) * (1.0 - 0.14 * tire_wear) * (1.0 - 0.38 * puddle) * (1.0 - 0.30 * gutter_band);
vec3 road_col = base_col * tarmac_scale;
float yellow_w = (1.0 - smoothstep(0.085 - edge_aa, 0.085 + edge_aa, abs(abs_x - 0.22))) * om_curb;
if (yellow_w > 0.01) {
float pv = (1.0 - 0.14 * puddle) * (0.92 + grain_n * 0.14 * micro_fade);
road_col = mix(road_col, vec3(0.88, 0.62, 0.10) * pv, yellow_w * 0.94);
}
float dash_on = (fract(wpz * 0.125) < 0.42) ? 1.0 : 0.0;
float lane_w = (1.0 - smoothstep(0.085 - edge_aa, 0.085 + edge_aa, abs(abs_x - 4.65))) * dash_on * om_curb;
float shoulder_w = (1.0 - smoothstep(0.10 - edge_aa, 0.10 + edge_aa, abs(abs_x - 8.95))) * om_curb;
float cross_cell = (wpz + 18.0) - 40.0 * floor((wpz + 18.0) / 40.0) - 20.0;
float cross_w = (abs(cross_cell) < 1.80 && abs_x < 8.40 && abs_x > 0.55 && fract(wpx * 0.85) < 0.50) ? (0.85 * om_curb) : 0.0;
float white_w = max(max(shoulder_w, lane_w), cross_w);
if (white_w > 0.01) {
float pv = (1.0 - 0.16 * puddle) * (0.90 + grain_n * 0.12 * micro_fade);
road_col = mix(road_col, vec3(0.78, 0.81, 0.86) * pv, white_w * 0.90);
}
vec3 curb_col = vec3(0.36, 0.38, 0.42) * (1.0 + grain_n * 0.10 * micro_fade);
float tile_seam = (fract(wpx * 0.45) < 0.045 || fract(wpz * 0.45) < 0.045) ? 0.72 : 1.0;
vec3 walk_col = vec3(0.24, 0.26, 0.30) * tile_seam * (1.0 + grain_n * 0.10 * micro_fade);
base_col = mix(mix(road_col, curb_col, curb_w), walk_col, walk_w);
roughness = mix(mix(roughness, 0.06, puddle), 0.78, walk_w);
env_boost = mix(0.85, 1.85, puddle);
} else if (v_detail_mode > 1.5 && v_detail_mode < 2.5 && abs(norm.y) < 0.35 && v_submat_mode < 0.5) {
float u_coord = (abs(norm.x) > abs(norm.z)) ? v_world_pos.z : v_world_pos.x;
float world_y = v_world_pos.y;
float dist_fade = 1.0 - smoothstep(130.0, 320.0, dist);
float px_sz = max(fw_pos * 0.75, dist * 0.0022);
if (world_y < 3.45) {
float su_s = u_coord * 0.26;
float fx_s = fract(su_s);
float fy_s = clamp(world_y / 3.45, 0.0, 1.0);
float pane_w = smoothstep(0.08, 0.14, fx_s) * (1.0 - smoothstep(0.86, 0.92, fx_s)) * smoothstep(0.14, 0.22, fy_s) * (1.0 - smoothstep(0.86, 0.92, fy_s)) * dist_fade;
float sh = euv_hash(vec2(floor(su_s), 7.0));
vec3 shop_glow = (sh < 0.40) ? vec3(1.18, 0.78, 0.36) : ((sh < 0.62) ? vec3(0.28, 0.88, 1.18) : ((sh < 0.80) ? vec3(1.12, 0.32, 0.68) : vec3(0.0)));
base_col = mix(base_col * 0.64, base_col * 0.40, pane_w);
emissive += shop_glow * (pane_w * (0.55 + 0.55 * (1.0 - fy_s)) * 0.92);
roughness = mix(roughness, 0.12, pane_w);
} else {
float su = u_coord * 0.48;
float sy = world_y * 0.33;
float fx_win = fract(su);
float fy_win = fract(sy);
float aa_u = clamp(px_sz * 0.48, 0.018, 0.32);
float aa_v = clamp(px_sz * 0.33, 0.018, 0.32);
float pane_u = smoothstep(0.14 - aa_u, 0.14 + aa_u, fx_win) * (1.0 - smoothstep(0.86 - aa_u, 0.86 + aa_u, fx_win));
float pane_v = smoothstep(0.18 - aa_v, 0.18 + aa_v, fy_win) * (1.0 - smoothstep(0.84 - aa_v, 0.84 + aa_v, fy_win));
float pane_w = clamp(pane_u * pane_v * dist_fade, 0.0, 1.0);
float spandrel = (fy_win < 0.14 || fy_win > 0.88) ? 0.70 : 0.84;
vec3 wall_base = base_col * spandrel;
float ch = euv_hash(vec2(floor(su), floor(sy)));
float room_lvl = 0.68 + fract(ch * 17.3) * 0.45;
float blind_grad = clamp(0.48 + 0.66 * (1.0 - fy_win), 0.38, 1.14);
float r_scale = pane_w * room_lvl * blind_grad;
if (ch < 0.22) {
base_col = mix(wall_base, base_col * 0.86, pane_w);
emissive += vec3(1.24, 0.86, 0.42) * r_scale;
} else if (ch < 0.33) {
base_col = mix(wall_base, base_col * 0.84, pane_w);
emissive += vec3(0.28, 0.86, 1.24) * r_scale;
} else if (ch < 0.42) {
base_col = mix(wall_base, base_col * 0.88, pane_w);
emissive += vec3(0.96, 0.94, 0.88) * (r_scale * 0.82);
} else if (ch < 0.50) {
base_col = mix(wall_base, base_col * 0.84, pane_w);
emissive += vec3(1.06, 0.34, 0.72) * (r_scale * 0.86);
} else {
float dark_g = clamp(0.36 + 0.22 * fy_win, 0.32, 0.62);
base_col = mix(wall_base, base_col * dark_g, pane_w);
}
roughness = mix(roughness, 0.10, pane_w);
env_boost = mix(0.85, 1.45, pane_w);
}
} else if (v_detail_mode > 2.5 && norm.y > 0.80) {
vec2 wp = v_world_pos.xz;
float aa_w = 1.0 / (1.0 + fw_xz * 0.85);
float w_a = cos(wp.x * 0.42 + wp.y * 0.64 + u_sky_horizon_tod.w * 2.4) * 0.08 * aa_w;
float w_b = cos(-wp.x * 0.78 + wp.y * 0.52 + u_sky_horizon_tod.w * 3.1) * 0.06 * aa_w;
norm = normalize(vec3(w_a - w_b, 1.0, w_a + w_b));
base_col = vec3(0.015, 0.095, 0.145);
roughness = 0.08;
metallic = 0.02;
env_boost = 1.65;
}
vec3 half_vec = normalize(view_dir + sun_dir);
float ndl = max(dot(norm, sun_dir), 0.0);
float ndv = max(dot(norm, view_dir), 0.002);
float ndh = max(dot(norm, half_vec), 0.0);
float hdv = max(dot(half_vec, view_dir), 0.0);
float a2 = roughness * roughness * roughness * roughness;
float d_den = ndh * ndh * (a2 - 1.0) + 1.0;
float ndf = a2 / max(3.14159265 * d_den * d_den, 0.0001);
vec3 f0 = mix(vec3(0.04), base_col, metallic);
vec3 fresnel = f0 + (vec3(1.0) - f0) * pow(1.0 - hdv, 5.0);
float k_g = (roughness + 1.0);
k_g = (k_g * k_g) * 0.125;
float g_v = ndv / (ndv * (1.0 - k_g) + k_g);
float g_l = ndl / (ndl * (1.0 - k_g) + k_g);
vec3 spec = (ndf * g_v * g_l * fresnel) / max(4.0 * ndv * ndl, 0.001);
vec3 kd = (vec3(1.0) - fresnel) * (1.0 - metallic);
vec3 direct = (kd * base_col / 3.14159265 + spec) * u_sun_color_ambient.rgb * ndl * 1.45;
float sky_w = norm.y * 0.5 + 0.5;
vec3 hemi = mix(u_sky_horizon_tod.rgb * 0.42, u_sky_zenith_aspect.rgb * 0.9 + u_sky_horizon_tod.rgb * 0.35, sky_w);
vec3 env_refl = mix(u_sky_horizon_tod.rgb, u_sky_zenith_aspect.rgb, clamp(reflect(-view_dir, norm).y * 0.5 + 0.5, 0.0, 1.0));
vec3 f_env = f0 + (max(vec3(1.0 - roughness), f0) - f0) * pow(1.0 - ndv, 5.0);
vec3 ambient = (base_col * (1.0 - metallic * 0.65) * hemi + env_refl * f_env * env_boost) * (0.45 + u_sun_color_ambient.w);
vec3 hdr = direct + ambient + emissive;
float fog_t = 1.0 - exp(-dist * u_sun_dir_fog.w);
hdr = mix(hdr, u_sky_horizon_tod.rgb, clamp(fog_t, 0.0, 0.86));
out_color = vec4(euv_aces(hdr * u_camera_pos.w), 1.0);
}
"#;
pub(crate) const ERR_WEB_GL2_DIRECT_MISSING: &str =
"WebGL2 direct GPU primitive pipeline unavailable on active canvas";
pub(crate) const ERR_WEB_GL2_CONTEXT_MISSING: &str =
"failed to acquire independent webgl2 canvas rendering context";
pub(crate) const WEB_GL2_DIRECT_VERT_SHADER: &str = "#version 300 es\n\
precision highp float;\n\
precision highp int;\n\
uniform highp vec2 u_view;\n\
uniform highp vec4 u_rect;\n\
void main() {\n\
vec2 corner = vec2((gl_VertexID == 1 || gl_VertexID == 4 || gl_VertexID == 5) ? 1.0 : 0.0,\n\
(gl_VertexID == 2 || gl_VertexID == 3 || gl_VertexID == 5) ? 1.0 : 0.0);\n\
vec2 px = u_rect.xy + corner * u_rect.zw;\n\
vec2 ndc = vec2((px.x / max(u_view.x, 1.0)) * 2.0 - 1.0, 1.0 - (px.y / max(u_view.y, 1.0)) * 2.0);\n\
gl_Position = vec4(ndc, 0.0, 1.0);\n\
}\n";
pub(crate) const WEB_GL2_DIRECT_FRAG_SHADER: &str = "#version 300 es\n\
precision highp float;\n\
uniform highp vec4 u_color;\n\
out highp vec4 out_color;\n\
void main() {\n\
out_color = u_color;\n\
}\n";
pub(crate) const WEB_GL2_DIRECT_UNIFORM_RECT: &str = "u_rect";
pub(crate) const WEB_GL2_DIRECT_UNIFORM_COLOR: &str = "u_color";
pub(crate) const WEB_GL2_UBER_UNIFORM_VIEWPORT: &str = "u_viewport";
pub(crate) const WEB_GL2_UBER_UNIFORM_SCROLL: &str = "u_scroll_offset";
pub(crate) const WEB_GL2_UBER_UNIFORM_GLYPH_R8: &str = "u_glyph_r8";
pub(crate) const WEB_GL2_UBER_UNIFORM_GLYPH_RGBA8: &str = "u_glyph_rgba8";
pub(crate) const WEB_GL2_UBER_UNIFORM_IMAGE_TEX: &str = "u_image_tex";
pub(crate) const WEB_GL2_UBER_UNIFORM_EXTERNAL_TEX: &str = "u_external_tex";
pub(crate) const WEB_GL2_UNIT_QUAD_VERTS: [f32; 12] =
[0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0];
pub(crate) const WEB_GL2_INITIAL_INSTANCE_VBO_BYTES: usize = 256 * 1024;
pub(crate) const WEB_ATTR_TABINDEX_ZERO: &str = "0";
pub(crate) const WEB_CONTEXT_2D: &str = "2d";
pub(crate) const WEB_DARK_MEDIA_QUERY: &str = "(prefers-color-scheme: dark)";
pub(crate) const ERR_WEB_WINDOW_MISSING: &str = "browser window or document unavailable";
pub(crate) const ERR_WEB_CANVAS_CREATE: &str = "failed to create HTMLCanvasElement";
pub(crate) const ERR_WEB_CONTEXT_2D_MISSING: &str = "failed to acquire 2d canvas rendering context";
pub(crate) const ERR_WEB_PRESENT_FAILED: &str = "failed to blit ImageData to canvas";
pub(crate) const WEB_CURSOR_DEFAULT: &str = "default";
pub(crate) const WEB_CURSOR_POINTER: &str = "pointer";
pub(crate) const WEB_CURSOR_TEXT: &str = "text";
pub(crate) const WEB_CURSOR_CROSSHAIR: &str = "crosshair";
pub(crate) const WEB_CURSOR_NOT_ALLOWED: &str = "not-allowed";
pub(crate) const WEB_CURSOR_GRAB: &str = "grab";
pub(crate) const WEB_CURSOR_GRABBING: &str = "grabbing";
pub(crate) const WEB_CURSOR_MOVE: &str = "move";
pub(crate) const WEB_CURSOR_EW_RESIZE: &str = "ew-resize";
pub(crate) const WEB_CURSOR_NS_RESIZE: &str = "ns-resize";
pub(crate) const WEB_METHOD_REQUEST_FULLSCREEN: &str = "requestFullscreen";
pub(crate) const WEB_METHOD_WEBKIT_REQUEST_FULLSCREEN: &str = "webkitRequestFullscreen";
pub(crate) const WEB_METHOD_EXIT_FULLSCREEN: &str = "exitFullscreen";
pub(crate) const WEB_METHOD_WEBKIT_EXIT_FULLSCREEN: &str = "webkitExitFullscreen";
pub(crate) const WEB_PROP_WEBKIT_FULLSCREEN_ELEMENT: &str = "webkitFullscreenElement";
pub(crate) const WEB_EVENT_DEVICE_MOTION: &str = "devicemotion";
pub(crate) const WEB_EVENT_DEVICE_ORIENTATION: &str = "deviceorientation";
pub(crate) const WEB_CTOR_DEVICE_MOTION_EVENT: &str = "DeviceMotionEvent";
pub(crate) const WEB_CTOR_DEVICE_ORIENTATION_EVENT: &str = "DeviceOrientationEvent";
pub(crate) const WEB_METHOD_REQUEST_PERMISSION: &str = "requestPermission";
pub(crate) const WEB_PERMISSION_GRANTED: &str = "granted";
pub(crate) const WEB_PROP_SCREEN: &str = "screen";
pub(crate) const WEB_PROP_ORIENTATION: &str = "orientation";
pub(crate) const WEB_PROP_ANGLE: &str = "angle";
pub(crate) const WEB_PROP_ACCEL_INCLUDING_GRAVITY: &str = "accelerationIncludingGravity";
pub(crate) const WEB_PROP_ACCELERATION: &str = "acceleration";
pub(crate) const WEB_PROP_ROTATION_RATE: &str = "rotationRate";
pub(crate) const WEB_PROP_ALPHA: &str = "alpha";
pub(crate) const WEB_PROP_BETA: &str = "beta";
pub(crate) const WEB_PROP_GAMMA: &str = "gamma";
pub(crate) const WEB_PROP_AXIS_X: &str = "x";
pub(crate) const WEB_PROP_AXIS_Y: &str = "y";
pub(crate) const WEB_PROP_AXIS_Z: &str = "z";
pub(crate) const WEB_DEG_TO_RAD: f32 = PI / 180.0;
pub(crate) const WEB_GRAVITY_LPF_ALPHA: f32 = 0.22;
pub(crate) const WEB_LINEAR_ACCEL_DEADZONE_MPS2: f32 = 0.30;
pub(crate) const WEB_GYRO_DEADZONE_RAD_S: f32 = 0.04;
pub(crate) const WEB_GRAVITY_SIGN_DOT_THRESHOLD: f32 = 12.0;
pub(crate) const WEB_SAFE_PROBE_ID: &str = "euv-safe-area-probe";
pub(crate) const WEB_TAG_DIV: &str = "div";
pub(crate) const WEB_TAG_IMG: &str = "img";
pub(crate) const WEB_SAFE_PROBE_STYLE: &str = "position:fixed;top:0;left:0;width:0;height:0;visibility:hidden;pointer-events:none;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);";
pub(crate) const WEB_CSS_PADDING_TOP: &str = "padding-top";
pub(crate) const WEB_CSS_PADDING_RIGHT: &str = "padding-right";
pub(crate) const WEB_CSS_PADDING_BOTTOM: &str = "padding-bottom";
pub(crate) const WEB_CSS_PADDING_LEFT: &str = "padding-left";
pub(crate) const WEB_PROP_CROSS_ORIGIN: &str = "crossOrigin";
pub(crate) const WEB_CORS_ANONYMOUS: &str = "anonymous";
pub(crate) const WEB_PROP_SRC: &str = "src";
pub(crate) const WEB_PROP_NATURAL_WIDTH: &str = "naturalWidth";
pub(crate) const WEB_PROP_NATURAL_HEIGHT: &str = "naturalHeight";
pub(crate) const WEB_METHOD_DRAW_IMAGE: &str = "drawImage";
pub(crate) const WEB_EVENT_LOAD: &str = "load";
pub(crate) const WEB_EVENT_ERROR: &str = "error";
pub(crate) const WEB_SCHEME_HTTP: &str = "http://";
pub(crate) const WEB_SCHEME_HTTPS: &str = "https://";
pub(crate) const WEB_IMAGE_MAX_DIM: u32 = 2048;
pub(crate) const WEB_SVG_FALLBACK_WIDTH: u32 = 240;
pub(crate) const WEB_SVG_FALLBACK_HEIGHT: u32 = 48;
pub(crate) const WEB_SVG_RASTER_MAX_DPR: f32 = 4.0;
pub(crate) const WEB_PROP_IMAGE_SMOOTHING_QUALITY: &str = "imageSmoothingQuality";
pub(crate) const WEB_IMG_SMOOTHING_HIGH: &str = "high";
pub(crate) const WEB_EXT_SVG: &str = ".svg";
pub(crate) const WEB_DATA_SVG_PREFIX: &str = "data:image/svg+xml";
pub(crate) const WEB_TAG_TEXTAREA: &str = "textarea";
pub(crate) const WEB_ATTR_COPY_PROXY: &str = "data-euv-copy-proxy";
pub(crate) const WEB_COPY_PROXY_FLAG: &str = "1";
pub(crate) const WEB_ATTR_READONLY: &str = "readonly";
pub(crate) const WEB_COPY_PROXY_STYLE: &str =
"position:fixed;left:-9999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none;";
pub(crate) const WEB_PROP_CLIPBOARD: &str = "clipboard";
pub(crate) const WEB_METHOD_WRITE_TEXT: &str = "writeText";
pub(crate) const WEB_PROP_VALUE: &str = "value";
pub(crate) const WEB_METHOD_SELECT: &str = "select";
pub(crate) const WEB_METHOD_SET_SELECTION_RANGE: &str = "setSelectionRange";
pub(crate) const WEB_METHOD_EXEC_COMMAND: &str = "execCommand";
pub(crate) const WEB_CMD_COPY: &str = "copy";
pub(crate) const WEB_METHOD_CATCH: &str = "catch";
pub(crate) const WEB_JS_NOOP_BODY: &str = "";
pub(crate) const WEB_TAG_IFRAME: &str = "iframe";
pub(crate) const WEB_WEBVIEW_IFRAME_ID: &str = "euv-webview-sheet-frame";
pub(crate) const WEB_ATTR_SRC: &str = "src";
pub(crate) const WEB_ATTR_TITLE: &str = "title";
pub(crate) const WEB_ATTR_REFERRER_POLICY: &str = "referrerpolicy";
pub(crate) const WEB_REFERRER_POLICY_STRICT: &str = "strict-origin-when-cross-origin";
pub(crate) const WEB_WEBVIEW_HIDDEN_STYLE: &str = "position:fixed;left:0;top:0;width:0;height:0;border:0;z-index:20;background:#ffffff;display:none;pointer-events:none;opacity:0;";