]> Dogcows Code - chaz/rasterize/blob - config.h
make animate script work for modern luas
[chaz/rasterize] / config.h
1
2 /*
3 * CS5600 University of Utah
4 * Charles McGarvey
5 * mcgarvey@eng.utah.edu
6 */
7
8 #ifndef _CONFIG_H_
9 #define _CONFIG_H_
10
11 /*
12 * BACKFACE_CULLING
13 * If enabled, triangles that are facing away from the viewer, according to
14 * the right-hand rule and counter-clockwise winding of the verticies, will
15 * not be drawn. This option can improve performance in some situations, but
16 * it may also cause visual problems for models that aren't entirely closed.
17 */
18 #if BACKFACE_CULLING
19 #define IF_BACKFACE_CULLING(X) X
20 #else
21 #define IF_BACKFACE_CULLING(X)
22 #endif
23
24 /*
25 * BLENDING
26 * If enabled, the blending function Crgb = (1 - Sa)Drgb + (Sa)Srgb is
27 * applied when calculating final colors on the raster.
28 */
29 #if BLENDING
30 #define IF_BLENDING(X) X
31 #else
32 #define IF_BLENDING(X)
33 #endif
34
35 /*
36 * CLIPPING
37 * If enabled, triangles will be not be drawn if they are entirely outside of
38 * the viewing volume. The number of pixels tested while rasterizing a
39 * triangle can also be minimized, which leads to a huge performance boost.
40 * For that reason, this is on unless explicitly disabled, and you really
41 * always want to leave it enabled. Note that this does not have anything to
42 * do with viewport clipping, which is always performed. Also note that any
43 * triangle which is partially within the viewing volume will be entirely
44 * drawn, which may be somewhat unexpected.
45 */
46 #ifndef CLIPPING
47 #define CLIPPING 1
48 #endif
49 #if CLIPPING
50 #define IF_CLIPPING(X) X
51 #else
52 #define IF_CLIPPING(X)
53 #endif
54
55 /*
56 * DEPTH_TEST
57 * If enabled, a z-buffer will be used to perform some sort of depth testing,
58 * resulting in the generally desirable situation where triangles that are
59 * further away will not appear in front of triangles that are closer. There
60 * is a performance penalty for this, so it must be enabled.
61 */
62 #if DEPTH_TEST
63 #define IF_DEPTH_TEST(X) X
64 #else
65 #define IF_DEPTH_TEST(X)
66 #endif
67
68 /*
69 * DOUBLE_FLOAT
70 * If enabled, scalars will be of type double. This provides and insane level
71 * of precision at a performance cost. The default behavior just uses floats.
72 */
73 #if DOUBLE_FLOAT
74 #define IF_DOUBLE_FLOAT(X) X
75 #else
76 #define IF_DOUBLE_FLOAT(X)
77 #endif
78
79 /*
80 * EXPORT_BMP
81 * If enabled, each scene rasterization will be saved as a BMP image file.
82 * This is on unless explicitly disabled.
83 */
84 #ifndef EXPORT_BMP
85 #define EXPORT_BMP 1
86 #endif
87 #if EXPORT_BMP
88 #define IF_EXPORT_BMP(X) X
89 #else
90 #define IF_EXPORT_BMP(X)
91 #endif
92
93 /*
94 * EXPORT_PPM
95 * If enabled, each scene rasterization will be saved as a PPM image file.
96 * This is on unless explicitly disabled.
97 */
98 #ifndef EXPORT_PPM
99 #define EXPORT_PPM 1
100 #endif
101 #if EXPORT_PPM
102 #define IF_EXPORT_PPM(X) X
103 #else
104 #define IF_EXPORT_PPM(X)
105 #endif
106
107 /*
108 * EXTRA_INLINE
109 * If enabled, functions that are defined in interface files will be marked as
110 * inline. The compiler will generally inline functions according to its own
111 * optimization heuristics, and this inline marking may persuade the compiler
112 * to inline a function that it otherwise would not. This option may bring a
113 * small performance boost, but it can also increase the size of the program
114 * executable.
115 */
116 #if EXTRA_INLINE
117 #define IF_EXTRA_INLINE(X) X
118 #else
119 #define IF_EXTRA_INLINE(X)
120 #endif
121
122 /*
123 * LIGHTING
124 * If enabled, local lighting will be used to increase realism of the scene.
125 * This option has a performance cost, but it can produce interesting visuals.
126 * The behavior of this option is effected by its precise value:
127 * 1 Phong lighting model with flat (per-face) interpolation.
128 * 2 Phong lighting model with Gouraud (per-vertex) interpolation.
129 * 3 Phong lighting model with Phong (per-pixel) interpolation.
130 */
131 #if LIGHTING
132 #define IF_LIGHTING(X) X
133 #else
134 #define IF_LIGHTING(X)
135 #endif
136
137 /*
138 * NDEBUG
139 * If enabled, assertions and other nonessential checks will not be compiled
140 * into the programs.
141 */
142 #if NDEBUG
143 #define IF_NDEBUG(X) X
144 #else
145 #define IF_NDEBUG(X)
146 #endif
147
148 /*
149 * CACHE_GEOMETRY
150 * If enabled, models will be saved to a quick-loading binary format after
151 * they are loaded. Or, if a cached version of a model is discovered when a
152 * model is requested to be loaded, it is loaded from the cache instead. This
153 * provides a decent speed improvement in cases where the model would
154 * otherwise be loaded from some kind of text format which would load slowly.
155 */
156 #if CACHE_GEOMETRY
157 #define IF_CACHE_GEOMETRY(X) X
158 #else
159 #define IF_CACHE_GEOMETRY(X)
160 #endif
161
162 /*
163 * CALC_NORMALS
164 * If enabled, per-vertex normals are calculated for models that don't come
165 * with pre-computed normals. This occurs at loading time. The normals are
166 * calculated by averaging the true normals of all the faces shared by each
167 * vertex. Otherwise, only per-face normals are calculated for such models,
168 * also at loading time.
169 */
170 #if CALC_NORMALS
171 #define IF_CALC_NORMALS(X) X
172 #else
173 #define IF_CALC_NORMALS(X)
174 #endif
175
176 /*
177 * SMOOTH_COLOR
178 * If enabled, color will be interpolated across the face of a triangle.
179 * Otherwise, the color will flat, and the average color of the colors
180 * associated with each vertex will be used.
181 */
182 #if SMOOTH_COLOR
183 #define IF_SMOOTH_COLOR(X) X
184 #else
185 #define IF_SMOOTH_COLOR(X)
186 #endif
187
188 /*
189 * TEXTURING
190 * If enabled, a texture will be used to color models that have texture
191 * coordinates. The color from the texture will actually be multiplied
192 * (i.e. mixed) with the regular color associated with the geometry. Also,
193 * Phong interpolation lighting (LIGHTING >= 3) is required to get actual
194 * texturing; otherwise, only the color at the origin point of the texture
195 * will be used.
196 */
197 #if TEXTURING
198 #define IF_TEXTURING(X) X
199 #else
200 #define IF_TEXTURING(X)
201 #endif
202
203 /*
204 * PERSPECTIVE_FIX
205 * If enabled, texturing will have correct perspective on triangles which
206 * show depth. You typically always want this, so it's enabled by default.
207 * This option is useful only if TEXTURING is also enabled.
208 */
209 #ifndef PERSPECTIVE_FIX
210 #define PERSPECTIVE_FIX 1
211 #endif
212 #if PERSPECTIVE_FIX
213 #define IF_PERSPECTIVE_FIX(X) X
214 #else
215 #define IF_PERSPECTIVE_FIX(X)
216 #endif
217
218 /*
219 * VERBOSITY
220 * If enabled, a description of what is happening will be printed to stdout.
221 * Otherwise, nothing is printed. The behavior of this option is effected by
222 * its precise value:
223 * 1 Print just a few very general descriptions.
224 * 2 After rasterization, also print the triangle count and other
225 * information that may be interesting.
226 * 3 Also print the number of seconds it took to render the entire scene,
227 * according to wall time.
228 * 4 Also print the number of triangles as they are being rastered. This
229 * uses ANSI escape codes which may not be supported on all terminals.
230 * It also causes a lot to be printed, so it can actually decrease render
231 * performance, especially on a slow (or remote) terminal.
232 * The default setting for this option is 3.
233 */
234 #ifndef VERBOSITY
235 #define VERBOSITY 3
236 #endif
237 #if VERBOSITY >= 2
238 #define IF_RASTER_STATS(X) X
239 #else
240 #define IF_RASTER_STATS(X)
241 #endif
242 #if VERBOSITY >= 3
243 #define IF_RENDER_TIMER(X) X
244 #else
245 #define IF_RENDER_TIMER(X)
246 #endif
247 #if VERBOSITY >= 4
248 #define IF_RENDER_PROGRESS(X) X
249 #else
250 #define IF_RENDER_PROGRESS(X)
251 #endif
252
253 #endif // _CONFIG_H_
254
This page took 0.041331 seconds and 4 git commands to generate.