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

Method writeVector

Engine/source/core/stream/bitStream.cpp:443–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441}
442
443void BitStream::writeVector( Point3F vec, F32 maxMag, S32 magBits, S32 normalBits )
444{
445 F32 mag = vec.len();
446
447 // If its zero length then we're done.
448 if ( !writeFlag( mag > 0.0f ) )
449 return;
450
451 // Write the magnitude compressed unless its greater than the maximum.
452 if ( writeFlag( mag < maxMag ) )
453 writeFloat( mag / maxMag, magBits );
454 else
455 write( mag );
456
457 // Finally write the normal part.
458 vec *= 1.0f / mag;
459 writeNormalVector( vec, normalBits );
460}
461
462void BitStream::readVector( Point3F *outVec, F32 maxMag, S32 magBits, S32 normalBits )
463{

Callers 1

packUpdateMethod · 0.80

Calls 2

writeFunction · 0.50
lenMethod · 0.45

Tested by

no test coverage detected