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

Method readPacketData

Engine/source/T3D/camera.cpp:1067–1155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1065//----------------------------------------------------------------------------
1066
1067void Camera::readPacketData(GameConnection *connection, BitStream *bstream)
1068{
1069 Parent::readPacketData(connection, bstream);
1070 Point3F pos,rot;
1071 mathRead(*bstream, &pos);
1072 bstream->setCompressionPoint(pos);
1073 bstream->read(&rot.x);
1074 if(bstream->readFlag())
1075 {
1076 // Include rot.y to allow for camera banking
1077 bstream->read(&rot.y);
1078 }
1079 bstream->read(&rot.z);
1080
1081 GameBase* obj = 0;
1082 mMode = (CameraMotionMode)bstream->readRangedU32(CameraFirstMode, CameraLastMode);
1083 mObservingClientObject = false;
1084 if (mMode == OrbitObjectMode || mMode == OrbitPointMode)
1085 {
1086 bstream->read(&mMinOrbitDist);
1087 bstream->read(&mMaxOrbitDist);
1088 bstream->read(&mCurOrbitDist);
1089
1090 if(mMode == OrbitObjectMode)
1091 {
1092 mObservingClientObject = bstream->readFlag();
1093 S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize);
1094 obj = static_cast<GameBase*>(connection->resolveGhost(gIndex));
1095 }
1096 if (mMode == OrbitPointMode)
1097 bstream->readCompressedPoint(&mPosition);
1098 }
1099 else if (mMode == TrackObjectMode)
1100 {
1101 S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize);
1102 obj = static_cast<GameBase*>(connection->resolveGhost(gIndex));
1103 }
1104
1105 if (obj != (GameBase*)mOrbitObject)
1106 {
1107 if (mOrbitObject)
1108 {
1109 clearProcessAfter();
1110 clearNotify(mOrbitObject);
1111 }
1112
1113 mOrbitObject = obj;
1114 if (mOrbitObject)
1115 {
1116 processAfter(mOrbitObject);
1117 deleteNotify(mOrbitObject);
1118 }
1119 }
1120
1121 mNewtonMode = bstream->readFlag();
1122 if(mNewtonMode)
1123 {
1124 bstream->read(&mVelocity.x);

Callers

nothing calls this directly

Calls 9

mathReadFunction · 0.85
setCompressionPointMethod · 0.80
readFlagMethod · 0.80
readRangedU32Method · 0.80
readIntMethod · 0.80
resolveGhostMethod · 0.80
readCompressedPointMethod · 0.80
readMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected