MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Decode

Method Decode

engine/Poseidon/Network/NetworkMsg.cpp:620–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618 NET_ERROR(mAside.Distance2(m.DirectionAside()) < 1e-6);
619#endif
620}
621
622void EncodedMatrix3::Decode(Matrix3& m) const
623{
624 // decoding is a little bit more tricky
625 // decode col. 1 (up)
626 Vector3 up;
627 up.Init();
628 up[0] = DecodeFloat16(_01c);
629 up[1] = DecodeFloat16(_11c);
630 float m21_sq = 1 - up[0] * up[0] - up[1] * up[1];
631 up[2] = (m21_sq >= 0 ? sqrt(m21_sq) : 0) * _21sign;
632
633 // decode col. 0 (direction)
634 Vector3 dir;
635 dir.Init();
636 dir[0] = DecodeFloat16(_02c);
637 dir[1] = DecodeFloat16(_12c);
638 float m22_sq = 1 - dir[0] * dir[0] - dir[1] * dir[1];
639 dir[2] = (m22_sq >= 0 ? sqrt(m22_sq) : 0) * _22sign;
640
641 m.SetDirectionAndUp(dir, up);
642}
643

Callers 1

GetMethod · 0.45

Calls 4

DecodeFloat16Function · 0.85
sqrtFunction · 0.85
InitMethod · 0.45
SetDirectionAndUpMethod · 0.45

Tested by

no test coverage detected