You are on page 1of 6

Assignment 6

This assignment deals with our transition of 2D into 3D. So we have to render a cube and make it rotate.
1. Game ControlsThe arrow keys are used to move the cube.
W,A,S,D is used to move the camera.
Q,E is used to zoom the camera in and out.
2. Below is the screenshot of the game when initially loadedWe can see the cube resting on the game and the cube has rotating constantly about the Y axis.

3. The camera can also move in 4 directions and it can also be zoomed. Below is the screenshot of
the camera zoom.

4. The cube can also be moved and it can intersect with the plane. This proves that the depth
buffer is working.

5. The vertices and indices are different for vertex drawing than in index based drawing.
For index drawing No. of indices = 36
No. of vertices = 8.
6. If we didnt have an index buffer and were forced for vertex based drawing,
No. of vertices = 36.
No. of triangles = 12.
7. Memory used when we using index based drawingMemory = No. of vertices * Memory used per vertex+ No. of indices * Memory used per index
Memory = 8 * 16 + 36 * 2

Hence total Memory = 200 bytes


8. Memory used when we using vertex based drawingMemory = No. of vertices * Memory used per vertex
Memory = 36 * 16
Hence total Memory = 576 bytes
9. By the above calculations we see that we are saving 376 bytes of memory by using index based
buffering.
10. Below is the header file for my camera implementation-

For the camera implementation I have stored the camera details like FOV, near and far planes
etc in the object. The default values of these get constructed in the constructor. The position
and rotation of the camera are stored as a vector and a quaternion.
The user just has to Move the camera using MoveCamera before submitting the camera object
to Graphics. All other details are handled by the constructor.

11. For sending the draw call I made an object of the DrawableItem class.

The constructor is constructing a Quaternion so the gameplay programmer only needs to pass a
a mesh, vector for position an angle of rotation and the axis of rotation from the game.
Below is how I fill a Drawable item and submit it in my game

12. For the submitted draw calls I store a vector of DrawableItems and push into this each time a
DrawableItem is submitted.
13. Below is how a gameplay engineer submits a camera

I am currently making the gameplay engineer submit the main camera each frame. This will be
changed in the future if we run into the case of multiple cameras. The main camera is created in
initialization.

You might also like