00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "config_egg.h"
00016 #include "eggRenderMode.h"
00017 #include "eggAnimData.h"
00018 #include "eggAnimPreload.h"
00019 #include "eggAttributes.h"
00020 #include "eggBin.h"
00021 #include "eggBinMaker.h"
00022 #include "eggComment.h"
00023 #include "eggCompositePrimitive.h"
00024 #include "eggCoordinateSystem.h"
00025 #include "eggCurve.h"
00026 #include "eggExternalReference.h"
00027 #include "eggFilenameNode.h"
00028 #include "eggGroup.h"
00029 #include "eggGroupNode.h"
00030 #include "eggGroupUniquifier.h"
00031 #include "eggLine.h"
00032 #include "eggMaterial.h"
00033 #include "eggNameUniquifier.h"
00034 #include "eggNamedObject.h"
00035 #include "eggNode.h"
00036 #include "eggNurbsCurve.h"
00037 #include "eggNurbsSurface.h"
00038 #include "eggObject.h"
00039 #include "eggPoint.h"
00040 #include "eggPolygon.h"
00041 #include "eggPolysetMaker.h"
00042 #include "eggPoolUniquifier.h"
00043 #include "eggPrimitive.h"
00044 #include "eggSAnimData.h"
00045 #include "eggSurface.h"
00046 #include "eggSwitchCondition.h"
00047 #include "eggTable.h"
00048 #include "eggTexture.h"
00049 #include "eggTriangleFan.h"
00050 #include "eggTriangleStrip.h"
00051 #include "eggUserData.h"
00052 #include "eggVertex.h"
00053 #include "eggVertexPool.h"
00054 #include "eggVertexUV.h"
00055 #include "eggVertexAux.h"
00056 #include "eggXfmAnimData.h"
00057 #include "eggXfmSAnim.h"
00058
00059 #include "dconfig.h"
00060
00061 Configure(config_egg);
00062 NotifyCategoryDef(egg, "");
00063
00064 ConfigureFn(config_egg) {
00065 init_libegg();
00066 }
00067
00068 ConfigVariableBool egg_support_old_anims
00069 ("egg-support-old-anims", true,
00070 PRC_DESC("Set this true to support loading of old character animation files, which "
00071 "had the convention that the order \"phr\" implied a reversed roll."));
00072
00073 ConfigVariableBool egg_mesh
00074 ("egg-mesh", true,
00075 PRC_DESC("Set this true to convert triangles and higher-order polygons "
00076 "into triangle strips and triangle fans when an egg file is "
00077 "loaded or converted to bam. Set this false just to triangulate "
00078 "everything into independent triangles."));
00079
00080 ConfigVariableBool egg_retesselate_coplanar
00081 ("egg-retesselate-coplanar", false,
00082 PRC_DESC("If this is true, the egg loader may reverse the "
00083 "tesselation direction of a single pair of planar triangles that "
00084 "share the same properties, if that will help get a better "
00085 "triangle strip. In some rare cases, doing so can distort the "
00086 "UV's on a face; turning this off should eliminate that artifact "
00087 "(at the cost of less-effective triangle stripping)."));
00088
00089 ConfigVariableBool egg_unroll_fans
00090 ("egg-unroll-fans", true,
00091 PRC_DESC("Set this true to allow the egg loader to convert weak triangle "
00092 "fans--triangles that share the same vertex but aren't "
00093 "connected enough to justify making a triangle fan primitive "
00094 "from them--into a series of zig-zag triangles that can make "
00095 "a triangle strip that might connect better with its neighbors."));
00096
00097 ConfigVariableBool egg_show_tstrips
00098 ("egg-show-tstrips", false,
00099 PRC_DESC("Set this true to color each triangle strip a random color, with "
00100 "the leading triangle a little bit darker, so you can visually "
00101 "observe the quality of the triangle stripping algorithm."));
00102
00103 ConfigVariableBool egg_show_qsheets
00104 ("egg-show-qsheets", false,
00105 PRC_DESC("Set this true to color each quadsheet a random color, so you "
00106 "can visually observe the quadsheet algorithm."));
00107
00108 ConfigVariableBool egg_show_quads
00109 ("egg-show-quads", false,
00110 PRC_DESC("Set this true to color each detected quad a random color, so "
00111 "you can visually observe the algorithm that unifies pairs of "
00112 "triangles into quads (prior to generating triangle strips)."));
00113
00114 ConfigVariableBool egg_subdivide_polys
00115 ("egg-subdivide-polys", true,
00116 PRC_DESC("This is obsolete. In the old Geom implementation, it used to "
00117 "be true to force higher-order polygons that were not otherwise "
00118 "meshed to be subdivided into triangles. In the new "
00119 "Geom implementation, this happens anyway."));
00120
00121 ConfigVariableBool egg_consider_fans
00122 ("egg-consider-fans", false,
00123 PRC_DESC("Set this true to enable the egg mesher to consider making "
00124 "triangle fans out of triangles that are connected at a common "
00125 "vertex. This may help if your scene involves lots of such "
00126 "connected triangles, but it can also make the overall stripping "
00127 "less effective (by interfering with triangle strips)."));
00128
00129 ConfigVariableDouble egg_max_tfan_angle
00130 ("egg-max-tfan-angle", 40.0,
00131 PRC_DESC("The maximum average angle per triangle to allow in a triangle "
00132 "fan. If triangles are larger than this--that is, more loosely "
00133 "packed--then we figure a triangle strip is likely to do a "
00134 "more effective job than a triangle fan, and the fan maker leaves "
00135 "it alone."));
00136
00137 ConfigVariableInt egg_min_tfan_tris
00138 ("egg-min-tfan-tris", 4,
00139 PRC_DESC("The minimum number of triangles that must be involved in order "
00140 "to generate a triangle fan. Fewer than this is just interrupting "
00141 "a triangle strip."));
00142
00143 ConfigVariableDouble egg_coplanar_threshold
00144 ("egg-coplanar-threshold", 0.01,
00145 PRC_DESC("The numerical threshold below which polygons are considered "
00146 "to be coplanar. Determined empirically."));
00147
00148 ConfigVariableInt egg_test_vref_integrity
00149 ("egg-test-vref-integrity", 20,
00150 PRC_DESC("The maximum number of vertices a primitive may have before "
00151 "its vertices will no longer be checked for internal integrity. "
00152 "This is meaningful in non-production builds only."));
00153
00154 ConfigVariableInt egg_recursion_limit
00155 ("egg-recursion-limit", 1000,
00156 PRC_DESC("The maximum number of levels that recursive algorithms within "
00157 "the egg library are allowed to traverse. This is a simple hack "
00158 "to prevent deeply-recursive algorithms from triggering a stack "
00159 "overflow. Set it larger to run more efficiently if your stack "
00160 "allows it; set it lower if you experience stack overflows."));
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170 void
00171 init_libegg() {
00172 static bool initialized = false;
00173 if (initialized) {
00174 return;
00175 }
00176 initialized = true;
00177
00178 EggRenderMode::init_type();
00179 EggAnimData::init_type();
00180 EggAnimPreload::init_type();
00181 EggAttributes::init_type();
00182 EggBin::init_type();
00183 EggBinMaker::init_type();
00184 EggComment::init_type();
00185 EggCompositePrimitive::init_type();
00186 EggCoordinateSystem::init_type();
00187 EggCurve::init_type();
00188 EggData::init_type();
00189 EggExternalReference::init_type();
00190 EggFilenameNode::init_type();
00191 EggGroup::init_type();
00192 EggGroupNode::init_type();
00193 EggGroupUniquifier::init_type();
00194 EggLine::init_type();
00195 EggMaterial::init_type();
00196 EggNameUniquifier::init_type();
00197 EggNamedObject::init_type();
00198 EggNode::init_type();
00199 EggNurbsCurve::init_type();
00200 EggNurbsSurface::init_type();
00201 EggObject::init_type();
00202 EggPoint::init_type();
00203 EggPolygon::init_type();
00204 EggPolysetMaker::init_type();
00205 EggPoolUniquifier::init_type();
00206 EggPrimitive::init_type();
00207 EggSAnimData::init_type();
00208 EggSurface::init_type();
00209 EggSwitchCondition::init_type();
00210 EggSwitchConditionDistance::init_type();
00211 EggTable::init_type();
00212 EggTexture::init_type();
00213 EggTriangleFan::init_type();
00214 EggTriangleStrip::init_type();
00215 EggUserData::init_type();
00216 EggVertex::init_type();
00217 EggVertexPool::init_type();
00218 EggVertexUV::init_type();
00219 EggVertexAux::init_type();
00220 EggXfmAnimData::init_type();
00221 EggXfmSAnim::init_type();
00222 }