#ifndef _CONFIG_H_
#define _CONFIG_H_
+/*
+ * OPENGL
+ * If enabled, the software rasterizer will be bypassed and the scene will
+ * be rendered using OpenGL. The resulting image will not be exported;
+ * rather, GLUT will be used to display the scene in a window. This option
+ * overrides options effecting the software rasterizer. Also, the float
+ * size will be 32-bit regardless of the DOUBLE_FLOAT option.
+ */
+#if OPENGL
+#define IF_OPENGL(X) X
+#undef DOUBLE_FLOAT
+#else
+#define IF_OPENGL(X)
+#endif
+
/*
* BACKFACE_CULLING
* If enabled, triangles that are facing away from the viewer, according to
#define IF_BACKFACE_CULLING(X)
#endif
+/*
+ * BLENDING
+ * If enabled, the blending function Crgb = (1 - Sa)Drgb + (Sa)Srgb is
+ * applied when calculating final colors 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
#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.
* 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 also depends on the SMOOTH_COLOR option and
- * whether or not the model has unique vertex normals; if SMOOTH_COLOR is
- * disabled, each triangle will be shaded a flat color. If it is enabled,
- * Gouraud interpolation is used to smooth the lighting across the face of
- * each triangle. See the PRE_NORMALS and SMOOTH_COLOR options.
+ * 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
#endif
/*
- * PRE_NORMALS
- * If enabled, normals are pre-computed while the triangles are loading.
- * Otherwise, the normals are computed during rasterization. The behavior of
- * this option is effected by its precise value:
- * 1 Normals are computed per-face, according to the right-hand rule and
- * counter-clockwise winding of the verticies.
- * 2 Normals are computed per-vertex; the normal for a vertex that is shared
- * between two or more faces will be the average of the normals of the
- * faces. There is a performance penalty for this setting.
- * 3 Same as 2, but the normals will be cached so that they will not need to
- * be computed the next time the mesh is loaded.
+ * 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 PRE_NORMALS
-#define IF_PRE_NORMALS(X) X
+#if CACHE_GEOMETRY
+#define IF_CACHE_GEOMETRY(X) X
#else
-#define IF_PRE_NORMALS(X)
+#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
/*
#define IF_SMOOTH_COLOR(X)
#endif
+/*
+ * TEXTURING
+ * If enabled, a texture will be used to color models that have texture
+ * coordinates. The color from the texture will actually be multiplied
+ * (i.e. mixed) with the regular color associated with the geometry. Also,
+ * Phong interpolation lighting (LIGHTING >= 3) is required to get actual
+ * texturing; otherwise, only the color at the origin point of the texture
+ * will be used.
+ */
+#if TEXTURING
+#define IF_TEXTURING(X) X
+#else
+#define IF_TEXTURING(X)
+#endif
+
+/*
+ * PERSPECTIVE_FIX
+ * If enabled, texturing will have correct perspective on triangles which
+ * show depth. You typically always want this, so it's enabled by default.
+ * This option is useful only if TEXTURING is also enabled.
+ */
+#ifndef PERSPECTIVE_FIX
+#define PERSPECTIVE_FIX 1
+#endif
+#if PERSPECTIVE_FIX
+#define IF_PERSPECTIVE_FIX(X) X
+#else
+#define IF_PERSPECTIVE_FIX(X)
+#endif
+
/*
* VERBOSITY
* If enabled, a description of what is happening will be printed to stdout.