| 544 | } |
| 545 | |
| 546 | void BitStream::readQuat( QuatF *outQuat, U32 bitCount ) |
| 547 | { |
| 548 | F32 quatVals[4]; |
| 549 | F32 sum = 0.0f; |
| 550 | |
| 551 | S32 idxMax = readInt( 2 ); |
| 552 | for (S32 i = 0; i < 4; ++i) |
| 553 | { |
| 554 | if (i == idxMax) |
| 555 | continue; |
| 556 | quatVals[i] = readSignedFloat( bitCount ) * M_SQRTHALF_F; |
| 557 | sum += quatVals[i] * quatVals[i]; |
| 558 | } |
| 559 | |
| 560 | if (sum > 1.0f) |
| 561 | quatVals[idxMax] = 1.0f; |
| 562 | else |
| 563 | quatVals[idxMax] = mSqrt(1.0f - sum); |
| 564 | |
| 565 | outQuat->set(quatVals[0], quatVals[1], quatVals[2], quatVals[3]); |
| 566 | } |
| 567 | |
| 568 | void BitStream::writeBits( const BitVector &bitvec ) |
| 569 | { |
no test coverage detected