00001 // Filename: eggXfmSAnim.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 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: EggXfmSAnim::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE EggXfmSAnim:: 00022 EggXfmSAnim(const string &name, CoordinateSystem cs) : EggGroupNode(name) { 00023 _has_fps = false; 00024 _coordsys = cs; 00025 } 00026 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: EggXfmSAnim::Copy constructor 00030 // Access: Public 00031 // Description: 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE EggXfmSAnim:: 00034 EggXfmSAnim(const EggXfmSAnim ©) 00035 : EggGroupNode(copy), 00036 _fps(copy._fps), 00037 _has_fps(copy._has_fps), 00038 _order(copy._order), 00039 _coordsys(copy._coordsys) { 00040 } 00041 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: EggXfmSAnim::Copy assignment operator 00045 // Access: Public 00046 // Description: 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE EggXfmSAnim &EggXfmSAnim:: 00049 operator = (const EggXfmSAnim ©) { 00050 EggGroupNode::operator = (copy); 00051 _fps = copy._fps; 00052 _has_fps = copy._has_fps; 00053 _order = copy._order; 00054 _coordsys = copy._coordsys; 00055 00056 return *this; 00057 } 00058 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: EggXfmSAnim::set_fps 00062 // Access: Public 00063 // Description: 00064 //////////////////////////////////////////////////////////////////// 00065 INLINE void EggXfmSAnim:: 00066 set_fps(double fps) { 00067 _fps = fps; 00068 _has_fps = true; 00069 } 00070 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: EggXfmSAnim::clear_fps 00074 // Access: Public 00075 // Description: 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE void EggXfmSAnim:: 00078 clear_fps() { 00079 _has_fps = false; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: EggXfmSAnim::has_fps 00084 // Access: Public 00085 // Description: 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE bool EggXfmSAnim:: 00088 has_fps() const { 00089 return _has_fps; 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: EggXfmSAnim::get_fps 00094 // Access: Public 00095 // Description: This is only valid if has_fps() returns true. 00096 //////////////////////////////////////////////////////////////////// 00097 INLINE double EggXfmSAnim:: 00098 get_fps() const { 00099 nassertr(has_fps(), 0.0); 00100 return _fps; 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: EggXfmSAnim::set_order 00105 // Access: Public 00106 // Description: 00107 //////////////////////////////////////////////////////////////////// 00108 INLINE void EggXfmSAnim:: 00109 set_order(const string &order) { 00110 _order = order; 00111 } 00112 00113 //////////////////////////////////////////////////////////////////// 00114 // Function: EggXfmSAnim::clear_order 00115 // Access: Public 00116 // Description: 00117 //////////////////////////////////////////////////////////////////// 00118 INLINE void EggXfmSAnim:: 00119 clear_order() { 00120 _order = ""; 00121 } 00122 00123 //////////////////////////////////////////////////////////////////// 00124 // Function: EggXfmSAnim::has_order 00125 // Access: Public 00126 // Description: 00127 //////////////////////////////////////////////////////////////////// 00128 INLINE bool EggXfmSAnim:: 00129 has_order() const { 00130 return !_order.empty(); 00131 } 00132 00133 //////////////////////////////////////////////////////////////////// 00134 // Function: EggXfmSAnim::get_order 00135 // Access: Public 00136 // Description: 00137 //////////////////////////////////////////////////////////////////// 00138 INLINE const string &EggXfmSAnim:: 00139 get_order() const { 00140 if (has_order()) { 00141 return _order; 00142 } else { 00143 return get_standard_order(); 00144 } 00145 } 00146 00147 //////////////////////////////////////////////////////////////////// 00148 // Function: EggXfmSAnim::get_standard_order 00149 // Access: Public, Static 00150 // Description: Returns the standard order of matrix component 00151 // composition. This is what the order string must be 00152 // set to in order to use set_value() or add_data() 00153 // successfully. 00154 //////////////////////////////////////////////////////////////////// 00155 INLINE const string &EggXfmSAnim:: 00156 get_standard_order() { 00157 if (temp_hpr_fix) { 00158 return _standard_order_hpr_fix; 00159 } else { 00160 return _standard_order_legacy; 00161 } 00162 } 00163 00164 //////////////////////////////////////////////////////////////////// 00165 // Function: EggXfmSAnim::get_coordinate_system 00166 // Access: Public 00167 // Description: Returns the coordinate system this table believes it 00168 // is defined within. This should always match the 00169 // coordinate system of the EggData structure that owns 00170 // it. It is necessary to store it here because the 00171 // meaning of the h, p, and r columns depends on the 00172 // coordinate system. 00173 //////////////////////////////////////////////////////////////////// 00174 INLINE CoordinateSystem EggXfmSAnim:: 00175 get_coordinate_system() const { 00176 return _coordsys; 00177 } 00178 00179 //////////////////////////////////////////////////////////////////// 00180 // Function: EggXfmSAnim::clear_data 00181 // Access: Public 00182 // Description: Removes all data from the table. It does this by 00183 // removing all of its children. 00184 //////////////////////////////////////////////////////////////////// 00185 INLINE void EggXfmSAnim:: 00186 clear_data() { 00187 EggGroupNode::clear(); 00188 }