Panda3D
eggCharacterCollection.I
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 eggCharacterCollection.I
10  * @author drose
11  * @date 2001-02-26
12  */
13 
14 /**
15  * Returns the number of egg files that have successfully been added to the
16  * Character table.
17  */
18 INLINE int EggCharacterCollection::
19 get_num_eggs() const {
20  return _eggs.size();
21 }
22 
23 /**
24  * Returns the ith egg file.
25  */
27 get_egg(int i) const {
28  nassertr(i >= 0 && i < (int)_eggs.size(), nullptr);
29  return _eggs[i]._egg;
30 }
31 
32 /**
33  * Returns the first model index associated with the indicated egg file. An
34  * egg file may contain multiple models, which will be consecutive integers
35  * beginning at get_first_model_index() and continuing for get_num_models().
36  *
37  * Each "model" corresponds to a single character model, or one LOD of a
38  * multiple-LOD model, or a single animation bundle.
39  */
40 INLINE int EggCharacterCollection::
41 get_first_model_index(int egg_index) const {
42  nassertr(egg_index >= 0 && egg_index < (int)_eggs.size(), 0);
43  return _eggs[egg_index]._first_model_index;
44 }
45 
46 /**
47  * Returns the number of different models found in the indicated egg file. An
48  * egg file may contain multiple models, which will be consecutive integers
49  * beginning at get_first_model_index() and continuing for get_num_models().
50  *
51  * Each "model" corresponds to a single character model, or one LOD of a
52  * multiple-LOD model, or a single animation bundle.
53  */
54 INLINE int EggCharacterCollection::
55 get_num_models(int egg_index) const {
56  nassertr(egg_index >= 0 && egg_index < (int)_eggs.size(), 0);
57  return _eggs[egg_index]._models.size();
58 }
59 
60 /**
61  * Returns the number of separate Characters that have been discovered in the
62  * various egg files added to the collection.
63  */
64 INLINE int EggCharacterCollection::
66  return _characters.size();
67 }
68 
69 /**
70  * Returns the ith character in the collection.
71  */
73 get_character(int i) const {
74  nassertr(i >= 0 && i < (int)_characters.size(), nullptr);
75  return _characters[i];
76 }
77 
78 /**
79  * Returns the character associated with the indicated model index.
80  */
82 get_character_by_model_index(int model_index) const {
83  nassertr(model_index >= 0 && model_index < (int)_characters_by_model_index.size(),
84  nullptr);
85  return _characters_by_model_index[model_index];
86 }
87 
88 /**
89  *
90  */
91 INLINE EggCharacterCollection::ModelDescription::
92 ModelDescription() {
93  _root_node = nullptr;
94 }
int get_num_models(int egg_index) const
Returns the number of different models found in the indicated egg file.
This is the primary interface into all the egg data, and the root of the egg file structure.
Definition: eggData.h:37
EggData * get_egg(int i) const
Returns the ith egg file.
int get_num_characters() const
Returns the number of separate Characters that have been discovered in the various egg files added to...
EggCharacterData * get_character(int i) const
Returns the ith character in the collection.
int get_first_model_index(int egg_index) const
Returns the first model index associated with the indicated egg file.
Represents a single character, as read and collected from several models and animation files.
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.