31 (
"cs",
"coordinate-system", 80,
32 "Specify the coordinate system to operate in. This may be one of " 33 "'y-up', 'z-up', 'y-up-left', or 'z-up-left'.",
34 &EggBase::dispatch_coordinate_system,
35 &_got_coordinate_system, &_coordinate_system);
37 _normals_mode = NM_preserve;
38 _normals_threshold = 0.0;
44 _got_transform =
false;
45 _transform = LMatrix4d::ident_mat();
47 _got_coordinate_system =
false;
48 _coordinate_system = CS_yup_right;
60 static NormalsMode strip = NM_strip;
61 static NormalsMode polygon = NM_polygon;
62 static NormalsMode vertex = NM_vertex;
63 static NormalsMode preserve = NM_preserve;
68 &EggBase::dispatch_normals,
nullptr, &strip);
72 "Strip existing normals and redefine polygon normals.",
73 &EggBase::dispatch_normals,
nullptr, &polygon);
76 (
"nv",
"threshold", 48,
77 "Strip existing normals and redefine vertex normals. Consider an edge " 78 "between adjacent polygons to be smooth if the angle between them " 79 "is less than threshold degrees.",
80 &EggBase::dispatch_normals,
nullptr, &vertex);
84 "Preserve normals exactly as they are. This is the default.",
85 &EggBase::dispatch_normals,
nullptr, &preserve);
89 "Compute tangent and binormal for the named texture coordinate " 90 "set(s). The name may include wildcard characters such as * and ?. " 91 "The normal must already exist or have been computed via one of the " 92 "above options. The tangent and binormal are used to implement " 93 "bump mapping and related texture-based lighting effects. This option " 94 "may be repeated as necessary to name multiple texture coordinate sets.",
95 &EggBase::dispatch_vector_string,
nullptr, &_tbn_names);
99 "Compute tangent and binormal for all texture coordinate " 100 "sets. This is equivalent to -tbn \"*\".",
101 &EggBase::dispatch_none, &_got_tbnall);
105 "Compute tangent and binormal for all normal maps. ",
106 &EggBase::dispatch_none, &_got_tbnauto);
116 "Construct <PointLight> entries for any unreferenced vertices, to make them visible.",
117 &EggBase::dispatch_none, &_make_points);
128 (
"TS",
"sx[,sy,sz]", 49,
129 "Scale the model uniformly by the given factor (if only one number " 130 "is given) or in each axis by sx, sy, sz (if three numbers are given).",
131 &EggBase::dispatch_scale, &_got_transform, &_transform);
135 "Rotate the model x degrees about the x axis, then y degrees about the " 136 "y axis, and then z degrees about the z axis.",
137 &EggBase::dispatch_rotate_xyz, &_got_transform, &_transform);
140 (
"TA",
"angle,x,y,z", 49,
141 "Rotate the model angle degrees counterclockwise about the given " 143 &EggBase::dispatch_rotate_axis, &_got_transform, &_transform);
147 "Translate the model by the indicated amount.\n\n" 148 "All transformation options (-TS, -TR, -TA, -TT) are cumulative and are " 149 "applied in the order they are encountered on the command line.",
150 &EggBase::dispatch_translate, &_got_transform, &_transform);
160 if (node->
is_of_type(EggTexture::get_class_type())) {
165 egg_tex->set_filename(outpath);
169 Filename alpha_fullpath, alpha_outpath;
171 alpha_fullpath, alpha_outpath);
176 }
else if (node->
is_of_type(EggFilenameNode::get_class_type())) {
182 egg_fnode->set_filename(outpath);
185 }
else if (node->
is_of_type(EggGroupNode::get_class_type())) {
187 EggGroupNode::const_iterator ci;
188 for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) {
202 append_command_comment(
EggData *data) {
214 append_command_comment(
EggData *data,
const string &comment) {
215 data->insert(data->begin(),
new EggComment(
"", comment));
224 dispatch_normals(
ProgramBase *
self,
const string &opt,
const string &arg,
void *mode) {
226 return base->ns_dispatch_normals(opt, arg, mode);
235 ns_dispatch_normals(
const string &opt,
const string &arg,
void *mode) {
236 _normals_mode = *(NormalsMode *)mode;
238 if (_normals_mode == NM_vertex) {
240 nout <<
"Invalid numeric parameter for -" << opt <<
": " 253 dispatch_scale(
const string &opt,
const string &arg,
void *var) {
254 LMatrix4d *transform = (LMatrix4d *)var;
262 if (words.size() == 3) {
268 }
else if (words.size() == 1) {
276 <<
" requires one or three numbers separated by commas.\n";
280 *transform = (*transform) * LMatrix4d::scale_mat(sx, sy, sz);
290 dispatch_rotate_xyz(
ProgramBase *
self,
const string &opt,
const string &arg,
void *var) {
292 return base->ns_dispatch_rotate_xyz(opt, arg, var);
300 ns_dispatch_rotate_xyz(
const string &opt,
const string &arg,
void *var) {
301 LMatrix4d *transform = (LMatrix4d *)var;
309 if (words.size() == 3) {
318 <<
" requires three numbers separated by commas.\n";
323 LMatrix4d::rotate_mat(xyz[0], LVector3d(1.0, 0.0, 0.0), _coordinate_system) *
324 LMatrix4d::rotate_mat(xyz[1], LVector3d(0.0, 1.0, 0.0), _coordinate_system) *
325 LMatrix4d::rotate_mat(xyz[2], LVector3d(0.0, 0.0, 1.0), _coordinate_system);
327 *transform = (*transform) * mat;
337 dispatch_rotate_axis(
ProgramBase *
self,
const string &opt,
const string &arg,
void *var) {
339 return base->ns_dispatch_rotate_axis(opt, arg, var);
347 ns_dispatch_rotate_axis(
const string &opt,
const string &arg,
void *var) {
348 LMatrix4d *transform = (LMatrix4d *)var;
357 if (words.size() == 4) {
367 <<
" requires four numbers separated by commas.\n";
371 *transform = (*transform) * LMatrix4d::rotate_mat(angle, axis, _coordinate_system);
380 dispatch_translate(
const string &opt,
const string &arg,
void *var) {
381 LMatrix4d *transform = (LMatrix4d *)var;
389 if (words.size() == 3) {
398 <<
" requires three numbers separated by commas.\n";
402 *transform = (*transform) * LMatrix4d::translate_mat(trans);
void set_fullpath(const Filename &fullpath)
Records the full pathname to the file, for the benefit of get_fullpath().
This is intended to be the base class for most general-purpose utility programs in the PANDATOOL tree...
const Filename & get_filename() const
Returns a nonmodifiable reference to the filename.
double string_to_double(const string &str, string &tail)
A string-interface wrapper around the C library strtol().
This is an egg node that contains a filename.
A base class for nodes in the hierarchy that are not leaf nodes.
has_alpha_filename
Returns true if a separate file for the alpha component has been applied, false otherwise.
Defines a texture map that may be applied to geometry.
set_alpha_fullpath
Records the full pathname to the file, for the benefit of get_alpha_fullpath().
void add_normals_options()
Adds -no, -np, etc.
void full_convert_path(const Filename &orig_filename, const DSearchPath &additional_path, Filename &resolved_path, Filename &output_path)
Converts the input path into two different forms: A resolved path, and an output path.
This is the primary interface into all the egg data, and the root of the egg file structure.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void convert_paths(EggNode *node, PathReplace *path_replace, const DSearchPath &additional_path)
Recursively walks the egg hierarchy.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
std::string get_exec_command() const
Returns the command that invoked this program, as a shell-friendly string, suitable for pasting into ...
void tokenize(const string &str, vector_string &words, const string &delimiters, bool discard_repeated_delimiters)
Chops the source string up into pieces delimited by any of the characters specified in delimiters.
get_alpha_filename
Returns the separate file assigned for the alpha channel.
This encapsulates the user's command-line request to replace existing, incorrect pathnames to models ...
A base class for things that may be directly added into the egg hierarchy.
set_alpha_filename
Specifies a separate file that will be loaded in with the 1- or 3-component texture and applied as th...
void add_transform_options()
Adds -TS, -TT, etc.
This is a base class for both EggSingleBase and EggMultiBase.
void add_points_options()
Adds -points as a valid option for this program.
This class stores a list of directories that can be searched, in order, to locate a particular file.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated 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.