Computer Science 112
The Art & Science of Computer Graphics

Spring 2013, The College of Saint Rose

Studio/Lab 7: Shared Models
Due: 11:59 PM, Tuesday, April 2, 2013


In this short "mini-lab" exercise, you will learn how to work with "shared models" in Mead.

You have created some very interesting models over the first half of the semester, and I would like you to be able to use each others' models as building blocks for the scenes you will be developing for the last several weeks and for your final projects.

Using a Shared Model

A shared model is one which defines one or more Mead objects, but does not add it to a scene or generate any images of the object. The idea is that it is an object that might be useful in many models, so we package it up so it is easier for other models to use.

There is an example of a shared model on the shared CS112 folder. Mount that folder (instructions on the course home page), navigate to the shared_models folder, and copy PacMan.scm to your own folder.

Open this model in Mead. Notice that it's mostly comments. Don't worry about the details yet.

Run this model. If all goes well, you will not get any errors, but you will also not get an image. That's because we did not (and you should never) add anything to the scene or shoot any pictures with the camera in a shared model. That's all up to the user of the shared model. As the author of a shared model, we don't know where in the scene the object(s) we provide will ultimately be placed.

Now, in the same folder as your copy of PacMan.scm, create a new model called PacMen.scm that contains the following:

(require (lib "Defs.ss" "Mead"))
(require "PacMan.scm")

(tell scene
      (add pacMan (translate 50 0 0))
      (add pacMan (translate -50 0 0))
      )

(tell camera (shoot))

This looks pretty similar to the models we've been developing all semester. The exceptions are

  1. the extra require at the top, and
  2. the fact that we can use an object called pacMan without defining it here.

That's because we're telling DrScheme that we want not only the Mead definitions (which we always get from the usual require) but also the definitions provided in PacMan.scm. And one of those definitions is a Difference object called pacMan.

Defining a Shared Model

Now, read carefully through the comments in PacMan.scm to learn the details of how we define a shared model.

Follow the Pac Man example to create at least one shared model to contribute to a class collection. To do this, you will take your favorite object or objects that you've developed for any previous lab models and put each into a "module" form that will make it easy for your classmates to use. Alternately, you may construct new objects to use for your shared models.

Good documentation is essential if others are going to be able to use an object from your shared model in their models. Clearly specify the default locations and dimensions of your objects. Specify if they come equipped with a material property or if the user should specify a Material. And take pride in your work: put your name in a prominent position in the comment at the top of your file.

To make sure your shared model(s) are set up correctly, run each and verify that you get no errors but also get no image produced. Look carefully and make sure you are not adding anything to the scene. Further, create a separate model file that has a require for each shared model you define and add at least one of each to your scene, again to make sure that everything is working properly.

Contributing Your Shared Model(s)

To contribute a model to the shared repository:

  1. Create a new Wiki page (not just a section of your main page) that describes your shared model. If you created a shared model of a particle accelerator, and your name is Peter Venkman, name your page "Peter Venkman's Particle Accelerator". Include an image or images to provide useful views. Don't forget to use file names for your images that include your name to avoid name collisions with classmates. Add your page to the "Shared Models" category. And of course, include your name on your shared model's wiki page so your classmates know who gets the credit when they use it!
  2. Email your shared model file to terescoj AT strose.edu so it can be copied into the shared model repository, located in the class shared folder under shared_models. This year's models will be in a subfolder s13.

When you use a classmate's shared model in one of your models, be sure to give proper credit, both as a comment in your model file and as part of your image description on your wiki entry.

In addition to models from this semester, shared models from two previous semesters are in the s08 and s10 folders under shared_models. You are welcome to take a look at those and/or make use of them in your upcoming labs.

Grading

Your submitted model and image will be graded out of 15 points. Your grade will be based on how well the model meets the requirements, documentation, and presentation on your Wiki page. Documentation (comments) in your submitted Mead model should include your name, the assignment (Studio/Lab 7: Shared Models) and a brief description of the model at the top, and descriptions of sections of the model that might not be clear to someone trying to understand it. Your model code should always be nicely formatted. You can always select "Reindent All" from the "Scheme" menu in DrScheme to have the system format your code nicely. This will help with readability. Since it's so easy to do, there's no excuse for turning in poorly-formatted models.

Grading Breakdown

At least 1 properly defined shared model 5 points
Code organization and style 2 points
Model documentation 3 points
Image and model description on wiki page 5 points