diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs index b3b38b2..def993f 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs | |||
@@ -33,8 +33,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
33 | { | 33 | { |
34 | /// <summary> | 34 | /// <summary> |
35 | /// Written to decode and encode a binary animation asset. | 35 | /// Written to decode and encode a binary animation asset. |
36 | /// The SecondLife Client reads in a BVH file and converts | 36 | /// The SecondLife Client reads in a BVH file and converts |
37 | /// it to the format described here. This isn't | 37 | /// it to the format described here. This isn't |
38 | /// </summary> | 38 | /// </summary> |
39 | public class BinBVHAnimation | 39 | public class BinBVHAnimation |
40 | { | 40 | { |
@@ -109,7 +109,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
109 | /// Contains an array of joints | 109 | /// Contains an array of joints |
110 | /// </summary> | 110 | /// </summary> |
111 | public binBVHJoint[] Joints; | 111 | public binBVHJoint[] Joints; |
112 | 112 | ||
113 | 113 | ||
114 | public byte[] ToBytes() | 114 | public byte[] ToBytes() |
115 | { | 115 | { |
@@ -136,14 +136,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
136 | Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint); | 136 | Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint); |
137 | } | 137 | } |
138 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0))); | 138 | iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0))); |
139 | 139 | ||
140 | using (MemoryStream ms2 = (MemoryStream)iostream.BaseStream) | 140 | using (MemoryStream ms2 = (MemoryStream)iostream.BaseStream) |
141 | outputbytes = ms2.ToArray(); | 141 | outputbytes = ms2.ToArray(); |
142 | } | 142 | } |
143 | 143 | ||
144 | return outputbytes; | 144 | return outputbytes; |
145 | } | 145 | } |
146 | 146 | ||
147 | public BinBVHAnimation() | 147 | public BinBVHAnimation() |
148 | { | 148 | { |
149 | rotationkeys = 0; | 149 | rotationkeys = 0; |
@@ -160,7 +160,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
160 | EaseOutTime = 0; | 160 | EaseOutTime = 0; |
161 | HandPose = 1; | 161 | HandPose = 1; |
162 | m_jointCount = 0; | 162 | m_jointCount = 0; |
163 | 163 | ||
164 | Joints = new binBVHJoint[1]; | 164 | Joints = new binBVHJoint[1]; |
165 | Joints[0] = new binBVHJoint(); | 165 | Joints[0] = new binBVHJoint(); |
166 | Joints[0].Name = "mPelvis"; | 166 | Joints[0].Name = "mPelvis"; |
@@ -180,7 +180,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
180 | Joints[0].positionkeys[0].key_element.X = ((float)rnd.NextDouble() * 2 - 1); | 180 | Joints[0].positionkeys[0].key_element.X = ((float)rnd.NextDouble() * 2 - 1); |
181 | Joints[0].positionkeys[0].key_element.Y = ((float)rnd.NextDouble() * 2 - 1); | 181 | Joints[0].positionkeys[0].key_element.Y = ((float)rnd.NextDouble() * 2 - 1); |
182 | Joints[0].positionkeys[0].key_element.Z = ((float)rnd.NextDouble() * 2 - 1); | 182 | Joints[0].positionkeys[0].key_element.Z = ((float)rnd.NextDouble() * 2 - 1); |
183 | 183 | ||
184 | 184 | ||
185 | } | 185 | } |
186 | 186 | ||
@@ -235,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | /// <summary> | 239 | /// <summary> |
240 | /// Variable length strings seem to be null terminated in the animation asset.. but.. | 240 | /// Variable length strings seem to be null terminated in the animation asset.. but.. |
241 | /// use with caution, home grown. | 241 | /// use with caution, home grown. |
@@ -294,7 +294,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
294 | /// <returns>The Joint data serialized into the binBVHJoint structure</returns> | 294 | /// <returns>The Joint data serialized into the binBVHJoint structure</returns> |
295 | private binBVHJoint readJoint(byte[] data, ref int i) | 295 | private binBVHJoint readJoint(byte[] data, ref int i) |
296 | { | 296 | { |
297 | 297 | ||
298 | binBVHJointKey[] positions; | 298 | binBVHJointKey[] positions; |
299 | binBVHJointKey[] rotations; | 299 | binBVHJointKey[] rotations; |
300 | 300 | ||
@@ -312,14 +312,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
312 | 312 | ||
313 | pJoint.Name = ReadBytesUntilNull(data, ref i); // Joint name | 313 | pJoint.Name = ReadBytesUntilNull(data, ref i); // Joint name |
314 | 314 | ||
315 | /* | 315 | /* |
316 | 2 <- Priority Revisited | 316 | 2 <- Priority Revisited |
317 | 0 | 317 | 0 |
318 | 0 | 318 | 0 |
319 | 0 | 319 | 0 |
320 | */ | 320 | */ |
321 | 321 | ||
322 | /* | 322 | /* |
323 | 5 <-- 5 keyframes | 323 | 5 <-- 5 keyframes |
324 | 0 | 324 | 0 |
325 | 0 | 325 | 0 |
@@ -327,7 +327,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
327 | ... 5 Keyframe data blocks | 327 | ... 5 Keyframe data blocks |
328 | */ | 328 | */ |
329 | 329 | ||
330 | /* | 330 | /* |
331 | 2 <-- 2 keyframes | 331 | 2 <-- 2 keyframes |
332 | 0 | 332 | 0 |
333 | 0 | 333 | 0 |
@@ -428,8 +428,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
428 | } | 428 | } |
429 | return m_keys; | 429 | return m_keys; |
430 | } | 430 | } |
431 | 431 | ||
432 | 432 | ||
433 | 433 | ||
434 | } | 434 | } |
435 | /// <summary> | 435 | /// <summary> |
@@ -443,7 +443,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
443 | public string Name; | 443 | public string Name; |
444 | 444 | ||
445 | /// <summary> | 445 | /// <summary> |
446 | /// Joint Animation Override? Was the same as the Priority in testing.. | 446 | /// Joint Animation Override? Was the same as the Priority in testing.. |
447 | /// </summary> | 447 | /// </summary> |
448 | public int Priority; | 448 | public int Priority; |
449 | 449 | ||
@@ -523,7 +523,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
523 | public static class BinBVHUtil | 523 | public static class BinBVHUtil |
524 | { | 524 | { |
525 | public const float ONE_OVER_U16_MAX = 1.0f / UInt16.MaxValue; | 525 | public const float ONE_OVER_U16_MAX = 1.0f / UInt16.MaxValue; |
526 | 526 | ||
527 | public static UInt16 FloatToUInt16(float val, float lower, float upper) | 527 | public static UInt16 FloatToUInt16(float val, float lower, float upper) |
528 | { | 528 | { |
529 | UInt16 uival = 0; | 529 | UInt16 uival = 0; |
@@ -536,7 +536,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
536 | { | 536 | { |
537 | upper -= lower; | 537 | upper -= lower; |
538 | val = val - lower; | 538 | val = val - lower; |
539 | 539 | ||
540 | // start with 500 upper and 200 lower.. subtract 200 from the upper and the value | 540 | // start with 500 upper and 200 lower.. subtract 200 from the upper and the value |
541 | } | 541 | } |
542 | else //if (lower < 0 && upper > 0) | 542 | else //if (lower < 0 && upper > 0) |
@@ -558,8 +558,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
558 | 558 | ||
559 | return uival; | 559 | return uival; |
560 | } | 560 | } |
561 | 561 | ||
562 | 562 | ||
563 | /// <summary> | 563 | /// <summary> |
564 | /// Endian Swap | 564 | /// Endian Swap |
565 | /// Swaps endianness if necessary | 565 | /// Swaps endianness if necessary |
@@ -590,7 +590,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
590 | output[i] = Convert.ToByte(chr[i]); | 590 | output[i] = Convert.ToByte(chr[i]); |
591 | 591 | ||
592 | } | 592 | } |
593 | 593 | ||
594 | output[i] = Convert.ToByte('\0'); | 594 | output[i] = Convert.ToByte('\0'); |
595 | return output; | 595 | return output; |
596 | } | 596 | } |