Foundations of 3D Computer GraphicsMaterials and Bump Mapping |
Spec
Code
In this project you will
upgrade the scene graph infrastructure to allow for multiple
types of materials with different GLSL shaders in a single scene.
One
particular material that you will help implement is a bump mapped
material.
This project builds off of a completed version of the
Hierarchical Transformations
assignment.
You can also use a completed version of the
Keyframe Animation
assignment.
Included with this code:
- Lots of infrastructure that easily allow you to use multiple shaders and materials in the scene graph (see below)
- Shaders are given to help you start implement bump mapping.
Main differences from the book's code:
- A class called Uniforms is used to hold onto the common uniform variable values you wish to pass to the shaders (such as a modelview matrix). This allows you to set these values once, and have the data automatically passed to any shaders used as you draw the scene.
- A class called RenderStates is used to hold onto the desired values to various OpenGL state variables. By calling the apply() member of a RenderState object, you can easily set the entire desired OpenGL state at once.
- A class called Material is used to point to the shader, the OpenGL state, and the additional uniform variables needed to render one type of material.
- A shape node in the scene graph now maintains a pointer to both the associated geoemtry and material objects.