17 #if !defined(TACHYON_H) 34 #define TACHYON_VERSION_STRING "0.99.5" 35 #define TACHYON_MAJOR_VERSION 0 36 #define TACHYON_MINOR_VERSION 99 37 #define TACHYON_PATCH_VERSION 5 240 #define RT_FORMAT_TARGA 0 241 #define RT_FORMAT_PPM 1 242 #define RT_FORMAT_SGIRGB 2 243 #define RT_FORMAT_JPEG 3 244 #define RT_FORMAT_WINBMP 4 245 #define RT_FORMAT_PNG 5 250 #define RT_FORMAT_PPM48 6 251 #define RT_FORMAT_PSD48 7 254 void rt_outputformat(SceneHandle, int format); 277 #define RT_CROP_DISABLED 0 278 #define RT_CROP_ENABLED 1 284 void rt_crop_output(SceneHandle, int hres, int vres, int lx, int ly); 302 #define RT_NORMAL_FIXUP_OFF 0 303 #define RT_NORMAL_FIXUP_FLIP 1 304 #define RT_NORMAL_FIXUP_GUESS 2 310 void rt_normal_fixup_mode(SceneHandle, int mode); 348 #define RT_ACCUMULATE_OFF 0 349 #define RT_ACCUMULATE_ON 1 350 #define RT_ACCUMULATE_CLEAR 2 359 void rt_accumulation_mode(SceneHandle, int mode); 386 #define RT_BACKGROUND_TEXTURE_SOLID 0 387 #define RT_BACKGROUND_TEXTURE_SKY_SPHERE 1 388 #define RT_BACKGROUND_TEXTURE_SKY_ORTHO_PLANE 2 413 void rt_background_mode(SceneHandle, int mode); 418 #define RT_FOG_NORMAL 0 419 #define RT_FOG_OPENGL 1 435 void rt_fog_rendering_mode(SceneHandle, int); 440 #define RT_FOG_NONE 0 441 #define RT_FOG_LINEAR 1 443 #define RT_FOG_EXP2 3 446 void rt_fog_mode(SceneHandle, int); 458 #define RT_TRANS_ORIG 0 459 #define RT_TRANS_VMD 1 460 #define RT_TRANS_RASTER3D 2 463 void rt_trans_mode(SceneHandle, int mode); 474 #define RT_BOUNDING_DISABLED 0 475 #define RT_BOUNDING_ENABLED 1 481 void rt_boundmode(SceneHandle, int mode); 500 #define RT_PROJECTION_PERSPECTIVE 0 501 #define RT_PROJECTION_ORTHOGRAPHIC 1 502 #define RT_PROJECTION_PERSPECTIVE_DOF 2 503 #define RT_PROJECTION_ORTHOGRAPHIC_DOF 3 504 #define RT_PROJECTION_EQUIRECTANGULAR 4 505 #define RT_PROJECTION_FISHEYE 5 506 #define RT_PROJECTION_STEREO_EQUIRECTANGULAR 6 509 void rt_camera_projection(SceneHandle, int mode); 517 const float *viewdir,
const float *updir);
525 float *updir,
float *rightdir);
602 #define RT_TEXTURE_CONSTANT 0 603 #define RT_TEXTURE_3D_CHECKER 1 604 #define RT_TEXTURE_GRIT 2 605 #define RT_TEXTURE_MARBLE 3 606 #define RT_TEXTURE_WOOD 4 607 #define RT_TEXTURE_GRADIENT 5 608 #define RT_TEXTURE_CYLINDRICAL_CHECKER 6 609 #define RT_TEXTURE_CYLINDRICAL_IMAGE 7 610 #define RT_TEXTURE_SPHERICAL_IMAGE 8 611 #define RT_TEXTURE_PLANAR_IMAGE 9 612 #define RT_TEXTURE_VOLUME_IMAGE 10 622 void * rt_texture(SceneHandle, apitexture *); 631 unsigned char *rgb24data);
655 #define RT_SHADER_AUTO 0 656 #define RT_SHADER_LOWEST 1 657 #define RT_SHADER_LOW 2 658 #define RT_SHADER_MEDIUM 3 659 #define RT_SHADER_HIGH 4 660 #define RT_SHADER_FULL 5 667 void rt_shadermode(SceneHandle voidscene, int mode); 673 #define RT_SHADER_NULL_PHONG 0 674 #define RT_SHADER_BLINN_FAST 1 675 #define RT_SHADER_BLINN 2 676 #define RT_SHADER_PHONG 3 679 void rt_phong_shader(SceneHandle voidscene, int mode); 684 #define RT_PHONG_PLASTIC 0 685 #define RT_PHONG_METAL 1 688 void rt_tex_phong(void * voidtex, flt phong, flt phongexp, int type); 729 float radius,
const float *direction,
730 float fallstart,
float fallend);
735 flt linearfactor,
flt quadfactor);
737 #define RT_AO_MAXDIST_UNLIMITED 3.402823e+38 743 void rt_ambient_occlusion(void *scene, int numsamples, 764 const float *axis,
float radius);
772 const float *axis,
float radius);
777 int numpoints,
flt radius);
780 int numpoints,
float radius);
793 const float *normal);
798 flt innerrad,
flt outerrad);
801 const float *normal,
float innerrad,
float outerrad);
808 const float *v0,
const float *v1,
const float *v2);
816 const float *v0,
const float *v1,
const float *v2,
817 const float *n0,
const float *n1,
const float *n2);
832 const float *v0,
const float *v1,
const float *v2,
833 const float *n0,
const float *n1,
const float *n2,
834 const float *c0,
const float *c1,
const float *c2);
846 int numverts,
const float * cnv,
847 int numstrips,
const int *vertsperstrip,
864 int xsize,
int ysize,
int zsize,
865 const char *filename,
void *invol);
870 int m,
int n,
flt *field,
flt wx,
flt wy);
890 #if !defined(TACHYON_NO_DEPRECATED) 900 #if defined(TACHYON_INTERNAL) 904 #define SPEPSILON 0.0004f 905 #define EPSILON 0.0004f 907 #define TWOPI 6.28318531f 908 #define MINCONTRIB 0.001959f 913 #define SPEPSILON 0.000000001 914 #define EPSILON 0.000000001 916 #define TWOPI 6.28318531 917 #define MINCONTRIB 0.001959 922 #define BOUNDTHRESH 16 941 #define RT_RAY_PRIMARY 1 942 #define RT_RAY_REGULAR 2 943 #define RT_RAY_SHADOW 4 944 #define RT_RAY_FINISHED 8 957 #define RT_SHADE_NOFLAGS 0 958 #define RT_SHADE_LIGHTING 1 959 #define RT_SHADE_PHONG 2 960 #define RT_SHADE_TEXTURE_MAPS 4 961 #define RT_SHADE_MIPMAP 8 962 #define RT_SHADE_REFLECTION 16 963 #define RT_SHADE_REFRACTION 32 964 #define RT_SHADE_SHADOWS 64 965 #define RT_SHADE_VOLUMETRIC 128 966 #define RT_SHADE_ANTIALIASING 256 967 #define RT_SHADE_DEPTH_OF_FIELD 512 968 #define RT_SHADE_SOFT_SHADOW 1024 969 #define RT_SHADE_VOLUMETRIC_SHADOW 2048 970 #define RT_SHADE_CLIPPING 4096 971 #define RT_SHADE_AMBIENTOCCLUSION 8192 980 #define RT_TEXTURE_NOFLAGS 0 981 #define RT_TEXTURE_SHADOWCAST 1 982 #define RT_TEXTURE_ISLIGHT 2 988 #define RT_IMAGE_BUFFER_RGB24 0 989 #define RT_IMAGE_BUFFER_RGB96F 1 995 #define RT_IMAGE_CLAMP 0 996 #define RT_IMAGE_NORMALIZE 1 997 #define RT_IMAGE_GAMMA 2 1001 typedef unsigned char byte;
1013 unsigned char * data;
1030 unsigned char * data;
1041 vector bg_grad_updir;
1044 flt bg_grad_invrange;
1045 flt bg_grad_noisemag;
1046 } background_texture;
1052 void (* freetex)(
void *);
1055 #define RT_TEXTURE_HEAD \ 1056 color (* texfunc)(const void *, const void *, void *); \ 1057 texture_methods * methods; \ 1058 unsigned int flags; \ 1100 void (* intersect)(
const void *,
void *);
1101 void (* normal)(
const void *,
const void *,
const void *,
void *);
1102 int (* bbox)(
void *, vector *, vector *);
1103 void (* freeobj)(
void *);
1116 #define RT_OBJECT_HEAD \ 1119 object_methods * methods; \ 1120 clip_group * clip; \ 1137 intersection closest;
1143 #define RT_CAMERA_FRUSTUM_AUTO 0 1144 #define RT_CAMERA_FRUSTUM_USER 1 1163 flt dof_aperture_rad;
1166 int modulate_eyeshift;
1167 flt modulate_eyeshift_pow;
1168 color (* cam_ray)(
void *,
flt,
flt);
1174 typedef struct fogdata_t {
1175 color (* fog_fctn)(
struct fogdata_t *, color,
flt);
1183 typedef struct amboccdata_t {
1197 typedef struct list {
1218 object * boundedobj;
1219 object * unboundedobj;
1223 typedef void * rt_parhandle;
1224 typedef void * rt_parbuf;
1227 char outfilename[256];
1236 #if defined(RT_ACCUMULATE_ON) 1238 unsigned int accum_count;
1259 color (* shader)(
void *);
1260 flt (* phongfunc)(
const struct ray_t * incident,
const shadedata * shadevars,
flt specpower);
1262 background_texture bgtex;
1263 color (* bgtexfunc)(
struct ray_t * incident);
1269 amboccludedata ambocc;
1271 rt_parhandle parhnd;
1275 clip_group * curclipgroup;
1276 int normalfixupmode;
1280 typedef struct ray_t {
1285 void (* add_intersection)(
flt,
const object *,
struct ray_t *);
1286 intersectstruct intstruct;
1290 unsigned long serial;
1291 unsigned long * mbox;
1294 unsigned int randval;
void rt_scalarvol(SceneHandle, void *tex, apivector mincoord, apivector maxcoord, int xsize, int ysize, int zsize, const char *filename, void *invol)
Define an axis-aligned scalar volumetric data set, loaded from a file.
void rt_ring(SceneHandle, void *tex, apivector center, apivector mormal, flt innerrad, flt outerrad)
Define an annular ring.
float g
Green color component.
void rt_trans_max_surfaces(SceneHandle, int maxsurfaces)
Set the maximum number of transparent surfaces that will be rendered.
float r
Red color component.
void rt_clip_fv(SceneHandle, int numplanes, const float *planes)
Enable or update a clipping plane group.
int rt_set_mpi_comm_world_split(int color, int key)
Override the previously set MPI communicator for Tachyon to use.
void rt_light_attenuation(void *light, flt constfactor, flt linearfactor, flt quadfactor)
Set light attenuation parameters for an existing light.
apicolor col
base object color
apivector rot
rotation of texture around origin
void rt_fog_parms(SceneHandle, apicolor col, flt start, flt end, flt density)
Set fog rendering parameters.
void * rt_spotlight(SceneHandle, void *tex, apivector center, flt radius, apivector direction, flt fallstart, flt fallend)
Define a spotlight with associated texture, position, radius, direction, falloff start, and falloff end parameters.
void rt_camera_vfov(SceneHandle, flt vfov)
Set vertical field of view (in degrees) for a perspective camera.
void rt_stri(SceneHandle, void *, apivector v0, apivector v1, apivector v2, apivector n0, apivector n1, apivector n2)
Define a smooth-shaded triangle using interpolated vertex normals.
flt diffuse
diffuse reflection
flt opacity
how opaque the object is
void rt_get_aspectratio(SceneHandle voidscene, float *aspectratio)
Get the view frustum aspect ratio (width/height)
void rt_boundthresh(SceneHandle, int threshold)
Set the threshold to be used when automatic generation of ray tracing acceleration structures is to b...
void rt_polycylinder3fv(SceneHandle, void *tex, const float *points, int numpoints, float radius)
Define a sequence of connected cylinders.
void rt_extvol(SceneHandle, void *tex, apivector mincoord, apivector maxcoord, int samples, flt(*evaluator)(flt, flt, flt))
Define an axis-aligned volumetric data set, with a user-defined sample evaluation callback function...
int shadowcast
does the object cast a shadow
void rt_landscape(SceneHandle, void *tex, int m, int n, apivector center, flt wx, flt wy)
Define an auto-generated height field.
void rt_polycylinder(SceneHandle, void *tex, apivector *points, int numpoints, flt radius)
Define a sequence of connected cylinders.
flt specular
specular reflection
void rt_cylinder3fv(SceneHandle, void *tex, const float *center, const float *axis, float radius)
Define an infinite cylinder.
void rt_background_gradient(SceneHandle, apivector up, flt topval, flt botval, apicolor topcolor, apicolor botcolor)
Set parameters for gradient (sky plane or sphere) background texturing.
void rt_clip_off(SceneHandle)
Disable active clipping plane group.
void rt_rawimage_rgb96f(SceneHandle, float *rawimage)
Request Tachyon to save the output image in the specified memory area, in raw 96-bit, packed, pixel interleaved, 32-bit float RGB bytes.
int rt_set_mpi_comm_world(void)
Override the previously set MPI communicator with MPI_COMM_WORLD.
void rt_define_teximage_rgb24(const char *name, int xsize, int ysize, int zsize, unsigned char *rgb24data)
Define a named 1-D, 2-D, or 3-D texture image with a 24-bit RGB image buffer, without any file refere...
flt rt_get_camera_vfov(SceneHandle)
Return vertical field of view (in degrees) for a perspective camera.
void rt_crop_disable(SceneHandle)
Disable output image cropping.
apivector ctr
origin of texture
void rt_resolution(SceneHandle, int hres, int vres)
Set the horizontal and vertical resolution (in pixels) for the specified scene.
void rt_box(SceneHandle, void *tex, apivector mincoord, apivector maxcoord)
Define an axis-aligned box.
void rt_plane(SceneHandle, void *tex, apivector center, apivector normal)
Define a plane.
int rt_set_mpi_comm(void *mpicomm)
Override the previously set MPI communicator for Tachyon to use.
int rt_initialize_mpi_comm_world()
Initialize Tachyon library, must be first Tachyon API called.
int rt_mynode(void)
distributed memory parallel node rank
void rt_outputfile(SceneHandle, const char *outname)
Set the filename for the output image for the specified scene.
void rt_tristripscnv3fv(SceneHandle scene, void *tex, int numverts, const float *cnv, int numstrips, const int *vertsperstrip, const int *facets)
Define smooth-shaded triangle strips using interpolated vertex normals, and per-vertex colors...
void rt_background(SceneHandle, apicolor)
Set the background color of the specified scene.
void rt_fcylinder3fv(SceneHandle, void *tex, const float *center, const float *axis, float radius)
Define a finite-length cylinder.
void rt_quadsphere(SceneHandle, void *tex, apivector center, flt rad)
Define a quadric sphere, normally used only for testing and benchmarking.
double flt
generic floating point number, using double
void rt_tex_outline(void *voidtex, flt outline, flt outlinewidth)
Set edge cueing outline shading parameters for an existing texture.
void rt_fcylinder(SceneHandle, void *tex, apivector center, apivector axis, flt radius)
Define a finite-length cylinder.
flt x
X coordinate or direction component.
void rt_verbose(SceneHandle, int v)
Enables or Disables verbose messages from the Tachyon library during rendering.
void rt_tri3fv(SceneHandle, void *tex, const float *v0, const float *v1, const float *v2)
Define a flat-shaded triangle.
void rt_camera_modulate_eye_separation(SceneHandle, flt cospow)
Set camera stereoscopic eye separation modulation and cosine power.
flt apiflt
for backward compatibility
void rt_camera_position3fv(SceneHandle, const float *center, const float *viewdir, const float *updir)
Set camera position and orientation.
void rt_cylinder(SceneHandle, void *tex, apivector center, apivector axis, flt radius)
Define an infinite cylinder.
flt y
Y coordinate or direction component.
apivector scale
scale of texture in x,y,z
void rt_camera_frustum(SceneHandle, flt left, flt right, flt bottom, flt top)
Set view frustum for active camera.
void * rt_light(SceneHandle, void *tex, apivector center, flt radius)
Define a point light with associated texture, position, and radius.
void rt_set_ui_message(void(*func)(int, char *))
Set function pointer for user interface output callbacks.
apivector uaxs
planar map u axis
void rt_renderscene(SceneHandle)
Render the current scene.
void rt_set_ui_progress(void(*func)(int))
Set function pointer for user interface progress callbacks.
flt rt_get_camera_zoom(SceneHandle)
Return current camera "zoom" factor.
void rt_get_resolution(SceneHandle, int *hres, int *vres)
Get the horizontal and vertical resolution (in pixels) for the specified scene.
Tachyon cross-platform timers, special math function wrappers, and RNGs.
void rt_vcstri3fv(SceneHandle, void *tex, const float *v0, const float *v1, const float *v2, const float *n0, const float *n1, const float *n2, const float *c0, const float *c1, const float *c2)
Define a smooth-shaded triangle using interpolated vertex normals and per-vertex colors.
flt rt_get_camera_modulate_eye_separation(SceneHandle)
Return current camera eye separation.
void rt_stri3fv(SceneHandle, void *, const float *v0, const float *v1, const float *v2, const float *n0, const float *n1, const float *n2)
Define a smooth-shaded triangle using interpolated vertex normals.
void rt_image_gamma(SceneHandle voidscene, float gamma)
Apply gamma correction to the pixel values after normalization.
int rt_initialize_nompi()
Initialize Tachyon library, must be first Tachyon API called.
void * rt_directional_light(SceneHandle, void *tex, apivector direction)
Define a directional light with associated texture and direction.
int rt_set_mpi_comm_split(void *mpicomm, int color, int key)
Override the previously set MPI communicator for Tachyon to use.
void * rt_directional_light3fv(SceneHandle, void *tex, const float *direction)
Define a directional light with associated texture and direction.
SceneHandle rt_newscene(void)
Allocate, initialize, and return a handle for a new scene.
void rt_camera_dof(SceneHandle voidscene, flt focaldist, flt aperture)
Set depth-of-field rendering options.
void rt_get_camera_position(SceneHandle, apivector *center, apivector *viewdir, apivector *updir, apivector *rightdir)
Get camera position and orientation.
int texturefunc
which texture function to use
flt ambient
ambient lighting
apivector vaxs
planar map v axis
void rt_vcstri(SceneHandle, void *tex, apivector v0, apivector v1, apivector v2, apivector n0, apivector n1, apivector n2, apicolor c0, apicolor c1, apicolor c2)
Define a smooth-shaded triangle using interpolated vertex normals and per-vertex colors.
void rt_tex_transmode(void *voidtex, int transmode)
Set transparent surface shading parameters for an existing texture, enabling or disabling angle-modul...
Old now-deprecated Tachyon APIs that have been replaced by newer APIs and/or improved functionality...
apivector rt_vector(flt x, flt y, flt z)
Helper function to make vectors.
void rt_shadow_filtering(SceneHandle, int mode)
Control whether or not transparent surfaces modulate incident light or not.
int rt_numnodes(void)
distributed memory parallel node count
void rt_finalize(void)
Shut down Tachyon library for good, at final use before program termination.
void rt_ring3fv(SceneHandle, void *tex, const float *center, const float *normal, float innerrad, float outerrad)
Define an annular ring.
void rt_plane3fv(SceneHandle, void *tex, const float *center, const float *normal)
Define a plane.
void rt_image_normalize(SceneHandle voidscene)
Enable renormalization of pixel values to the range [0 1) (rather than clamping) prior to output...
void rt_camera_eye_separation(SceneHandle, flt eyesep)
Set camera stereoscopic eye separation.
void rt_aa_maxsamples(SceneHandle, int maxsamples)
Sets the maximum number of supersamples to take for any pixel.
float b
Blue color component.
void rt_heightfield(SceneHandle, void *tex, apivector center, int m, int n, flt *field, flt wx, flt wy)
Define an axis-aligned height field.
void rt_sphere3fv(SceneHandle, void *tex, const float *center, float radius)
Define a sphere with associated texture, center, and radius.
apicolor rt_color(flt r, flt g, flt b)
Helper function to make colors.
void rt_aspectratio(SceneHandle voidscene, float aspectratio)
Set the view frustum aspect ratio (width/height)
void * rt_texture_copy_standard(SceneHandle, void *oldtex)
Do not use this unless you know what you're doing, this is a short-term workaround until new object t...
void rt_sphere(SceneHandle, void *tex, apivector center, flt radius)
Define a sphere with associated texture, center, and radius.
void rt_clip_dv(SceneHandle, int numplanes, const double *planes)
Enable or update a clipping plane group.
void rt_set_numthreads(SceneHandle, int)
Explicitly set the number of worker threads Tachyon will use.
void * rt_spotlight3fv(SceneHandle, void *tex, const float *center, float radius, const float *direction, float fallstart, float fallend)
Define a spotlight with associated texture, position, radius, direction, falloff start, and falloff end parameters.
void * rt_texture_copy_vcstri(SceneHandle, void *oldtex)
Do not use this unless you know what you're doing, this is a short-term workaround until new object t...
void rt_camera_raydepth(SceneHandle, int maxdepth)
Camera maximum ray recursion depth (i.e.
apivector waxs
volume map W axis
void rt_rawimage_rgb24(SceneHandle, unsigned char *rawimage)
Have Tachyon save the output image in the specified memory area, in raw 24-bit, packed, pixel interleaved, unsigned RGB bytes.
int rt_initialize_mpi_comm_split(void *mpicomm, int color, int key)
Initialize Tachyon library, must be first Tachyon API called.
int rt_initialize_mpi_comm(void *mpicomm)
Initialize Tachyon library, must be first Tachyon API called.
flt rt_get_camera_eye_separation(SceneHandle)
Return current camera eye separation.
void rt_camera_position(SceneHandle, apivector center, apivector viewdir, apivector updir)
Set camera position and orientation.
void rt_tri(SceneHandle, void *tex, apivector v0, apivector v1, apivector v2)
Define a flat-shaded triangle.
void rt_get_camera_position3fv(SceneHandle, float *center, float *viewdir, float *updir, float *rightdir)
Get camera position and orientation.
int rt_initialize(int *, char ***)
Initialize Tachyon library, must be first Tachyon API called.
void rt_camera_zoom(SceneHandle, flt zoom)
Set camera "zoom" factor.
int rt_set_mpi_comm_world_split_all(void)
Override the previously set MPI communicator for Tachyon to use.
void rt_image_clamp(SceneHandle voidscene)
Enable clamping of pixel values to the range [0 1) (rather than renormalizing) prior to output...
flt z
Z coordinate or direction component.
void rt_deletescene(SceneHandle)
Destroy and deallocate the specified scene.
void * rt_light3fv(SceneHandle, void *tex, const float *center, float radius)
Define a point light with associated texture, position, and radius.
void rt_rescale_lights(SceneHandle, flt lightscale)
Rescale all light sources in the scene by factor lightscale.