@takram/three-atmosphere
Version:
A Three.js and R3F implementation of Precomputed Atmospheric Scattering
66 lines (65 loc) • 2.75 kB
JavaScript
import { X as I } from "./shared.js";
import { A as G, c as N, d as L, j as g, k as X, D as y, l as h, I as H, w as x, L as v, M as B, P as d, x as k, r as F, q as O, m as Z, n as b, o as w, S as z, p as V, t as W, z as Y, C as j, E as q, G as J, J as K, s as Q, T as $, a as ee, b as ae, u as te, g as se, i as re, f as Te, h as oe, e as Ee, v as ie, y as ne, B as ce, F as _e, H as Re } from "./shared.js";
import { Color as _, Vector3 as m } from "three";
import { saturate as n, clamp as u } from "@takram/three-geospatial";
const D = /* @__PURE__ */ new m();
function l(a, r = new _()) {
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), i = 1, R = s > 0 ? c * i / s : 0, S = s > 0 ? (1 - c - s) * i / s : 0, e = D.set(R, i, S).applyMatrix3(I);
return e.x = n(e.x), e.y = n(e.y), e.z = n(e.z), r.setFromVector3(e.normalize());
}
function A(a) {
return 4600 * (1 / (0.92 * u(a, -0.4, 2) + 1.7) + 1 / (0.92 * a + 0.62));
}
function p(a, r = new _()) {
return l(
A(a),
r
);
}
export {
G as AerialPerspectiveEffect,
N as AtmosphereMaterialBase,
L as AtmosphereParameters,
g as DEFAULT_PRECOMPUTED_TEXTURES_URL,
X as DEFAULT_STARS_DATA_URL,
y as DensityProfileLayer,
h as IRRADIANCE_TEXTURE_HEIGHT,
H as IRRADIANCE_TEXTURE_WIDTH,
x as IrradianceMaskPass,
v as LightingMaskPass,
B as METER_TO_LENGTH_UNIT,
d as PrecomputedTexturesGenerator,
k as PrecomputedTexturesLoader,
F as SCATTERING_TEXTURE_DEPTH,
O as SCATTERING_TEXTURE_HEIGHT,
Z as SCATTERING_TEXTURE_MU_SIZE,
b as SCATTERING_TEXTURE_MU_S_SIZE,
w as SCATTERING_TEXTURE_NU_SIZE,
z as SCATTERING_TEXTURE_R_SIZE,
V as SCATTERING_TEXTURE_WIDTH,
W as SKY_RENDER_ORDER,
Y as SkyLightProbe,
j as SkyMaterial,
q as StarsGeometry,
J as StarsMaterial,
K as SunDirectionalLight,
Q as TRANSMITTANCE_TEXTURE_HEIGHT,
$ as TRANSMITTANCE_TEXTURE_WIDTH,
I as XYZ_TO_SRGB,
ee as aerialPerspectiveEffectOptionsDefaults,
ae as atmosphereMaterialParametersBaseDefaults,
p as convertBVIndexToLinearSRGBChromaticity,
l as convertTemperatureToLinearSRGBChromaticity,
te as getAltitudeCorrectionOffset,
se as getECIToECEFRotationMatrix,
re as getMoonDirectionECEF,
Te as getMoonDirectionECI,
oe as getSunDirectionECEF,
Ee as getSunDirectionECI,
ie as getSunLightColor,
ne as skyLightProbeParametersDefaults,
ce as skyMaterialParametersDefaults,
_e as starsMaterialParametersDefaults,
Re as sunDirectionalLightParametersDefaults
};
//# sourceMappingURL=index.js.map