00001 // Filename: eggCharacterCollection.I 00002 // Created by: drose (26Feb01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: EggCharacterCollection::get_num_eggs 00018 // Access: Public 00019 // Description: Returns the number of egg files that have 00020 // successfully been added to the Character table. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE int EggCharacterCollection:: 00023 get_num_eggs() const { 00024 return _eggs.size(); 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: EggCharacterCollection::get_egg 00029 // Access: Public 00030 // Description: Returns the ith egg file. 00031 //////////////////////////////////////////////////////////////////// 00032 INLINE EggData *EggCharacterCollection:: 00033 get_egg(int i) const { 00034 nassertr(i >= 0 && i < (int)_eggs.size(), (EggData *)NULL); 00035 return _eggs[i]._egg; 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: EggCharacterCollection::get_first_model_index 00040 // Access: Public 00041 // Description: Returns the first model index associated with the 00042 // indicated egg file. An egg file may contain multiple 00043 // models, which will be consecutive integers beginning 00044 // at get_first_model_index() and continuing for 00045 // get_num_models(). 00046 // 00047 // Each "model" corresponds to a single character model, 00048 // or one LOD of a multiple-LOD model, or a single 00049 // animation bundle. 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE int EggCharacterCollection:: 00052 get_first_model_index(int egg_index) const { 00053 nassertr(egg_index >= 0 && egg_index < (int)_eggs.size(), 0); 00054 return _eggs[egg_index]._first_model_index; 00055 } 00056 00057 //////////////////////////////////////////////////////////////////// 00058 // Function: EggCharacterCollection::get_num_models 00059 // Access: Public 00060 // Description: Returns the number of different models found in the 00061 // indicated egg file. An egg file may contain multiple 00062 // models, which will be consecutive integers beginning 00063 // at get_first_model_index() and continuing for 00064 // get_num_models(). 00065 // 00066 // Each "model" corresponds to a single character model, 00067 // or one LOD of a multiple-LOD model, or a single 00068 // animation bundle. 00069 //////////////////////////////////////////////////////////////////// 00070 INLINE int EggCharacterCollection:: 00071 get_num_models(int egg_index) const { 00072 nassertr(egg_index >= 0 && egg_index < (int)_eggs.size(), 0); 00073 return _eggs[egg_index]._models.size(); 00074 } 00075 00076 //////////////////////////////////////////////////////////////////// 00077 // Function: EggCharacterCollection::get_num_characters 00078 // Access: Public 00079 // Description: Returns the number of separate Characters that have 00080 // been discovered in the various egg files added to the 00081 // collection. 00082 //////////////////////////////////////////////////////////////////// 00083 INLINE int EggCharacterCollection:: 00084 get_num_characters() const { 00085 return _characters.size(); 00086 } 00087 00088 //////////////////////////////////////////////////////////////////// 00089 // Function: EggCharacterCollection::get_character 00090 // Access: Public 00091 // Description: Returns the ith character in the collection. 00092 //////////////////////////////////////////////////////////////////// 00093 INLINE EggCharacterData *EggCharacterCollection:: 00094 get_character(int i) const { 00095 nassertr(i >= 0 && i < (int)_characters.size(), (EggCharacterData *)NULL); 00096 return _characters[i]; 00097 } 00098 00099 //////////////////////////////////////////////////////////////////// 00100 // Function: EggCharacterCollection::get_character_by_model_index 00101 // Access: Public 00102 // Description: Returns the character associated with the indicated 00103 // model index. 00104 //////////////////////////////////////////////////////////////////// 00105 INLINE EggCharacterData *EggCharacterCollection:: 00106 get_character_by_model_index(int model_index) const { 00107 nassertr(model_index >= 0 && model_index < (int)_characters_by_model_index.size(), 00108 (EggCharacterData *)NULL); 00109 return _characters_by_model_index[model_index]; 00110 } 00111 00112 //////////////////////////////////////////////////////////////////// 00113 // Function: EggCharacterCollection::ModelDescription::Constructor 00114 // Access: Public 00115 // Description: 00116 //////////////////////////////////////////////////////////////////// 00117 INLINE EggCharacterCollection::ModelDescription:: 00118 ModelDescription() { 00119 _root_node = (EggObject *)NULL; 00120 }