Updating and Drawing
Updating and Drawing the eeGeo SDK
The Update method of the EegeoWorld object is responsible for updating numerous services in the world and required three arguments:
- float dt
- const Camera::RenderCamera& renderCamera
- const dv3& ecefInterestPoint
The first argument, float dt, represents delta time – the time elapsed between frames – and is used to update time dependent functionality, such as animations. This is a conventional argument in update loops.
The second argument is a RenderCamera, used for camera-based updates. For example, some features such as the road names will use the camera altitude as part of the calculation to determine their alpha level in order to fade correctly. Other features rely on the camera’s location, such as the traffic controller, which spawns traffic based on the camera position or the themes service, which uses it to determine how the current area of the world should look.
The third argument is a 3D vector that holds the current interest point. In this context, interest point refers to the geographical point on the Earth at the centre of the screen. The interest point is often used to obtain a terrain height estimate without a costly height lookup.
The Draw method is responsible for rendering objects in the world. This includes objects in the render queue added by renderable filters. For more information, see the Rendering documentation.
The Draw method takes a single argument; a const reference to a RenderCamera. This camera is packaged into a RenderContext object with the current screen dimensions and is used in the EnqueueRenderables method of the IRenderableFilters interface. This means that the camera passed into EegeoWorld.Draw() is the same camera that can be extracted from RenderContext any time you enqueue renderables in a renderable filter.
In addition to this, the Draw method makes use of the camera for other functionality, such as calculating light directions.
For consistency, the camera passed into the EegeoWorld.Draw() method should be the same as the camera passed into the EegeoWorld.Update() method.