In this project you will continue working on an X3D viewer that can render animated textured scenes.
You are given support code for this project that should compile under Windows and Linux. Support code links against Glut, Expat, PNG, and JPEG libraries. It parses an input X3D file, partially constructs a scene graph inserting various X3D nodes into it, and then passes the scene to the Glut renderer. The X3D file format is described in the X3D specs. Most of your tasks will be modifying the file x3.cpp (look for words YOUR CODE HERE), although some modifications in x3.h may be required. As a part of your assignment you will need to create an example X3D scene file that will show an animated humanoid-like character moving through a scene.
The images are loaded by the parser, and are stored as objects of Image class (image_ field stores the pointer to the image). You need to do three things to make textures show up in the viewer:
OpenGL can apply tranformations to specified texture coordinates before using them. This is described for TextureTransform node in the X3D specs. You will need to implement it as described. This is similar to what happened in X3Transform node however there is no hierarchy and no need to use matrix stack. Just override the transforms every time it is needed.
The provided support code has some basic animation capability by using Timer, Interpolator, and Link nodes. Each link specifies which timer's time to feed into which interpolator to update which field of which node. In the task 4, all you need to do is to implement a piecewise linear interpolation of the sequence of values. You are given an array of keys and array of values of the same length. Now, given a time value, a helper function is called to figure out between which two keys the time falls. Then all you have to do is to produce an in-between value for three different data types: scalars, vectors, and rotations. For rotations, a simple implementation will simply interpolate angles and axes separately. In your scenes, very often, the orientation axis will stay the same, thus you mostly need to worry about angle interpolation.
In this task, you are in the same setting as in task four, however you need to produce a smooth interpolation using Catmull-Rom splines (tension zero, section 15.5.3 of our textbook). You will only to do this for position and scalar values, no rotations. In order to allow for easier debugging, I added a non-standard Curve node which can have a position interpolator as a child and will then draw a curve in space that will sample that position interpolator's trajectory.
Once you have your basic linear interpolation working you can start creating your final animated scene, which should have an articulated hierarchical character model which has a simplified structure of a human. In particular, you will need to tie together several interpolation nodes with proper rotation transformations of the skeletal links to produce a walking figure. The legs should consist of two parts each (upper and lower leg). Once a basic periodic walk cycle is created you can propagate it through a scene with a translation transform. For extra credit, walk your character on a curved path (this would also require changing its orientation). See section 16.4 of the book for an example of the human skeleton structure. Texture your character with some images to show that you have control over your viewer (like the head should point forward and knees bend backwards). Do not worry about being overly realistic, think of your character as being a puppet/robot. (The character parts should not fly away in different directions during animation though).
First of all, download the support code archive
The executable should be called with one command-line argument -- the name of the X3D scene file (there are some scenes provided in the data folder).
The following keystrokes are defined in the glut window (you may
map more operations to keys inside KeyboardCallback
function but you should not change the predefined keys below).
The code needs to be linked against glut, expat, png, and jpeg libraries, and the compilation requires the corresponding header files.
Copy libexpat.dll and glut32.dll to somewhere on you path. Specify the X3D file name in the Debugging options, or run the program from a command line.
Download the file p3.tgz into some folder. Open console and
go to that folder. Then type
Now this should bring up a scene with a clock (and it should not dump core). It
should also print messages saying that textures are loaded. Then you are all
set.
tar xvzf p3.tar.gz
cd p3/proj3
make
./proj3 ../data/aclock.x3d
Make sure your code compiles and works on CAEN Linux or Windows machines. You will need to turn in
We'll post the detailed submission instructions in the very near future.
Do not submit any binary files (object, executable, or image) with your project.
The timestamp on your source files and your writeup will indicate the time of submission and if this is past the deadline your submission will be considered late. Therefore, you are allowed multiple 'submissions' as long as you respect the deadline. The submission folders will also be closed for writing right after the deadline.
Test the compilation: Your submission must compile without errors and warnings on supported platforms. Mention the platform in your writeup. Code that doesn't compile will be heavily penalized.