]> Dogcows Code - chaz/rasterize/blob - config.h
9637deae9233ea9d0e21a67dcc53ca4cfc786c99
[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 * CLIPPING
26 * If enabled, triangles will be not be drawn if they are entirely outside of
27 * the viewing volume. The number of pixels tested while rasterizing a
28 * triangle can also be minimized, which leads to a huge performance boost.
29 * For that reason, this is on unless explicitly disabled, and you really
30 * always want to leave it enabled. Note that this does not have anything to
31 * do with viewport clipping, which is always performed. Also note that any
32 * triangle which is partially within the viewing volume will be entirely
33 * drawn, which may be somewhat unexpected.
34 */
35 #ifndef CLIPPING
36 #define CLIPPING 1
37 #endif
38 #if CLIPPING
39 #define IF_CLIPPING(X) X
40 #else
41 #define IF_CLIPPING(X)
42 #endif
43
44 /*
45 * DEPTH_TEST
46 * If enabled, a z-buffer will be used to perform some sort of depth testing,
47 * resulting in the generally desirable situation where triangles that are
48 * further away will not appear in front of triangles that are closer. There
49 * is a performance penalty for this, so it must be enabled.
50 */
51 #if DEPTH_TEST
52 #define IF_DEPTH_TEST(X) X
53 #else
54 #define IF_DEPTH_TEST(X)
55 #endif
56
57 /*
58 * EXPORT_BMP
59 * If enabled, each scene rasterization will be saved as a BMP image file.
60 * This is on unless explicitly disabled.
61 */
62 #ifndef EXPORT_BMP
63 #define EXPORT_BMP 1
64 #endif
65 #if EXPORT_BMP
66 #define IF_EXPORT_BMP(X) X
67 #else
68 #define IF_EXPORT_BMP(X)
69 #endif
70
71 /*
72 * EXPORT_PPM
73 * If enabled, each scene rasterization will be saved as a PPM image file.
74 * This is on unless explicitly disabled.
75 */
76 #ifndef EXPORT_PPM
77 #define EXPORT_PPM 1
78 #endif
79 #if EXPORT_PPM
80 #define IF_EXPORT_PPM(X) X
81 #else
82 #define IF_EXPORT_PPM(X)
83 #endif
84
85 /*
86 * EXTRA_INLINE
87 * If enabled, functions that are defined in interface files will be marked as
88 * inline. The compiler will generally inline functions according to its own
89 * optimization heuristics, and this inline marking may persuade the compiler
90 * to inline a function that it otherwise would not. This option may bring a
91 * small performance boost, but it can also increase the size of the program
92 * executable.
93 */
94 #if EXTRA_INLINE
95 #define IF_EXTRA_INLINE(X) X
96 #else
97 #define IF_EXTRA_INLINE(X)
98 #endif
99
100 /*
101 * LIGHTING
102 * If enabled, local lighting will be used to increase realism of the scene.
103 * This option has a performance cost, but it can produce interesting visuals.
104 * The behavior of this option also depends on the SMOOTH_COLOR option and
105 * whether or not the model has unique vertex normals; if SMOOTH_COLOR is
106 * disabled, each triangle will be shaded a flat color. If it is enabled,
107 * Gouraud interpolation is used to smooth the lighting across the face of
108 * each triangle. See the PRE_NORMALS and SMOOTH_COLOR options.
109 */
110 #if LIGHTING
111 #define IF_LIGHTING(X) X
112 #else
113 #define IF_LIGHTING(X)
114 #endif
115
116 /*
117 * NDEBUG
118 * If enabled, assertions and other nonessential checks will not be compiled
119 * into the programs.
120 */
121 #if NDEBUG
122 #define IF_NDEBUG(X) X
123 #else
124 #define IF_NDEBUG(X)
125 #endif
126
127 /*
128 * PRE_NORMALS
129 * If enabled, normals are pre-computed while the triangles are loading.
130 * Otherwise, the normals are computed during rasterization. The behavior of
131 * this option is effected by its precise value:
132 * 1 Normals are computed per-face, according to the right-hand rule and
133 * counter-clockwise winding of the verticies.
134 * 2 Normals are computed per-vertex; the normal for a vertex that is shared
135 * between two or more faces will be the average of the normals of the
136 * faces. There is a performance penalty for this setting.
137 * 3 Same as 2, but the normals will be cached so that they will not need to
138 * be computed the next time the mesh is loaded.
139 */
140 #if PRE_NORMALS
141 #define IF_PRE_NORMALS(X) X
142 #else
143 #define IF_PRE_NORMALS(X)
144 #endif
145
146 /*
147 * SMOOTH_COLOR
148 * If enabled, color will be interpolated across the face of a triangle.
149 * Otherwise, the color will flat, and the average color of the colors
150 * associated with each vertex will be used.
151 */
152 #if SMOOTH_COLOR
153 #define IF_SMOOTH_COLOR(X) X
154 #else
155 #define IF_SMOOTH_COLOR(X)
156 #endif
157
158 /*
159 * VERBOSITY
160 * If enabled, a description of what is happening will be printed to stdout.
161 * Otherwise, nothing is printed. The behavior of this option is effected by
162 * its precise value:
163 * 1 Print just a few very general descriptions.
164 * 2 After rasterization, also print the triangle count and other
165 * information that may be interesting.
166 * 3 Also print the number of seconds it took to render the entire scene,
167 * according to wall time.
168 * 4 Also print the number of triangles as they are being rastered. This
169 * uses ANSI escape codes which may not be supported on all terminals.
170 * It also causes a lot to be printed, so it can actually decrease render
171 * performance, especially on a slow (or remote) terminal.
172 * The default setting for this option is 3.
173 */
174 #ifndef VERBOSITY
175 #define VERBOSITY 3
176 #endif
177 #if VERBOSITY >= 2
178 #define IF_RASTER_STATS(X) X
179 #else
180 #define IF_RASTER_STATS(X)
181 #endif
182 #if VERBOSITY >= 3
183 #define IF_RENDER_TIMER(X) X
184 #else
185 #define IF_RENDER_TIMER(X)
186 #endif
187 #if VERBOSITY >= 4
188 #define IF_RENDER_PROGRESS(X) X
189 #else
190 #define IF_RENDER_PROGRESS(X)
191 #endif
192
193 #endif // _CONFIG_H_
194
This page took 0.041519 seconds and 3 git commands to generate.