Created
February 16, 2025 08:58
-
-
Save akella/dcece171c925d7b63dbe36f994fb6896 to your computer and use it in GitHub Desktop.
useful
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as THREE from 'three'; | |
const { cos, sin, PI } = Math; | |
const TEXTURE_OFFSET = -1.855; | |
export const latlong2xyz = (R, longitude, latitude)=> { | |
let lon = longitude * PI / 180 + 1.87; | |
const lat = latitude * PI / 180; | |
lon = -lon; | |
const x = R * cos(lat) * cos(lon); | |
const y = R * sin(lat); | |
const z = R * cos(lat) * sin(lon); | |
let finalCoord = new THREE.Vector3(x, y, z); | |
finalCoord.applyAxisAngle(new THREE.Vector3(0, 1, 0), TEXTURE_OFFSET); | |
return finalCoord; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
vec4, | |
vec3, | |
Fn, | |
uv, | |
texture, | |
uniform, | |
normalLocal, | |
mul, | |
positionLocal, | |
pass, | |
overlay, | |
refract, | |
positionWorld, | |
cameraPosition, | |
normalize, | |
length, | |
screenUV, | |
normalWorld, | |
vec2, | |
textureBicubic, | |
float, | |
negate, | |
smoothstep, | |
attribute, | |
sin, | |
cos, | |
instancedBufferAttribute, | |
mat4, | |
div, | |
modelWorldMatrix, | |
transformedNormalWorld, | |
cameraProjectionMatrix, | |
cameraViewMatrix, | |
Loop, | |
} from "three/tsl"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment