| 411 | } |
| 412 | |
| 413 | void 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 | |
| 432 | void BitStream::readVector( Point3F *outVec, F32 maxMag, S32 magBits, S32 normalBits ) |
| 433 | { |
no test coverage detected