Panda3D
 All Classes Functions Variables Enumerations
eggCharacterCollection.I
1 // Filename: eggCharacterCollection.I
2 // Created by: drose (26Feb01)
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 
16 ////////////////////////////////////////////////////////////////////
17 // Function: EggCharacterCollection::get_num_eggs
18 // Access: Public
19 // Description: Returns the number of egg files that have
20 // successfully been added to the Character table.
21 ////////////////////////////////////////////////////////////////////
22 INLINE int EggCharacterCollection::
23 get_num_eggs() const {
24  return _eggs.size();
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: EggCharacterCollection::get_egg
29 // Access: Public
30 // Description: Returns the ith egg file.
31 ////////////////////////////////////////////////////////////////////
33 get_egg(int i) const {
34  nassertr(i >= 0 && i < (int)_eggs.size(), (EggData *)NULL);
35  return _eggs[i]._egg;
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: EggCharacterCollection::get_first_model_index
40 // Access: Public
41 // Description: Returns the first model index associated with the
42 // indicated egg file. An egg file may contain multiple
43 // models, which will be consecutive integers beginning
44 // at get_first_model_index() and continuing for
45 // get_num_models().
46 //
47 // Each "model" corresponds to a single character model,
48 // or one LOD of a multiple-LOD model, or a single
49 // animation bundle.
50 ////////////////////////////////////////////////////////////////////
51 INLINE int EggCharacterCollection::
52 get_first_model_index(int egg_index) const {
53  nassertr(egg_index >= 0 && egg_index < (int)_eggs.size(), 0);
54  return _eggs[egg_index]._first_model_index;
55 }
56 
57 ////////////////////////////////////////////////////////////////////
58 // Function: EggCharacterCollection::get_num_models
59 // Access: Public
60 // Description: Returns the number of different models found in the
61 // indicated egg file. An egg file may contain multiple
62 // models, which will be consecutive integers beginning
63 // at get_first_model_index() and continuing for
64 // get_num_models().
65 //
66 // Each "model" corresponds to a single character model,
67 // or one LOD of a multiple-LOD model, or a single
68 // animation bundle.
69 ////////////////////////////////////////////////////////////////////
70 INLINE int EggCharacterCollection::
71 get_num_models(int egg_index) const {
72  nassertr(egg_index >= 0 && egg_index < (int)_eggs.size(), 0);
73  return _eggs[egg_index]._models.size();
74 }
75 
76 ////////////////////////////////////////////////////////////////////
77 // Function: EggCharacterCollection::get_num_characters
78 // Access: Public
79 // Description: Returns the number of separate Characters that have
80 // been discovered in the various egg files added to the
81 // collection.
82 ////////////////////////////////////////////////////////////////////
83 INLINE int EggCharacterCollection::
85  return _characters.size();
86 }
87 
88 ////////////////////////////////////////////////////////////////////
89 // Function: EggCharacterCollection::get_character
90 // Access: Public
91 // Description: Returns the ith character in the collection.
92 ////////////////////////////////////////////////////////////////////
94 get_character(int i) const {
95  nassertr(i >= 0 && i < (int)_characters.size(), (EggCharacterData *)NULL);
96  return _characters[i];
97 }
98 
99 ////////////////////////////////////////////////////////////////////
100 // Function: EggCharacterCollection::get_character_by_model_index
101 // Access: Public
102 // Description: Returns the character associated with the indicated
103 // model index.
104 ////////////////////////////////////////////////////////////////////
106 get_character_by_model_index(int model_index) const {
107  nassertr(model_index >= 0 && model_index < (int)_characters_by_model_index.size(),
108  (EggCharacterData *)NULL);
109  return _characters_by_model_index[model_index];
110 }
111 
112 ////////////////////////////////////////////////////////////////////
113 // Function: EggCharacterCollection::ModelDescription::Constructor
114 // Access: Public
115 // Description:
116 ////////////////////////////////////////////////////////////////////
117 INLINE EggCharacterCollection::ModelDescription::
118 ModelDescription() {
119  _root_node = (EggObject *)NULL;
120 }
EggData * get_egg(int i) const
Returns the ith egg file.
This is the primary interface into all the egg data, and the root of the egg file structure...
Definition: eggData.h:41
EggCharacterData * get_character_by_model_index(int model_index) const
Returns the character associated with the indicated model index.
int get_num_eggs() const
Returns the number of egg files that have successfully been added to the Character table...
int get_first_model_index(int egg_index) const
Returns the first model index associated with the indicated egg file.
int get_num_models(int egg_index) const
Returns the number of different models found in the indicated egg file.
Represents a single character, as read and collected from several models and animation files...
EggCharacterData * get_character(int i) const
Returns the ith character in the collection.
The highest-level base class in the egg directory.
Definition: eggObject.h:31
int get_num_characters() const
Returns the number of separate Characters that have been discovered in the various egg files added to...