Assignment Description

Due: Monday Aug 9th 23:59:59 PDT

You will write the OpenGL rendering and interaction part of a very simple game engine. We supply you with the geometry and textures of 5 maps from the Half-Life series, and we load this into an internal mesh structure for you. Your responsibility is to render this map, and allow the user to fly through it.

IMPORTANT, LICENSING ISSUES: This project uses maps from the Half-Life commercial engine. We are supplying this, and using it, in a purely educational manner. YOU ARE NOT ALLOWED TO REDISTRIBUTE ANY OF THIS DATA, OR USE IT FOR ANYTHING BEYOND THIS CLASS. In an effort to make the course relevant and interesting we are supplying you this data, but all copywrite is still held by Valve Inc.

Minimum Specifications

This project includes both the programming of an OpenGL application, as well as the more trial-and-error process of configuring your program to open with a reasonable view of the map you're loading. We suggest working through features in the order listed.

  1. Render all the polygons inside OBJMesh.
    • Each polygon is stores as an OBJFace (See MeshInfo.h)
    • Start by rendering each polygon with the color of the material associated with it.
    • The materialId integer on OBJFace corresponds to the index of this polygon's material inside the materials array inside OBJMesh
  2. Implement controls to move through the scene. You need to support:
    • Keyboard controls moving forwards and backwards (translating along the camera's z-axis)
    • Keyboard controls for looking left and right (rotating in horizontal plane, around camera's y-axis)
    • Keyboard controls for looking up and down (rotating around camera's x-axis)
    • Make the default position that the camera displays when the program launches be looking down on the map, ensuring that the whole map is visible. You can, for extra credit, implement something different that initializes the camera in a specific place within the map. This is specially relevant if you implement the "Gravity" part of the extra credit section -- in this case your default position should not start out as looking down on the map, but be somewhere on the ground plane inside the map.
  3. Implement a Phong shader in GLSL using the provided shading framework.
    • Use Shader::setUniform to pass uniforms to the shader variables you create.
    • Read the color of each polygon from it's associated material.
    • Use the material properties read from the command line. This is stored inside the Scene object as _m.
    • Light the mesh using two directional lights. Use the bounding box we make available inside OBJMesh to configure the directional lights in sane manner. Offset the two lights in opposite directions, so that it creates the effect of having two suns in different parts of the sky falling onto the map. To do this, you can, for example, model it as a light coming from a directional orthogonal to the largest side of the bounding box.
  4. Texture map each polygon by passing the texture map for this polygon to the GLSL shader.
    • The materialId int on OBJFace corresponds to the index of the materials array holding the specific texture map information for this polygon. Use Common.h's createGLTexture function to convert an image loaded with FreeImage (an FIBITMAP) to an OpenGL texture stored on the GPU, and store the texture id using the variable we provide on the material class.
    • You will need to modify the GLSL shader to use this texture map.

Extra Credit

We will be awarding extra credit up to 25% of the project total. We will be awarding credit roughly proportional to the order of these ideas:

Implementation Hints

To start off, please read the MeshInfo.h header file that describes the whole internal mesh format. Understand how to access different types of elements - there is some sample code in Scene.cpp that shows you how to query the mesh for data.

Look at int main() to see all the OpenGL configuration we do.

TODO comments appears inside the code. Fill things in here. If you need to go beyond the skeleton or modify things to your own liking, feel free to do so.

Resources

You will find the following resources useful in completing this project:

Skeleton Code

Download here. Aug 4 (enabled depth test (z-buffering) and 2D texturing in setup, and fixed function names in Camera.h)
Maps download here. (sunet id required)

Submission Instructions

We provide you with 5 maps. You can set the values of your material properties at your discretion. You need to submit two images and text files for each map, with the following names (replacing [nr] with the map number):

Also submit ALL your source code!