Printable Version | PREV | NEXT |
The SLIDE language uses Tcl as its scripting language. The SLIDE renderer, slide, is actually a Tcl wish program which has been augmented with real time 3D rendering capabilities using OpenGL. This relationship has many benefits.
There are four different ways to incorporate Tcl calls into a SLIDE scene description.
<expr>
}%. These
expressions will be called once during intialization in an unspecified
order in Tcl's global variable scope. The following is an example of
a point on a circle:
point p0 ( %{expr cos($SLF_PI/4)}% %{expr sin($SLF_PI/4)}% 0 )
endpoint
point p0 ( {expr cos($SLF_TIME)} {expr sin($SLF_TIME)} 0 )
endpoint
SLF_TIME
is a Tcl variable whose value is updated by
the slide renderer. There are a number of other variables
that are maintained by the renderer:
SLF_TIME |
The run time seconds of the simulation | |
SLF_FRAME |
The number of the current frame counted from the last dynamics restart. This is useful for creating batch processed animations. | |
SLF_tcltag__SCALE |
The scale factor exported by a render statement's crystal ball interface | |
SLF_tcltag__AXIS_X SLF_tcltag__AXIS_Y SLF_tcltag__AXIS_Z |
The axis of rotation exported by a render statement's crystal ball interface | |
SLF_tcltag__ANGLE |
The rotation angle in degrees exported by a render statement's crystal ball interface |
Also, all of the SLIDE Enumerated Type values
are exported as Tcl variables. For example, the value of
SLF_GOURAUD
can be referenced by
$SLF_GOURAUD
in the global variable scope.
tclinit tcl_code |
tclupdate tcl_code |
These top level statements allow you to specify arbitrary TCL code that will be run at a particular point in the rendering program. As with other TCL statements, the tcl_code blocks should be enclosed in curly braces {}; the braces will be stripped off before the code is sent to the TCL interpreter.
The tclinit statement adds a block of TCL code to be run when the SLIDE file is first read in. All of the tclinit blocks will be run in the order in which they were encountered in the file. They will be run exactly once. This is a good place to define procedures and create widgets.
The tclupdate statement adds a block of TCL code to be run at
the beginning of each update to the scene graph just before rendering.
All of the tclupdate blocks will be run in the order in which
they were encountered in the file.
They will be run once per update. This is a good place to assign
values to global variables that will be used by many elements in your
SLIDE scene.
The SLIDE API allows the user to dynamically interact with SLIDE through
TCL commands.
The API allows SLIDE objects to be created and deleted as follows:
slide delete type id |
|
slide create point p1 { 0 2 1 } slide delete sphere Ball slide delete point p1 slide create sphere Ball -radius 6 slide create point p1 { 1 0 0 } |
PREV | NEXT |