1
0
mirror of git://f0xx.org/android_cast synced 2026-07-29 05:58:14 +03:00
This commit is contained in:
Anton Afanasyeu
2026-06-06 18:53:42 +02:00
parent 39603e9763
commit 76d3d3eca4
2 changed files with 12 additions and 7 deletions

View File

@@ -105,17 +105,22 @@ function inverseRotateY(nx, ny, nz, rotY) {
};
}
function sphereTexFromLonLat(lon, lat) {
/** Hub texture coords: N-up artwork on orthographic disk (matches globe3d=0). */
function texFromLonLat(lon, lat) {
const cosLat = Math.cos(lat);
return {
x: cosLat * Math.sin(lon),
y: -Math.sin(lat),
y: Math.sin(lat),
z: cosLat * Math.cos(lon),
};
}
function bodyToTex(body) {
return { x: body.x, y: -body.y, z: body.z };
}
function bodyLonLat(body) {
const tex = { x: body.x, y: -body.y, z: body.z };
const tex = bodyToTex(body);
return {
lon: Math.atan2(tex.x, tex.z),
lat: Math.asin(Math.max(-1, Math.min(1, tex.y))),
@@ -187,7 +192,7 @@ function bakeOceanEquator(globe) {
for (let i = 0; i < EQ_W; i++) {
const lon = (i / EQ_W) * 2 * Math.PI - Math.PI;
const lat = Math.PI * 0.5 - (j / EQ_H) * Math.PI;
const tex = sphereTexFromLonLat(lon, lat);
const tex = texFromLonLat(lon, lat);
const p = (j * EQ_W + i) * 4;
let rgba = [OCEAN_FALLBACK.r, OCEAN_FALLBACK.g, OCEAN_FALLBACK.b, 255];
@@ -213,7 +218,7 @@ function bakeGridEquator(globe, gridOverlay) {
for (let i = 0; i < EQ_W; i++) {
const lon = (i / EQ_W) * 2 * Math.PI - Math.PI;
const lat = Math.PI * 0.5 - (j / EQ_H) * Math.PI;
const tex = sphereTexFromLonLat(lon, lat);
const tex = texFromLonLat(lon, lat);
const p = (j * EQ_W + i) * 4;
let rgba = analyticGridRgba(lon, lat);
@@ -244,7 +249,7 @@ function bakeLandEquator(continents, mercFlat) {
for (let i = 0; i < EQ_W; i++) {
const lon = (i / EQ_W) * 2 * Math.PI - Math.PI;
const lat = Math.PI * 0.5 - (j / EQ_H) * Math.PI;
const tex = sphereTexFromLonLat(lon, lat);
const tex = texFromLonLat(lon, lat);
const p = (j * EQ_W + i) * 4;
let rgba = [0, 0, 0, 0];

View File

@@ -180,7 +180,7 @@ unset($__platformDir);
var supportsLayout = !!(window.CSS && CSS.supports && CSS.supports('object-fit', 'cover'));
var logoEnabled = !!(stage && supportsSvg && supportsLayout);
var logoBuild = '20260606globe8';
var logoBuild = '20260606globe9';
function hubAsset(rel) {
var link = document.querySelector('link[href*="hub.css"]');