home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
120.lha
/
AnimBalls
/
README
< prev
next >
Wrap
Text File
|
1986-11-20
|
5KB
|
96 lines
ANIMBALLS - An animation hack by JimG (Jim Guilford)
Animballs allows one to create a collection of balls in three space
and then interactively rotate them in real time. It uses HAM mode to
allow for a wide range of coloring.
To use animballs, type "animballs BallsFileName" from the CLI, where
BallsFileName is the name of the file containing the description of the
balls. The format of the file will be described later. A blank screen
will appear with the heading of "Please Wait . . .". During this phase,
some calculations are taking place. For a large or complex image, this
may take a while, so be patient. After a while, the image of the balls
will appear and you can start rotating them.
You rotate them by draging with the mouse. You should press and hold
the left button of the mouse. Then as you move the mouse, the image will
rotate. As you move the mouse left and right, the universe will rotate
around a veritcal axis (the front of the image moving towards the left
or right). As you move the mouse up and down, the collection of balls
will rotate around a horizontal axis (front of the object moving up or
down). If you press and hold the Control key (CTRL) while you move the
mouse, the direction of rotation is modified. With CTRL, moving the
mouse to the right rotates the image clockwise, and to the left
counterclockwise. Moving the mouse up and down with CTRL pressed has no
effect.
Pressing (and holding) the shift key while dragging the mouse will
slow the rotations down by a factor of 2. Pressing the Alt key will
speed up the rotations by a factor of 2.
You terminate the program by left clicking on the close gadget.
The program may also be invoked as "animballs -bw FileName". This
specified black & white mode. Everything will be rendered on a black and
white screen instead of a HAM screen. This will both require less memory
and speed up the redisplay. For a complex scene, this may be required.
Note that in the current implementation, the balls are rendered into a
200 by 200 screen. This means that if you move the mouse further to the
right, the pointer will disappear. Don't let this worry you. It is still
there, you just can't see it.
The balls description file starts with an optional title. If the first
character is an double quote ("), then everything up to the next double
quote is taken as a title. If the first character is not a quote, then a
default title is used. Following this are many numbers which describe
the collection of balls. Each number is separated from the others by
white-space (space, tab, new-line). Commas should NOT appear.
First are three numbers which describe the red, green, and blue
components of the background color. These should vary from 0 to 1.
Animballs will find a background color which approximates the color you
give it. A future enhancement may be to exactly use the given color, but
I don't feel like re-coding it now.
Following this is the number of balls. Then a description of each ball
follows. There is no significance to the order in which the balls appear.
For each ball, the first three numbers are the x, y, z coordinates of
the center. The center of the screen is the center of rotation, and
forms the 0,0,0 point. Then comes the radius of the ball, and finally
comes the r,g,b components of the ball color. Note again that there are
no commas between any of the numbers.
In order to prevent the balls from rotating out of the screen, the
distance to the furthest ball added to its radius should not exceed
about 90. If it does, a warning will be printed, and the program will
re-scale the balls to fit into the allowed space. A further enhancement
might be to allow larger scenes and then clip the images, but I haven't
done this.
The balls are rendered by a light source at infinity from the 1,1,1
direction (right, up, out of the screen). The given color is the diffuse
color. White specular highlights are added. The parameters are hard
coded in the program, but may be changed if the program is to be recompiled.
About the code
Feel free to use the code for any non-commercial purpose. If you make
any enhancements (or have any other comments) I would appreciate hearing
about them. The file "makedata.c" contains the code which generates the
data.c file. It is not required for compiling animballs but is included
for completeness. I wrote the code using the Lattice 4.0 C compiler. I
haven't tried compiling it under Manx or the earlier Lattice compiler,
but I don't do anything particularly strange, so it shouldn't be too
hard to port. The only thing that may cause problems is the
#include <proto/foo> lines. If these are troublesome, they can be
removed with no harm (under 4.0 they enable addition type checking and
allow the library routines to be called directly from C instead of going
through stubs). I compiled animballs with the following command:
lc -Lf -f animballs screen hamstuff myblit data
All this does is invoke the C compiler on each file and then link them.
The -f and -Lf cause the Motorola Fast Floating Point routines to be
used insead of the IEEE routines. This speeds up the rendering, but is
not strictly required.
Jim Guilford
225 Hoosick St.
Troy, NY 12180
Internet: guilford@csv.rpi.edu
uucp: . . . rutgers!nysernic!rpics!guilford