26 set_program_brief(
"crop geometry in an .egg file");
27 set_program_description
28 (
"egg-crop strips out all parts of an egg file that fall outside of an " 29 "arbitrary bounding volume, specified with a minimum and maximum point " 30 "in world coordinates.");
34 "Specify the minimum point.",
35 &EggCrop::dispatch_double_triple, &_got_min, &_min[0]);
39 "Specify the maximum point.",
40 &EggCrop::dispatch_double_triple, &_got_max, &_max[0]);
51 if (!_got_min || !_got_max) {
52 nout <<
"You must specify both a minimum and a maximum bounds.\n";
64 int num_removed = strip_prims(_data);
65 nout <<
"Removed " << num_removed <<
" primitives.\n";
67 _data->remove_unused_vertices(
true);
81 EggGroupNode::iterator ci;
83 while (ci != group->end()) {
87 if (child->
is_of_type(EggPrimitive::get_class_type())) {
89 EggPrimitive::iterator vi;
90 for (vi = prim->begin(); vi != prim->end() && all_in; ++vi) {
94 all_in = (pos[0] >= _min[0] && pos[0] <= _max[0] &&
95 pos[1] >= _min[1] && pos[1] <= _max[1] &&
96 pos[2] >= _min[2] && pos[2] <= _max[2]);
103 ci = group->erase(ci);
107 if (child->
is_of_type(EggGroupNode::get_class_type())) {
109 num_removed += strip_prims(group_child);
119 int main(
int argc,
char *argv[]) {
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
A base class for nodes in the hierarchy that are not leaf nodes.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
LVertexd get_pos3() const
Valid if get_num_dimensions() returns 3 or 4.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A program to read an egg file and write an equivalent egg file, possibly performing some minor operat...
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
virtual bool post_command_line()
This is called after the command line has been completely processed, and it gives the program a chanc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void write_egg_file()
Writes out the egg file as the normal result of the program.
A base class for things that may be directly added into the egg hierarchy.
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.