fix(globe): arc sphere size independent of camera zoom using inverse distance scaling
This commit is contained in:
@@ -200,6 +200,18 @@ function updatePulses(time) {
|
||||
}
|
||||
}
|
||||
|
||||
var refCamDist = camera.position.length();
|
||||
function updateArcScale() {
|
||||
var dist = camera.position.length();
|
||||
var s = refCamDist / dist;
|
||||
for (var a = 0; a < arcData.length; a++) {
|
||||
var sps = arcData[a].spheres;
|
||||
for (var i = 0; i < sps.length; i++) {
|
||||
sps[i].scale.set(s, s, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var inertiaY = 0.0005, inertiaX = 0;
|
||||
function animate() {
|
||||
requestAnimationFrame(animate);
|
||||
@@ -209,6 +221,7 @@ function animate() {
|
||||
earth.rotation.y += inertiaY; arcGroup.rotation.y += inertiaY; gridGroup.rotation.y += inertiaY; borderGroup.rotation.y += inertiaY;
|
||||
earth.rotation.x += inertiaX; arcGroup.rotation.x += inertiaX; gridGroup.rotation.x += inertiaX; borderGroup.rotation.x += inertiaX;
|
||||
updatePulses(Date.now() / 1000);
|
||||
updateArcScale();
|
||||
renderer.render(scene, camera);
|
||||
}
|
||||
animate();
|
||||
|
||||
Reference in New Issue
Block a user