Controlling the camera in eeGeo 3D maps
Cameras in eeGeo 3D Maps
The SDK relies on its host application providing a camera object, which specifies a point of view from which the app views the world. The SDK uses the camera to determine which parts of the world are in view, and to draw the world scene.
A host app creates an instance of class EegeoWorld – this contains most of the state and functionality of Eegeo 3D maps.
The app creates an instance of RenderCamera, and binds it to the EegeoWorld instance by calling EegeoWorld::SetRenderCamera().
The RenderCamera class defines world, view and projection transforms common to most 3D rendering APIs.
Updating the camera
Each app is free to decide how to update the state of RenderCamera – setting its location, orientation, field of view, etc. However, we provide a set of helper types that are useful for creating and controlling a RenderCamera in typical apps, located in the namespace Eegeo::Camera::GlobeCamera.
- GlobeCameraController contains a RenderCamera, and controls it so that it looks at a point of interest on the surface of the Earth.
- GlobeCameraTouchController provides user-input from touch surface gestures for a GlobeCameraController. This allows the user to pan, zoom and rotate the camera about its point of interest.
The Example SDK Apps illustrates how these camera controller types are used in a typical app.
Care must be taken over the order in which camera controller components are updated with respect to EegeoWorld.
- Call EegeoWorld::EarlyUpdate. This updates components on which camera controllers typically depend, such as environment flattening
- Update camera controllers, setting the RenderCamera state for this update frame
- Call EegeoWorld::Update. This updates the remaining EegeoWorld components based on the state of its RenderCamera
See Example SDK App MyApp::Update for an example implementation.