EAE_6320_Assignment3
A downloadable game
This Assignment is about producing a platform independent file from two platform specific files by following good design patterns. And to make the 3D Objects and Effects initialize based on the given data rather than hard coded.
In order to make the graphics.cpp platform independent, I had to move the code that does initialization of views, clearing the back buffer and swapping the buffers to somewhere else. Since this is mostly related to the views and buffers, I decided to create a class which takes care of this, named it cViewBuffer and created the interfaces for the platform specific tasks, the ones I mentioned above.
Then I had to make the 3D object initialize based on some input data (vertices and order of indices of the vertices to draw the object). Though all these data is needed to initialize, it only needed the number of indices to render the object. So, I created a variable to store the number of indices in my 3D object class and also I needed to store the index buffer. It has a unique datatype for each platform. This resulted in a size of 24 Bytes in Direct3D and 16 Bytes in OpenGL. To reduce the size of my 3D object representation, the only way I could think was making the int to an uint16_t. I tried that but it didn’t change the size of the object. Why do you think?
Here is my interface for initializing an object
To make the effect initialize on some input, it needed the data for fragment and vertex shaders. There is nothing more it needed to store to bind that effect. Size of my effect is 12 Bytes in Direct3D and 16 Bytes in OpenGL. Since I haven’t added anything extra I don’t think there is any way to reduce its size than what it is now.
Here is my code that initializes an effect
Here is the code that clears the back buffer color
Here is the image that shows the clear color in Graphics debugger
I made the background color to animate by using the simulation time which is available in the Graphics.cpp file.
Leave a comment
Log in with itch.io to leave a comment.