skadistats.clarity.io.decoder.QAnglePitchYawOnlyDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clarity Show documentation
Show all versions of clarity Show documentation
Clarity is an open source replay parser for Dota 2, CSGO, CS2 and Deadlock written in Java.
package skadistats.clarity.io.decoder;
import skadistats.clarity.io.bitstream.BitStream;
import skadistats.clarity.model.Vector;
public class QAnglePitchYawOnlyDecoder implements Decoder {
private final int nBits;
public QAnglePitchYawOnlyDecoder(int nBits) {
this.nBits = nBits;
}
@Override
public Vector decode(BitStream bs) {
var v = new float[3];
if ((nBits | 0x20) == 0x20) {
v[0] = Float.intBitsToFloat(bs.readUBitInt(32));
v[1] = Float.intBitsToFloat(bs.readUBitInt(32));
} else {
v[0] = bs.readBitAngle(nBits);
v[1] = bs.readBitAngle(nBits);
}
return new Vector(v);
}
}