Changeset 7459 in orxonox.OLD for branches/network/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc
- Timestamp:
- Apr 30, 2006, 1:50:25 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc
r7444 r7459 16 16 17 17 #include "synchronizeable_quaternion.h" 18 #include "converter.h" 18 19 19 20 20 21 /** 21 22 * standard constructor 22 * @todo this constructor is not jet implemented - do it 23 */ 24 SynchronizeableQuaternion::SynchronizeableQuaternion( Quaternion * ptrIn, Quaternion * ptrOut, std::string name, int permission, int priority) : SynchronizeableVar( ptrIn, ptrOut, name, 0, permission, priority ) 23 */ 24 SynchronizeableQuaternion::SynchronizeableQuaternion( Quaternion * ptrIn, Quaternion * ptrOut, std::string name, int permission, int priority) : SynchronizeableVar( ptrIn, ptrOut, name, 4*INTSIZE, permission, priority ) 25 25 { 26 26 this->vPtrIn = ptrIn; … … 31 31 /** 32 32 * standard deconstructor 33 */33 */ 34 34 SynchronizeableQuaternion::~SynchronizeableQuaternion () 35 35 { … … 44 44 int SynchronizeableQuaternion::writeToBuf( byte * buf, int maxLength ) 45 45 { 46 #warning implement this 46 int n = 0; 47 int res; 48 49 res = Converter::floatToByteArray( vPtrIn->v.x, buf, maxLength - n ); 50 assert( res > 0 ); 51 n += res; 52 53 res = Converter::floatToByteArray( vPtrIn->v.y, buf, maxLength - n ); 54 assert( res > 0 ); 55 n += res; 56 57 res = Converter::floatToByteArray( vPtrIn->v.z, buf, maxLength - n ); 58 assert( res > 0 ); 59 n += res; 60 61 res = Converter::floatToByteArray( vPtrIn->w, buf, maxLength - n ); 62 assert( res > 0 ); 63 n += res; 64 65 assert( 4*FLOATSIZE == n ); 66 67 return n; 47 68 } 48 69 … … 55 76 int SynchronizeableQuaternion::readFromBuf( byte * buf, int maxLength ) 56 77 { 57 #warning implement this 78 assert( maxLength >= 4*FLOATSIZE ); 79 80 float x,y,z,w; 81 82 int res; 83 int n = 0; 84 85 res += Converter::byteArrayToFloat( buf + n, &x ); 86 assert( res > 0 ); 87 n += res; 88 89 res += Converter::byteArrayToFloat( buf + n, &x ); 90 assert( res > 0 ); 91 n += res; 92 93 res += Converter::byteArrayToFloat( buf + n, &x ); 94 assert( res > 0 ); 95 n += res; 96 97 res += Converter::byteArrayToFloat( buf + n, &w ); 98 assert( res > 0 ); 99 n += res; 100 101 *vPtrOut = Quaternion( Vector(x, y, z), w ); 102 103 assert( res == 4*FLOATSIZE ); 104 return res; 58 105 }
Note: See TracChangeset
for help on using the changeset viewer.