Panda3D
|
00001 // Filename: eggAnimData.I 00002 // Created by: drose (19Feb99) 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 #include "pnotify.h" 00016 00017 //////////////////////////////////////////////////////////////////// 00018 // Function: EggAnimData::Constructor 00019 // Access: Public 00020 // Description: 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE EggAnimData:: 00023 EggAnimData(const string &name) : EggNode(name) { 00024 _has_fps = false; 00025 } 00026 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: EggAnimData::Copy constructor 00030 // Access: Public 00031 // Description: 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE EggAnimData:: 00034 EggAnimData(const EggAnimData ©) : 00035 EggNode(copy), _data(copy._data), 00036 _fps(copy._fps), _has_fps(copy._has_fps) { 00037 } 00038 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: EggAnimData::Copy assignment operator 00042 // Access: Public 00043 // Description: 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE EggAnimData &EggAnimData:: 00046 operator = (const EggAnimData ©) { 00047 EggNode::operator = (copy); 00048 _data = copy._data; 00049 _fps = copy._fps; 00050 _has_fps = copy._has_fps; 00051 00052 return *this; 00053 } 00054 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: EggAnimData::set_fps 00058 // Access: Public 00059 // Description: 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE void EggAnimData:: 00062 set_fps(double fps) { 00063 _fps = fps; 00064 _has_fps = true; 00065 } 00066 00067 00068 //////////////////////////////////////////////////////////////////// 00069 // Function: EggAnimData::clear_fps 00070 // Access: Public 00071 // Description: 00072 //////////////////////////////////////////////////////////////////// 00073 INLINE void EggAnimData:: 00074 clear_fps() { 00075 _has_fps = false; 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function: EggAnimData::has_fps 00080 // Access: Public 00081 // Description: 00082 //////////////////////////////////////////////////////////////////// 00083 INLINE bool EggAnimData:: 00084 has_fps() const { 00085 return _has_fps; 00086 } 00087 00088 //////////////////////////////////////////////////////////////////// 00089 // Function: EggAnimData::get_fps 00090 // Access: Public 00091 // Description: This is only valid if has_fps() returns true. 00092 //////////////////////////////////////////////////////////////////// 00093 INLINE double EggAnimData:: 00094 get_fps() const { 00095 nassertr(has_fps(), 0.0); 00096 return _fps; 00097 } 00098 00099 00100 //////////////////////////////////////////////////////////////////// 00101 // Function: EggAnimData::clear_data 00102 // Access: Public 00103 // Description: Removes all data and empties the table. 00104 //////////////////////////////////////////////////////////////////// 00105 INLINE void EggAnimData:: 00106 clear_data() { 00107 _data.clear(); 00108 } 00109 00110 //////////////////////////////////////////////////////////////////// 00111 // Function: EggAnimData::add_data 00112 // Access: Public 00113 // Description: Adds a single element to the table. 00114 //////////////////////////////////////////////////////////////////// 00115 INLINE void EggAnimData:: 00116 add_data(double value) { 00117 _data.push_back(value); 00118 } 00119 00120 00121 00122 //////////////////////////////////////////////////////////////////// 00123 // Function: EggAnimData::get_size 00124 // Access: Public 00125 // Description: Returns the number of elements in the table. 00126 //////////////////////////////////////////////////////////////////// 00127 INLINE int EggAnimData:: 00128 get_size() const { 00129 return _data.size(); 00130 } 00131 00132 00133 //////////////////////////////////////////////////////////////////// 00134 // Function: EggAnimData::get_data 00135 // Access: Public 00136 // Description: Returns the entire table of data. 00137 //////////////////////////////////////////////////////////////////// 00138 INLINE PTA_double EggAnimData:: 00139 get_data() const { 00140 return _data; 00141 } 00142 00143 00144 //////////////////////////////////////////////////////////////////// 00145 // Function: EggAnimData::set_data 00146 // Access: Public 00147 // Description: Replaces the entire table of data. 00148 //////////////////////////////////////////////////////////////////// 00149 INLINE void EggAnimData:: 00150 set_data(const PTA_double &data) { 00151 _data = data; 00152 } 00153