Changeset 6815 in orxonox.OLD for trunk/src/lib/coord
- Timestamp:
- Jan 28, 2006, 5:11:51 PM (19 years ago)
- Location:
- trunk/src/lib/coord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r6780 r6815 1077 1077 SYNCHELP_READ_BEGIN(); 1078 1078 1079 SYNCHELP_READ_FKT( BaseObject::writeState );1079 SYNCHELP_READ_FKT( BaseObject::writeState, NWT_PN_BO_WRITESTATE ); 1080 1080 1081 1081 // char * parentName = NULL; … … 1094 1094 1095 1095 int parentMode; 1096 SYNCHELP_READ_INT( parentMode );1096 SYNCHELP_READ_INT( parentMode, NWT_PN_PARENTMODE ); 1097 1097 this->setParentMode((PARENT_MODE)parentMode); 1098 1098 1099 1099 float f1, f2, f3, f4; 1100 1100 1101 SYNCHELP_READ_FLOAT( f1 );1102 SYNCHELP_READ_FLOAT( f2 );1103 SYNCHELP_READ_FLOAT( f3 );1101 SYNCHELP_READ_FLOAT( f1, NWT_PN_COORX ); 1102 SYNCHELP_READ_FLOAT( f2, NWT_PN_COORY ); 1103 SYNCHELP_READ_FLOAT( f3, NWT_PN_COORZ ); 1104 1104 this->setRelCoor( f1, f2, f3 ); 1105 1105 1106 1106 1107 SYNCHELP_READ_FLOAT( f1 );1108 SYNCHELP_READ_FLOAT( f2 );1109 SYNCHELP_READ_FLOAT( f3 );1110 SYNCHELP_READ_FLOAT( f4 );1107 SYNCHELP_READ_FLOAT( f1, NWT_PN_ROTV ); 1108 SYNCHELP_READ_FLOAT( f2, NWT_PN_ROTX ); 1109 SYNCHELP_READ_FLOAT( f3, NWT_PN_ROTY ); 1110 SYNCHELP_READ_FLOAT( f4, NWT_PN_ROTZ ); 1111 1111 this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) ); 1112 1112 … … 1140 1140 SYNCHELP_WRITE_BEGIN(); 1141 1141 1142 SYNCHELP_WRITE_FKT( BaseObject::readState );1142 SYNCHELP_WRITE_FKT( BaseObject::readState, NWT_PN_BO_WRITESTATE ); 1143 1143 1144 1144 // if ( this->parent ) … … 1151 1151 // } 1152 1152 1153 SYNCHELP_WRITE_INT( this->parentMode );1154 1155 SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );1156 SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );1157 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );1158 1159 SYNCHELP_WRITE_FLOAT( this->relDirection.w );1160 SYNCHELP_WRITE_FLOAT( this->relDirection.v.x );1161 SYNCHELP_WRITE_FLOAT( this->relDirection.v.y );1162 SYNCHELP_WRITE_FLOAT( this->relDirection.v.z );1153 SYNCHELP_WRITE_INT( this->parentMode, NWT_PN_PARENTMODE ); 1154 1155 SYNCHELP_WRITE_FLOAT( this->relCoordinate.x, NWT_PN_COORX ); 1156 SYNCHELP_WRITE_FLOAT( this->relCoordinate.y, NWT_PN_COORY ); 1157 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z, NWT_PN_COORZ ); 1158 1159 SYNCHELP_WRITE_FLOAT( this->relDirection.w, NWT_PN_ROTV ); 1160 SYNCHELP_WRITE_FLOAT( this->relDirection.v.x, NWT_PN_ROTX ); 1161 SYNCHELP_WRITE_FLOAT( this->relDirection.v.y, NWT_PN_ROTY ); 1162 SYNCHELP_WRITE_FLOAT( this->relDirection.v.z, NWT_PN_ROTZ ); 1163 1163 1164 1164 // int n = children.size(); … … 1209 1209 1210 1210 byte flags = 0; 1211 SYNCHELP_READ_BYTE( flags );1211 SYNCHELP_READ_BYTE( flags, NWT_PN_FLAGS ); 1212 1212 //PRINTF(0)("%s::FLAGS = %d\n", this->getName(), flags); 1213 1213 … … 1216 1216 if ( flags & __FLAG_COOR ) 1217 1217 { 1218 SYNCHELP_READ_FLOAT( f1 );1219 SYNCHELP_READ_FLOAT( f2 );1220 SYNCHELP_READ_FLOAT( f3 );1218 SYNCHELP_READ_FLOAT( f1, NWT_PN_SCOORX ); 1219 SYNCHELP_READ_FLOAT( f2, NWT_PN_SCOORY ); 1220 SYNCHELP_READ_FLOAT( f3, NWT_PN_SCOORZ ); 1221 1221 PRINTF(0)("RCVD COOR: %f %f %f\n", f1, f2, f3); 1222 1222 this->setRelCoor( f1, f2, f3 ); … … 1225 1225 if ( flags & __FLAG_ROT ) 1226 1226 { 1227 SYNCHELP_READ_FLOAT( f1 );1228 SYNCHELP_READ_FLOAT( f2 );1229 SYNCHELP_READ_FLOAT( f3 );1230 SYNCHELP_READ_FLOAT( f4 );1227 SYNCHELP_READ_FLOAT( f1, NWT_PN_SROTV ); 1228 SYNCHELP_READ_FLOAT( f2, NWT_PN_SROTX ); 1229 SYNCHELP_READ_FLOAT( f3, NWT_PN_SROTY ); 1230 SYNCHELP_READ_FLOAT( f4, NWT_PN_SROTZ ); 1231 1231 PRINTF(0)("RCVD QUAT: %f %f %f %f\n", f1, f2, f3, f4); 1232 1232 //this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) ); … … 1250 1250 int PNode::readSync( byte * data, int maxLength ) 1251 1251 { 1252 //WARNING: if you change this file make sure you also change needsReadSync 1252 1253 SYNCHELP_WRITE_BEGIN(); 1253 1254 … … 1270 1271 1271 1272 1272 SYNCHELP_WRITE_BYTE( flags );1273 SYNCHELP_WRITE_BYTE( flags, NWT_PN_FLAGS ); 1273 1274 //PRINTF(0)("FLAGS = %d\n", flags); 1274 1275 … … 1276 1277 { 1277 1278 1278 PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z);1279 1280 SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );1281 SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );1282 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );1279 //PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z); 1280 1281 SYNCHELP_WRITE_FLOAT( this->relCoordinate.x, NWT_PN_SCOORX ); 1282 SYNCHELP_WRITE_FLOAT( this->relCoordinate.y, NWT_PN_SCOORY ); 1283 SYNCHELP_WRITE_FLOAT( this->relCoordinate.z, NWT_PN_SCOORZ ); 1283 1284 1284 1285 coorx = relCoordinate.x; … … 1290 1291 { 1291 1292 1292 PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z);1293 1294 SYNCHELP_WRITE_FLOAT( this->absDirection.w );1295 SYNCHELP_WRITE_FLOAT( this->absDirection.v.x );1296 SYNCHELP_WRITE_FLOAT( this->absDirection.v.y );1297 SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );1293 //PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z); 1294 1295 SYNCHELP_WRITE_FLOAT( this->absDirection.w, NWT_PN_SROTV ); 1296 SYNCHELP_WRITE_FLOAT( this->absDirection.v.x, NWT_PN_SROTX ); 1297 SYNCHELP_WRITE_FLOAT( this->absDirection.v.y, NWT_PN_SROTY ); 1298 SYNCHELP_WRITE_FLOAT( this->absDirection.v.z, NWT_PN_SROTZ ); 1298 1299 1299 1300 rotw = absDirection.w; … … 1305 1306 return SYNCHELP_WRITE_N; 1306 1307 } 1308 1309 bool PNode::needsReadSync( ) 1310 { 1311 if ( fabs( coorx - relCoordinate.x ) > __OFFSET_POS || 1312 fabs( coory - relCoordinate.y ) > __OFFSET_POS || 1313 fabs( coorz - relCoordinate.z ) > __OFFSET_POS ) 1314 return true; 1315 1316 if ( fabs( rotw - absDirection.w ) > __OFFSET_ROT || 1317 fabs( rotx - absDirection.v.x ) > __OFFSET_ROT || 1318 fabs( roty - absDirection.v.y ) > __OFFSET_ROT || 1319 fabs( rotz - absDirection.v.z ) > __OFFSET_ROT ) 1320 return true; 1321 1322 return false; 1323 } -
trunk/src/lib/coord/p_node.h
r6695 r6815 190 190 int writeSync(const byte* data, int length, int sender); 191 191 int readSync(byte* data, int maxLength ); 192 bool needsReadSync(); 192 193 193 194 private:
Note: See TracChangeset
for help on using the changeset viewer.