00001 // Filename: eggComponentData.I 00002 // Created by: drose (26Feb01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: EggComponentData::get_num_models 00022 // Access: Public 00023 // Description: Returns the maximum number of back pointers this 00024 // component may have. The component may store a back 00025 // pointer for models indexed 0 .. num_models - 00026 // 1. You must call has_model() on each model 00027 // index to confirm whether a particular model in that 00028 // range has a back pointer. 00029 //////////////////////////////////////////////////////////////////// 00030 INLINE int EggComponentData:: 00031 get_num_models() const { 00032 return _back_pointers.size(); 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function: EggComponentData::has_model 00037 // Access: Public 00038 // Description: Returns true if the component has a back pointer to 00039 // an egg file somewhere for the indicated model, false 00040 // otherwise. 00041 //////////////////////////////////////////////////////////////////// 00042 INLINE bool EggComponentData:: 00043 has_model(int model_index) const { 00044 if (model_index >= 0 && model_index < (int)_back_pointers.size()) { 00045 return _back_pointers[model_index] != (EggBackPointer *)NULL; 00046 } 00047 return false; 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: EggComponentData::get_model 00052 // Access: Public 00053 // Description: Returns the back pointer to an egg file for the 00054 // indicated model if it exists, or NULL if it does not. 00055 //////////////////////////////////////////////////////////////////// 00056 INLINE EggBackPointer *EggComponentData:: 00057 get_model(int model_index) const { 00058 if (model_index >= 0 && model_index < (int)_back_pointers.size()) { 00059 return _back_pointers[model_index]; 00060 } 00061 return (EggBackPointer *)NULL; 00062 }