* Commit some BinBVH rotation convenience. Calculates the W element of the joint rotation quaternion and provides a property so consumer doesn't have to.
parent
dc0a19f737
commit
e15ffe31e3
|
@ -345,6 +345,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// argh! floats into two bytes!.. bad bad bad bad
|
// argh! floats into two bytes!.. bad bad bad bad
|
||||||
// After fighting with it for a while.. -1, to 1 seems to give the best results
|
// After fighting with it for a while.. -1, to 1 seems to give the best results
|
||||||
rotations = readKeys(data, ref i, rotationkeys, -1f, 1f);
|
rotations = readKeys(data, ref i, rotationkeys, -1f, 1f);
|
||||||
|
for (int iter = 0; iter < rotations.Length; iter++)
|
||||||
|
{
|
||||||
|
rotations[iter].W = 1f -
|
||||||
|
(rotations[iter].key_element.X + rotations[iter].key_element.Y +
|
||||||
|
rotations[iter].key_element.Z);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!BitConverter.IsLittleEndian)
|
if (!BitConverter.IsLittleEndian)
|
||||||
|
@ -481,6 +487,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector3 key_element;
|
public Vector3 key_element;
|
||||||
|
|
||||||
|
public float W;
|
||||||
|
|
||||||
public void WriteBytesToStream(BinaryWriter iostream, float InPoint, float OutPoint, float min, float max)
|
public void WriteBytesToStream(BinaryWriter iostream, float InPoint, float OutPoint, float min, float max)
|
||||||
{
|
{
|
||||||
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(BinBVHUtil.FloatToUInt16(time, InPoint, OutPoint))));
|
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(BinBVHUtil.FloatToUInt16(time, InPoint, OutPoint))));
|
||||||
|
|
Loading…
Reference in New Issue