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