Add possibility to setup Camera above horizon for augmented reality support #846
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Changes
LookAtNavigator concept was replaced by Camera and LookAt objects.
This approach allows to set camera position and rotation freely without having obligatory viewport center on the terrain.
LookAt object is a virtual look at position which can be used to set camera orientation from the perspective of looking at some point from some range and rotation. It is used to provide similar behaviour to WorldWindowController as LookAtNavigator before.
Also this improvement adds camera field of view assignment for advanced camera control and future augmented reality capabilities.
As a side effect - near clip distance calculation and camera limits was added, which prevent putting camera under the terrain.
Why Should This Be In Core?
This feature is present in Java and Android SDK, but missing in JS.
It is not possible to control camera tilt above horizon and camera field of view, which are required to display e.g. augmented reality view or represent real flexible camera behavior in 3D space.
Benefits
This enhancement allows to control camera based on it own position, heading, tilt, roll and field of view.
Look at position is only a virtual point on terrain which can be used to setup camera attributes during navigation.
This improvement also fix camera falling under the terrain. Now near clip distance is calculated correctly and camera navigation has limits to be above the ground.
Potential Drawbacks
Performance of picking lookAt position on every gesture begin is quite low. It should be used correctly to avoid infinite rendering loop.
New approach of view matrix calculation based on field of view gives little bit different test results than original approach, when calculating pixel size at distance and perspective projection.
This PR is a huge refactoring of viewing concept and must be tested a lot before merge.
Some tests where commented, because they require normal GLCanvas instead of mock due to a pick operation inside.