33 #define FIREOPACITY 14.0 54 #define RFILE "/cfs/johns/anim/frame" 68 int xx, addr, addr2, addr3, addr4;
71 flames[i].
x += (rand() % 7) - 3;
72 flames[i].
y += (rand() % 7) - 3;
113 for (z=0; z<(
ZS - 1); z++) {
115 for (y=1; y<(
YS - 1); y++) {
116 addr2 = y*
XS + addr3;
117 for (x=1; x<(
XS - 1); x++) {
127 xx =
fire[0][addr + 1 ] +
140 xx +=
fire[0][addr4 - 1] +
143 xx +=
fire[0][addr4 - 1] +
147 xx +=
fire[0][addr4 - 1] +
152 xx +=
fire[0][addr4 - 1] +
155 xx +=
fire[0][addr4 - 1] +
159 xx +=
fire[0][addr4 - 1] +
166 fire[1][addr +
XS*
YS] = (
unsigned char) xx - 1;
176 int main(
int argc,
char **argv) {
185 void * t1, * t2, * vt1, * lt1;
190 unsigned char * rawimage;
191 unsigned char * interlacedimage;
201 interlacedimage = malloc(
XRES*
YRES*4);
203 omfhandle = OMFopen(
XRES,
YRES, AVR26,
"fire.omf");
246 strcpy((
char *) &p1.
imap,
"/disk7/cube/imaps/leafy261.ppm");
270 sprintf(fname,
".%4.4d.tga",i);
271 strcpy(fname2,
RFILE);
272 strcat(fname2, fname);
281 if (
rt_mynode()==0) printf(
"Rendering: %s \n",fname2);
285 Ccenter.
x = xc*3.2; Ccenter.
y = yc*3.2;
286 Cview.
x = -xc; Cview.
y = -yc;
293 6, Ccenter, Cview, Cup);
298 for (yy=0; yy<
YRES; yy+=2) {
299 memcpy(&interlacedimage[(yy>>1)*
XRES*3], &rawimage[yy*
XRES*3],
XRES*3);
300 memcpy(&interlacedimage[((yy>>1)+1)*
XRES*3], &rawimage[(yy+1)*
XRES*3],
XRES*3);
303 OMFwriteframe(omfhandle, interlacedimage);
310 free(interlacedimage);
int main(int argc, char **argv)
void rt_camera_setup(SceneHandle voidscene, flt zoom, flt aspectratio, int antialiasing, int raydepth, apivector camcent, apivector viewvec, apivector upvec)
Define a camera for a perspective projection, given the specified zoom factor, aspect ratio...
void * rt_texture(SceneHandle sc, apitexture *apitex)
Translate a texture definition into the internal format used by Tachyon, and returns an opaque pointe...
apicolor col
base object color
apivector rot
rotation of texture around origin
void rt_resolution(SceneHandle voidscene, int hres, int vres)
Set the horizontal and vertical resolution (in pixels) for the specified scene.
flt diffuse
diffuse reflection
flt opacity
how opaque the object is
flt specular
specular reflection
apicolor rt_color(flt r, flt g, flt b)
Helper function to make colors.
apivector ctr
origin of texture
char imap[96]
name of image map
void rt_renderscene(SceneHandle voidscene)
Render the current scene.
void rt_sphere(SceneHandle scene, void *tex, apivector ctr, flt rad)
Define a sphere with associated texture, center, and radius.
void rt_scalarvol(SceneHandle scene, void *tex, apivector min, apivector max, int xs, int ys, int zs, const char *fname, void *voidvol)
Define an axis-aligned scalar volumetric data set, loaded from a file.
int rt_initialize(int *argc, char ***argv)
Initialize Tachyon library, must be first Tachyon API called.
flt x
X coordinate or direction component.
flt apiflt
for backward compatibility
flt y
Y coordinate or direction component.
apivector scale
scale of texture in x,y,z
SceneHandle rt_newscene(void)
Allocate, initialize, and return a handle for a new scene.
void rt_rawimage_rgb24(SceneHandle voidscene, unsigned char *img)
Have Tachyon save the output image in the specified memory area, in raw 24-bit, packed, pixel interleaved, unsigned RGB bytes.
void rt_outputfile(SceneHandle voidscene, const char *outname)
Set the filename for the output image for the specified scene.
apivector uaxs
planar map u axis
int texturefunc
which texture function to use
apivector rt_vector(flt x, flt y, flt z)
Helper function to make vectors.
flt ambient
ambient lighting
apivector vaxs
planar map v axis
void rt_finalize(void)
Shut down Tachyon library for good, at final use before program termination.
unsigned char fire[2][XS *YS *ZS+10000]
void rt_plane(SceneHandle scene, void *tex, apivector ctr, apivector norm)
Define a plane.
Tachyon public API function prototypes and declarations used to drive the ray tracing engine...
void * rt_light(SceneHandle voidscene, void *tex, apivector ctr, flt rad)
Define a point light with associated texture, position, and radius.
int rt_mynode(void)
distributed memory parallel node rank
void rt_verbose(SceneHandle voidscene, int v)
Enables or Disables verbose messages from the Tachyon library during rendering.