Panda3D

eggOptchar.h
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 eggOptchar.h
10 * @author drose
11 * @date 2003-07-18
12 */
13
14 #ifndef EGGOPTCHAR_H
15 #define EGGOPTCHAR_H
16
17 #include "pandatoolbase.h"
18
19 #include "eggCharacterFilter.h"
20 #include "luse.h"
21
22 #include "pvector.h"
23 #include "vector_string.h"
24 #include "globPattern.h"
25
26 class EggCharacterData;
27 class EggComponentData;
28 class EggJointData;
29 class EggSliderData;
30 class EggGroupNode;
31
32 /**
33 * Performs basic optimizations of a character model and its associated
34 * animations, by analyzing the animation tables and removing unneeded joints
35 * and/or morphs. Can also be used to restructure the character hierarchy.
36 */
37 class EggOptchar : public EggCharacterFilter {
38 public:
39 EggOptchar();
40
41 void run();
42
43 protected:
44 virtual bool handle_args(Args &args);
45
46 private:
47 static bool dispatch_vector_string_pair(const std::string &opt, const std::string &arg, void *var);
48 static bool dispatch_name_components(const std::string &opt, const std::string &arg, void *var);
49 static bool dispatch_double_components(const std::string &opt, const std::string &arg, void *var);
50 static bool dispatch_flag_groups(const std::string &opt, const std::string &arg, void *var);
51
52 void determine_removed_components();
53 void move_vertices();
54 bool process_joints();
55 EggJointData *find_best_parent(EggJointData *joint_data) const;
56 EggJointData *find_best_vertex_joint(EggJointData *joint_data) const;
57
58 bool apply_user_reparents();
59 bool zero_channels();
60 bool quantize_channels();
61 void analyze_joints(EggJointData *joint_data, int level);
62 void analyze_sliders(EggCharacterData *char_data);
63 void list_joints(EggJointData *joint_data, int indent_level, bool verbose);
64 void list_joints_p(EggJointData *joint_data, int &col);
65 void list_scalars(EggCharacterData *char_data, bool verbose);
66 void describe_component(EggComponentData *comp_data, int indent_level,
67 bool verbose);
68 void do_reparent();
69
70 void quantize_vertices();
71 void quantize_vertices(EggNode *egg_node);
72 void quantize_vertex(EggVertex *egg_vertex);
73
74 void do_flag_groups(EggGroupNode *egg_group);
75 void rename_joints();
76 void rename_primitives(EggGroupNode *egg_group, const std::string &name);
77 void change_dart_type(EggGroupNode *egg_group, const std::string &new_dart_type);
78 void do_preload();
79 void do_defpose();
80
81 bool _list_hierarchy;
82 bool _list_hierarchy_v;
83 bool _list_hierarchy_p;
84 bool _preload;
85 bool _keep_all;
86
87 class StringPair {
88 public:
89 std::string _a;
90 std::string _b;
91 };
92 typedef pvector<StringPair> StringPairs;
93 StringPairs _new_joints;
94 StringPairs _reparent_joints;
95 StringPairs _zero_channels;
96 StringPairs _rename_joints;
97
98 vector_string _keep_components;
99 vector_string _drop_components;
100 vector_string _expose_components;
101 vector_string _suppress_components;
102
103 std::string _dart_type;
104
105 class DoubleString {
106 public:
107 double _a;
108 std::string _b;
109 };
110 typedef pvector<DoubleString> DoubleStrings;
111 DoubleStrings _quantize_anims;
112
113 typedef pvector<GlobPattern> Globs;
114
115 class FlagGroupsEntry {
116 public:
117 Globs _groups;
118 std::string _name;
119 };
120 typedef pvector<FlagGroupsEntry> FlagGroups;
121 FlagGroups _flag_groups;
122
123 std::string _defpose;
124
125 bool _optimal_hierarchy;
126 double _vref_quantum;
127 };
128
129 #endif
EggCharacterData
Represents a single character, as read and collected from several models and animation files.
Definition: eggCharacterData.h:52
EggCharacterFilter
This is the base class for a family of programs that operate on a number of character models and thei...
Definition: eggCharacterFilter.h:32
EggComponentData
This is the base class of both EggJointData and EggSliderData.
Definition: eggComponentData.h:34
EggGroupNode
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:46
EggJointData
This is one node of a hierarchy of EggJointData nodes, each of which represents a single joint of the...
Definition: eggJointData.h:31
EggNode
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:36
EggOptchar
Performs basic optimizations of a character model and its associated animations, by analyzing the ani...
Definition: eggOptchar.h:37
EggSliderData
This corresponds to a single morph slider control.
Definition: eggSliderData.h:28
EggVertex
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
Definition: eggVertex.h:39
pdeque< std::string >
pvector< StringPair >
eggCharacterFilter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
globPattern.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pvector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
vector_string.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.