1 /*
2  * rtcommon.h - This file contains common defines typedefs used by various
3  *   parts of the raytracer and it interfaces
4  *
5  * $Id: rtcommon.h,v 1.34 2009/11/05 21:15:52 johns Exp $
6  *
7  */
8 
9 #include "util.h"    /* rt_timer_xxx() and rt_rand() */
10 #include "hash.h"    /* rt_hash_xxx() */
11 
12 /*
13  * Tachyon version strings for feature detection and compatibility testing.
14  */
15 #define TACHYON_VERSION_STRING      "0.98.9"
16 #define TACHYON_MAJOR_VERSION       0
17 #define TACHYON_MINOR_VERSION       98
18 #define TACHYON_PATCH_VERSION       9
19 
20 /*
21  * Build the ray tracer and its interfaces using either doubles or floats
22  * based on compile time defition of USESINGLEFLT
23  */
24 #ifdef USESINGLEFLT
25 typedef float flt;   /* generic floating point number, using float  */
26 typedef flt apiflt;  /* generic floating point number, using float  */
27 #else
28 typedef double flt;  /* generic floating point number, using double */
29 typedef flt apiflt;  /* generic floating point number, using double */
30 #endif
31 
32 
33 /*
34  * Parameter values for rt_boundmode()
35  */
36 #define RT_BOUNDING_DISABLED 0  /* spatial subdivision/bounding disabled */
37 #define RT_BOUNDING_ENABLED  1  /* spatial subdivision/bounding enabled  */
38 
39 
40 /*
41  * Parameter values for rt_camera_projection()
42  */
43 #define RT_PROJECTION_PERSPECTIVE      0
44 #define RT_PROJECTION_ORTHOGRAPHIC     1
45 #define RT_PROJECTION_PERSPECTIVE_DOF  2
46 #define RT_PROJECTION_FISHEYE          3
47 
48 /*
49  * Fog modes
50  */
51 #define RT_FOG_NORMAL     0 /* radial fog                             */
52 #define RT_FOG_VMD        1 /* planar OpenGL-like fog                 */
53 
54 #define RT_FOG_NONE       0 /* no fog                                 */
55 #define RT_FOG_LINEAR     1 /* linear fog                             */
56 #define RT_FOG_EXP        2 /* exponential fog                        */
57 #define RT_FOG_EXP2       3 /* exponential-squared fog                */
58 
59 /*
60  * Transparency modes
61  */
62 #define RT_TRANS_ORIG     0 /* original transparency mode               */
63 #define RT_TRANS_VMD      1 /* mult shaded color by opacity, for VMD    */
64 
65 /*
66  * Surface normal / winding order fixup mode
67  * used for triangles with interpolate normals
68  */
69 #define RT_NORMAL_FIXUP_OFF    0 /* surface normals and winding order agree  */
70 #define RT_NORMAL_FIXUP_FLIP   1 /* flip normals to agree with winding order */
71 #define RT_NORMAL_FIXUP_GUESS  2 /* random normal/winding order, guess       */
72 
73 /*
74  * Shader Modes for rt_shadermode()
75  *
76  * These are sorted from lowest quality (and fastest execution)
77  * to highest quality (and slowest execution)
78  */
79 #define RT_SHADER_AUTO    0  /* Automatically determine shader needed */
80 #define RT_SHADER_LOWEST  1  /* lowest quality shading available      */
81 #define RT_SHADER_LOW     2  /* low quality shading                   */
82 #define RT_SHADER_MEDIUM  3  /* Medium quality shading                */
83 #define RT_SHADER_HIGH    4  /* High quality shading                  */
84 #define RT_SHADER_FULL    5  /* Highest quality shading available     */
85 
86 /*
87  * Shader modes for rt_phong_shader()
88  */
89 #define RT_SHADER_NULL_PHONG 0 /* Disable phong contributions               */
90 #define RT_SHADER_BLINN_FAST 1 /* Fast version of Blinn's equation          */
91 #define RT_SHADER_BLINN      2 /* Blinn's specular highlights, as in OpenGL */
92 #define RT_SHADER_PHONG      3 /* Phong specular highlights                 */
93 
94 /*
95  * Shader capability flags - sorted by relative execution cost.
96  *
97  * Used to automatically setup the fastest shader that supports
98  * all of the capabilities used in a given scene.
99  * Ideally, we use the shader that just has the features we need,
100  * and nothing more, but its impractical to have that many seperate
101  * shaders, each optimized for an exact set of features, but we
102  * do the best we can with a reasonable amount of code.
103  */
104 #define RT_SHADE_NOFLAGS                0  /* clear feature flags          */
105 #define RT_SHADE_LIGHTING               1  /* need lighting                */
106 #define RT_SHADE_PHONG                  2  /* need phong shading           */
107 #define RT_SHADE_TEXTURE_MAPS           4  /* need texture mapping         */
108 #define RT_SHADE_MIPMAP                 8  /* need mip-maps                */
109 #define RT_SHADE_REFLECTION            16  /* need reflections             */
110 #define RT_SHADE_REFRACTION            32  /* need refraction              */
111 #define RT_SHADE_SHADOWS               64  /* need shadows                 */
112 #define RT_SHADE_VOLUMETRIC           128  /* need volume rendering        */
113 #define RT_SHADE_ANTIALIASING         256  /* need antialiasing            */
114 #define RT_SHADE_DEPTH_OF_FIELD       512  /* need depth of field          */
115 #define RT_SHADE_SOFT_SHADOW         1024  /* need soft-shadows/penumbra   */
116 #define RT_SHADE_VOLUMETRIC_SHADOW   2048  /* need volumetric shadows      */
117 #define RT_SHADE_CLIPPING            4096  /* need clipping logic enabled  */
118 #define RT_SHADE_AMBIENTOCCLUSION    8192  /* need ambient occlusion       */
119 
120 
121 /*
122  * Background texture mapping types
123  */
124 #define RT_BACKGROUND_TEXTURE_SOLID        0
125 #define RT_BACKGROUND_TEXTURE_SKY_SPHERE   1
126 
127 
128 /*
129  * Object texture mapping types
130  */
131 #define RT_TEXTURE_CONSTANT                0
132 #define RT_TEXTURE_3D_CHECKER              1
133 #define RT_TEXTURE_GRIT                    2
134 #define RT_TEXTURE_MARBLE                  3
135 #define RT_TEXTURE_WOOD                    4
136 #define RT_TEXTURE_GRADIENT                5
137 #define RT_TEXTURE_CYLINDRICAL_CHECKER     6
138 #define RT_TEXTURE_CYLINDRICAL_IMAGE       7
139 #define RT_TEXTURE_SPHERICAL_IMAGE         8
140 #define RT_TEXTURE_PLANAR_IMAGE            9
141 #define RT_TEXTURE_VOLUME_IMAGE           10
142 
143 
144 /*
145  * Phong types
146  */
147 #define RT_PHONG_PLASTIC                   0
148 #define RT_PHONG_METAL                     1
149 
150 
151 /*
152  * Supported output file formats list.
153  */
154 /* 24-bit color image formats */
155 #define RT_FORMAT_TARGA                    0
156 #define RT_FORMAT_PPM                      1
157 #define RT_FORMAT_SGIRGB                   2
158 #define RT_FORMAT_JPEG                     3
159 #define RT_FORMAT_WINBMP                   4
160 #define RT_FORMAT_PNG                      5
161 
162 /* deeper image formats */
163 #define RT_FORMAT_PPM48                    6
164 #define RT_FORMAT_PSD48                    7
165 
166 
167 /*
168  * Image cropping modes
169  */
170 #define RT_CROP_DISABLED                   0
171 #define RT_CROP_ENABLED                    1
172 
173 
174