diff options
author | BlueWall | 2010-10-15 09:01:20 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2010-10-15 09:46:49 -0400 |
commit | dd1058e6b3f6e922712a4acd5744ef3ff0b9170d (patch) | |
tree | 349dbba482c7f5c1b7929b4f19bd08d96ac6e2ba /OpenSim/Framework/PrimitiveBaseShape.cs | |
parent | A couple of more ways attachment point is sent (diff) | |
download | opensim-SC_OLD-dd1058e6b3f6e922712a4acd5744ef3ff0b9170d.zip opensim-SC_OLD-dd1058e6b3f6e922712a4acd5744ef3ff0b9170d.tar.gz opensim-SC_OLD-dd1058e6b3f6e922712a4acd5744ef3ff0b9170d.tar.bz2 opensim-SC_OLD-dd1058e6b3f6e922712a4acd5744ef3ff0b9170d.tar.xz |
Adding projected light filters to prim propeties
Requires the LL Mesh Beta viewer
Signed-off-by: Teravus Ovares (Dan Olivares) <teravus@gmail.com>
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 0a81363..ff7eaef 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); } |
@@ -800,6 +807,7 @@ namespace OpenSim.Framework | |||
800 | ushort FlexiEP = 0x10; | 807 | ushort FlexiEP = 0x10; |
801 | ushort LightEP = 0x20; | 808 | ushort LightEP = 0x20; |
802 | ushort SculptEP = 0x30; | 809 | ushort SculptEP = 0x30; |
810 | ushort ProjectionEP = 0x40; | ||
803 | 811 | ||
804 | int i = 0; | 812 | int i = 0; |
805 | uint TotalBytesLength = 1; // ExtraParamsNum | 813 | uint TotalBytesLength = 1; // ExtraParamsNum |
@@ -823,6 +831,12 @@ namespace OpenSim.Framework | |||
823 | TotalBytesLength += 17;// data | 831 | TotalBytesLength += 17;// data |
824 | TotalBytesLength += 2 + 4; // type | 832 | TotalBytesLength += 2 + 4; // type |
825 | } | 833 | } |
834 | if (_projectionEntry) | ||
835 | { | ||
836 | ExtraParamsNum++; | ||
837 | TotalBytesLength += 28;// data | ||
838 | TotalBytesLength += 2 + 4;// type | ||
839 | } | ||
826 | 840 | ||
827 | byte[] returnbytes = new byte[TotalBytesLength]; | 841 | byte[] returnbytes = new byte[TotalBytesLength]; |
828 | 842 | ||
@@ -874,7 +888,19 @@ namespace OpenSim.Framework | |||
874 | Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length); | 888 | Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length); |
875 | i += SculptData.Length; | 889 | i += SculptData.Length; |
876 | } | 890 | } |
891 | if (_projectionEntry) | ||
892 | { | ||
893 | byte[] ProjectionData = GetProjectionBytes(); | ||
877 | 894 | ||
895 | returnbytes[i++] = (byte)(ProjectionEP % 256); | ||
896 | returnbytes[i++] = (byte)((ProjectionEP >> 8) % 256); | ||
897 | returnbytes[i++] = (byte)((ProjectionData.Length) % 256); | ||
898 | returnbytes[i++] = (byte)((ProjectionData.Length >> 16) % 256); | ||
899 | returnbytes[i++] = (byte)((ProjectionData.Length >> 20) % 256); | ||
900 | returnbytes[i++] = (byte)((ProjectionData.Length >> 24) % 256); | ||
901 | Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length); | ||
902 | i += ProjectionData.Length; | ||
903 | } | ||
878 | if (!_flexiEntry && !_lightEntry && !_sculptEntry) | 904 | if (!_flexiEntry && !_lightEntry && !_sculptEntry) |
879 | { | 905 | { |
880 | byte[] returnbyte = new byte[1]; | 906 | byte[] returnbyte = new byte[1]; |
@@ -893,6 +919,7 @@ namespace OpenSim.Framework | |||
893 | const ushort FlexiEP = 0x10; | 919 | const ushort FlexiEP = 0x10; |
894 | const ushort LightEP = 0x20; | 920 | const ushort LightEP = 0x20; |
895 | const ushort SculptEP = 0x30; | 921 | const ushort SculptEP = 0x30; |
922 | const ushort ProjectionEP = 0x40; | ||
896 | 923 | ||
897 | switch (type) | 924 | switch (type) |
898 | { | 925 | { |
@@ -922,6 +949,14 @@ namespace OpenSim.Framework | |||
922 | } | 949 | } |
923 | ReadSculptData(data, 0); | 950 | ReadSculptData(data, 0); |
924 | break; | 951 | break; |
952 | case ProjectionEP: | ||
953 | if (!inUse) | ||
954 | { | ||
955 | _projectionEntry = false; | ||
956 | return; | ||
957 | } | ||
958 | ReadProjectionData(data, 0); | ||
959 | break; | ||
925 | } | 960 | } |
926 | } | 961 | } |
927 | 962 | ||
@@ -933,10 +968,12 @@ namespace OpenSim.Framework | |||
933 | const ushort FlexiEP = 0x10; | 968 | const ushort FlexiEP = 0x10; |
934 | const ushort LightEP = 0x20; | 969 | const ushort LightEP = 0x20; |
935 | const ushort SculptEP = 0x30; | 970 | const ushort SculptEP = 0x30; |
971 | const ushort ProjectionEP = 0x40; | ||
936 | 972 | ||
937 | bool lGotFlexi = false; | 973 | bool lGotFlexi = false; |
938 | bool lGotLight = false; | 974 | bool lGotLight = false; |
939 | bool lGotSculpt = false; | 975 | bool lGotSculpt = false; |
976 | bool lGotFilter = false; | ||
940 | 977 | ||
941 | int i = 0; | 978 | int i = 0; |
942 | byte extraParamCount = 0; | 979 | byte extraParamCount = 0; |
@@ -973,6 +1010,11 @@ namespace OpenSim.Framework | |||
973 | i += 17; | 1010 | i += 17; |
974 | lGotSculpt = true; | 1011 | lGotSculpt = true; |
975 | break; | 1012 | break; |
1013 | case ProjectionEP: | ||
1014 | ReadProjectionData(data, i); | ||
1015 | i += 28; | ||
1016 | lGotFilter = true; | ||
1017 | break; | ||
976 | } | 1018 | } |
977 | } | 1019 | } |
978 | 1020 | ||
@@ -982,6 +1024,8 @@ namespace OpenSim.Framework | |||
982 | _lightEntry = false; | 1024 | _lightEntry = false; |
983 | if (!lGotSculpt) | 1025 | if (!lGotSculpt) |
984 | _sculptEntry = false; | 1026 | _sculptEntry = false; |
1027 | if (!lGotFilter) | ||
1028 | _projectionEntry = false; | ||
985 | 1029 | ||
986 | } | 1030 | } |
987 | 1031 | ||
@@ -1121,6 +1165,42 @@ namespace OpenSim.Framework | |||
1121 | return data; | 1165 | return data; |
1122 | } | 1166 | } |
1123 | 1167 | ||
1168 | public void ReadProjectionData(byte[] data, int pos) | ||
1169 | { | ||
1170 | byte[] ProjectionTextureUUID = new byte[16]; | ||
1171 | |||
1172 | if (data.Length - pos >= 28) | ||
1173 | { | ||
1174 | _projectionEntry = true; | ||
1175 | Array.Copy(data, pos, ProjectionTextureUUID,0, 16); | ||
1176 | _projectionTextureID = new UUID(ProjectionTextureUUID, 0); | ||
1177 | |||
1178 | _projectionFocus = Utils.BytesToFloat(data, pos + 16); | ||
1179 | _projectionFOV = Utils.BytesToFloat(data, pos + 20); | ||
1180 | _projectionAmb = Utils.BytesToFloat(data, pos + 24); | ||
1181 | } | ||
1182 | else | ||
1183 | { | ||
1184 | _projectionEntry = false; | ||
1185 | _projectionTextureID = UUID.Zero; | ||
1186 | _projectionFocus = 0f; | ||
1187 | _projectionFOV = 0f; | ||
1188 | _projectionAmb = 0f; | ||
1189 | } | ||
1190 | } | ||
1191 | |||
1192 | public byte[] GetProjectionBytes() | ||
1193 | { | ||
1194 | byte[] data = new byte[28]; | ||
1195 | |||
1196 | _projectionTextureID.GetBytes().CopyTo(data, 0); | ||
1197 | Utils.FloatToBytes(_projectionFocus).CopyTo(data, 16); | ||
1198 | Utils.FloatToBytes(_projectionFOV).CopyTo(data, 20); | ||
1199 | Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24); | ||
1200 | |||
1201 | return data; | ||
1202 | } | ||
1203 | |||
1124 | 1204 | ||
1125 | /// <summary> | 1205 | /// <summary> |
1126 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values | 1206 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values |