double eyeHorizon = this.globe.horizonDistance(eyeAltitude); double atmosphereHorizon = this.globe.horizonDistance(160000); double near = eyeAltitude * 0.5; double far = eyeHorizon + atmosphereHorizon;
protected LookAt cameraToLookAt(Globe globe, Camera camera, LookAt result) { this.cameraToViewingMatrix(globe, camera, this.modelview); this.modelview.extractEyePoint(this.forwardRay.origin); this.modelview.extractForwardVector(this.forwardRay.direction); if (!globe.intersect(this.forwardRay, this.originPoint)) { double horizon = globe.horizonDistance(camera.altitude); this.forwardRay.pointAt(horizon, this.originPoint); } globe.cartesianToGeographic(this.originPoint.x, this.originPoint.y, this.originPoint.z, this.originPos); globe.cartesianToLocalTransform(this.originPoint.x, this.originPoint.y, this.originPoint.z, this.origin); this.modelview.multiplyByMatrix(this.origin); result.latitude = this.originPos.latitude; result.longitude = this.originPos.longitude; result.altitude = this.originPos.altitude; result.range = -this.modelview.m[11]; result.heading = this.modelview.extractHeading(camera.roll); // disambiguate heading and roll result.tilt = this.modelview.extractTilt(); result.roll = camera.roll; // roll passes straight through return result; }
this.rc.verticalExaggeration = this.verticalExaggeration; this.rc.fieldOfView = this.fieldOfView; this.rc.horizonDistance = this.globe.horizonDistance(this.navigator.getAltitude()); this.rc.camera = this.navigator.getAsCamera(this.globe, this.rc.camera); this.rc.cameraPoint = this.globe.geographicToCartesian(this.rc.camera.latitude, this.rc.camera.longitude, this.rc.camera.altitude, this.rc.cameraPoint);
double farDistance = globe.horizonDistance(navigator.getAltitude()) + globe.horizonDistance(160000); Matrix4 projection = new Matrix4(); projection.setToPerspectiveProjection(viewport.width, viewport.height, 45d /*fovy*/, nearDistance, farDistance);
Viewport pickViewport = new Viewport(49, 49, 3, 3); // 3x3 viewport centered on a pick point double nearDistance = navigator.getAltitude() * 0.75; double farDistance = globe.horizonDistance(navigator.getAltitude()) + globe.horizonDistance(160000); Matrix4 projection = new Matrix4(); projection.setToPerspectiveProjection(viewport.width, viewport.height, 45d /*fovy*/, nearDistance, farDistance);