Panda3D
 All Classes Functions Variables Enumerations
cDistributedSmoothNodeBase.I
1 // Filename: cDistributedSmoothNodeBase.I
2 // Created by: drose (03Sep04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: CDistributedSmoothNodeBase::set_repository
18 // Access: Published, Static
19 // Description: Tells the C++ instance definition about the AI or Client
20 // repository, used for sending datagrams.
21 ////////////////////////////////////////////////////////////////////
24  bool is_ai, CHANNEL_TYPE ai_id) {
25  _repository = repository;
26  _is_ai = is_ai;
27  _ai_id = ai_id;
28 }
29 
30 #ifdef HAVE_PYTHON
31 ////////////////////////////////////////////////////////////////////
32 // Function: CDistributedSmoothNodeBase::set_clock_delta
33 // Access: Published, Static
34 // Description: Tells the C++ instance definition about the global
35 // ClockDelta object.
36 ////////////////////////////////////////////////////////////////////
37 INLINE void CDistributedSmoothNodeBase::
38 set_clock_delta(PyObject *clock_delta) {
39  _clock_delta = clock_delta;
40 }
41 #endif // HAVE_PYTHON
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: CDistributedSmoothNodeBase::only_changed
45 // Access: Private, Static
46 // Description: Returns true if at least some of the bits of compare
47 // are set in flags, but no bits outside of compare are
48 // set. That is to say, that the only things that are
49 // changed are the bits indicated in compare.
50 ////////////////////////////////////////////////////////////////////
51 INLINE bool CDistributedSmoothNodeBase::
52 only_changed(int flags, int compare) {
53  return (flags & compare) != 0 && (flags & ~compare) == 0;
54 }
55 
56 ////////////////////////////////////////////////////////////////////
57 // Function: CDistributedSmoothNodeBase::d_setSmStop
58 // Access: Private
59 // Description:
60 ////////////////////////////////////////////////////////////////////
61 INLINE void CDistributedSmoothNodeBase::
62 d_setSmStop() {
63  //cout << "d_setSmStop" << endl;
64  DCPacker packer;
65  begin_send_update(packer, "setSmStop");
66  finish_send_update(packer);
67 }
68 
69 ////////////////////////////////////////////////////////////////////
70 // Function: CDistributedSmoothNodeBase::d_setSmH
71 // Access: Private
72 // Description:
73 ////////////////////////////////////////////////////////////////////
74 INLINE void CDistributedSmoothNodeBase::
75 d_setSmH(PN_stdfloat h) {
76  //cout << "d_setSmH: " << h << endl;
77  DCPacker packer;
78  begin_send_update(packer, "setSmH");
79  packer.pack_double(h);
80  finish_send_update(packer);
81 }
82 
83 ////////////////////////////////////////////////////////////////////
84 // Function: CDistributedSmoothNodeBase::d_setSmZ
85 // Access: Private
86 // Description:
87 ////////////////////////////////////////////////////////////////////
88 INLINE void CDistributedSmoothNodeBase::
89 d_setSmZ(PN_stdfloat z) {
90  //cout << "d_setSmZ: " << z << endl;
91  DCPacker packer;
92  begin_send_update(packer, "setSmZ");
93  packer.pack_double(z);
94  finish_send_update(packer);
95 }
96 
97 ////////////////////////////////////////////////////////////////////
98 // Function: CDistributedSmoothNodeBase::d_setSmXY
99 // Access: Private
100 // Description:
101 ////////////////////////////////////////////////////////////////////
102 INLINE void CDistributedSmoothNodeBase::
103 d_setSmXY(PN_stdfloat x, PN_stdfloat y) {
104  //cout << "d_setSmXY: " << x << ", " << y << endl;
105  DCPacker packer;
106  begin_send_update(packer, "setSmXY");
107  packer.pack_double(x);
108  packer.pack_double(y);
109  finish_send_update(packer);
110 }
111 
112 ////////////////////////////////////////////////////////////////////
113 // Function: CDistributedSmoothNodeBase::d_setSmXZ
114 // Access: Private
115 // Description:
116 ////////////////////////////////////////////////////////////////////
117 INLINE void CDistributedSmoothNodeBase::
118 d_setSmXZ(PN_stdfloat x, PN_stdfloat z) {
119  //cout << "d_setSmXZ: " << x << ", " << z << endl;
120  DCPacker packer;
121  begin_send_update(packer, "setSmXZ");
122  packer.pack_double(x);
123  packer.pack_double(z);
124  finish_send_update(packer);
125 }
126 
127 ////////////////////////////////////////////////////////////////////
128 // Function: CDistributedSmoothNodeBase::d_setSmPos
129 // Access: Private
130 // Description:
131 ////////////////////////////////////////////////////////////////////
132 INLINE void CDistributedSmoothNodeBase::
133 d_setSmPos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
134  //cout << "d_setSmXYZ: " << x << ", " << y << ", " << z << endl;
135  DCPacker packer;
136  begin_send_update(packer, "setSmPos");
137  packer.pack_double(x);
138  packer.pack_double(y);
139  packer.pack_double(z);
140  finish_send_update(packer);
141 }
142 
143 ////////////////////////////////////////////////////////////////////
144 // Function: CDistributedSmoothNodeBase::d_setSmHpr
145 // Access: Private
146 // Description:
147 ////////////////////////////////////////////////////////////////////
148 INLINE void CDistributedSmoothNodeBase::
149 d_setSmHpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
150  //cout << "d_setSmHPR: " << h << ", " << p << ", " << r << endl;
151  DCPacker packer;
152  begin_send_update(packer, "setSmHpr");
153  packer.pack_double(h);
154  packer.pack_double(p);
155  packer.pack_double(r);
156  finish_send_update(packer);
157 }
158 
159 ////////////////////////////////////////////////////////////////////
160 // Function: CDistributedSmoothNodeBase::d_setSmXYH
161 // Access: Private
162 // Description:
163 ////////////////////////////////////////////////////////////////////
164 INLINE void CDistributedSmoothNodeBase::
165 d_setSmXYH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat h) {
166  //cout << "d_setSmXYH: " << x << ", " << y << ", " << h << endl;
167  DCPacker packer;
168  begin_send_update(packer, "setSmXYH");
169  packer.pack_double(x);
170  packer.pack_double(y);
171  packer.pack_double(h);
172  finish_send_update(packer);
173 }
174 
175 ////////////////////////////////////////////////////////////////////
176 // Function: CDistributedSmoothNodeBase::d_setSmXYZH
177 // Access: Private
178 // Description:
179 ////////////////////////////////////////////////////////////////////
180 INLINE void CDistributedSmoothNodeBase::
181 d_setSmXYZH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h) {
182  //cout << "d_setSmXYZH: " << x << ", " << y << ", " << z << ", " << h << endl;
183  DCPacker packer;
184  begin_send_update(packer, "setSmXYZH");
185  packer.pack_double(x);
186  packer.pack_double(y);
187  packer.pack_double(z);
188  packer.pack_double(h);
189  finish_send_update(packer);
190 }
191 
192 ////////////////////////////////////////////////////////////////////
193 // Function: CDistributedSmoothNodeBase::d_setSmPosHpr
194 // Access: Private
195 // Description:
196 ////////////////////////////////////////////////////////////////////
197 INLINE void CDistributedSmoothNodeBase::
198 d_setSmPosHpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
199  //cout << "d_setSmPosHpr: " << x << ", " << y << ", " << z << ", " << h << ", " << p << ", " << r << endl;
200  DCPacker packer;
201  begin_send_update(packer, "setSmPosHpr");
202  packer.pack_double(x);
203  packer.pack_double(y);
204  packer.pack_double(z);
205  packer.pack_double(h);
206  packer.pack_double(p);
207  packer.pack_double(r);
208  finish_send_update(packer);
209 }
210 
211 ////////////////////////////////////////////////////////////////////
212 // Function: CDistributedSmoothNodeBase::d_setSmPosHprL
213 // send out pos, hpr, and location info (zoneId)
214 // Access: Private
215 // Description:
216 ////////////////////////////////////////////////////////////////////
217 INLINE void CDistributedSmoothNodeBase::
218 d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_uint64 l) {
219  //cout << "d_setSmPosHprL: " << x << ", " << y << ", " << z << ", " << h << ", " << p << ", " << r << l << endl;
220  DCPacker packer;
221  begin_send_update(packer, "setSmPosHprL");
222  packer.pack_uint64(_currL[0]);
223  packer.pack_double(x);
224  packer.pack_double(y);
225  packer.pack_double(z);
226  packer.pack_double(h);
227  packer.pack_double(p);
228  packer.pack_double(r);
229  finish_send_update(packer);
230 }
231 
This class can be used for packing a series of numeric and string data into a binary stream...
Definition: dcPacker.h:38
void pack_double(double value)
Packs the indicated numeric or string value into the stream.
Definition: dcPacker.I:176
void set_repository(CConnectionRepository *repository, bool is_ai, CHANNEL_TYPE ai_id)
Tells the C++ instance definition about the AI or Client repository, used for sending datagrams...
This class implements the C++ side of the ConnectionRepository object.
void pack_uint64(PN_uint64 value)
Packs the indicated numeric or string value into the stream.
Definition: dcPacker.I:244