windows-nt/Source/XPSP1/NT/multimedia/danim/doc/default/repl.htm

177 lines
5.2 KiB
HTML
Raw Normal View History

2020-09-26 03:20:57 -05:00
<HTML>
<HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 BGCOLOR="#FFFFFF">
<FONT FACE="ARIAL" COLOR="BLACK">
<IMG SRC="hcreate.GIF" ALT="Internet Development Technologies">
<BLOCKQUOTE>
<TITLE>Creating ActiveVRML animations </TITLE>
</HEAD>
<BODY>
<CENTER>
<H3>Creating ActiveVRML animations <P></H3>
</CENTER>
<P>
This page describes how you can quickly write and
run your own ActiveVRML scripts. We recommend you get started by looking at the examples we provide.
<P>
The primary tool we currently use for directly writing ActiveVRML
content is a program called the &quot;repl&quot;, standing for
&quot;Read-Evaluate-Print-Loop&quot;, similar to the REPL's in
other interpreted languages. The repl allows ActiveVRML expressions
to be evaluated, and allows an environment to be built up.
<P>
As such, it's very useful for exploratory, incremental programming
- determining the types of expressions, using partial results
in subsequent expressions, etc.
<P>
The user may type declarations such as
<P>
myGeo = geo1 union geo2;;
<P>
directly. Note that two semicolons are required after each piece
of input to the repl.
<P>
Also, the repl supports a number of useful &quot;directives&quot;
preceded with #:
<UL>
<LI>#setdir &lt;pathname&gt;;; -- set the current working directory. Example: #setdir "c:\mydir";;
<LI>#use &lt;filename&gt;;; -- load a file into the environment being built up in the repl. Identifiers in the filename will
then be available. Example: #use "foo.avr"
<LI>#add &lt;str&gt;,&lt;id&gt;;; -- add the id to the list of
behaviors being sampled and displayed. Example: #add "cool", model;;
<LI>#eval &lt;expression&gt;;; -- directly evaluate an ActiveVRML expression. Example: #eval 1 + 2;;
<LI>#delete &lt;str&gt;;; -- remove the id from the list. Example: #delete "cool"
<LI>Ctrl-C -- to exit the repl.
</UL>
<P>
<H2>Using the Repl</H2>
<P>
<B>Down loading sample AVR files:</B>
<P>
Copy to your local drive the entire \Samples directory from
\\ACTGFX\ACTIVE
<P>
Place your local samples directory anywhere you want.
<P>
This directory will copy several AVR files (*.avr) and some resources
needed. AVR files contain the actual code that gets interpreted
by the engine via the Repl.
<P>
Loading an AVR file into the Repl can be done from a DOS box by typing : repl &lt;filename.avr&gt; The repl is located in "\Program Files\Plus!\Microsoft Internet\A-vrml". <P>
The Repl window looks like a DOS command window with a &gt; prompt. At the
beginning of every session you'll get a typical &quot;Welcome
to ActiveVRML &quot; message on your window.
<P>
ActiveVRML is an interpreted language so there is no need to compile
your scripts. You can also directly type AVR code at the prompt
and work with the repl interactively.
<P>
Load the model by typing:
#add &quot;cool&quot;, model;;
<P>
IMPORTANT: Always type 2 semicolons after every # command
<P>
This command tells the repl to sample the variable 'model' and
assigns a tag called &quot;cool&quot;.
<P>
The general syntax for #add is:
<P>
#add &lt;any quoted string&gt;,&lt; identifier&gt;;;
<P>
where the identifier is a variable defined in the avr file
<P>
<B>To Terminate sampling:</B>
<OL>
<LI>At the &gt; prompt type:
</OL>
<P>
#delete &lt;quoted string&gt;;;
<P>
Make sure the string matches the one you used for the #add
<P>
<B>To exit the Repl:</B>
<P>
At the &gt; prompt hit Ctrl+C
<H2>Sample Repl session</H2>
<P>
The following is a sample repl session that displays a somewhat
interesting image animation. The user types the bold lines.
The others are response lines.
<P>
<TT>Welcome to ActiveVRML version 1.0.</TT>
<P>
<TT><B>&gt; redIm = solidColorImage(red);;</B></TT>
<P>
<TT>redIm : () (image)</TT>
<P>
<TT><B>&gt; w = 0.004 + 0.004 * abs(sin(time));;</B></TT>
<P>
<TT>w : () (number)</TT>
<P>
<TT><B>&gt; w2 = w * 2;;</B></TT>
<P>
<TT>w2 : () (number)</TT>
<P>
<TT><B>&gt; blueIm = crop(point2Xy(-w,-w),</B></TT>
<P>
<TT><B> point2Xy(w,w),</B></TT>
<P>
<TT><B> solidColorImage(blue));;</B></TT>
<P>
<TT>blueIm : () (image)</TT>
<P>
<TT><B>&gt; model = tile(point2Xy(-w2,-w2),</B></TT>
<P>
<TT><B> point2Xy(w2,w2),</B></TT>
<P>
<TT><B> blueIm)</B></TT>
<P>
<TT><B> over redIm;;</B></TT>
<P>
<TT>model : () (image)</TT>
<P>
<TT><B>&gt; #add &quot;mine&quot;, model;;</B></TT>
<P>
(At this point, a window comes up and starts displaying the image
behavior)
<P>
Note here that after every expression evaluation, the system prints
out the type of the expression. Also, #add only supports certain
types. Currently, #add supports only image, image*sound, and
image*sound*sound types. To view a geometry, you must use &quot;renderedImage&quot;
to render it into an image, and then #add the image.
<H2>Documentation</H2>
<P>
We have a
<A HREF=earth.htm> tutorial </A> and a
<A HREF=avrml.htm> full spec reference </A>
in our Website that you can consult for more details on how to write content.
<H2>Reporting Problems and Support</H2>
<P>
Please send all your bug reports to EnriqueP or ToddFe. Please
include your system configuration along with detailed steps to
reproduce the problem.
<H2>Feature Requests and Suggestions</H2>
<P>
We welcome any feedback that you may have. Please send email to
ColinC and cc. EnriqueP.
</BLOCKQUOTE>
</BODY>
</HTML>