Panda3D

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