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

Method writePacketData

Engine/source/afx/afxCamera.cpp:872–926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870}
871
872void afxCamera::writePacketData(GameConnection *connection, BitStream *bstream)
873{
874 // Update client regardless of status flags.
875 Parent::writePacketData(connection, bstream);
876
877 Point3F pos; mObjToWorld.getColumn(3, &pos);
878 bstream->setCompressionPoint(pos); // SET COMPRESSION POINT
879 mathWrite(*bstream, pos); // SND POS
880 bstream->write(mRot.x); // SND X ROT
881 bstream->write(mRot.z); // SND Z ROT
882
883 if (bstream->writeFlag(mCam_dirty))
884 {
885 mathWrite(*bstream, mCam_offset); // SND CAM_OFFSET
886 mathWrite(*bstream, mCoi_offset); // SND COI_OFFSET
887 bstream->write(mCam_distance);
888 bstream->write(mCam_angle);
889 mCam_dirty = false;
890 }
891
892 U32 writeMode = mMode;
893 Point3F writePos = mPosition;
894 S32 gIndex = -1;
895 if (mMode == OrbitObjectMode)
896 {
897 gIndex = bool(mOrbitObject) ? connection->getGhostIndex(mOrbitObject): -1;
898 if(gIndex == -1)
899 {
900 writeMode = OrbitPointMode;
901 mOrbitObject->getWorldBox().getCenter(&writePos);
902 }
903 }
904
905 bstream->writeRangedU32(writeMode, CameraFirstMode, CameraLastMode); // SND MODE
906 if (writeMode == ThirdPersonMode)
907 {
908 bstream->write(mThird_person_snap_s > 0); // SND SNAP
909 if (mThird_person_snap_s > 0)
910 mThird_person_snap_s--;
911 }
912
913 if (writeMode == OrbitObjectMode || writeMode == OrbitPointMode)
914 {
915 bstream->write(mMinOrbitDist); // SND ORBIT MIN DIST
916 bstream->write(mMaxOrbitDist); // SND ORBIT MAX DIST
917 bstream->write(mCurOrbitDist); // SND ORBIT CURR DIST
918 if(writeMode == OrbitObjectMode)
919 {
920 bstream->writeFlag(mObservingClientObject); // SND OBSERVING CLIENT OBJ
921 bstream->writeInt(gIndex, NetConnection::GhostIdBitSize); // SND ORBIT OBJ
922 }
923 if (writeMode == OrbitPointMode)
924 bstream->writeCompressedPoint(writePos); // WRITE COMPRESSION POINT
925 }
926}
927
928void afxCamera::readPacketData(GameConnection *connection, BitStream *bstream)
929{

Callers

nothing calls this directly

Calls 11

mathWriteFunction · 0.85
getColumnMethod · 0.80
setCompressionPointMethod · 0.80
getGhostIndexMethod · 0.80
writeRangedU32Method · 0.80
writeIntMethod · 0.80
writeCompressedPointMethod · 0.80
writeMethod · 0.45
writeFlagMethod · 0.45
getCenterMethod · 0.45
getWorldBoxMethod · 0.45

Tested by

no test coverage detected