| 441 | } |
| 442 | |
| 443 | void 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 | |
| 462 | void BitStream::readVector( Point3F *outVec, F32 maxMag, S32 magBits, S32 normalBits ) |
| 463 | { |
no test coverage detected