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

Method writeVector

Engine/source/core/stream/bitStream.cpp:413–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413void BitStream::writeVector( Point3F vec, F32 maxMag, S32 magBits, S32 normalBits )
414{
415 F32 mag = vec.len();
416
417 // If its zero length then we're done.
418 if ( !writeFlag( mag > 0.0f ) )
419 return;
420
421 // Write the magnitude compressed unless its greater than the maximum.
422 if ( writeFlag( mag < maxMag ) )
423 writeFloat( mag / maxMag, magBits );
424 else
425 write( mag );
426
427 // Finally write the normal part.
428 vec *= 1.0f / mag;
429 writeNormalVector( vec, normalBits );
430}
431
432void BitStream::readVector( Point3F *outVec, F32 maxMag, S32 magBits, S32 normalBits )
433{

Callers 2

packUpdateMethod · 0.80
packUpdateMethod · 0.80

Calls 2

writeFunction · 0.50
lenMethod · 0.45

Tested by

no test coverage detected