17 #if defined(USEOPENGL) 75 for (i=0; i<
NUMSP; i++) {
110 for (i=0; i<
NUMSP; i++) {
152 for (i=0; i<
NUMSP; i++) {
176 int main(
int argc,
char **argv) {
178 int i, xres, yres, maxframes;
186 unsigned char *img = NULL;
195 for (i=1; i<argc; i++) {
196 if (!strcmp(
"-res", argv[i])) {
199 sscanf(argv[i],
"%d", &xres);
201 sscanf(argv[i],
"%d", &xres);
205 if (!strcmp(
"-frames", argv[i])) {
208 sscanf(argv[i],
"%d", &maxframes);
212 if (!strcmp(
"-nosave", argv[i])) {
216 if (!strcmp(
"-opengl", argv[i])) {
223 img = (
unsigned char *) calloc(1, xres*yres*3);
228 Ccenter.
x=0.0; Ccenter.
y=0.0; Ccenter.
z=-3.0;
229 Cview.
x=0.0; Cview.
y=0.0; Cview.
z=1.0;
230 Cup.
x=0.0; Cup.
y=1.0; Cup.
z=0.0;
232 ctr1.
x=20.0; ctr1.
y=20.0; ctr1.
z=-40.0;
233 ctr2.
x=-20.0; ctr2.
y=20.0; ctr2.
z=-40.0;
253 sprintf(fname,
"outfile.%4.4d.tga",i);
254 if (
rt_mynode()==0) printf(
"Rendering: %s\n", fname);
257 printf(
"\rRendering %d... ", i);
279 float wscalex, wscaley, wminscale;
280 float wxoffset, wyoffset;
281 int wsx, wsy, instereo, maxx, maxy;
287 wscalex = wsx / (float) maxx;
288 wscaley = wsy / (float) maxy;
289 wminscale = (wscalex < wscaley) ? wscalex : wscaley;
290 wxoffset = ((wminscale * maxx) - wsx) / 2.0f;
291 wyoffset = ((wminscale * maxy) - wsy) / 2.0f;
293 glDrawBuffer(GL_BACK);
294 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
295 glClearColor(0.0, 0.0, 0.0, 1.0);
296 glViewport(0, 0, wsx, wsy);
297 glClear(GL_COLOR_BUFFER_BIT);
299 glShadeModel(GL_FLAT);
300 glViewport((
int) -wxoffset, (
int) -wyoffset, wsx, wsy);
301 glMatrixMode(GL_PROJECTION);
303 glOrtho(0.0, wsx, 0.0, wsy, -1.0, 1.0);
305 glMatrixMode(GL_MODELVIEW);
306 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
307 glPixelZoom(wminscale, wminscale);
316 for (j=0; j<
NUMSP; j++)
float g
Green color component.
void * glwin_create(const char *wintitle, int width, int height)
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...
float r
Red color component.
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
void drawsp(SceneHandle scene)
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.
void glwin_destroy(void *voidhandle)
flt diffuse
diffuse reflection
flt opacity
how opaque the object is
void glwin_draw_image(void *voidhandle, int xsize, int ysize, unsigned char *img)
flt specular
specular reflection
apivector ctr
origin of texture
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.
int glwin_get_winsize(void *voidhandle, int *xsize, int *ysize)
int rt_initialize(int *argc, char ***argv)
Initialize Tachyon library, must be first Tachyon API called.
flt x
X coordinate or direction component.
int rt_mynode(void)
distributed memory parallel node rank
int main(int argc, char **argv)
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.
void rt_deletescene(SceneHandle voidscene)
Destroy and deallocate the specified scene.
int texturefunc
which texture function to use
flt ambient
ambient lighting
void rt_finalize(void)
Shut down Tachyon library for good, at final use before program termination.
float b
Blue color component.
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 glwin_get_wininfo(void *voidhandle, int *instereo, int *havestencil)
flt z
Z coordinate or direction component.
void rt_verbose(SceneHandle voidscene, int v)
Enables or Disables verbose messages from the Tachyon library during rendering.