top of page

3D RENDERING

Controls: Esc - To quit game

WASD to move the cube

Move the camera

OU(Z-axis)

IK(Y-axis)

JL(X-axis)

Rotate the camera

YR(Z-axis)

TG(Y-axis)

FH(X-axis)

C/V to traverse cameras in the camera vector

The vertices required to make the cube are 8. The triangles required to make the cube are 12.

If we did what we were doing at the start of the class to render the cube we would require 36 vertices.

We know the size of each sVertex struct=16 bytes

The size to store single index is 2bytes

So, with indexed drawing we require,

Sizeof(sVertex)*number of vertices+ sizeof(single index)*number of indices

16*8+2*36=200 bytes

And without indexed drawing it would require

 Sizeof(sVertex)*number of vertices

16*36=576 bytes

So, without indices we need 576-200= 376 more bytes to render the same thing.

 

In my camera interface, I have getters and setters to avoid garbage values from ever getting assigned. Apart from this I have UpdateCurrentCameraPosition and UpdateCurrentCameraOrientation function to update the position and orientation of the current camera. I also have a vector to store all the cameras and I have a change camera function to change my current camera. Cameras can be static it means they won’t move with the user input or they are not static i.e. they move and rotate however you like.

For the transformation, I call the transformation matrix after I update the position and the orientation of the GameObject.

I submit the current camera every frame. I do this because I have implemented a vector to store cameras in the camera class. So, whenever a gameplay programmer creates a camera he must push it to that vector using the interface I provide and update the max camera count also using the interface that I provide. Then on a keypress he can choose any camera he wants and that would be the current camera.

This assignment we had to enable culling and depth buffers in OpenGL. Then create a stencilview in D3D and start using culling and depth buffers in D3D also.

We also create a cube and updated our mesh file and code to handle the third float i.e. z.

We create a camera class and use it to view the object.

I faced some problems with logging which I solved using the call stack of this and the previous assignment. I had introduced a bug by calling my AspectRatio static in my camera class. Basically, it was initializing the default log file before the initialize all function was called which caused the issue. I also had to change the vec4 constructor in vertex glsl shader file to accepts x,y,z,1.0 instead of a vec3 and a 1.0

bottom of page