Panda3D
characterMaker.h
1 // Filename: characterMaker.h
2 // Created by: drose (06Mar02)
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 #ifndef CHARACTERMAKER_H
16 #define CHARACTERMAKER_H
17 
18 #include "pandabase.h"
19 
20 #include "vertexTransform.h"
21 #include "vertexSlider.h"
22 #include "character.h"
23 #include "vector_PartGroupStar.h"
24 #include "typedef.h"
25 #include "pmap.h"
26 
27 
28 class EggNode;
29 class EggGroup;
30 class EggGroupNode;
31 class EggPrimitive;
32 class EggBin;
33 class PartGroup;
35 class Character;
36 class GeomNode;
37 class CharacterSlider;
38 class MovingPartBase;
39 class EggLoader;
40 class PandaNode;
41 
42 ////////////////////////////////////////////////////////////////////
43 // Class : CharacterMaker
44 // Description : Converts an EggGroup hierarchy, beginning with a
45 // group with <Dart> set, to a character node with
46 // joints.
47 ////////////////////////////////////////////////////////////////////
48 class EXPCL_PANDAEGG CharacterMaker {
49 public:
50  CharacterMaker(EggGroup *root, EggLoader &loader, bool structured = false);
51 
52  Character *make_node();
53 
54  string get_name() const;
55  PartGroup *egg_to_part(EggNode *egg_node) const;
56  VertexTransform *egg_to_transform(EggNode *egg_node);
57  int egg_to_index(EggNode *egg_node) const;
58  PandaNode *part_to_node(PartGroup *part, const string &name) const;
59 
60  int create_slider(const string &name);
61  VertexSlider *egg_to_slider(const string &name);
62 
63 private:
64  CharacterJointBundle *make_bundle();
65  void build_joint_hierarchy(EggNode *egg_node, PartGroup *part, int index);
66  void parent_joint_nodes(PartGroup *part);
67 
68  void make_geometry(EggNode *egg_node);
69 
70  EggGroupNode *determine_primitive_home(EggPrimitive *egg_primitive);
71  EggGroupNode *determine_bin_home(EggBin *egg_bin);
72  VertexTransform *get_identity_transform();
73 
75  NodeMap _node_map;
76 
77  typedef vector_PartGroupStar Parts;
78  Parts _parts;
79 
81  VertexTransforms _vertex_transforms;
82  PT(VertexTransform) _identity_transform;
83 
85  VertexSliders _vertex_sliders;
86 
87  EggLoader &_loader;
88  EggGroup *_egg_root;
89  PT(Character) _character_node;
90  CharacterJointBundle *_bundle;
91  PartGroup *_morph_root;
92  PartGroup *_skeleton_root;
93 
94  bool _structured;
95 
96 };
97 
98 #endif
A base class for any of a number of kinds of geometry primitives: polygons, point lights...
Definition: eggPrimitive.h:51
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
The collection of all the joints and sliders in the character.
An animated character, with skeleton-morph animation and either soft-skinned or hard-skinned vertices...
Definition: character.h:41
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:51
This is an abstract base class that retains some slider value, which is a linear value that typically...
Definition: vertexSlider.h:41
This is the base class for a single animatable piece that may be bound to one channel (or more...
This is a morph slider within the character.
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:36
This is an abstract base class that holds a pointer to some transform, computed in some arbitrary way...
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:38
Converts an EggGroup hierarchy, beginning with a group with <Dart> set, to a character node with join...
A node that holds Geom objects, renderable pieces of geometry.
Definition: geomNode.h:37
Converts an egg data structure, possibly read from an egg file but not necessarily, into a scene graph suitable for rendering.
Definition: eggLoader.h:70
A type of group node that holds related subnodes.
Definition: eggBin.h:30
This is the base class for PartRoot and MovingPart.
Definition: partGroup.h:45