cDistributedSmoothNodeBase.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Filename: cDistributedSmoothNodeBase.h
  2. // Created by: drose (03Sep04)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef CDISTRIBUTEDSMOOTHNODEBASE_H
  19. #define CDISTRIBUTEDSMOOTHNODEBASE_H
  20. #include "directbase.h"
  21. #include "nodePath.h"
  22. #include "dcbase.h"
  23. #include "dcPacker.h"
  24. #include "dcPython.h" // to pick up Python.h
  25. class DCClass;
  26. class CConnectionRepository;
  27. ////////////////////////////////////////////////////////////////////
  28. // Class : CDistributedSmoothNodeBase
  29. // Description : This class defines some basic methods of
  30. // DistributedSmoothNodeBase which have been moved into
  31. // C++ as a performance optimization.
  32. ////////////////////////////////////////////////////////////////////
  33. class EXPCL_DIRECT CDistributedSmoothNodeBase {
  34. PUBLISHED:
  35. CDistributedSmoothNodeBase();
  36. ~CDistributedSmoothNodeBase();
  37. INLINE static void
  38. set_repository(CConnectionRepository *repository,
  39. bool is_ai, CHANNEL_TYPE ai_id);
  40. INLINE static void
  41. set_clock_delta(PyObject *clock_delta);
  42. void initialize(const NodePath &node_path, DCClass *dclass,
  43. CHANNEL_TYPE do_id);
  44. void send_everything();
  45. void broadcast_pos_hpr_full();
  46. void broadcast_pos_hpr_xyh();
  47. private:
  48. INLINE static bool only_changed(int flags, int compare);
  49. INLINE void d_setSmStop();
  50. INLINE void d_setSmH(float h);
  51. INLINE void d_setSmXY(float x, float y);
  52. INLINE void d_setSmXZ(float x, float z);
  53. INLINE void d_setSmPos(float x, float y, float z);
  54. INLINE void d_setSmHpr(float h, float p, float r);
  55. INLINE void d_setSmXYH(float x, float y, float h);
  56. INLINE void d_setSmXYZH(float x, float y, float z, float h);
  57. INLINE void d_setSmPosHpr(float x, float y, float z, float h, float p, float r);
  58. void begin_send_update(DCPacker &packer, const string &field_name);
  59. void finish_send_update(DCPacker &packer);
  60. enum Flags {
  61. F_new_x = 0x01,
  62. F_new_y = 0x02,
  63. F_new_z = 0x04,
  64. F_new_h = 0x08,
  65. F_new_p = 0x10,
  66. F_new_r = 0x20,
  67. };
  68. NodePath _node_path;
  69. DCClass *_dclass;
  70. CHANNEL_TYPE _do_id;
  71. static CConnectionRepository *_repository;
  72. static bool _is_ai;
  73. static CHANNEL_TYPE _ai_id;
  74. static PyObject *_clock_delta;
  75. LPoint3f _store_xyz;
  76. LVecBase3f _store_hpr;
  77. bool _store_stop;
  78. };
  79. #include "cDistributedSmoothNodeBase.I"
  80. #endif // CDISTRIBUTEDSMOOTHNODEBASE_H