Jabka Object System

jabka/toad-stamp.gif

Donald H. House, June 28, 1996


This document gives a brief introduction to the special features of Jabka's version of the Scheme programming language that provide support needed for object-oriented graphics. Central to providing this support is the addition to Scheme the new atom type object. This document describes how objects are created in Jabka and outlines the Jabka ojbect heirarchy. Other Jabka Scheme extensions meant specifically to support graphics are described in a separate document entitled the Jabka Graphics Programming Reference.

Contents

Overview of Objects in Jabka

The Jabka Object Class Hierarchy

Creating, Naming, and Destroying Objects

Using Objects

Class and Method Descriptions


Overview of Objects in Jabka

Jabka is an object-oriented graphics system. This means that the various components of the system can be thought of as objects that you can create and destroy on command, and to which you can send commands, known as messages, asking them to perform certain actions. Each object keeps track of certain information about itself, and knows about a collection of associated procedures or methods to use to operate on this information. For example, you might want to create a camera, tell it how to position itself and adjust its zoom lens, and then finally to take a picture. The camera is the object, and you would send it messages like pan and raise to position it, zoom to adjust the lens, and finally shoot to take the picture.

classes and instances

Objects are of different types, and the type of an object is called its class. We say that a particular object is an instance of that class. Object classes are hierarchically organized, with the top level in the hierarchy providing overall structure, and lower level objects providing specialization. For example, in Jabka there is a class Device, which provides the basic structure for outputting a graphic image to an external medium. Device has several subclasses, File, Framebuffer, Bitmap and Pixmap which provide further specializations that are needed to handle output to an external disc file, to a hardware framebuffer, or to a monochrome or color window on the screen. File, in turn, has subclasses GIFFile, JabkaFile, PictureFile, and PPMFile to handle output to files in various image file formats. We say that a JabkaFile object is a kind of File object, which is in turn a kind of Device. Or, we can say that Device is a superclass of File, and File is a superclass of JabkaFile. A subclass shares all of the data-structures and methods of its superclass, but may add data structures and methods of its own, or may provide modifications or extensions to the methods of its superclass.

prototypes

Beyond class heirarchy, there is the notion in Jabka of an object's prototype. When an object is created in Jabka, it is actually formed as an image of a prototype object. The object initially borrows all of its attributes from its prototype. An object can be specialized from its prototype by sending it a message that modifys or sets one of its attributes to be different from that of the prototype. For example, one of the standard predefined material objects in Jabka is called plastic, that when rendered looks like white plastic. If a new object is created with plastic as its prototype, it will also render as white plastic. However, if a message is sent to the new object to set its color to a lemon yellow, it will then render as lemon yellow plastic. In other words, it still keeps the attributes of the prototype that make it look like plastic, but now takes on its own specialized color. However, prototyping in Jabka is even more powerful than the kind of "cloning" mechanism just described.

All of an object's attributes that have not been explicitly set continue to be derived from the prototype. What this means is that each object derived from a prototype that has not explicitly modified a certain attribute will dynamically take on any change to that attribute when it is made to the prototype. For example, suppose that you have made six different materials, all with plastic as their prototype, but all specialized with their own color. And, suppose that many of the objects in a scene have been made from these six materials. Now, you might want to experiment with changing the shininess of all of your plastic objects. Since all of the plastics share plastic as a prototype, it is a simple matter to send plastic a message to change its specularity (shininess), and this change will automatically affect all six of the materials sharing plastic as a prototype. On the other hand, changing the color of the prototype plastic will not affect the color of the derived materials, since each of them has been given its own specific color and no longer derives its color from the prototype.

class prototypes

The notions of class and prototype come together in the following way in Jabka. There is a fixed class heirarchy, built into Jabka, that defines the base set of objects from which prototypes can be formed. When Jabka is started up, a prototype object is automatically created corresponding to each class in the object heirarchy. You could call this base set of objects the class prototypes. Further specialized objects are automatically created by prototyping them from this base set. Finally, the user is free to create new objects using any existing object as a prototype.

The Jabka Object Class Hierarchy

The complete object hierarchy in Jabka is outlined below. Subclasses are indented below their superclasses. Class prototype objects have the same name as the class. Capitalization is as in the original C++ code which Jabka is written in. The scheme interface ignores case, and the usual convention is to use all lower case for names.


