Panda3D
softNodeTree.h
1 // Filename: softNodeTree.h
2 // Created by: masad (03Oct03)
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 SOFTNODETREE_H
16 #define SOFTNODETREE_H
17 
18 #include "pandatoolbase.h"
19 #include "softNodeDesc.h"
20 
21 #include <SAA.h>
22 
23 class EggGroup;
24 class EggTable;
25 class EggXfmSAnim;
26 class EggData;
27 class EggGroupNode;
28 
29 
30 ////////////////////////////////////////////////////////////////////
31 // Class : SoftNodeTree
32 // Description : Describes a complete tree of soft nodes for
33 // conversion.
34 ////////////////////////////////////////////////////////////////////
35 class SoftNodeTree {
36 public:
37  SoftNodeTree();
38  SoftNodeDesc *build_node(SAA_Scene *scene, SAA_Elem *model);
39  bool build_complete_hierarchy(SAA_Scene &scene, SAA_Database &database);
40  void handle_null(SAA_Scene *scene, SoftNodeDesc *node_desc, const char *node_name);
41  // bool build_selected_hierarchy(SAA_Scene *s, SAA_Database *d, char *scene_name);
42 
43  int get_num_nodes() const;
44  SoftNodeDesc *get_node(int n) const;
45  SoftNodeDesc *get_node(string name) const;
46 
47  char *GetRootName(const char *);
48  char *GetModelNoteInfo(SAA_Scene *, SAA_Elem *);
49  char *GetName(SAA_Scene *scene, SAA_Elem *element);
50  char *GetFullName(SAA_Scene *scene, SAA_Elem *element);
51 
52  EggGroupNode *get_egg_root() {return _egg_root;}
53  EggGroup *get_egg_group(SoftNodeDesc *node_desc);
54  EggTable *get_egg_table(SoftNodeDesc *node_desc);
56 
57  void clear_egg(EggData *egg_data, EggGroupNode *egg_root, EggGroupNode *skeleton_node);
58 
59  PT(SoftNodeDesc) _root;
60  PN_stdfloat _fps;
61  int _use_prefix;
62  char *_search_prefix;
63 
64 
65 private:
66 
67  EggData *_egg_data;
68  EggGroupNode *_egg_root;
69  EggGroupNode *_skeleton_node;
70 
71  SoftNodeDesc *r_build_node(SoftNodeDesc *parent_node, const string &path);
72 
74  NodesByName _nodes_by_name;
75 
77  Nodes _nodes;
78 };
79 
80 #endif
EggTable * get_egg_table(SoftNodeDesc *node_desc)
Returns the EggTable corresponding to the joint for the indicated node.
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:51
char * GetModelNoteInfo(SAA_Scene *, SAA_Elem *)
Given an element, return a string containing the contents of its MODEL NOTE entry.
char * GetName(SAA_Scene *scene, SAA_Elem *element)
Given an element, return a copy of the element&#39;s name WITHOUT prefix.
SoftNodeDesc * get_node(int n) const
Returns the nth node in the hierarchy, in an arbitrary ordering.
This is the primary interface into all the egg data, and the root of the egg file structure...
Definition: eggData.h:41
int get_num_nodes() const
Returns the total number of nodes in the hierarchy, not counting the root node.
char * GetFullName(SAA_Scene *scene, SAA_Elem *element)
Given an element, return a copy of the element&#39;s name complete with prefix.
Describes a complete tree of soft nodes for conversion.
Definition: softNodeTree.h:35
void clear_egg(EggData *egg_data, EggGroupNode *egg_root, EggGroupNode *skeleton_node)
Removes all of the references to generated egg structures from the tree, and prepares the tree for ge...
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:36
char * GetRootName(const char *)
Given a string, return a copy of the string up to the first occurence of &#39;-&#39;.
EggGroup * get_egg_group(SoftNodeDesc *node_desc)
Returns the EggGroupNode corresponding to the group or joint for the indicated node.
bool build_complete_hierarchy(SAA_Scene &scene, SAA_Database &database)
Walks through the complete Soft hierarchy and builds up the corresponding tree.
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
Definition: eggXfmSAnim.h:33
Describes a single instance of a node aka element in the Soft scene graph, relating it to the corresp...
Definition: softNodeDesc.h:46
This corresponds to a.
Definition: eggTable.h:31
void handle_null(SAA_Scene *scene, SoftNodeDesc *node_desc, const char *node_name)
Sets joint information for MNILL node.
SoftNodeDesc * build_node(SAA_Scene *scene, SAA_Elem *model)
Returns a pointer to the node corresponding to the indicated dag_path object, creating it first if ne...
EggXfmSAnim * get_egg_anim(SoftNodeDesc *node_desc)
Returns the anim table corresponding to the joint for the indicated node.