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