Assignment 5 - PLACEHOLDER
ZIP Link
Assignment4.zip
Write-Up
The
basics of this assignment were to alter the vertex shader to alter the
color value across the entire object, in this case a rectangle. The
default values are a gray-scale rectangle, with different gray values at
each vertex.
Then we were to check for user input via the keyboard, and move the rectangle around the screen.
Finally,
we were to include a generic builder (GenericBuilder) builder project,
which will simplify future projects for building different assets.
Technical Write-Up
So,
I was able to edit the current code and get it to draw a gray-scale
rectangle correctly. The values for doing this involve editing the
Material file including a section for constants. I included mine as
shown below:
I
initially was going to use the g_colorModifier in a table of constants.
I had trouble trying to push and pop values from the table when reading
it using lua functions. I had to comment it out to get it to work. I
will work on this for future iterations, as I did not provide myself
with enough time to complete this assignment.
The
g_colorModifier is table of values that holds an amount for the amount
of red, green, and blue to be used for the pixels on the gray-scale
triangle. This color modifier that is being checked for allows multiple
materials to be saved with different color values. This will modify the
color for the vertexShader of the item with that material being included
on it. Multiple objects/entities could contain different materials, and
be altered depending on their vertex shader, fragment shader, and now
by constant values such as a color modifier.
Here are a couple of images showing the different colors on the rectangle.
The
second step in this process was to include code that would check for
user input, and update the position of the rectangle object. I started
the project using the material to hold the position and velocity of the
object, but this was incorrect according to our assignment. We were not
to hold the position values for the object in the material. The material
shouldn't worry about it's position in the world.
I
did not complete this step, as I did not provide myself with enough
time. I will complete this in future iterations, and here is how I will
do it. I will create an Entity object which stores the position and
velocity values. This entity will store a material, containing all of
the information it needs to draw itself. This will include the shader
paths and constants needed. The Entity will also hold a value for it's
"mesh" which holds all of locations of vertices to be drawn for itself.
There
will be timer and input classes to detect the player inputs, and move
appropriate rates with respect to the timer. It will be checked on the
Game project's update call altering the Entity's position. With this
position being altered, you will have to add this offset to the vertex
values, causing the object's vertices to be altered when they are drawn
to the screen.
The third item we were to complete was
adding in a GenericBuilder. I did not provide myself enough time to
complete this section. From what I understand, this section will allow
us to implement new projects for new assets quicker, with less hassle.
It will allow you to copy the new asset type from the source to the
target assets location. The templated generic class is used to be called
in a virtual 'Build' function, to be re-written for that new builder
class.
Realized Learning Moments
I
didn't realize I would be stuck in the section looking for the material
constants for the vertex shader. The example was well explained on the
site, but I did not understand where these elements were being used in
prior code.
I did not provide myself enough time to finish this assignment. I need to prepare more time for this and the future assignments.
Time Used
Reading: 2 hours
Write-Up: 0.5 hour
Technical Write-Up: 0.5 hour
Coding: 2 hours