Friday, February 15, 2013

Graphics Assignment 4


Woah, this assignment was colossal and took a lot of my time. I spent most of my time structuring my code and writing parsing code for the new file formats.


Changes:
- I have added a Scene class now, which contains the entities, light and camera. The Mesh class updates and draws itself. All the renderer does now is contain the scene and asks the scene to update and draw itself.
- I have added support for light color and intensity
- I have added 4 new file formats and this is how they look like:

Effect
technique name
{
               vs = filepath
               fs = filepath
               expectedTexture = type
}

Material
effect = filepath
texture = filepath

Entity

mesh = filepath
material = filepath

Scene
noOfEntities = n
Entities
{
               entity = filepath
               x =
               y =
               z =
               rotY =
}
{
               entity = filepath
               x =
               y =
               z =
               rotY =
}
{
               entity = filepath
               x =
               y =
               z =
               rotY =
}

Light
{
               x =
               y =
               z =
               r =
               g =
               b =
               intensity =
}
Camera
{
               x =
               y =
               z =
               rotY =
}


 Screenshots


PIX Screenshot

Instructions:
- Move the light in the x and y plane using W,A,S,D
- Move the light forward and backward using R,F
- Move the camera using the arrow keys.

Notes:
Hmm, problems I ran into..
- There was this issue when all my cubes were being drawn at the same position i.e. the position of the last updated cube. I fixed this later, I realized that I was overwriting the registers that the vertex shader uses to store its uniforms and made sure that I load the uniforms and then draw it immediately, and then load the next set of uniforms.

- I ran into this linker error on which I wasted a lot of my time. I always guard my headers but I was still getting the 'already defined' error. John helped me out with this later and it got fixed by making one of my variables extern and defining it in a seperate cpp file.


No comments:

Post a Comment