/* * CS5600 University of Utah * Charles McGarvey * mcgarvey@eng.utah.edu */ #ifndef _CONFIG_H_ #define _CONFIG_H_ /* * BACKFACE_CULLING * If enabled, triangles that are facing away from the viewer, according to * the right-hand rule and counter-clockwise winding of the verticies, will * not be drawn. This option can improve performance in some situations, but * it may also cause visual problems for models that aren't entirely closed. */ #if BACKFACE_CULLING #define IF_BACKFACE_CULLING(X) X #else #define IF_BACKFACE_CULLING(X) #endif /* * BLENDING * If enabled, the blending function Crgb = (1 - Sa)Drgb + (Sa)Srgb is * applied when determing color on the raster. */ #if BLENDING #define IF_BLENDING(X) X #else #define IF_BLENDING(X) #endif /* * CLIPPING * If enabled, triangles will be not be drawn if they are entirely outside of * the viewing volume. The number of pixels tested while rasterizing a * triangle can also be minimized, which leads to a huge performance boost. * For that reason, this is on unless explicitly disabled, and you really * always want to leave it enabled. Note that this does not have anything to * do with viewport clipping, which is always performed. Also note that any * triangle which is partially within the viewing volume will be entirely * drawn, which may be somewhat unexpected. */ #ifndef CLIPPING #define CLIPPING 1 #endif #if CLIPPING #define IF_CLIPPING(X) X #else #define IF_CLIPPING(X) #endif /* * DEPTH_TEST * If enabled, a z-buffer will be used to perform some sort of depth testing, * resulting in the generally desirable situation where triangles that are * further away will not appear in front of triangles that are closer. There * is a performance penalty for this, so it must be enabled. */ #if DEPTH_TEST #define IF_DEPTH_TEST(X) X #else #define IF_DEPTH_TEST(X) #endif /* * DOUBLE_FLOAT * If enabled, scalars will be of type double. This provides and insane level * of precision at a performance cost. The default behavior just uses floats. */ #if DOUBLE_FLOAT #define IF_DOUBLE_FLOAT(X) X #else #define IF_DOUBLE_FLOAT(X) #endif /* * EXPORT_BMP * If enabled, each scene rasterization will be saved as a BMP image file. * This is on unless explicitly disabled. */ #ifndef EXPORT_BMP #define EXPORT_BMP 1 #endif #if EXPORT_BMP #define IF_EXPORT_BMP(X) X #else #define IF_EXPORT_BMP(X) #endif /* * EXPORT_PPM * If enabled, each scene rasterization will be saved as a PPM image file. * This is on unless explicitly disabled. */ #ifndef EXPORT_PPM #define EXPORT_PPM 1 #endif #if EXPORT_PPM #define IF_EXPORT_PPM(X) X #else #define IF_EXPORT_PPM(X) #endif /* * EXTRA_INLINE * If enabled, functions that are defined in interface files will be marked as * inline. The compiler will generally inline functions according to its own * optimization heuristics, and this inline marking may persuade the compiler * to inline a function that it otherwise would not. This option may bring a * small performance boost, but it can also increase the size of the program * executable. */ #if EXTRA_INLINE #define IF_EXTRA_INLINE(X) X #else #define IF_EXTRA_INLINE(X) #endif /* * LIGHTING * If enabled, local lighting will be used to increase realism of the scene. * This option has a performance cost, but it can produce interesting visuals. * The behavior of this option is effected by its precise value: * 1 Phong lighting model with flat (per-face) interpolation. * 2 Phong lighting model with Gouraud (per-vertex) interpolation. * 3 Phong lighting model with Phong (per-pixel) interpolation. */ #if LIGHTING #define IF_LIGHTING(X) X #else #define IF_LIGHTING(X) #endif /* * NDEBUG * If enabled, assertions and other nonessential checks will not be compiled * into the programs. */ #if NDEBUG #define IF_NDEBUG(X) X #else #define IF_NDEBUG(X) #endif /* * CACHE_GEOMETRY * If enabled, models will be saved to a quick-loading binary format after * they are loaded. Or, if a cached version of a model is discovered when a * model is requested to be loaded, it is loaded from the cache instead. This * provides a decent speed improvement in cases where the model would * otherwise be loaded from some kind of text format which would load slowly. */ #if CACHE_GEOMETRY #define IF_CACHE_GEOMETRY(X) X #else #define IF_CACHE_GEOMETRY(X) #endif /* * CALC_NORMALS * If enabled, per-vertex normals are calculated for models that don't come * with pre-computed normals. This occurs at loading time. The normals are * calculated by averaging the true normals of all the faces shared by each * vertex. Otherwise, only per-face normals are calculated for such models, * also at loading time. */ #if CALC_NORMALS #define IF_CALC_NORMALS(X) X #else #define IF_CALC_NORMALS(X) #endif /* * SMOOTH_COLOR * If enabled, color will be interpolated across the face of a triangle. * Otherwise, the color will flat, and the average color of the colors * associated with each vertex will be used. */ #if SMOOTH_COLOR #define IF_SMOOTH_COLOR(X) X #else #define IF_SMOOTH_COLOR(X) #endif /* * VERBOSITY * If enabled, a description of what is happening will be printed to stdout. * Otherwise, nothing is printed. The behavior of this option is effected by * its precise value: * 1 Print just a few very general descriptions. * 2 After rasterization, also print the triangle count and other * information that may be interesting. * 3 Also print the number of seconds it took to render the entire scene, * according to wall time. * 4 Also print the number of triangles as they are being rastered. This * uses ANSI escape codes which may not be supported on all terminals. * It also causes a lot to be printed, so it can actually decrease render * performance, especially on a slow (or remote) terminal. * The default setting for this option is 3. */ #ifndef VERBOSITY #define VERBOSITY 3 #endif #if VERBOSITY >= 2 #define IF_RASTER_STATS(X) X #else #define IF_RASTER_STATS(X) #endif #if VERBOSITY >= 3 #define IF_RENDER_TIMER(X) X #else #define IF_RENDER_TIMER(X) #endif #if VERBOSITY >= 4 #define IF_RENDER_PROGRESS(X) X #else #define IF_RENDER_PROGRESS(X) #endif #endif // _CONFIG_H_