Quake 2 Model Animator
This is a fairly simple test driver to import and render an animated (or static), lit (or unlit) Quake 2 (.MD2) model file. The GUI looks like this:
I’ll only list the not-really-obvious features here:
Start! – Pops up a separate OpenGL window that’s used for rendering. Note that ONCE you have started, “Use Lighting” can no longer be checked or unchecked without restarting the application.
Show/Hide Console – Pops up a console window (separate from both this dialog and the OpenGL rendering window) that shows what the importer is doing at that moment (during loading, this shows “parsing animations, generating normals, etc…” so if there’s a crash, its cause can be easily located.
Print Heap – Lists all of the current heap entries in the console window, to make sure that there are no memory leaks (that models are completely unloaded)
Print Profiler – Prints the number of CPU cycles that are being used to render the model. This can be used to judge when a model might need to have its polycount reduced, if lighting is slowing down the application too much, and so forth.
Flush Profiler – This should be done every time a new model is imported
LoadModel pops up a dialog prompting for an .MD2 (model file), while LoadSkin requires that the texture be in .PCX image format.
UseLighting causes the importer to generate lighting normals for the model at loadtime; note that this substantially slows down BOTH loading AND rendering. It also adds a “sphere” in the world that can be moved around (see below); this sphere represents the position of the dynamic light source.
Next Animation cycles between the model’s animations (of course, if the model is static, this does nothing). If “Wait Until Current Finishes” is unchecked, the model will immediately shift to the next animation; otherwise it waits until the current, say, step in a “walk” animation completes before transitioning.
Finally, Keyboard Controls
Up/Down/Left/Right rotates the view about the character
Page Up/Page Down zooms in & out
A/S/D/W moves the light source around (if lighting is enabled)
Snapshots
Here is a snapshot of a model rendered with realtime lighting:
Here is the same model without lighting, but with texturing
Here’s a snapshot of some sample log information about a loading model: