Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const target = MapViewUtils.rayCastWorldCoordinates(mapView, 0, 0);
if (target === null) {
throw new Error("MapView does not support a view pointing in the void.");
}
const t = Math.abs(
Math.cos(
MapViewUtils.extractSphericalCoordinatesFromLocation(
mapView,
mapView.camera,
mapView.projection.unprojectPoint(target)
).tilt
)
);
const density = MathUtils.smoothStep(horizontalDensity, verticalDensity, t);
this.m_fog.near = MathUtils.lerp(viewRange * startRatio, viewRange, 1.0 - density);
this.m_fog.far = MathUtils.lerp(viewRange * endRatio, viewRange, density);
this.m_fog.near = Math.min(this.m_fog.near, mapView.camera.far);
this.m_fog.far = Math.min(this.m_fog.far, mapView.camera.far);
}
}
assert(startRatio <= endRatio);
const target = MapViewUtils.rayCastWorldCoordinates(mapView, 0, 0);
if (target === null) {
throw new Error("MapView does not support a view pointing in the void.");
}
const t = Math.abs(
Math.cos(
MapViewUtils.extractSphericalCoordinatesFromLocation(
mapView,
mapView.camera,
mapView.projection.unprojectPoint(target)
).tilt
)
);
const density = MathUtils.smoothStep(horizontalDensity, verticalDensity, t);
this.m_fog.near = MathUtils.lerp(viewRange * startRatio, viewRange, 1.0 - density);
this.m_fog.far = MathUtils.lerp(viewRange * endRatio, viewRange, density);
this.m_fog.near = Math.min(this.m_fog.near, mapView.camera.far);
this.m_fog.far = Math.min(this.m_fog.far, mapView.camera.far);
}
}