Merge branch 'feat/hud-2d' into feat/hud-about
This commit is contained in:
@@ -465,9 +465,13 @@ export class GalaxySystemSceneComponent implements AfterViewInit, OnDestroy {
|
|||||||
const scene = this.engine.getScene();
|
const scene = this.engine.getScene();
|
||||||
const camera = this.engine.getCamera();
|
const camera = this.engine.getCamera();
|
||||||
camera.position.copy(GALAXY_OVERVIEW_POSITION);
|
camera.position.copy(GALAXY_OVERVIEW_POSITION);
|
||||||
camera.near = GALAXY_NEAR_PC;
|
// The perspective camera whichever one is live: it is where the depth range is reasoned,
|
||||||
camera.far = GALAXY_FAR_PC;
|
// and the plan view re-derives its own from it every frame. Writing to the active camera
|
||||||
camera.updateProjectionMatrix();
|
// put the astronomical-unit range on one that overwrites it, and the system clipped.
|
||||||
|
const depthCamera = this.engine.getPerspectiveCamera();
|
||||||
|
depthCamera.near = GALAXY_NEAR_PC;
|
||||||
|
depthCamera.far = GALAXY_FAR_PC;
|
||||||
|
depthCamera.updateProjectionMatrix();
|
||||||
|
|
||||||
this.controls = new OrbitControls(camera, canvas);
|
this.controls = new OrbitControls(camera, canvas);
|
||||||
this.controls.enableDamping = true;
|
this.controls.enableDamping = true;
|
||||||
@@ -902,6 +906,13 @@ export class GalaxySystemSceneComponent implements AfterViewInit, OnDestroy {
|
|||||||
if (!placed) {
|
if (!placed) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (this.engine.currentProjection === 'orthographic') {
|
||||||
|
// A parallel projection has no vanishing point to walk towards: every ray through the
|
||||||
|
// frame is the view direction, so treating the unprojected offset as one and stepping
|
||||||
|
// along it throws the sideways part away and pulls the whole ring into the middle. The
|
||||||
|
// unprojected point is already where the name goes.
|
||||||
|
return this.ringPoint.set(placed.x, placed.y, 0).unproject(camera);
|
||||||
|
}
|
||||||
const along = this.ringPoint.set(placed.x, placed.y, 0.5).unproject(camera).sub(camera.position).normalize();
|
const along = this.ringPoint.set(placed.x, placed.y, 0.5).unproject(camera).sub(camera.position).normalize();
|
||||||
return along.multiplyScalar(NEIGHBOUR_DEPTH_AU).add(camera.position);
|
return along.multiplyScalar(NEIGHBOUR_DEPTH_AU).add(camera.position);
|
||||||
}
|
}
|
||||||
@@ -1481,9 +1492,13 @@ export class GalaxySystemSceneComponent implements AfterViewInit, OnDestroy {
|
|||||||
// clumped over the system's star.
|
// clumped over the system's star.
|
||||||
this.labelOverlay?.update([]);
|
this.labelOverlay?.update([]);
|
||||||
|
|
||||||
camera.near = SYSTEM_NEAR_AU;
|
// The perspective camera whichever one is live: it is where the depth range is reasoned,
|
||||||
camera.far = SYSTEM_FAR_AU;
|
// and the plan view re-derives its own from it every frame. Writing to the active camera
|
||||||
camera.updateProjectionMatrix();
|
// put the astronomical-unit range on one that overwrites it, and the system clipped.
|
||||||
|
const depthCamera = this.engine.getPerspectiveCamera();
|
||||||
|
depthCamera.near = SYSTEM_NEAR_AU;
|
||||||
|
depthCamera.far = SYSTEM_FAR_AU;
|
||||||
|
depthCamera.updateProjectionMatrix();
|
||||||
this.controls!.minDistance = SYSTEM_MIN_DISTANCE_AU;
|
this.controls!.minDistance = SYSTEM_MIN_DISTANCE_AU;
|
||||||
this.controls!.maxDistance = SYSTEM_MAX_DISTANCE_AU;
|
this.controls!.maxDistance = SYSTEM_MAX_DISTANCE_AU;
|
||||||
|
|
||||||
@@ -1532,9 +1547,13 @@ export class GalaxySystemSceneComponent implements AfterViewInit, OnDestroy {
|
|||||||
// into the next system entered.
|
// into the next system entered.
|
||||||
this.clearObjectCard();
|
this.clearObjectCard();
|
||||||
|
|
||||||
camera.near = GALAXY_NEAR_PC;
|
// The perspective camera whichever one is live: it is where the depth range is reasoned,
|
||||||
camera.far = GALAXY_FAR_PC;
|
// and the plan view re-derives its own from it every frame. Writing to the active camera
|
||||||
camera.updateProjectionMatrix();
|
// put the astronomical-unit range on one that overwrites it, and the system clipped.
|
||||||
|
const depthCamera = this.engine.getPerspectiveCamera();
|
||||||
|
depthCamera.near = GALAXY_NEAR_PC;
|
||||||
|
depthCamera.far = GALAXY_FAR_PC;
|
||||||
|
depthCamera.updateProjectionMatrix();
|
||||||
this.controls!.minDistance = GALAXY_MIN_DISTANCE_PC;
|
this.controls!.minDistance = GALAXY_MIN_DISTANCE_PC;
|
||||||
this.controls!.maxDistance = GALAXY_MAX_DISTANCE_PC;
|
this.controls!.maxDistance = GALAXY_MAX_DISTANCE_PC;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user