Search this site
Embedded Files
Devyn Lehrman
  • Home
  • About
  • Write-Up Proposal
  • Engine System Update #1
  • Engine System Update #2
  • Engine System RELEASE
  • Final Project Proposal
  • Final Project Write-Up
Devyn Lehrman
  • Home
  • About
  • Write-Up Proposal
  • Engine System Update #1
  • Engine System Update #2
  • Engine System RELEASE
  • Final Project Proposal
  • Final Project Write-Up
  • More
    • Home
    • About
    • Write-Up Proposal
    • Engine System Update #1
    • Engine System Update #2
    • Engine System RELEASE
    • Final Project Proposal
    • Final Project Write-Up

Downloads:
Assignment03 64-Bit (DirectX)
Assignment03 32-Bit (OpenGL)

Clear Color interface

I created one new interface to separate everything out of Graphic.cpp to make it platform-independent. I made a cView class, where the Back Buffer, Color and Depth buffer,  and view-related initialization and clean-up are handled. This GIF shows my background in a different color,  as well as my final product (two Meshes drawn with their own Effects).


My cView class is divided into the four files: .h, .cpp, .d3d.cpp, and .gl.cpp. The main interface methods are shown in the next two pictures.



(Why is it called a clear color?)

Back Buffer

My code in Graphics.cpp using these interfaces, which call the code that was separated out of Graphics to allow Graphics.cpp to be platform-independent.

Loading Effects

Demonstrating my class-driven interface for loading shaders. This code is currently in Graphics.cpp, but could be abstracted to be called with the filepaths from anywhere.

Size of Effect Object

I'm not quite sure what this question was going for. The size of my cEffect class, which maintains an individual Effect, is 16 bytes. I specifically pushed a changed to my code to shrink to this, as I recognized I didn't need to store the filepaths of the fragment/vertex shaders.

These are 2 cShader pointers,  which in fact I don't know that this could be reduced any further - perhaps compacting the data of my cEffect class down into one pointer, and using the implementation to parse the singular array back into two individual shaders?

These pointers mean the program needs to load 2 cShaders which are also 16 bytes each. And as general overhead, the Shader Tracker object is 32 bytes. As the comment says a more sophisticated game engine would likely track more, so while possible, I don't suppose we should focus on trimming this.

Initializing Meshes (Fixed)

This is my interface call for initializing the mesh. In order, the data that is passed is: the Vertex Buffer this mesh uses, the Number of Triangles in the VB, the Index Buffer for this particular mesh, the Number of Indices to draw, and finally, the Index of the Effect that this Mesh will render with.

Initialization generates a platform-compliant Vertex Buffer and Index Buffer to store, it stores the number Indices, and also the index for the effect.

Memory of a Mesh

A triangle would use 6 bytes - 3 vertices which are represented by indices of uint16_t. However, this also requires the three points of the triangle, therefore a single triangle who doesn't share sides with any other triangle would additionally require 36 bytes - 12 for each point (4 bytes per coordinate). While I could shrink the sizes of the number of Indices and the Effect Index, alignment seems to force my cMesh class to be 32 bytes. Again, there could be some despicable colliding of arrays to fuse pointers, but I'll pass.

An isolated triangle therefore would in total require 42 bytes before the 32 my cMesh class accounts for.

This would be smaller on average if triangles shared sides, as there would be less than Triangles*3 vertices recorded in total. The more shared vertices, the smaller the mesh. The indices, however, would always have a 6 byte requirement per triangle.

Google Sites
Report abuse
Page details
Page updated
Google Sites
Report abuse