next up previous contents
Next: DisplayDevice Up: Display objects Previous: ColorUser   Contents

Subsections


DispCmd

Files: DispCmds.h, DispCmd.C
Derived from: none
Global instance (if any): none
Used in optional component: Part of main VMD code

Description

DispCmd is a base class for a large number of objects which are used to create the display lists in Displayable objects. Each subclass represents a particular drawing primitive, such as plotting a line, changing the current color, or applying a rotation. These objects take the data required for the particular primitive they represent (for example, the endpoints of a line, or the index of a color) and append this data to the end of the display list for a given Displayable. Routines are available to permit a DispCmd to be used more than once, and also to have the DispCmd remember the location where the data was most recently appended so that new data may be copied over existing data in a display list.

Constructors

Enumerations, lists or character name arrays

At the beginning of DispCmds.h is an enumeration with entries for all the different DispCmd-derived classes. These names are used by the render routine in each DisplayDevice to determine what the commands are in a display list. When new drawing primitives are added, a new name should be put in this list, and that name should be specified in the DispCmd base class constructor.

Following this are enumerations describing the different types of spheres that may be drawn, and the different types of lines.

Internal data structures

Nonvirtual member functions

Method of use

Each class derived from DispCmd should have two constructors: If a derived class does not require any arguments (for example, the PUSH command, which just signals to push the top transformation matrix, but does not require any data itself), only the default constructor is used. Otherwise, each derived class should also provide two new functions;

Within the put and reput functions, DispCmd uses several routines in Displayable to start the action of writing a new command to the end of the display list, to copy over the data itself, and to signal the data is copied.

Suggestions for future changes/additions

At present, most Displayable objects contain instances of these commands as private members, which are used to create their internal display lists. This is not really necessary, it would probably be better if there were one global instance of each different DispCmd, available for use by the Displayable objects. This would decrease the memory used, and the time for construction of the Displayable using the global instances instead of a local copy.


next up previous contents
Next: DisplayDevice Up: Display objects Previous: ColorUser   Contents
vmd@ks.uiuc.edu