CSCI 441 - Computer Graphics

Fall 2023 - Assignment 2 - An Unexpected Journey

This assignment is due by Thursday, September 21, 2023 11:59pm.

You step back to admire your work. You're not quite sure how you did it, but there it is for all to see. The sign promoting your shop is freshly painted and standing.

And so you wait...

You've diversified your offerings, accepting strange trinkets and items from far away places. You have no idea what you are supposed to be collecting, but if it's an item you haven't heard of or seen before, then you figure it might be something to hold on to.

After some time, the person in the cloak returns and doesn't say anything for a long while. You hear:

"This is proving more difficult than we realized. You have only acquired one of the items. Maui is running short on time and has provided me with this list, which I now give to you."

Part I - Let's Make A Deal


The shadowy figure hands you the list and motions for you to follow. You begin traveling through parts of town you've never entered before. As you wind your way through a maze of stalls and shops, you try to make a mental map of where you're going so that you can return.

"These people have what you are looking for. You will need to acquire the rest from the other traders. Be ready to barter and argue, they won't give you a fair price."

You begin reading over the list. It's a strange set of items, seven in all. You're not even sure which is the one that you already possess. On the back of the list, you find written:

For this assignment, you will write an OpenGL/GLFW program that displays a 2D animated and interactive Hero. Make your window a traditional size, in fact make it 512x512 (the same as Lab00b, hmm). Your Hero must be made up of OpenGL primitives, at least one of which is solid, and drawn in hierarchical fashion. In other words, the eyes and mouth should be drawn with respect to the head and the head with respect to the body, etc. A carefully placed call with glm::translate() could be used to move entire portions of the Hero's body.

Your Hero must have some form of constant animation regardless of user interaction (head bobbing side to side, arms waving up and down, etc.).

The user must be able to move the Hero around the screen with the WASD keys and the Hero must wrap around the screen. That is, when the Hero gets to the left edge of the screen, the Hero should then reappear on the right edge of the screen. Same scenario for right-to-left, top-to-bottom, and bottom-to-top. When each of these four scenario happens, you must call the following respective functions: moveLeft(), moveRight(), moveUp(), and moveDown(). This will take care of advancing the map for you. Make sure to keep the function call to drawMap() at the beginning of draw loop.

The Hero must also interact with the mouse (change the Hero's expression, fire an arrow, etc.) and the interaction must be based on the position of the mouse (the Hero runs away from the mouse, it fires an arrow at the mouse, the Hero constantly looks at the mouse, etc.). Your program must register a callback for the keyboard and mouse. As discussed in class, it is possible to combine all these events.

Point, Set, Match: combine the mouse and keyboard together for A + Click or similar operations.

Have fun and be creative! Don't be limited to just the suggestions above. Try out different key combinations (maybe allow the arrow keys to move your hero in addition to WASD), make full use of the mouse, make your assignment as cool as possible! Your Hero will be added to the Hero page so if you have a particularly cool pose you'd like to use, be sure to capture that as your screenshot.

Use this source code package. Additionally, download these world map images and put them into the images/ folder to populate the world map.

After acquiring all seven items, the items written vanish and a new message appears.

Make haste. The taniwha are growing stronger. -M

Part II - Website


Update the webpage that you submitted with A1 to include an entry for this assignment. As usual, include a screenshot (or two) and a brief description of the program, intended to showcase what your program does to people who are not familiar with the assignment.


Part III - Questions


Briefly answer the questions below. Include your response in the README.txt file.

  1. Provide a series of OpenGL/glm calls that accomplish the following transformations. Assume you have a function drawHelmet() which takes care of drawing the Mines helmet to the screen.
    1. As seen in class, it is very simple to rotate an object and have it spin around its own local axis. The Mines helmet is located at (x, y). How can we rotate the helmet around the origin (0, 0) without the object spinning, but staying stationary around its own local axes? An angle of rotation θr is provided and updated each frame to simulate the animation.
    2. Instead of rotating around the origin (0, 0), how can we rotate the helmet around an arbitrary point (i, j)?

Documentation


With this and all future assignments, you are expected to appropriately document your code. This includes writing comments in your source code - remember that your comments should explain what a piece of code is supposed to do and why; don't just re-write what the code says in plain English. Comments serve the dual purpose of explaining your code to someone unfamiliar with it and assisting in debugging. If you know what a piece of code is supposed to be doing, you can figure out where it's going awry more easily.

Proper documentation also means including a README.txt file with your submission. In your submission folder, always include a file called README.txt that lists:


Grading Rubric


Your submission will be graded according to the following rubric:

Percentage Requirement Description
20% Hero is correctly drawn with OpenGL primitives. Draw calls are structured hierarchically, with some form of model instancing [1]. Hero must be broken down into function calls that handle smaller components.
25% Hero is in a state of constant animation, even when the user is not interacting with it.
20% Hero responds to keyboard presses by moving around the screen. Proper bounds checking is performed to move your Hero from world to world and the worlds update. Pressing ESC closes the program.
20% Hero responds to mouse clicks and mouse movement. The response is based on the location of the mouse.
5% Questions from Part III are answered and included in the README.txt file.
5% Submission includes source code, CMakeLists.txt, and README.txt.
Source code is well documented. Webpage named <HeroName>.html submitted and updated with screenshot from the latest assignment.
5% Submission compiles and executes.

[1] In other words, a call to drawHero() would be made up of calls to drawHead(), drawBody(), etc.. Within drawHead() are two calls to drawEye() to place each eye on the head. A properly placed call using glm::translate() could move the entire head (and eyes) with respect to the Hero's body. Each component should be drawn with respect to the component it is attached to (i.e. eye locations are set as offset from center of head) rather than being specified with respect to the center of the Hero. Individual components can then be moved hierarchically. If there are any questions, feel free to post a question to Piazza.


Experience Gained & Available Achievements


Assignment Attribute
Assignments +100 XP
Web Attribute
Web +100 XP
Point, Set, Match
Point, Set, Match
???
???
???
???


Submission


When you are completed with the assignment, zip together your source code, CMakeLists.txt, and README.txt into a folder named src/ plus include your www/ folder. Name the zip file, HeroName_A2.zip. Upload this file to Canvas under A2. The structure of your submission should look as follows:

This assignment is due by Thursday, September 21, 2023 11:59pm.