Panda3D
|
00001 // Filename: eggComponentData.h 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 #ifndef EGGCOMPONENTDATA_H 00016 #define EGGCOMPONENTDATA_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "eggObject.h" 00021 #include "namable.h" 00022 #include "pset.h" 00023 00024 class EggCharacterCollection; 00025 class EggCharacterData; 00026 class EggBackPointer; 00027 class NameUniquifier; 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Class : EggComponentData 00031 // Description : This is the base class of both EggJointData and 00032 // EggSliderData. It represents a single component of a 00033 // character, either a joint or a slider, along with 00034 // back pointers to the references to this component in 00035 // all model and animation egg files read. 00036 //////////////////////////////////////////////////////////////////// 00037 class EggComponentData : public EggObject, public Namable { 00038 public: 00039 EggComponentData(EggCharacterCollection *collection, 00040 EggCharacterData *char_data); 00041 virtual ~EggComponentData(); 00042 00043 void add_name(const string &name, NameUniquifier &uniquifier); 00044 bool matches_name(const string &name) const; 00045 00046 int get_num_frames(int model_index) const; 00047 void extend_to(int model_index, int num_frames) const; 00048 double get_frame_rate(int model_index) const; 00049 00050 virtual void add_back_pointer(int model_index, EggObject *egg_object)=0; 00051 virtual void write(ostream &out, int indent_level = 0) const=0; 00052 00053 INLINE int get_num_models() const; 00054 INLINE bool has_model(int model_index) const; 00055 INLINE EggBackPointer *get_model(int model_index) const; 00056 void set_model(int model_index, EggBackPointer *back); 00057 00058 protected: 00059 00060 // This points back to all the egg structures that reference this 00061 // particular table or slider. 00062 typedef pvector<EggBackPointer *> BackPointers; 00063 BackPointers _back_pointers; 00064 00065 typedef pset<string> Names; 00066 Names _names; 00067 00068 EggCharacterCollection *_collection; 00069 EggCharacterData *_char_data; 00070 00071 00072 public: 00073 static TypeHandle get_class_type() { 00074 return _type_handle; 00075 } 00076 static void init_type() { 00077 EggObject::init_type(); 00078 register_type(_type_handle, "EggComponentData", 00079 EggObject::get_class_type()); 00080 } 00081 virtual TypeHandle get_type() const { 00082 return get_class_type(); 00083 } 00084 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00085 00086 private: 00087 static TypeHandle _type_handle; 00088 }; 00089 00090 #include "eggComponentData.I" 00091 00092 #endif 00093 00094