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