diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 129 |
1 files changed, 127 insertions, 2 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 0a81363..927415e 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -136,6 +136,13 @@ namespace OpenSim.Framework | |||
136 | [XmlIgnore] private bool _lightEntry; | 136 | [XmlIgnore] private bool _lightEntry; |
137 | [XmlIgnore] private bool _sculptEntry; | 137 | [XmlIgnore] private bool _sculptEntry; |
138 | 138 | ||
139 | // Light Projection Filter | ||
140 | [XmlIgnore] private bool _projectionEntry; | ||
141 | [XmlIgnore] private UUID _projectionTextureID; | ||
142 | [XmlIgnore] private float _projectionFOV; | ||
143 | [XmlIgnore] private float _projectionFocus; | ||
144 | [XmlIgnore] private float _projectionAmb; | ||
145 | |||
139 | public byte ProfileCurve | 146 | public byte ProfileCurve |
140 | { | 147 | { |
141 | get { return (byte)((byte)HollowShape | (byte)ProfileShape); } | 148 | get { return (byte)((byte)HollowShape | (byte)ProfileShape); } |
@@ -795,11 +802,57 @@ namespace OpenSim.Framework | |||
795 | } | 802 | } |
796 | } | 803 | } |
797 | 804 | ||
805 | public bool ProjectionEntry { | ||
806 | get { | ||
807 | return _projectionEntry; | ||
808 | } | ||
809 | set { | ||
810 | _projectionEntry = value; | ||
811 | } | ||
812 | } | ||
813 | |||
814 | public UUID ProjectionTextureUUID { | ||
815 | get { | ||
816 | return _projectionTextureID; | ||
817 | } | ||
818 | set { | ||
819 | _projectionTextureID = value; | ||
820 | } | ||
821 | } | ||
822 | |||
823 | public float ProjectionFOV { | ||
824 | get { | ||
825 | return _projectionFOV; | ||
826 | } | ||
827 | set { | ||
828 | _projectionFOV = value; | ||
829 | } | ||
830 | } | ||
831 | |||
832 | public float ProjectionFocus { | ||
833 | get { | ||
834 | return _projectionFocus; | ||
835 | } | ||
836 | set { | ||
837 | _projectionFocus = value; | ||
838 | } | ||
839 | } | ||
840 | |||
841 | public float ProjectionAmbiance { | ||
842 | get { | ||
843 | return _projectionAmb; | ||
844 | } | ||
845 | set { | ||
846 | _projectionAmb = value; | ||
847 | } | ||
848 | } | ||
849 | |||
798 | public byte[] ExtraParamsToBytes() | 850 | public byte[] ExtraParamsToBytes() |
799 | { | 851 | { |
800 | ushort FlexiEP = 0x10; | 852 | ushort FlexiEP = 0x10; |
801 | ushort LightEP = 0x20; | 853 | ushort LightEP = 0x20; |
802 | ushort SculptEP = 0x30; | 854 | ushort SculptEP = 0x30; |
855 | ushort ProjectionEP = 0x40; | ||
803 | 856 | ||
804 | int i = 0; | 857 | int i = 0; |
805 | uint TotalBytesLength = 1; // ExtraParamsNum | 858 | uint TotalBytesLength = 1; // ExtraParamsNum |
@@ -823,6 +876,12 @@ namespace OpenSim.Framework | |||
823 | TotalBytesLength += 17;// data | 876 | TotalBytesLength += 17;// data |
824 | TotalBytesLength += 2 + 4; // type | 877 | TotalBytesLength += 2 + 4; // type |
825 | } | 878 | } |
879 | if (_projectionEntry) | ||
880 | { | ||
881 | ExtraParamsNum++; | ||
882 | TotalBytesLength += 28;// data | ||
883 | TotalBytesLength += 2 + 4;// type | ||
884 | } | ||
826 | 885 | ||
827 | byte[] returnbytes = new byte[TotalBytesLength]; | 886 | byte[] returnbytes = new byte[TotalBytesLength]; |
828 | 887 | ||
@@ -874,8 +933,20 @@ namespace OpenSim.Framework | |||
874 | Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length); | 933 | Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length); |
875 | i += SculptData.Length; | 934 | i += SculptData.Length; |
876 | } | 935 | } |
877 | 936 | if (_projectionEntry) | |
878 | if (!_flexiEntry && !_lightEntry && !_sculptEntry) | 937 | { |
938 | byte[] ProjectionData = GetProjectionBytes(); | ||
939 | |||
940 | returnbytes[i++] = (byte)(ProjectionEP % 256); | ||
941 | returnbytes[i++] = (byte)((ProjectionEP >> 8) % 256); | ||
942 | returnbytes[i++] = (byte)((ProjectionData.Length) % 256); | ||
943 | returnbytes[i++] = (byte)((ProjectionData.Length >> 16) % 256); | ||
944 | returnbytes[i++] = (byte)((ProjectionData.Length >> 20) % 256); | ||
945 | returnbytes[i++] = (byte)((ProjectionData.Length >> 24) % 256); | ||
946 | Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length); | ||
947 | i += ProjectionData.Length; | ||
948 | } | ||
949 | if (!_flexiEntry && !_lightEntry && !_sculptEntry && !_projectionEntry) | ||
879 | { | 950 | { |
880 | byte[] returnbyte = new byte[1]; | 951 | byte[] returnbyte = new byte[1]; |
881 | returnbyte[0] = 0; | 952 | returnbyte[0] = 0; |
@@ -893,6 +964,7 @@ namespace OpenSim.Framework | |||
893 | const ushort FlexiEP = 0x10; | 964 | const ushort FlexiEP = 0x10; |
894 | const ushort LightEP = 0x20; | 965 | const ushort LightEP = 0x20; |
895 | const ushort SculptEP = 0x30; | 966 | const ushort SculptEP = 0x30; |
967 | const ushort ProjectionEP = 0x40; | ||
896 | 968 | ||
897 | switch (type) | 969 | switch (type) |
898 | { | 970 | { |
@@ -922,6 +994,14 @@ namespace OpenSim.Framework | |||
922 | } | 994 | } |
923 | ReadSculptData(data, 0); | 995 | ReadSculptData(data, 0); |
924 | break; | 996 | break; |
997 | case ProjectionEP: | ||
998 | if (!inUse) | ||
999 | { | ||
1000 | _projectionEntry = false; | ||
1001 | return; | ||
1002 | } | ||
1003 | ReadProjectionData(data, 0); | ||
1004 | break; | ||
925 | } | 1005 | } |
926 | } | 1006 | } |
927 | 1007 | ||
@@ -933,10 +1013,12 @@ namespace OpenSim.Framework | |||
933 | const ushort FlexiEP = 0x10; | 1013 | const ushort FlexiEP = 0x10; |
934 | const ushort LightEP = 0x20; | 1014 | const ushort LightEP = 0x20; |
935 | const ushort SculptEP = 0x30; | 1015 | const ushort SculptEP = 0x30; |
1016 | const ushort ProjectionEP = 0x40; | ||
936 | 1017 | ||
937 | bool lGotFlexi = false; | 1018 | bool lGotFlexi = false; |
938 | bool lGotLight = false; | 1019 | bool lGotLight = false; |
939 | bool lGotSculpt = false; | 1020 | bool lGotSculpt = false; |
1021 | bool lGotFilter = false; | ||
940 | 1022 | ||
941 | int i = 0; | 1023 | int i = 0; |
942 | byte extraParamCount = 0; | 1024 | byte extraParamCount = 0; |
@@ -973,6 +1055,11 @@ namespace OpenSim.Framework | |||
973 | i += 17; | 1055 | i += 17; |
974 | lGotSculpt = true; | 1056 | lGotSculpt = true; |
975 | break; | 1057 | break; |
1058 | case ProjectionEP: | ||
1059 | ReadProjectionData(data, i); | ||
1060 | i += 28; | ||
1061 | lGotFilter = true; | ||
1062 | break; | ||
976 | } | 1063 | } |
977 | } | 1064 | } |
978 | 1065 | ||
@@ -982,6 +1069,8 @@ namespace OpenSim.Framework | |||
982 | _lightEntry = false; | 1069 | _lightEntry = false; |
983 | if (!lGotSculpt) | 1070 | if (!lGotSculpt) |
984 | _sculptEntry = false; | 1071 | _sculptEntry = false; |
1072 | if (!lGotFilter) | ||
1073 | _projectionEntry = false; | ||
985 | 1074 | ||
986 | } | 1075 | } |
987 | 1076 | ||
@@ -1121,6 +1210,42 @@ namespace OpenSim.Framework | |||
1121 | return data; | 1210 | return data; |
1122 | } | 1211 | } |
1123 | 1212 | ||
1213 | public void ReadProjectionData(byte[] data, int pos) | ||
1214 | { | ||
1215 | byte[] ProjectionTextureUUID = new byte[16]; | ||
1216 | |||
1217 | if (data.Length - pos >= 28) | ||
1218 | { | ||
1219 | _projectionEntry = true; | ||
1220 | Array.Copy(data, pos, ProjectionTextureUUID,0, 16); | ||
1221 | _projectionTextureID = new UUID(ProjectionTextureUUID, 0); | ||
1222 | |||
1223 | _projectionFOV = Utils.BytesToFloat(data, pos + 16); | ||
1224 | _projectionFocus = Utils.BytesToFloat(data, pos + 20); | ||
1225 | _projectionAmb = Utils.BytesToFloat(data, pos + 24); | ||
1226 | } | ||
1227 | else | ||
1228 | { | ||
1229 | _projectionEntry = false; | ||
1230 | _projectionTextureID = UUID.Zero; | ||
1231 | _projectionFOV = 0f; | ||
1232 | _projectionFocus = 0f; | ||
1233 | _projectionAmb = 0f; | ||
1234 | } | ||
1235 | } | ||
1236 | |||
1237 | public byte[] GetProjectionBytes() | ||
1238 | { | ||
1239 | byte[] data = new byte[28]; | ||
1240 | |||
1241 | _projectionTextureID.GetBytes().CopyTo(data, 0); | ||
1242 | Utils.FloatToBytes(_projectionFOV).CopyTo(data, 16); | ||
1243 | Utils.FloatToBytes(_projectionFocus).CopyTo(data, 20); | ||
1244 | Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24); | ||
1245 | |||
1246 | return data; | ||
1247 | } | ||
1248 | |||
1124 | 1249 | ||
1125 | /// <summary> | 1250 | /// <summary> |
1126 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values | 1251 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values |