Panda3D
|
00001 // Filename: config_egg.cxx 00002 // Created by: drose (19Mar00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 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 "eggXfmAnimData.h" 00056 #include "eggXfmSAnim.h" 00057 00058 #include "dconfig.h" 00059 00060 Configure(config_egg); 00061 NotifyCategoryDef(egg, ""); 00062 00063 ConfigureFn(config_egg) { 00064 init_libegg(); 00065 } 00066 00067 ConfigVariableBool egg_support_old_anims 00068 ("egg-support-old-anims", true, 00069 PRC_DESC("Set this true to support loading of old character animation files, which " 00070 "had the convention that the order \"phr\" implied a reversed roll.")); 00071 00072 ConfigVariableBool egg_mesh 00073 ("egg-mesh", true, 00074 PRC_DESC("Set this true to convert triangles and higher-order polygons " 00075 "into triangle strips and triangle fans when an egg file is " 00076 "loaded or converted to bam. Set this false just to triangulate " 00077 "everything into independent triangles.")); 00078 00079 ConfigVariableBool egg_retesselate_coplanar 00080 ("egg-retesselate-coplanar", false, 00081 PRC_DESC("If this is true, the egg loader may reverse the " 00082 "tesselation direction of a single pair of planar triangles that " 00083 "share the same properties, if that will help get a better " 00084 "triangle strip. In some rare cases, doing so can distort the " 00085 "UV's on a face; turning this off should eliminate that artifact " 00086 "(at the cost of less-effective triangle stripping).")); 00087 00088 ConfigVariableBool egg_unroll_fans 00089 ("egg-unroll-fans", true, 00090 PRC_DESC("Set this true to allow the egg loader to convert weak triangle " 00091 "fans--triangles that share the same vertex but aren't " 00092 "connected enough to justify making a triangle fan primitive " 00093 "from them--into a series of zig-zag triangles that can make " 00094 "a triangle strip that might connect better with its neighbors.")); 00095 00096 ConfigVariableBool egg_show_tstrips 00097 ("egg-show-tstrips", false, 00098 PRC_DESC("Set this true to color each triangle strip a random color, with " 00099 "the leading triangle a little bit darker, so you can visually " 00100 "observe the quality of the triangle stripping algorithm.")); 00101 00102 ConfigVariableBool egg_show_qsheets 00103 ("egg-show-qsheets", false, 00104 PRC_DESC("Set this true to color each quadsheet a random color, so you " 00105 "can visually observe the quadsheet algorithm.")); 00106 00107 ConfigVariableBool egg_show_quads 00108 ("egg-show-quads", false, 00109 PRC_DESC("Set this true to color each detected quad a random color, so " 00110 "you can visually observe the algorithm that unifies pairs of " 00111 "triangles into quads (prior to generating triangle strips).")); 00112 00113 ConfigVariableBool egg_subdivide_polys 00114 ("egg-subdivide-polys", true, 00115 PRC_DESC("This is obsolete. In the old Geom implementation, it used to " 00116 "be true to force higher-order polygons that were not otherwise " 00117 "meshed to be subdivided into triangles. In the new " 00118 "Geom implementation, this happens anyway.")); 00119 00120 ConfigVariableBool egg_consider_fans 00121 ("egg-consider-fans", false, 00122 PRC_DESC("Set this true to enable the egg mesher to consider making " 00123 "triangle fans out of triangles that are connected at a common " 00124 "vertex. This may help if your scene involves lots of such " 00125 "connected triangles, but it can also make the overall stripping " 00126 "less effective (by interfering with triangle strips).")); 00127 00128 ConfigVariableDouble egg_max_tfan_angle 00129 ("egg-max-tfan-angle", 40.0, 00130 PRC_DESC("The maximum average angle per triangle to allow in a triangle " 00131 "fan. If triangles are larger than this--that is, more loosely " 00132 "packed--then we figure a triangle strip is likely to do a " 00133 "more effective job than a triangle fan, and the fan maker leaves " 00134 "it alone.")); 00135 00136 ConfigVariableInt egg_min_tfan_tris 00137 ("egg-min-tfan-tris", 4, 00138 PRC_DESC("The minimum number of triangles that must be involved in order " 00139 "to generate a triangle fan. Fewer than this is just interrupting " 00140 "a triangle strip.")); 00141 00142 ConfigVariableDouble egg_coplanar_threshold 00143 ("egg-coplanar-threshold", 0.01, 00144 PRC_DESC("The numerical threshold below which polygons are considered " 00145 "to be coplanar. Determined empirically.")); 00146 00147 ConfigVariableInt egg_test_vref_integrity 00148 ("egg-test-vref-integrity", 20, 00149 PRC_DESC("The maximum number of vertices a primitive may have before " 00150 "its vertices will no longer be checked for internal integrity. " 00151 "This is meaningful in non-production builds only.")); 00152 00153 //////////////////////////////////////////////////////////////////// 00154 // Function: init_libegg 00155 // Description: Initializes the library. This must be called at 00156 // least once before any of the functions or classes in 00157 // this library can be used. Normally it will be 00158 // called by the static initializers and need not be 00159 // called explicitly, but special cases exist. 00160 //////////////////////////////////////////////////////////////////// 00161 void 00162 init_libegg() { 00163 static bool initialized = false; 00164 if (initialized) { 00165 return; 00166 } 00167 initialized = true; 00168 00169 EggRenderMode::init_type(); 00170 EggAnimData::init_type(); 00171 EggAnimPreload::init_type(); 00172 EggAttributes::init_type(); 00173 EggBin::init_type(); 00174 EggBinMaker::init_type(); 00175 EggComment::init_type(); 00176 EggCompositePrimitive::init_type(); 00177 EggCoordinateSystem::init_type(); 00178 EggCurve::init_type(); 00179 EggData::init_type(); 00180 EggExternalReference::init_type(); 00181 EggFilenameNode::init_type(); 00182 EggGroup::init_type(); 00183 EggGroupNode::init_type(); 00184 EggGroupUniquifier::init_type(); 00185 EggLine::init_type(); 00186 EggMaterial::init_type(); 00187 EggNameUniquifier::init_type(); 00188 EggNamedObject::init_type(); 00189 EggNode::init_type(); 00190 EggNurbsCurve::init_type(); 00191 EggNurbsSurface::init_type(); 00192 EggObject::init_type(); 00193 EggPoint::init_type(); 00194 EggPolygon::init_type(); 00195 EggPolysetMaker::init_type(); 00196 EggPoolUniquifier::init_type(); 00197 EggPrimitive::init_type(); 00198 EggSAnimData::init_type(); 00199 EggSurface::init_type(); 00200 EggSwitchCondition::init_type(); 00201 EggSwitchConditionDistance::init_type(); 00202 EggTable::init_type(); 00203 EggTexture::init_type(); 00204 EggTriangleFan::init_type(); 00205 EggTriangleStrip::init_type(); 00206 EggUserData::init_type(); 00207 EggVertex::init_type(); 00208 EggVertexPool::init_type(); 00209 EggVertexUV::init_type(); 00210 EggXfmAnimData::init_type(); 00211 EggXfmSAnim::init_type(); 00212 }