|
|
@ -121,7 +121,6 @@ function init() { |
|
|
|
if (pos.x && pos.y && pos.z) { |
|
|
|
pingGeometry.translate(pos.x, pos.y, pos.z) |
|
|
|
mergedGeometry.merge(pingGeometry) |
|
|
|
// Reset ping item position.
|
|
|
|
pingGeometry.translate(-pos.x, -pos.y, -pos.z) |
|
|
|
} |
|
|
|
} |
|
|
@ -130,7 +129,7 @@ function init() { |
|
|
|
groups.tracePoints = total |
|
|
|
groups.tracePoints.name = 'Trace Points' |
|
|
|
scene.add(groups.tracePoints) |
|
|
|
groups.tracePoints.rotation.y = groups.globePoints.rotation.y |
|
|
|
groups.tracePoints.rotation.y = groups.globePoints.rotation.y - 0.05 |
|
|
|
} |
|
|
|
|
|
|
|
init.addTracePoints = addTracePoints; |
|
|
@ -146,9 +145,10 @@ function init() { |
|
|
|
} |
|
|
|
|
|
|
|
function convertFlatCoordsToSphereCoords(x, y) { |
|
|
|
// Convert latitude and longitude on the 90/180 degree axis.
|
|
|
|
let latitude = ((x - globeWidth) / globeWidth) * -180 |
|
|
|
let longitude = ((y - globeHeight) / globeHeight) * -90 |
|
|
|
latitude = (latitude * Math.PI) / 180 //(latitude / 180) * Math.PI
|
|
|
|
longitude = (longitude * Math.PI) / 180 //(longitude / 180) * Math.PI
|
|
|
|
const radius = Math.cos(longitude) * globeRadius |
|
|
|
const targetX = Math.cos(latitude) * radius |
|
|
|
const targetY = Math.sin(longitude) * globeRadius |
|
|
@ -177,13 +177,16 @@ function init() { |
|
|
|
var projected = position.project(camera.object) |
|
|
|
return { |
|
|
|
x: projected.x * width + width - contentWidth / 2, |
|
|
|
y: -(projected.y * height) + height - contentHeight - 10, // -10 for a small offset
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function returnCameraAngles(x, y) { |
|
|
|
let targetAzimuthalAngle = ((x - globeWidth) / globeWidth) * Math.PI |
|
|
|
targetAzimuthalAngle = targetAzimuthalAngle + Math.PI / 2 |
|
|
|
targetAzimuthalAngle += 0.3 |
|
|
|
let targetPolarAngle = (y / (globeHeight * 2)) * Math.PI |
|
|
|
targetPolarAngle += 0.1 // Add a small vertical offset
|
|
|
|
return { |
|
|
|
azimuthal: targetAzimuthalAngle, |
|
|
|
polar: targetPolarAngle, |
|
|
@ -221,6 +224,7 @@ function init() { |
|
|
|
function render() { |
|
|
|
renderer.render(scene, camera.object) |
|
|
|
requestAnimationFrame(render) |
|
|
|
//animate()
|
|
|
|
groups.globePoints.rotation.y += 0.01 |
|
|
|
if (groups.tracePoints !== null) { |
|
|
|
groups.tracePoints.rotation.y += 0.01 |
|
|
|