Class: Main

Main

new Main()

Main runnable class. This is the main class for general communication to other modules, and in charge of overall animation, and represnting manoeuvres on the WebGL scene.
Source:

Methods

animate()

Starts the animation of the scene, and is self-calling. Repeats itself to allow for user to move and rotate the scene, so it can reflect this in the view. Also calls the statistics update method to allow for it to track the speed of animation in the browser.
Source:

calculateOnboardPosition(time, scale, tube)

Calculates the positon of the onboard camera when the user enables it. Gets a point slightly ahead of the animation time, in order to be a nose-cam for the plane. Performs similar actions as the spline camera positioning method, by
Parameters:
Name Type Description
time Long The animation time of the flight.
scale Integer The amount to scale the positon vector by.
tube Tube The spline cuvre created from the manoeuvre.
Source:

calculatePlanePosition(time, scale, tube)

Calculates the position of the camera eye, or plane model in this case. Does this by getting the vector at the point of the animation time, then interpolates the rotation of the plane, alongside selecting the position to look at.
Parameters:
Name Type Description
time Long The animation time of the flight.
scale Integer The amount to scale the positon vector by.
tube Tube The spline cuvre created from the manoeuvre.
Source:

init()

Initial function, starts all critical modules, including scene, objects, event listeners and html events. Self-calling function runs on startup, and after modules are loaded the animation begins and allows for user interaction.
Source:

render()

Renderes the scene with the camera, to allow for the the scene to be looked at from different angles. Uses the event class to get the rotation required to be done to the scene from the last time the user dragged the scene in an X or Y axis mean.
Source:

renderPlane()

Calculates where to place the aeroplane on the maneouvre path, based on the time. Sets cameras to look in correct positions too, based on if the user chooses the look ahead option. Performs interpolation on the different sections of each move, to make a smoother flight path.
Source:

setupParent()

Creates the 3D object to be added to by any the manoeuvre mesh. Can be added to and removed like an array.
Source:

setupRenderer()

Creates the renderer (container) of the WebGL scene, and sets size of it, background and pixel ratio.
Source:

setupScene()

Sets up the scene, and calls the ground and light to be added. Adds the scene to the entire 3D object parent.
Source: