Posted: Thu May 14

Due: Wednesday 5/20 10:00am

3-Pass Animation

  • Pass 1: Setup pass
    • Handle the frames and basename commands.
    • Check for vary, deal with errors/warnings.
  • Pass 2: Vary pass
    • Pre-compute all the knob values for every frame.
    • Create a data structure to store all theses values.
  • Pass 3: Drawing pass
    • If animation is present, update the symbol table using values from pass 2 before doing anything else.
    • Run through the operations list as normal.
    • If animation code is present, save the screen at the end as a frame with an appropriate file name.
    • If animation code is present, stitch all the frames together. Check source code for helper functions for this (may require an imagemagick installation)

Specific MDL Commands:

  • frames
    • set the total number of frames for the animation (handle in first pass)
  • basename
    • set the basename for frames for the animation (handle in first pass)
  • vary
    • set the knob values for the animation (handle in second pass)
  • set
    • Set an individual knob value directly. (this happens in the main drawing loop)
  • In addition to the new commands, you will have to:
    • Call the first and second pass functions in the main drawing function
    • Run the main drawing loop for the correct number of frames
    • Update the knob values in the symbol table for each frame
    • Save each frame when done, and reset appropriate structures
    • Generate a gif from all the images at the end

You only need to modify one of the following files (c/python/java):

  • Java
    • MDLReader.java
  • Python
    • script.py
  • C
    • my_main.c
      • look at print_pcode.c, it is an ideal template to follow for my_main.c
    • mdl.y: there is a comment at the very bottom that you will need to check.