Panda3D
cDistributedSmoothNodeBase.h
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.h
10  * @author drose
11  * @date 2004-09-03
12  */
13 
14 #ifndef CDISTRIBUTEDSMOOTHNODEBASE_H
15 #define CDISTRIBUTEDSMOOTHNODEBASE_H
16 
17 #include "directbase.h"
18 #include "nodePath.h"
19 #include "dcbase.h"
20 #include "dcPacker.h"
21 #include "dcPython.h" // to pick up Python.h
22 #include "clockObject.h"
23 
24 class DCClass;
26 
27 /**
28  * This class defines some basic methods of DistributedSmoothNodeBase which
29  * have been moved into C++ as a performance optimization.
30  */
31 class EXPCL_DIRECT_DISTRIBUTED CDistributedSmoothNodeBase {
32 PUBLISHED:
35 
36  INLINE void
37  set_repository(CConnectionRepository *repository,
38  bool is_ai, CHANNEL_TYPE ai_id);
39 
40 #ifdef HAVE_PYTHON
41  INLINE void
42  set_clock_delta(PyObject *clock_delta);
43 #endif
44 
45  void initialize(const NodePath &node_path, DCClass *dclass,
46  CHANNEL_TYPE do_id);
47 
48  void send_everything();
49 
50  void broadcast_pos_hpr_full();
51  void broadcast_pos_hpr_xyh();
52  void broadcast_pos_hpr_xy();
53 
54  void set_curr_l(uint64_t l);
55  void print_curr_l();
56 
57 private:
58  INLINE static bool only_changed(int flags, int compare);
59 
60  INLINE void d_setSmStop();
61  INLINE void d_setSmH(PN_stdfloat h);
62  INLINE void d_setSmZ(PN_stdfloat z);
63  INLINE void d_setSmXY(PN_stdfloat x, PN_stdfloat y);
64  INLINE void d_setSmXZ(PN_stdfloat x, PN_stdfloat z);
65  INLINE void d_setSmPos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
66  INLINE void d_setSmHpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
67  INLINE void d_setSmXYH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat h);
68  INLINE void d_setSmXYZH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h);
69  INLINE void d_setSmPosHpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
70  INLINE void d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, uint64_t l);
71 
72  void begin_send_update(DCPacker &packer, const std::string &field_name);
73  void finish_send_update(DCPacker &packer);
74 
75  enum Flags {
76  F_new_x = 0x01,
77  F_new_y = 0x02,
78  F_new_z = 0x04,
79  F_new_h = 0x08,
80  F_new_p = 0x10,
81  F_new_r = 0x20,
82  };
83 
84  NodePath _node_path;
85  DCClass *_dclass;
86  CHANNEL_TYPE _do_id;
87 
88  CConnectionRepository *_repository;
89  bool _is_ai;
90  CHANNEL_TYPE _ai_id;
91 #ifdef HAVE_PYTHON
92  PyObject *_clock_delta;
93 #endif
94 
95  LPoint3 _store_xyz;
96  LVecBase3 _store_hpr;
97  bool _store_stop;
98  // contains most recently sent location info as index 0, index 1 contains
99  // most recently set location info
100  uint64_t _currL[2];
101 };
102 
104 
105 #endif // CDISTRIBUTEDSMOOTHNODEBASE_H
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class implements the C++ side of the ConnectionRepository object.
This class defines some basic methods of DistributedSmoothNodeBase which have been moved into C++ as ...
Defines a particular DistributedClass as read from an input .dc file.
Definition: dcClass.h:44
This class can be used for packing a series of numeric and string data into a binary stream,...
Definition: dcPacker.h:34
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:159
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.