MGED CMD vdraw
vdraw[edit]
Contents
Syntax[edit]
- vdraw o(pen)|w(rite)|i(nsert)|d(elete)|p(arams)|r(ead)|v(list)|s(how) args
Argument(s)[edit]
- open
- With no argument, this command asks whether or not any vlist is currently open. Returns "1" if yes, "0" if no. The vdraw function keeps at most one vlist open at any time - this is the vlist which is operated on by all of the other commands. All other commands, except the vdraw vlist commands, return an error if there is no open vlist.
- open name
- Open the named vlist for editing, creating a new vlist if it doesn't already exist, and closing the previous vlist. Returns 1 if creating a new vlist, or 0 otherwise.
- write index command x y z
- Write the given command and vector into the index-th node of the current vlist. The existing nodes are numbered from 0 to n-1, where n is the length of the vlist. If the index is in the range 0 to n, there is no return value; otherwise an error message is returned.
- write next command x y z
- Append the given command and vector to the end of the current vlist. No return value.
- insert index command x y z
- Insert the given command and vector in front of the index-th node of the current vlist. Returns an error if the index is not in the range 0 to n, where n is the length of the vlist.
- delete index
- Delete the index-th node from the current vlist. Returns an error if index is not in the range 0 to n-1.
- delete last
- Delete the last node from the current vlist. Returns an error if the current vlist is empty.
- delete all
- Delete all of the nodes from the current vlist.
- arams color rrggbb
- Set the color parameter of the current vlist with a six-digit hexidecimal integer.
- params name name
- Set the name of the current vlist to name. Returns an error if a vlist with the given name already exists.
- read index
- Returns the contents of the index-th node of the current vlist, in the order command x y z. Returns an error if the node does not exist.
- read color
- Returns the six-digit hexidecimal integer representing the color of the current vlist.
- read length
- Returns the length of the current vlist.
- read name
- Returns the name of the current vlist.
- send
- Displays the current vlist by creating a pseudosolid. If the name of the vlist is name, then vdraw will create a pseudosolid named _VDRWname, replacing any existing pseudosolid with the same name. If a true solid with that name exists, "-1" is returned and the vlist is not displayed. A "0" is returned if the vlist is successfully displayed.
- vlist list
- Returns a list containing the names of all of the vlists being maintained by vdraw, or an empty string if there are no vlists.
- vlist delete name
- Deletes the named vlist. If the vlist doesn't exist, an error is returned. Note that this only deletes the copy of the vlist maintained by vdraw -- the corresponding pseudosolid, if it exists, is not automatically deleted.
Return Value(s)[edit]
- read index
- Returns the contents of the index-th node of the current vlist, in the order command x y z. Returns an error if the node does not exist.
- read color
- Returns the six-digit hexidecimal integer representing the color of the current vlist.
- read length
- Returns the length of the current vlist.
- read name
- Returns the name of the current vlist.
- vlist list
- Returns a list containing the names of all of the vlists being maintained by vdraw, or an empty string if there are no vlists.
Description[edit]
Solids are displayed in MGED using vlists. These are are lists of commands and vectors which draw lines and polygons. The vdraw command allows the user to edit vlists from the command line and then display them in the MGED display window as "pseudosolids" -- vestigial entries in the in-memory list of displayed solids which have a name, color, and a display list, but which do not represent geometry.
The vectors in the vlist can represent points or normal vectors defining lines and polygons; the interpretation of each vector depends on the integer command which accompanies it. The following commands are defined in raytrace.h:
NAME COMMAND MEANING RT_VLIST_LINE_MOVE 0 begin new line RT_VLIST_LINE_DRAW 1 draw line to this point RT_VLIST_POLY_START 2 give surface normal for polygon RT_VLIST_POLY_MOVE 3 first polygon vertex RT_VLIST_POLY_DRAW 4 subsequent polygon vertex RT_VLIST_POLY_END 5 last polygon vertex (repeat first) RT_VLIST_POLY_VERTNORM 6 per-vertex normal (for interpolation)
Vdraw can take a variety of arguments which specify various operations on the vlists. Note that any textual argument can be replaced by its first letter. For example, vdraw d a has the same effect as vdraw delete all.
In the following descriptions, index is an integer referring to a particular node in a vlist, command is an integer representing one of the drawing commands described above, name is a string no longer than 31 characters, and rrggbb is a six-digit hexidecimal integer representing a color.
Example(s)[edit]
- mged> vdraw open square
- Open a list named square.
- mged> vdraw params color ff00
- Set color to green.
- mged> vdraw write next 0 0 0 0
- Start a line at the origin.
- mged> vdraw write next 1 100 0 0
- Draw line to (100 0 0).
- mged> vdraw write next 1 100 100 0
- Draw line to (100 100 0).
- mged> vdraw write next 1 0 100 0
- Draw line to (0 100 0).
- mged> vdraw write next 1 0 0 0
- Draw line to (0 0 0).
- mged> vdraw send
- Draw the square in the mged display.
See Also[edit]
- No related commands.
Page Generated by David Loman on: 10/12/2007 at: 7:26:48 AM