MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / packUpdate

Method packUpdate

Engine/source/T3D/convexShape.cpp:519–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517}
518
519U32 ConvexShape::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
520{
521 U32 retMask = Parent::packUpdate( conn, mask, stream );
522
523 if ( stream->writeFlag( mask & TransformMask ) )
524 {
525 mathWrite(*stream, getTransform());
526 mathWrite(*stream, getScale());
527 }
528
529 if ( stream->writeFlag( mask & UpdateMask ) )
530 {
531 PACK_ASSET(conn, Material);
532
533 U32 surfCount = mSurfaces.size();
534 stream->writeInt( surfCount, 32 );
535
536 for ( S32 i = 0; i < surfCount; i++ )
537 {
538 QuatF quat( mSurfaces[i] );
539 Point3F pos( mSurfaces[i].getPosition() );
540
541 mathWrite( *stream, quat );
542 mathWrite( *stream, pos );
543
544 mathWrite(*stream, mSurfaceUVs[i].offset);
545 mathWrite(*stream, mSurfaceUVs[i].scale);
546
547 stream->writeFlag(mSurfaceUVs[i].horzFlip);
548 stream->writeFlag(mSurfaceUVs[i].vertFlip);
549
550 stream->writeInt(mSurfaceUVs[i].matID, 16);
551 }
552
553 const U32 surfaceTex = mSurfaceTextures.size();
554
555 stream->writeInt( surfaceTex, 32 );
556 //next check for any texture coord or scale mods
557 for(U32 i=0; i < surfaceTex; i++)
558 {
559 if (stream->writeFlag(mSurfaceTextures[i].mMaterialAsset.notNull()))
560 {
561 NetStringHandle assetIdStr = mSurfaceTextures[i].mMaterialAsset.getAssetId();
562 conn->packNetStringHandleU(stream, assetIdStr);
563 }
564 else
565 stream->writeString(mSurfaceTextures[i].mMaterialName);
566 }
567 }
568
569 return retMask;
570}
571
572void ConvexShape::unpackUpdate( NetConnection *conn, BitStream *stream )
573{

Callers

nothing calls this directly

Calls 9

mathWriteFunction · 0.85
writeIntMethod · 0.80
notNullMethod · 0.80
packNetStringHandleUMethod · 0.80
writeFlagMethod · 0.45
sizeMethod · 0.45
getPositionMethod · 0.45
getAssetIdMethod · 0.45
writeStringMethod · 0.45

Tested by

no test coverage detected