Panda3D
 All Classes Functions Variables Enumerations
config_egg.cxx
1 // Filename: config_egg.cxx
2 // Created by: drose (19Mar00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "config_egg.h"
16 #include "eggRenderMode.h"
17 #include "eggAnimData.h"
18 #include "eggAnimPreload.h"
19 #include "eggAttributes.h"
20 #include "eggBin.h"
21 #include "eggBinMaker.h"
22 #include "eggComment.h"
23 #include "eggCompositePrimitive.h"
24 #include "eggCoordinateSystem.h"
25 #include "eggCurve.h"
26 #include "eggExternalReference.h"
27 #include "eggFilenameNode.h"
28 #include "eggGroup.h"
29 #include "eggGroupNode.h"
30 #include "eggGroupUniquifier.h"
31 #include "eggLine.h"
32 #include "eggMaterial.h"
33 #include "eggNameUniquifier.h"
34 #include "eggNamedObject.h"
35 #include "eggNode.h"
36 #include "eggNurbsCurve.h"
37 #include "eggNurbsSurface.h"
38 #include "eggObject.h"
39 #include "eggPatch.h"
40 #include "eggPoint.h"
41 #include "eggPolygon.h"
42 #include "eggPolysetMaker.h"
43 #include "eggPoolUniquifier.h"
44 #include "eggPrimitive.h"
45 #include "eggSAnimData.h"
46 #include "eggSurface.h"
47 #include "eggSwitchCondition.h"
48 #include "eggTable.h"
49 #include "eggTexture.h"
50 #include "eggTriangleFan.h"
51 #include "eggTriangleStrip.h"
52 #include "eggUserData.h"
53 #include "eggVertex.h"
54 #include "eggVertexPool.h"
55 #include "eggVertexUV.h"
56 #include "eggVertexAux.h"
57 #include "eggXfmAnimData.h"
58 #include "eggXfmSAnim.h"
59 
60 #include "dconfig.h"
61 
62 Configure(config_egg);
63 NotifyCategoryDef(egg, "");
64 
65 ConfigureFn(config_egg) {
66  init_libegg();
67 }
68 
69 ConfigVariableBool egg_support_old_anims
70 ("egg-support-old-anims", true,
71  PRC_DESC("Set this true to support loading of old character animation files, which "
72  "had the convention that the order \"phr\" implied a reversed roll."));
73 
74 ConfigVariableBool egg_mesh
75 ("egg-mesh", true,
76  PRC_DESC("Set this true to convert triangles and higher-order polygons "
77  "into triangle strips and triangle fans when an egg file is "
78  "loaded or converted to bam. Set this false just to triangulate "
79  "everything into independent triangles."));
80 
81 ConfigVariableBool egg_retesselate_coplanar
82 ("egg-retesselate-coplanar", false,
83  PRC_DESC("If this is true, the egg loader may reverse the "
84  "tesselation direction of a single pair of planar triangles that "
85  "share the same properties, if that will help get a better "
86  "triangle strip. In some rare cases, doing so can distort the "
87  "UV's on a face; turning this off should eliminate that artifact "
88  "(at the cost of less-effective triangle stripping)."));
89 
90 ConfigVariableBool egg_unroll_fans
91 ("egg-unroll-fans", true,
92  PRC_DESC("Set this true to allow the egg loader to convert weak triangle "
93  "fans--triangles that share the same vertex but aren't "
94  "connected enough to justify making a triangle fan primitive "
95  "from them--into a series of zig-zag triangles that can make "
96  "a triangle strip that might connect better with its neighbors."));
97 
98 ConfigVariableBool egg_show_tstrips
99 ("egg-show-tstrips", false,
100  PRC_DESC("Set this true to color each triangle strip a random color, with "
101  "the leading triangle a little bit darker, so you can visually "
102  "observe the quality of the triangle stripping algorithm."));
103 
104 ConfigVariableBool egg_show_qsheets
105 ("egg-show-qsheets", false,
106  PRC_DESC("Set this true to color each quadsheet a random color, so you "
107  "can visually observe the quadsheet algorithm."));
108 
109 ConfigVariableBool egg_show_quads
110 ("egg-show-quads", false,
111  PRC_DESC("Set this true to color each detected quad a random color, so "
112  "you can visually observe the algorithm that unifies pairs of "
113  "triangles into quads (prior to generating triangle strips)."));
114 
115 ConfigVariableBool egg_subdivide_polys
116 ("egg-subdivide-polys", true,
117  PRC_DESC("This is obsolete. In the old Geom implementation, it used to "
118  "be true to force higher-order polygons that were not otherwise "
119  "meshed to be subdivided into triangles. In the new "
120  "Geom implementation, this happens anyway."));
121 
122 ConfigVariableBool egg_consider_fans
123 ("egg-consider-fans", false,
124  PRC_DESC("Set this true to enable the egg mesher to consider making "
125  "triangle fans out of triangles that are connected at a common "
126  "vertex. This may help if your scene involves lots of such "
127  "connected triangles, but it can also make the overall stripping "
128  "less effective (by interfering with triangle strips)."));
129 
130 ConfigVariableDouble egg_max_tfan_angle
131 ("egg-max-tfan-angle", 40.0,
132  PRC_DESC("The maximum average angle per triangle to allow in a triangle "
133  "fan. If triangles are larger than this--that is, more loosely "
134  "packed--then we figure a triangle strip is likely to do a "
135  "more effective job than a triangle fan, and the fan maker leaves "
136  "it alone."));
137 
138 ConfigVariableInt egg_min_tfan_tris
139 ("egg-min-tfan-tris", 4,
140  PRC_DESC("The minimum number of triangles that must be involved in order "
141  "to generate a triangle fan. Fewer than this is just interrupting "
142  "a triangle strip."));
143 
144 ConfigVariableDouble egg_coplanar_threshold
145 ("egg-coplanar-threshold", 0.01,
146  PRC_DESC("The numerical threshold below which polygons are considered "
147  "to be coplanar. Determined empirically."));
148 
149 ConfigVariableInt egg_test_vref_integrity
150 ("egg-test-vref-integrity", 20,
151  PRC_DESC("The maximum number of vertices a primitive may have before "
152  "its vertices will no longer be checked for internal integrity. "
153  "This is meaningful in non-production builds only."));
154 
155 ConfigVariableInt egg_recursion_limit
156 ("egg-recursion-limit", 1000,
157  PRC_DESC("The maximum number of levels that recursive algorithms within "
158  "the egg library are allowed to traverse. This is a simple hack "
159  "to prevent deeply-recursive algorithms from triggering a stack "
160  "overflow. Set it larger to run more efficiently if your stack "
161  "allows it; set it lower if you experience stack overflows."));
162 
163 ////////////////////////////////////////////////////////////////////
164 // Function: init_libegg
165 // Description: Initializes the library. This must be called at
166 // least once before any of the functions or classes in
167 // this library can be used. Normally it will be
168 // called by the static initializers and need not be
169 // called explicitly, but special cases exist.
170 ////////////////////////////////////////////////////////////////////
171 void
172 init_libegg() {
173  static bool initialized = false;
174  if (initialized) {
175  return;
176  }
177  initialized = true;
178 
179  EggRenderMode::init_type();
180  EggAnimData::init_type();
181  EggAnimPreload::init_type();
182  EggAttributes::init_type();
183  EggBin::init_type();
184  EggBinMaker::init_type();
185  EggComment::init_type();
186  EggCompositePrimitive::init_type();
187  EggCoordinateSystem::init_type();
188  EggCurve::init_type();
189  EggData::init_type();
190  EggExternalReference::init_type();
191  EggFilenameNode::init_type();
192  EggGroup::init_type();
193  EggGroupNode::init_type();
194  EggGroupUniquifier::init_type();
195  EggLine::init_type();
196  EggMaterial::init_type();
197  EggNameUniquifier::init_type();
198  EggNamedObject::init_type();
199  EggNode::init_type();
200  EggNurbsCurve::init_type();
201  EggNurbsSurface::init_type();
202  EggObject::init_type();
203  EggPatch::init_type();
204  EggPoint::init_type();
205  EggPolygon::init_type();
206  EggPolysetMaker::init_type();
207  EggPoolUniquifier::init_type();
208  EggPrimitive::init_type();
209  EggSAnimData::init_type();
210  EggSurface::init_type();
211  EggSwitchCondition::init_type();
212  EggSwitchConditionDistance::init_type();
213  EggTable::init_type();
214  EggTexture::init_type();
215  EggTriangleFan::init_type();
216  EggTriangleStrip::init_type();
217  EggUserData::init_type();
218  EggVertex::init_type();
219  EggVertexPool::init_type();
220  EggVertexUV::init_type();
221  EggVertexAux::init_type();
222  EggXfmAnimData::init_type();
223  EggXfmSAnim::init_type();
224 }
This is a convenience class to specialize ConfigVariable as a boolean type.
This is a convenience class to specialize ConfigVariable as a floating-point type.
This is a convenience class to specialize ConfigVariable as an integer type.