Panda3D
|
00001 // Filename: cDistributedSmoothNodeBase.I 00002 // Created by: drose (03Sep04) 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: CDistributedSmoothNodeBase::set_repository 00018 // Access: Published, Static 00019 // Description: Tells the C++ instance definition about the AI or Client 00020 // repository, used for sending datagrams. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE void CDistributedSmoothNodeBase:: 00023 set_repository(CConnectionRepository *repository, 00024 bool is_ai, CHANNEL_TYPE ai_id) { 00025 _repository = repository; 00026 _is_ai = is_ai; 00027 _ai_id = ai_id; 00028 } 00029 00030 #ifdef HAVE_PYTHON 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: CDistributedSmoothNodeBase::set_clock_delta 00033 // Access: Published, Static 00034 // Description: Tells the C++ instance definition about the global 00035 // ClockDelta object. 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE void CDistributedSmoothNodeBase:: 00038 set_clock_delta(PyObject *clock_delta) { 00039 _clock_delta = clock_delta; 00040 } 00041 #endif // HAVE_PYTHON 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: CDistributedSmoothNodeBase::only_changed 00045 // Access: Private, Static 00046 // Description: Returns true if at least some of the bits of compare 00047 // are set in flags, but no bits outside of compare are 00048 // set. That is to say, that the only things that are 00049 // changed are the bits indicated in compare. 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE bool CDistributedSmoothNodeBase:: 00052 only_changed(int flags, int compare) { 00053 return (flags & compare) != 0 && (flags & ~compare) == 0; 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: CDistributedSmoothNodeBase::d_setSmStop 00058 // Access: Private 00059 // Description: 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE void CDistributedSmoothNodeBase:: 00062 d_setSmStop() { 00063 //cout << "d_setSmStop" << endl; 00064 DCPacker packer; 00065 begin_send_update(packer, "setSmStop"); 00066 finish_send_update(packer); 00067 } 00068 00069 //////////////////////////////////////////////////////////////////// 00070 // Function: CDistributedSmoothNodeBase::d_setSmH 00071 // Access: Private 00072 // Description: 00073 //////////////////////////////////////////////////////////////////// 00074 INLINE void CDistributedSmoothNodeBase:: 00075 d_setSmH(PN_stdfloat h) { 00076 //cout << "d_setSmH: " << h << endl; 00077 DCPacker packer; 00078 begin_send_update(packer, "setSmH"); 00079 packer.pack_double(h); 00080 finish_send_update(packer); 00081 } 00082 00083 //////////////////////////////////////////////////////////////////// 00084 // Function: CDistributedSmoothNodeBase::d_setSmZ 00085 // Access: Private 00086 // Description: 00087 //////////////////////////////////////////////////////////////////// 00088 INLINE void CDistributedSmoothNodeBase:: 00089 d_setSmZ(PN_stdfloat z) { 00090 //cout << "d_setSmZ: " << z << endl; 00091 DCPacker packer; 00092 begin_send_update(packer, "setSmZ"); 00093 packer.pack_double(z); 00094 finish_send_update(packer); 00095 } 00096 00097 //////////////////////////////////////////////////////////////////// 00098 // Function: CDistributedSmoothNodeBase::d_setSmXY 00099 // Access: Private 00100 // Description: 00101 //////////////////////////////////////////////////////////////////// 00102 INLINE void CDistributedSmoothNodeBase:: 00103 d_setSmXY(PN_stdfloat x, PN_stdfloat y) { 00104 //cout << "d_setSmXY: " << x << ", " << y << endl; 00105 DCPacker packer; 00106 begin_send_update(packer, "setSmXY"); 00107 packer.pack_double(x); 00108 packer.pack_double(y); 00109 finish_send_update(packer); 00110 } 00111 00112 //////////////////////////////////////////////////////////////////// 00113 // Function: CDistributedSmoothNodeBase::d_setSmXZ 00114 // Access: Private 00115 // Description: 00116 //////////////////////////////////////////////////////////////////// 00117 INLINE void CDistributedSmoothNodeBase:: 00118 d_setSmXZ(PN_stdfloat x, PN_stdfloat z) { 00119 //cout << "d_setSmXZ: " << x << ", " << z << endl; 00120 DCPacker packer; 00121 begin_send_update(packer, "setSmXZ"); 00122 packer.pack_double(x); 00123 packer.pack_double(z); 00124 finish_send_update(packer); 00125 } 00126 00127 //////////////////////////////////////////////////////////////////// 00128 // Function: CDistributedSmoothNodeBase::d_setSmPos 00129 // Access: Private 00130 // Description: 00131 //////////////////////////////////////////////////////////////////// 00132 INLINE void CDistributedSmoothNodeBase:: 00133 d_setSmPos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { 00134 //cout << "d_setSmXYZ: " << x << ", " << y << ", " << z << endl; 00135 DCPacker packer; 00136 begin_send_update(packer, "setSmPos"); 00137 packer.pack_double(x); 00138 packer.pack_double(y); 00139 packer.pack_double(z); 00140 finish_send_update(packer); 00141 } 00142 00143 //////////////////////////////////////////////////////////////////// 00144 // Function: CDistributedSmoothNodeBase::d_setSmHpr 00145 // Access: Private 00146 // Description: 00147 //////////////////////////////////////////////////////////////////// 00148 INLINE void CDistributedSmoothNodeBase:: 00149 d_setSmHpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) { 00150 //cout << "d_setSmHPR: " << h << ", " << p << ", " << r << endl; 00151 DCPacker packer; 00152 begin_send_update(packer, "setSmHpr"); 00153 packer.pack_double(h); 00154 packer.pack_double(p); 00155 packer.pack_double(r); 00156 finish_send_update(packer); 00157 } 00158 00159 //////////////////////////////////////////////////////////////////// 00160 // Function: CDistributedSmoothNodeBase::d_setSmXYH 00161 // Access: Private 00162 // Description: 00163 //////////////////////////////////////////////////////////////////// 00164 INLINE void CDistributedSmoothNodeBase:: 00165 d_setSmXYH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat h) { 00166 //cout << "d_setSmXYH: " << x << ", " << y << ", " << h << endl; 00167 DCPacker packer; 00168 begin_send_update(packer, "setSmXYH"); 00169 packer.pack_double(x); 00170 packer.pack_double(y); 00171 packer.pack_double(h); 00172 finish_send_update(packer); 00173 } 00174 00175 //////////////////////////////////////////////////////////////////// 00176 // Function: CDistributedSmoothNodeBase::d_setSmXYZH 00177 // Access: Private 00178 // Description: 00179 //////////////////////////////////////////////////////////////////// 00180 INLINE void CDistributedSmoothNodeBase:: 00181 d_setSmXYZH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h) { 00182 //cout << "d_setSmXYZH: " << x << ", " << y << ", " << z << ", " << h << endl; 00183 DCPacker packer; 00184 begin_send_update(packer, "setSmXYZH"); 00185 packer.pack_double(x); 00186 packer.pack_double(y); 00187 packer.pack_double(z); 00188 packer.pack_double(h); 00189 finish_send_update(packer); 00190 } 00191 00192 //////////////////////////////////////////////////////////////////// 00193 // Function: CDistributedSmoothNodeBase::d_setSmPosHpr 00194 // Access: Private 00195 // Description: 00196 //////////////////////////////////////////////////////////////////// 00197 INLINE void CDistributedSmoothNodeBase:: 00198 d_setSmPosHpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) { 00199 //cout << "d_setSmPosHpr: " << x << ", " << y << ", " << z << ", " << h << ", " << p << ", " << r << endl; 00200 DCPacker packer; 00201 begin_send_update(packer, "setSmPosHpr"); 00202 packer.pack_double(x); 00203 packer.pack_double(y); 00204 packer.pack_double(z); 00205 packer.pack_double(h); 00206 packer.pack_double(p); 00207 packer.pack_double(r); 00208 finish_send_update(packer); 00209 } 00210 00211 //////////////////////////////////////////////////////////////////// 00212 // Function: CDistributedSmoothNodeBase::d_setSmPosHprL 00213 // send out pos, hpr, and location info (zoneId) 00214 // Access: Private 00215 // Description: 00216 //////////////////////////////////////////////////////////////////// 00217 INLINE void CDistributedSmoothNodeBase:: 00218 d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_uint64 l) { 00219 //cout << "d_setSmPosHprL: " << x << ", " << y << ", " << z << ", " << h << ", " << p << ", " << r << l << endl; 00220 DCPacker packer; 00221 begin_send_update(packer, "setSmPosHprL"); 00222 packer.pack_uint64(_currL[0]); 00223 packer.pack_double(x); 00224 packer.pack_double(y); 00225 packer.pack_double(z); 00226 packer.pack_double(h); 00227 packer.pack_double(p); 00228 packer.pack_double(r); 00229 finish_send_update(packer); 00230 } 00231