CPSC310A
Video Game Development

Assignment 3

Transformations

Details

Add a transformations of models and the view by creating a Clone class and a Camera class. The classes should have the following methods:

Clone

Clone(Model *model)

Creates a new clone. A clone is a 3D model that can be drawn, moved, translated.

void draw()

Draw this clone using its model's draw method. If the clone has been translated, rotated, or scaled, the model that is drawn should be translated, rotated, or scaled accordingly.

void translate(float x, float y, float z)

Translate this clone by the amount specified in each world-coordinate axis.

void rotate(float x, float y, float z)

Rotate this clone about by the amount specified about the object's local axes.

void scale(float x, float y, float z)

Scale this clone by the amount specified in each local-coordinate axis.

Camera

Camera()

Creates a new camera located at the origin with a view vector of [0, 0, -1], an up vector [0, 0, 1].

void translate(float x, float y, float z)

Translate this camera object by the amount specified in each world-coordinate axis.

void rotate(float x, float y, float z)

Rotate this camera object about by the amount specified about the object's local axes.

Extra

The following functions may be useful, but are not required.

void move(float lateral, float up, float forward)

Translate this clone or camera by the amount specified in each local-coordiate axis.

void rotate(float x, float y, float z, float angle)

Rotate this clone or camera around the specified local-coordinate axis by the specified angle.

void rotate_to(float forward_x, float forward_y, float forward_z, float up_x, float up_y, float up_z)

Rotate this clone or camera so that it's forward and up vector are as specified.

void move_to(float x, float y, float z)

Move this clone or camera so that it's local coordinate orgin is located at the specified world-coordinates.

Vector3f get_origin()

Return the local origin of this object or camera.

Vector3f get_lateral()

Return the local x-axis of this object or camera.

Vector3f get_up()

Return the local y-axis of this object or camera.

Vector3f get_forward()

Return the local z-axis of this object or camera.

Test

Your program should include a test program that is a rudamentary game including an environment, a camera, and player control.

Submission

Your program will be evaluated for both style and functionality. Submit your code as a tar file on cseval before class on Wednesday March 19th.