Assignment 1 Quadcopter
Topics covered:
? Drawing 2D meshes
? 2D transformations: rotation, translation, scale
? Scene graph
? 2D camera: view and projection matrices, aspect
Task Description
Your task is to implement a simple scene with a landscape of houses and a quadcopter
drone that flies overhead (following the mouse). The drone includes a spy camera that can
be activated to get a close-up view of the map below.
Figure 1: World camera
Figure 2: Drone spy camera
Framework
For this assignment, you will need the Eclipse project containing the JOGL and JOML
libraries that we have been using in the workshop. See the week 1 workshop for instructions
to download and install this project.
A basic framework for the assignment has been provided in GitHub Classroom:
https://classroom.github.com/a/0sOe5CgT
Clone this framework into your own Github account.
It contains the files:
? Ass1.java – the main class implementing a JFrame and a GLEventListener
? House.java – a class that draws a house
? InputManager.java – a class that provides a simple interface for keyboard and mouse input
? Transform.java – a class that provides methods to create 2D translation, rotation and scale
matrices.
? vertex.glsl / fragment.glsl – a very simple shader
To complete the assignment, you will need to edit these files and add further classes of your
own (although you probably shouldn’t need to change the InputManager and Transform
classes).
Components
You are required to complete each of the components below. Each component contributes
a percentage towards your Completeness mark, as described below.
Houses (10%)
The basic house provided should be modified so that the roof is a different colour to the
main building, as shown in the screenshots above. Choose whatever colours you like.
Landscape (10%)
The world should be 20x20 square field with 20 houses randomly positioned in it. The
background should be a suitable shade of colour.
World camera (20%)
The basic world camera should show the entire 20x20 world, regardless of the size of the
window. The world should look square and not be stretched. If the window is not square,
the shortest axis should fit the size of the world, and the world should be centred in the
window, as shown below.
Figure 3: World camera. Window is wider than it is tall.
Figure 4: World camera. Window is wider than it is tall.
Drone (20%)
The drone has a body and four rotors (in a different colour). The rotors are animated to spin
at a constant speed. Neighbouring rotors spin in opposite directions, as shown below.
Figure 5: The quadcopter drone. Arrows show the direction of spin.
Mouse control (20%)
The drone is controlled using the mouse:
? It rotates (at a constant speed) so that the front of the drone faces the mouse pointer.
? It moves forward (at a constant speed) until it is within some threshold of the mouse
pointer, then stops.
Hint: InputManager.getMousePosition() returns the mouse position in NDC coordinates.
You need to convert this to a different coordinate frame.
Spy camera (20%)
If the mouse button is held down, the view switches to the spy camera. This camera is
centred at the drone’s position and shows a 2x2 area of the world underneath the drone
(the drone itself should not be shown). If the window is not square, the image should be
centred in the window, and the area outside the 2x2 field of view should be black:
Figure 6: The spy camera. The area outside the 2x2 field of view should be black.
Submission
Files will be submitted using Github Classroom. Your most recent commit to the repository
before the assignment deadline will be marked. No late submissions will be accepted,
except in the case of special consideration (which requires a formal application). Last minute
problems with Git are not an excuse for late submission. Remember to commit and push
your work regularly as you go.
Marks
Your marks will be calculated using three components:
? Completeness: The total value of the components (listed above) that have been attempted.
? Correctness: Whether your code is correctly implemented (according to the rubric below)
? Clarity: Whether your code is easy to understand (according to the rubric below)
The final mark will be calculated as:
Final mark = Completeness * (60 * Completeness + 40 * Correctness)
So, for example if you attempt 80% of the features above, with perfect correctness (100%)
and slightly sloppy code (70%), your mark would be:
Final mark = 80%* (60 * 100% + 40 * 70%) = 70.4
Rubric
Grade Correctness Clarity
A+
(100%)
Excellent work. Code is free from any
apparent errors. Problems are solved in
a suitable fashion.
Good consistent style. Well structured &
commented code. Appropriate division into
classes and methods, to make
implementation clear.
B
(80%)
Very good work. Code has minor errors
which do not significantly affect
performance.
Code is readable with no significant codesmell.
Code architecture is adequate but
could be improved.
C
(70%)
Good work. Code has one or two minor
errors that affect performance.
Problems may be solved in ways that
are convoluted or otherwise show lack
of understanding.
Code is readable but has some code-smell
that needs to be addressed. Code
architecture is adequate but could be
improved.
D
(60%)
Poor. Code is functional but contains
major flaws
Significant issues with code quality.
Inconsistent application of style. Poor
readability with code-smell issues. Code
architecture could be improved.
F
(40%)
Code compiles and run, but major
elements are not functional.
Significant issues with code quality.
Inconsistent application of style. Poor
readability with code
-smell issues. Messy
code architecture with significant
encapsulation violations.
0
% Code does not compile
.
Major issues with code quality. Major
readability problems and code smell
throughout. Messy code architecture with
significant encapsulation violations.