diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 9be75da..b7c0596 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -57,7 +57,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
57 | ALLOWED_DROP = 64, | 57 | ALLOWED_DROP = 64, |
58 | OWNER = 128 | 58 | OWNER = 128 |
59 | } | 59 | } |
60 | 60 | [Flags] | |
61 | public enum TextureAnimFlags : byte | ||
62 | { | ||
63 | NONE = 0x00, | ||
64 | ANIM_ON = 0x01, | ||
65 | LOOP = 0x02, | ||
66 | REVERSE = 0x04, | ||
67 | PING_PONG = 0x08, | ||
68 | SMOOTH = 0x10, | ||
69 | ROTATE = 0x20, | ||
70 | SCALE = 0x40 | ||
71 | } | ||
61 | 72 | ||
62 | public partial class SceneObjectPart : IScriptHost | 73 | public partial class SceneObjectPart : IScriptHost |
63 | { | 74 | { |
@@ -1367,9 +1378,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
1367 | UpdateTextureEntry(tex.ToBytes()); | 1378 | UpdateTextureEntry(tex.ToBytes()); |
1368 | } | 1379 | } |
1369 | 1380 | ||
1381 | public byte ConvertScriptUintToByte(uint indata) | ||
1382 | { | ||
1383 | byte outdata = (byte)TextureAnimFlags.NONE; | ||
1384 | if ((indata & 1) != 0) outdata |= (byte)TextureAnimFlags.ANIM_ON; | ||
1385 | if ((indata & 2) != 0) outdata |= (byte)TextureAnimFlags.LOOP; | ||
1386 | if ((indata & 4) != 0) outdata |= (byte)TextureAnimFlags.REVERSE; | ||
1387 | if ((indata & 8) != 0) outdata |= (byte)TextureAnimFlags.PING_PONG; | ||
1388 | if ((indata & 16) != 0) outdata |= (byte)TextureAnimFlags.SMOOTH; | ||
1389 | if ((indata & 32) != 0) outdata |= (byte)TextureAnimFlags.ROTATE; | ||
1390 | if ((indata & 64) != 0) outdata |= (byte)TextureAnimFlags.SCALE; | ||
1391 | return outdata; | ||
1392 | } | ||
1393 | |||
1370 | public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) | 1394 | public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) |
1371 | { | 1395 | { |
1372 | m_TextureAnimation = pTexAnim.GetBytes(); | 1396 | byte[] data = new byte[16]; |
1397 | int pos = 0; | ||
1398 | |||
1399 | // The flags don't like conversion from uint to byte, so we have to do | ||
1400 | // it the crappy way. See the above function :( | ||
1401 | |||
1402 | data[pos] = ConvertScriptUintToByte(pTexAnim.Flags); pos++; | ||
1403 | data[pos] = (byte)pTexAnim.Face; pos++; | ||
1404 | data[pos] = (byte)pTexAnim.SizeX; pos++; | ||
1405 | data[pos] = (byte)pTexAnim.SizeX; pos++; | ||
1406 | |||
1407 | Helpers.FloatToBytes(0).CopyTo(data, pos); | ||
1408 | Helpers.FloatToBytes(0).CopyTo(data, pos + 4); | ||
1409 | Helpers.FloatToBytes(0.5f).CopyTo(data, pos + 8); | ||
1410 | |||
1411 | m_TextureAnimation = data; | ||
1373 | } | 1412 | } |
1374 | 1413 | ||
1375 | #endregion | 1414 | #endregion |