@takram/three-atmosphere
Version:
A Three.js and R3F implementation of Precomputed Atmospheric Scattering
71 lines (70 loc) • 2.73 kB
JavaScript
import { A as G, c as P, d as L, D as X, s as g, j as h, I as y, v as x, M as H, P as v, p as B, o as F, k as d, l as k, m as Z, S as w, n as O, r as b, x as z, z as V, B as W, E as Y, G as j, q, T as K, a as J, b as Q, t as $, g as ee, i as ae, f as te, h as se, e as re, u as Te, w as oe, y as Ee, C as ne, F as ie } from "./shared.js";
import { Color as R, Vector3 as S, Matrix3 as u } from "three";
import { saturate as i, clamp as A } from "@takram/three-geospatial";
const D = /* @__PURE__ */ new S(), l = /* @__PURE__ */ new u(
3.2404542,
-1.5371385,
-0.4985314,
-0.969266,
1.8760108,
0.041556,
0.0556434,
-0.2040259,
1.0572252
);
function m(a, r = new R()) {
const t = a, T = t ** 2, o = (0.860117757 + 154118254e-12 * t + 128641212e-15 * T) / (1 + 842420235e-12 * t + 708145163e-15 * T), E = (0.317398726 + 422806245e-13 * t + 420481691e-16 * T) / (1 - 289741816e-13 * t + 161456053e-15 * T), c = 3 * o / (2 * o - 8 * E + 4), s = 2 * E / (2 * o - 8 * E + 4), n = 1, _ = s > 0 ? c * n / s : 0, I = s > 0 ? (1 - c - s) * n / s : 0, e = D.set(_, n, I).applyMatrix3(l);
return e.x = i(e.x), e.y = i(e.y), e.z = i(e.z), r.setFromVector3(e.normalize());
}
function C(a) {
return 4600 * (1 / (0.92 * A(a, -0.4, 2) + 1.7) + 1 / (0.92 * a + 0.62));
}
function M(a, r = new R()) {
return m(
C(a),
r
);
}
export {
G as AerialPerspectiveEffect,
P as AtmosphereMaterialBase,
L as AtmosphereParameters,
X as DEFAULT_PRECOMPUTED_TEXTURES_URL,
g as DEFAULT_STARS_DATA_URL,
h as IRRADIANCE_TEXTURE_HEIGHT,
y as IRRADIANCE_TEXTURE_WIDTH,
x as IrradianceMaskPass,
H as METER_TO_LENGTH_UNIT,
v as PrecomputedTexturesLoader,
B as SCATTERING_TEXTURE_DEPTH,
F as SCATTERING_TEXTURE_HEIGHT,
d as SCATTERING_TEXTURE_MU_SIZE,
k as SCATTERING_TEXTURE_MU_S_SIZE,
Z as SCATTERING_TEXTURE_NU_SIZE,
w as SCATTERING_TEXTURE_R_SIZE,
O as SCATTERING_TEXTURE_WIDTH,
b as SKY_RENDER_ORDER,
z as SkyLightProbe,
V as SkyMaterial,
W as StarsGeometry,
Y as StarsMaterial,
j as SunDirectionalLight,
q as TRANSMITTANCE_TEXTURE_HEIGHT,
K as TRANSMITTANCE_TEXTURE_WIDTH,
J as aerialPerspectiveEffectOptionsDefaults,
Q as atmosphereMaterialParametersBaseDefaults,
M as convertBVIndexToLinearSRGBChromaticity,
m as convertTemperatureToLinearSRGBChromaticity,
$ as getAltitudeCorrectionOffset,
ee as getECIToECEFRotationMatrix,
ae as getMoonDirectionECEF,
te as getMoonDirectionECI,
se as getSunDirectionECEF,
re as getSunDirectionECI,
Te as getSunLightColor,
oe as skyLightProbeParametersDefaults,
Ee as skyMaterialParametersDefaults,
ne as starsMaterialParametersDefaults,
ie as sunDirectionalLightParametersDefaults
};
//# sourceMappingURL=index.js.map