Ver Fonte

add setSmZ()

David Rose há 21 anos atrás
pai
commit
9e60c303b7

+ 3 - 0
direct/src/distributed/DistributedSmoothNode.py

@@ -177,6 +177,9 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
     def setSmH(self, h, timestamp):
         self.setComponentH(h)
         self.setComponentTLive(timestamp)
+    def setSmZ(self, z, timestamp):
+        self.setComponentZ(z)
+        self.setComponentTLive(timestamp)
     def setSmXY(self, x, y, timestamp):
         self.setComponentX(x)
         self.setComponentY(y)

+ 3 - 0
direct/src/distributed/DistributedSmoothNodeAI.py

@@ -24,6 +24,9 @@ class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
     # These have their FFI functions exposed for efficiency
     def setSmH(self, h, t):
         self._NodePath__overloaded_setH_ptrNodePath_float(h)
+
+    def setSmZ(self, z, t):
+        self._NodePath__overloaded_setZ_ptrNodePath_float(z)
         
     def setSmXY(self, x, y, t):
         self._NodePath__overloaded_setX_ptrNodePath_float(x)

+ 13 - 0
direct/src/distributed/cDistributedSmoothNodeBase.I

@@ -80,6 +80,19 @@ d_setSmH(float h) {
   finish_send_update(packer);
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: CDistributedSmoothNodeBase::d_setSmZ
+//       Access: Private
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE void CDistributedSmoothNodeBase::
+d_setSmZ(float z) {
+  DCPacker packer;
+  begin_send_update(packer, "setSmZ");
+  packer.pack_double(z);
+  finish_send_update(packer);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: CDistributedSmoothNodeBase::d_setSmXY
 //       Access: Private

+ 5 - 0
direct/src/distributed/cDistributedSmoothNodeBase.cxx

@@ -137,6 +137,11 @@ broadcast_pos_hpr_full() {
     _store_stop = false;
     d_setSmH(_store_hpr[0]);
 
+  } else if (only_changed(flags, F_new_z)) {
+    // Only change in Z.
+    _store_stop = false;
+    d_setSmZ(_store_xyz[2]);
+
   } else if (only_changed(flags, F_new_x | F_new_y)) {
     // Only change in X, Y
     _store_stop = false;

+ 1 - 0
direct/src/distributed/cDistributedSmoothNodeBase.h

@@ -59,6 +59,7 @@ private:
 
   INLINE void d_setSmStop();
   INLINE void d_setSmH(float h);
+  INLINE void d_setSmZ(float z);
   INLINE void d_setSmXY(float x, float y);
   INLINE void d_setSmXZ(float x, float z);
   INLINE void d_setSmPos(float x, float y, float z);