From e15ffe31e38fe201f9c346703f5c1a2d86cfc809 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 10 Jul 2009 00:13:42 +0000 Subject: * Commit some BinBVH rotation convenience. Calculates the W element of the joint rotation quaternion and provides a property so consumer doesn't have to. --- OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs b/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs index 367e8d8..1dd9613 100644 --- a/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs +++ b/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs @@ -345,6 +345,12 @@ namespace OpenSim.Region.Framework.Scenes // 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 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) @@ -481,6 +487,8 @@ namespace OpenSim.Region.Framework.Scenes /// public Vector3 key_element; + public float W; + public void WriteBytesToStream(BinaryWriter iostream, float InPoint, float OutPoint, float min, float max) { iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(BinBVHUtil.FloatToUInt16(time, InPoint, OutPoint)))); -- cgit v1.1