diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 48 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 41 |
2 files changed, 65 insertions, 24 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 44f484e..83ddf95 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -213,6 +213,8 @@ namespace OpenSim.Framework | |||
213 | /// <param name="prim"></param> | 213 | /// <param name="prim"></param> |
214 | public PrimitiveBaseShape(Primitive prim) | 214 | public PrimitiveBaseShape(Primitive prim) |
215 | { | 215 | { |
216 | // m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Creating from {0}", prim.ID); | ||
217 | |||
216 | PCode = (byte)prim.PrimData.PCode; | 218 | PCode = (byte)prim.PrimData.PCode; |
217 | ExtraParams = new byte[1]; | 219 | ExtraParams = new byte[1]; |
218 | 220 | ||
@@ -376,7 +378,7 @@ namespace OpenSim.Framework | |||
376 | _pathEnd = Primitive.PackEndCut(end); | 378 | _pathEnd = Primitive.PackEndCut(end); |
377 | } | 379 | } |
378 | 380 | ||
379 | public void SetSculptData(byte sculptType, UUID SculptTextureUUID) | 381 | public void SetSculptProperties(byte sculptType, UUID SculptTextureUUID) |
380 | { | 382 | { |
381 | _sculptType = sculptType; | 383 | _sculptType = sculptType; |
382 | _sculptTexture = SculptTextureUUID; | 384 | _sculptTexture = SculptTextureUUID; |
@@ -613,29 +615,39 @@ namespace OpenSim.Framework | |||
613 | } | 615 | } |
614 | } | 616 | } |
615 | 617 | ||
616 | public byte SculptType { | 618 | public byte SculptType |
617 | get { | 619 | { |
620 | get | ||
621 | { | ||
618 | return _sculptType; | 622 | return _sculptType; |
619 | } | 623 | } |
620 | set { | 624 | set |
625 | { | ||
621 | _sculptType = value; | 626 | _sculptType = value; |
622 | } | 627 | } |
623 | } | 628 | } |
624 | 629 | ||
625 | public byte[] SculptData { | 630 | public byte[] SculptData |
626 | get { | 631 | { |
632 | get | ||
633 | { | ||
627 | return _sculptData; | 634 | return _sculptData; |
628 | } | 635 | } |
629 | set { | 636 | set |
637 | { | ||
638 | // m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Setting SculptData to data with length {0}", value.Length); | ||
630 | _sculptData = value; | 639 | _sculptData = value; |
631 | } | 640 | } |
632 | } | 641 | } |
633 | 642 | ||
634 | public int FlexiSoftness { | 643 | public int FlexiSoftness |
635 | get { | 644 | { |
645 | get | ||
646 | { | ||
636 | return _flexiSoftness; | 647 | return _flexiSoftness; |
637 | } | 648 | } |
638 | set { | 649 | set |
650 | { | ||
639 | _flexiSoftness = value; | 651 | _flexiSoftness = value; |
640 | } | 652 | } |
641 | } | 653 | } |
@@ -869,6 +881,8 @@ namespace OpenSim.Framework | |||
869 | 881 | ||
870 | public byte[] ExtraParamsToBytes() | 882 | public byte[] ExtraParamsToBytes() |
871 | { | 883 | { |
884 | // m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()"); | ||
885 | |||
872 | ushort FlexiEP = 0x10; | 886 | ushort FlexiEP = 0x10; |
873 | ushort LightEP = 0x20; | 887 | ushort LightEP = 0x20; |
874 | ushort SculptEP = 0x30; | 888 | ushort SculptEP = 0x30; |
@@ -884,18 +898,21 @@ namespace OpenSim.Framework | |||
884 | TotalBytesLength += 16;// data | 898 | TotalBytesLength += 16;// data |
885 | TotalBytesLength += 2 + 4; // type | 899 | TotalBytesLength += 2 + 4; // type |
886 | } | 900 | } |
901 | |||
887 | if (_lightEntry) | 902 | if (_lightEntry) |
888 | { | 903 | { |
889 | ExtraParamsNum++; | 904 | ExtraParamsNum++; |
890 | TotalBytesLength += 16;// data | 905 | TotalBytesLength += 16;// data |
891 | TotalBytesLength += 2 + 4; // type | 906 | TotalBytesLength += 2 + 4; // type |
892 | } | 907 | } |
908 | |||
893 | if (_sculptEntry) | 909 | if (_sculptEntry) |
894 | { | 910 | { |
895 | ExtraParamsNum++; | 911 | ExtraParamsNum++; |
896 | TotalBytesLength += 17;// data | 912 | TotalBytesLength += 17;// data |
897 | TotalBytesLength += 2 + 4; // type | 913 | TotalBytesLength += 2 + 4; // type |
898 | } | 914 | } |
915 | |||
899 | if (_projectionEntry) | 916 | if (_projectionEntry) |
900 | { | 917 | { |
901 | ExtraParamsNum++; | 918 | ExtraParamsNum++; |
@@ -905,7 +922,6 @@ namespace OpenSim.Framework | |||
905 | 922 | ||
906 | byte[] returnbytes = new byte[TotalBytesLength]; | 923 | byte[] returnbytes = new byte[TotalBytesLength]; |
907 | 924 | ||
908 | |||
909 | // uint paramlength = ExtraParamsNum; | 925 | // uint paramlength = ExtraParamsNum; |
910 | 926 | ||
911 | // Stick in the number of parameters | 927 | // Stick in the number of parameters |
@@ -925,6 +941,7 @@ namespace OpenSim.Framework | |||
925 | Array.Copy(FlexiData, 0, returnbytes, i, FlexiData.Length); | 941 | Array.Copy(FlexiData, 0, returnbytes, i, FlexiData.Length); |
926 | i += FlexiData.Length; | 942 | i += FlexiData.Length; |
927 | } | 943 | } |
944 | |||
928 | if (_lightEntry) | 945 | if (_lightEntry) |
929 | { | 946 | { |
930 | byte[] LightData = GetLightBytes(); | 947 | byte[] LightData = GetLightBytes(); |
@@ -939,6 +956,7 @@ namespace OpenSim.Framework | |||
939 | Array.Copy(LightData, 0, returnbytes, i, LightData.Length); | 956 | Array.Copy(LightData, 0, returnbytes, i, LightData.Length); |
940 | i += LightData.Length; | 957 | i += LightData.Length; |
941 | } | 958 | } |
959 | |||
942 | if (_sculptEntry) | 960 | if (_sculptEntry) |
943 | { | 961 | { |
944 | byte[] SculptData = GetSculptBytes(); | 962 | byte[] SculptData = GetSculptBytes(); |
@@ -953,6 +971,7 @@ namespace OpenSim.Framework | |||
953 | Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length); | 971 | Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length); |
954 | i += SculptData.Length; | 972 | i += SculptData.Length; |
955 | } | 973 | } |
974 | |||
956 | if (_projectionEntry) | 975 | if (_projectionEntry) |
957 | { | 976 | { |
958 | byte[] ProjectionData = GetProjectionBytes(); | 977 | byte[] ProjectionData = GetProjectionBytes(); |
@@ -966,6 +985,7 @@ namespace OpenSim.Framework | |||
966 | Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length); | 985 | Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length); |
967 | i += ProjectionData.Length; | 986 | i += ProjectionData.Length; |
968 | } | 987 | } |
988 | |||
969 | if (!_flexiEntry && !_lightEntry && !_sculptEntry && !_projectionEntry) | 989 | if (!_flexiEntry && !_lightEntry && !_sculptEntry && !_projectionEntry) |
970 | { | 990 | { |
971 | byte[] returnbyte = new byte[1]; | 991 | byte[] returnbyte = new byte[1]; |
@@ -973,10 +993,7 @@ namespace OpenSim.Framework | |||
973 | return returnbyte; | 993 | return returnbyte; |
974 | } | 994 | } |
975 | 995 | ||
976 | |||
977 | return returnbytes; | 996 | return returnbytes; |
978 | //m_log.Info("[EXTRAPARAMS]: Length = " + m_shape.ExtraParams.Length.ToString()); | ||
979 | |||
980 | } | 997 | } |
981 | 998 | ||
982 | public void ReadInUpdateExtraParam(ushort type, bool inUse, byte[] data) | 999 | public void ReadInUpdateExtraParam(ushort type, bool inUse, byte[] data) |
@@ -1047,7 +1064,6 @@ namespace OpenSim.Framework | |||
1047 | extraParamCount = data[i++]; | 1064 | extraParamCount = data[i++]; |
1048 | } | 1065 | } |
1049 | 1066 | ||
1050 | |||
1051 | for (int k = 0; k < extraParamCount; k++) | 1067 | for (int k = 0; k < extraParamCount; k++) |
1052 | { | 1068 | { |
1053 | ushort epType = Utils.BytesToUInt16(data, i); | 1069 | ushort epType = Utils.BytesToUInt16(data, i); |
@@ -1091,7 +1107,6 @@ namespace OpenSim.Framework | |||
1091 | _sculptEntry = false; | 1107 | _sculptEntry = false; |
1092 | if (!lGotFilter) | 1108 | if (!lGotFilter) |
1093 | _projectionEntry = false; | 1109 | _projectionEntry = false; |
1094 | |||
1095 | } | 1110 | } |
1096 | 1111 | ||
1097 | public void ReadSculptData(byte[] data, int pos) | 1112 | public void ReadSculptData(byte[] data, int pos) |
@@ -1120,6 +1135,7 @@ namespace OpenSim.Framework | |||
1120 | if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4) | 1135 | if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4) |
1121 | _sculptType = 4; | 1136 | _sculptType = 4; |
1122 | } | 1137 | } |
1138 | |||
1123 | _sculptTexture = SculptUUID; | 1139 | _sculptTexture = SculptUUID; |
1124 | _sculptType = SculptTypel; | 1140 | _sculptType = SculptTypel; |
1125 | //m_log.Info("[SCULPT]:" + SculptUUID.ToString()); | 1141 | //m_log.Info("[SCULPT]:" + SculptUUID.ToString()); |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 5ace351..b8b1039 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -324,10 +324,25 @@ namespace OpenSim.Framework | |||
324 | } | 324 | } |
325 | 325 | ||
326 | /// <summary> | 326 | /// <summary> |
327 | /// Debug utility function to convert OSD into formatted XML for debugging purposes. | ||
328 | /// </summary> | ||
329 | /// <param name="osd"> | ||
330 | /// A <see cref="OSD"/> | ||
331 | /// </param> | ||
332 | /// <returns> | ||
333 | /// A <see cref="System.String"/> | ||
334 | /// </returns> | ||
335 | public static string GetFormattedXml(OSD osd) | ||
336 | { | ||
337 | return GetFormattedXml(OSDParser.SerializeLLSDXmlString(osd)); | ||
338 | } | ||
339 | |||
340 | /// <summary> | ||
327 | /// Debug utility function to convert unbroken strings of XML into something human readable for occasional debugging purposes. | 341 | /// Debug utility function to convert unbroken strings of XML into something human readable for occasional debugging purposes. |
328 | /// | ||
329 | /// Please don't delete me even if I appear currently unused! | ||
330 | /// </summary> | 342 | /// </summary> |
343 | /// <remarks> | ||
344 | /// Please don't delete me even if I appear currently unused! | ||
345 | /// </remarks> | ||
331 | /// <param name="rawXml"></param> | 346 | /// <param name="rawXml"></param> |
332 | /// <returns></returns> | 347 | /// <returns></returns> |
333 | public static string GetFormattedXml(string rawXml) | 348 | public static string GetFormattedXml(string rawXml) |
@@ -431,26 +446,36 @@ namespace OpenSim.Framework | |||
431 | } | 446 | } |
432 | 447 | ||
433 | /// <summary> | 448 | /// <summary> |
434 | /// Return an SHA1 hash of the given string | 449 | /// Return an SHA1 hash |
435 | /// </summary> | 450 | /// </summary> |
436 | /// <param name="data"></param> | 451 | /// <param name="data"></param> |
437 | /// <returns></returns> | 452 | /// <returns></returns> |
438 | 453 | ||
454 | public static string SHA1Hash(string data, Encoding enc) | ||
455 | { | ||
456 | return SHA1Hash(enc.GetBytes(data)); | ||
457 | } | ||
458 | |||
439 | public static string SHA1Hash(string data) | 459 | public static string SHA1Hash(string data) |
440 | { | 460 | { |
441 | return SHA1Hash(data, Encoding.Default); | 461 | return SHA1Hash(Encoding.Default.GetBytes(data)); |
442 | } | 462 | } |
443 | 463 | ||
444 | public static string SHA1Hash(string data, Encoding encoding) | 464 | /// <summary> |
465 | /// Return an SHA1 hash | ||
466 | /// </summary> | ||
467 | /// <param name="data"></param> | ||
468 | /// <returns></returns> | ||
469 | public static string SHA1Hash(byte[] data) | ||
445 | { | 470 | { |
446 | byte[] hash = ComputeSHA1Hash(data, encoding); | 471 | byte[] hash = ComputeSHA1Hash(data); |
447 | return BitConverter.ToString(hash).Replace("-", String.Empty); | 472 | return BitConverter.ToString(hash).Replace("-", String.Empty); |
448 | } | 473 | } |
449 | 474 | ||
450 | private static byte[] ComputeSHA1Hash(string src, Encoding encoding) | 475 | private static byte[] ComputeSHA1Hash(byte[] src) |
451 | { | 476 | { |
452 | SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); | 477 | SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); |
453 | return SHA1.ComputeHash(encoding.GetBytes(src)); | 478 | return SHA1.ComputeHash(src); |
454 | } | 479 | } |
455 | 480 | ||
456 | public static int fast_distance2d(int x, int y) | 481 | public static int fast_distance2d(int x, int y) |