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

Method packNode

Engine/source/Verve/VPath/VPathNode.cpp:66–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64//-----------------------------------------------------------------------------
65
66U32 VPathNode::packNode( NetConnection *pConnection, BitStream *pStream )
67{
68 // Init Return Mask.
69 U32 retMask = 0;
70
71 // Fetch State.
72 VNetStateInfo *state = getState( pConnection );
73
74 // Note: This is out of sync with VPathNode::unpackUpdate().
75 // If you're ever going to use these methods outside of VPath, you
76 // will need to read a flag *before* calling unpack!
77
78 // Was the Node Created?
79 if ( pStream->writeFlag( state->Mask & k_StateCreate ) )
80 {
81 // Clear Update.
82 state->Mask &= ~k_StateCreate;
83 }
84
85 // Send mLocalPosition?
86 if ( pStream->writeFlag( state->Mask & k_StateUpdatePosition ) )
87 {
88 // Write mLocalPosition.
89 pStream->write( mLocalPosition.x );
90 pStream->write( mLocalPosition.y );
91 pStream->write( mLocalPosition.z );
92
93 // Clear Update.
94 state->Mask &= ~k_StateUpdatePosition;
95 }
96
97 // Send mLocalRotation?
98 if ( pStream->writeFlag( state->Mask & k_StateUpdateRotation ) )
99 {
100 // Write mLocalRotation.
101 pStream->write( mLocalRotation.x );
102 pStream->write( mLocalRotation.y );
103 pStream->write( mLocalRotation.z );
104 pStream->write( mLocalRotation.w );
105
106 // Clear Update.
107 state->Mask &= ~k_StateUpdateRotation;
108 }
109
110 // Send mWeight?
111 if ( pStream->writeFlag( state->Mask & k_StateUpdateWeight ) )
112 {
113 // Write mWeight.
114 pStream->write( mWeight );
115
116 // Clear Update.
117 state->Mask &= ~k_StateUpdateWeight;
118 }
119
120 // Send Orientation Update?
121 if ( pStream->writeFlag( state->Mask & k_StateUpdateOrientation ) )
122 {
123 // Clear Update?

Callers 1

packUpdateMethod · 0.45

Calls 4

getStateFunction · 0.85
writeIntMethod · 0.80
writeFlagMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected