Program4

Create a trackball interface. Your repository will contain template code. Be sure to fill in all the TODO blocks. The interface should allow the object to be rotated and translated in all directions. If the mouse is moving when the button is released, the object should continue to spin. You should use perspective projection. The window should be resizable and when resized the object should maintain the proper aspect ratio.

Fixes to make things work:

Here is the code we wrote in class. It goes in the WorldState constructor.

translateToOrigin = glm::translate(glm::mat4(1.0f), -model.getCentroid());
currentModelTransform = translateToOrigin;

Rubric:
Model is at origin-1: Not at origin0: At origin
Intuitive interface0: Interface does not function1: Click+drag allows rotation, translation along xy, and translation along z.
Perspective projection0: Incorrect perspective projection1: Correct perspective projection
Rotation0: No rotation1: Incorrect rotation2: Vertical drag rotations X , horizontal drag rotates Y, non-centered drag rotates Z
XY Translation0: No translation1: Vertical drag moves along Y, horizontal drag moves along X
Z Translation0: No translation1: Vertical shift+drag moves along Z
Transform order0: Unnatural transforms2: Rotation and translation remain natural after manipulation.
Spinning0: No spinning1: Spin based on drag velocity
Resize0: Resize incorrect1: Object has correct aspect ratio after resize and fills window

Reference solution