Glob Global object -- superclass of all Jabka graphics objects
  Device Device -- system dependent device for storing an image
    BitmapDev Bitmap -- monochrome on-board image frame store
    File File -- for writing an image to a disk file
      GIFFile GIF File -- 8-bit GIF formated file
      JabkaFile Jabka File -- Jabka's 24 bit raster format
      PictureFile Picture File -- Jabka's picture format
      PPMFile PPM File -- Portable Pixmap formated file
    FrameBuffer Framebuffer -- off-board RAM storage for an image
    PixmapDev Color Pixmap -- color on-board image frame store
  Filter Image Filter Operator -- defines a transformation of an image
    BoxFilter Box Shaped Filter -- Box Shaped Convolution Filter
    BrushFilter Brush Filter -- Brush Texturing Filter
  Image Image -- system independent off-screen storage for an image
    Picture Picture -- image is collection of 2D objects (draw mode)
    Raster Raster -- image is a full color raster (paint mode)
  Material Material Description -- describes surface properties of object
  ModelingObj Modeling Object -- element of 3D model
    Camera Camera -- virtural camera Light Light -- light source
    Part Part -- internal node in model geometry hierarchy
    Primitive Primitive -- leaf in model geometry hierarchy
      Polyline Polyline -- connected line segments in 3 space
      Surface Surface -- surface in 3 space
        BezPatch Bezier Surface -- surface formed by 4 cubic Bezier curves
        Polysurface Polygonal Surface -- surface formed from polygons
      Solid Solid -- 3 dimensional solid
        Quadric Quadric -- 3 dimensional quadric solid
        Superquadric Superquadric -- 3 dimensional superquadric solid
  Nametable Name Table -- hashed symbol table for object system
  Pane Window Pane -- framework for a screen window
    GWindow Graphic Output Window -- basic color graphics window
  Reader File Reader -- for reading an image from a disk file
    GIFReader GIF Reader -- reads 8-bit GIF format image file
    JabkaReader Jabka Reader -- reads Jabka raster format image file
    PictureReader Picture Reader -- reads Jabka picture format image file
    PPMReader PPM Reader -- reads Portable Pixmap format image file
  Renderer Renderer -- basic framework for all renderers
    BSPRenderer Binary Space-Partitioning-Tree Renderer
    RayTracer Ray Tracing Renderer
    Scanline Scanline Renderer
    Wireframe Wireframe Renderer -- usually used as previewer
  Shader Shader -- given a point on surface determines color (shade)
  TextureMap Texture Map -- texture maps for use in defining materials
    ColorMap Color Map -- texture geometric shapes and color gradients

Creating, Naming, and Destroying Objects

Using Objects

Once an object is created, you give it commands by sending it messages. The methods that are understood by each class are described below. Messages are sent to an object using a syntax that looks identical to a function call in Scheme: (obj message ...) where obj must be a Jabka object, and as many messages as are desired may be provided. Each of the messages has the format (method argument ...) where method must be a valid method name for the class of the object obj, and the correct number and type of arguments for that method must be provided. Messages are sent to the object, and processed by the object in the order of their occurance in the call to the object. The result of the application of the final method in the sequence is returned. For example, if a named light has been created using the command (object bulb light), the command (bulb (setcolor yellow) (gettype)) will first set the color of the light to yellow, and then return its type (either lightbulb or striplight).

Class and Method Descriptions

The following lists the classes and methods that the user will most likely need in constructing 3D models and rendering images in Jabka, when using the Scheme interface. Remember that each subclass inherits the methods of all of its superclasses, so in the following listing only the methods unique to a subclass appear. The notation x::y used below means that x is a subclass of y, or equivalently y is the superclass of x.

Glob Global object -- superclass of all graphics system objects

Device::Glob Device -- system dependent device for storing an image

BitmapDev::Device Bitmap -- one bit per pixel on-board monochrome image frame store

File::Device File -- for writing an image to a disk file

GIFFile::File GIF File -- 8-bit GIF formated file

JabkaFile::File Jabka File -- Jabka's 24 bit raster format

PictureFile::File Picture File -- Jabka's picture format

PPMFile::File PPM File -- Portable Pixmap formated file

FrameBuffer::Device Framebuffer -- off-board RAM storage for an image

PixmapDev::Device Color Pixmap -- variable bits per pixel on-board image frame store

Filter::Glob Image Filter Operator -- defines a transformation of an image

BoxFilter::Filter Box Shaped Filter -- Box Shaped Convolution Filter

BrushFilter::Filter Brush Filter -- Brush Texturing Filter

Image::Glob Image -- system independent off-screen storage for an image

Picture::Image Picture -- image is collection of 2D objects (draw mode)

Raster::Image Raster -- image is a full color raster (paint mode)

Material::Glob Material Description -- describes surface of geometric object

ModelingObj::Glob Modeling Object -- element of 3D model

Camera::ModelingObj Camera -- virtural camera

Light::ModelingObj Light -- light source

Part::ModelingObj Part -- node in geometric model graph

Primitive::ModelingObj Primitive -- leaf in model geometry hierarchy

Polyline::Primitive Polyline -- connected line segments in 3 space

Surface::Primitive Surface -- surface in 3 space

BezPatch::Surface Bezier Patch -- patch surface formed by 4 cubic Bezier curves

Polysurface::Surface Polygonal Surface -- surface formed from polygons

Solid::Primitive Solid -- 3 dimensional solid

Quadric::Solid Quadric -- 3 dimensional quadric solid

Superquadric::Solid Superquadric -- 3 dimensional superquadric solid note: refer to Barr, Superquadrics and angle-preserving transforms, IEEE Computer Graphics and Applications, Jan. 1981 for a complete description of superquadric solids.

Nametable::Glob Name Table -- hashed symbol table for object system

Pane::Glob Window Pane -- framework for a screen window

GWindow::Pane Graphic Output Window -- basic color graphics window

Reader::Glob File Reader -- for reading an image from a disk file

GIFReader::Reader GIF Reader -- reads 8-bit GIF format image file

JabkaReader::Reader Jabka Reader -- reads Jabka raster format image file

PictureReader::Reader Picture Reader -- reads Jabka picture format image file

PPMReader::Reader PPM Reader -- reads Portable Pixmap format image file

Renderer::Glob Renderer -- basic framework for all renderers

BSPRenderer::Renderer Binary Space-Partitioning-Tree Renderer

RayTracer::Renderer Ray Tracing Renderer

Scanline::Renderer Scanline Renderer

Wireframe::Renderer Wireframe Renderer -- used mostly as a previewer

Shader::Glob Shader -- used by renderers to determine pixel shade

TextureMap::Glob Texture Map -- used to supply a texture to a material's surface

ColorMap::TextureMap Color Map -- used to supply a color pattern to a material's surface