diff options
author | onefang | 2021-08-26 06:21:19 +1000 |
---|---|---|
committer | onefang | 2021-08-26 06:21:19 +1000 |
commit | cdfbb899f1112dab44d5490838765e9bd73bc60e (patch) | |
tree | 52cddd0b76e7ad8544a0ada533f91bb5fc402025 /OpenSim/Framework/PrimitiveBaseShape.cs | |
parent | Still failing to reconnect for dbCount(), just set the fucking timeout to a y... (diff) | |
parent | Don't strip (OWNER) out of script error report. (diff) | |
download | opensim-SC-cdfbb899f1112dab44d5490838765e9bd73bc60e.zip opensim-SC-cdfbb899f1112dab44d5490838765e9bd73bc60e.tar.gz opensim-SC-cdfbb899f1112dab44d5490838765e9bd73bc60e.tar.bz2 opensim-SC-cdfbb899f1112dab44d5490838765e9bd73bc60e.tar.xz |
Merge branch 'switch' into Domme.
Diffstat (limited to 'OpenSim/Framework/PrimitiveBaseShape.cs')
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 326 |
1 files changed, 143 insertions, 183 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 6e7a038..a49f53c 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -133,17 +133,26 @@ namespace OpenSim.Framework | |||
133 | [XmlIgnore] private float _lightCutoff; | 133 | [XmlIgnore] private float _lightCutoff; |
134 | [XmlIgnore] private float _lightFalloff; | 134 | [XmlIgnore] private float _lightFalloff; |
135 | [XmlIgnore] private float _lightIntensity = 1.0f; | 135 | [XmlIgnore] private float _lightIntensity = 1.0f; |
136 | [XmlIgnore] private bool _flexiEntry; | 136 | |
137 | [XmlIgnore] private bool _lightEntry; | ||
138 | [XmlIgnore] private bool _sculptEntry; | ||
139 | 137 | ||
140 | // Light Projection Filter | 138 | // Light Projection Filter |
141 | [XmlIgnore] private bool _projectionEntry; | ||
142 | [XmlIgnore] private UUID _projectionTextureID; | 139 | [XmlIgnore] private UUID _projectionTextureID; |
143 | [XmlIgnore] private float _projectionFOV; | 140 | [XmlIgnore] private float _projectionFOV; |
144 | [XmlIgnore] private float _projectionFocus; | 141 | [XmlIgnore] private float _projectionFocus; |
145 | [XmlIgnore] private float _projectionAmb; | 142 | [XmlIgnore] private float _projectionAmb; |
146 | 143 | ||
144 | [XmlIgnore] private uint _meshFlags; | ||
145 | |||
146 | [XmlIgnore] private bool _flexiEntry; | ||
147 | [XmlIgnore] private bool _lightEntry; | ||
148 | [XmlIgnore] private bool _sculptEntry; | ||
149 | [XmlIgnore] private bool _projectionEntry; | ||
150 | [XmlIgnore] private bool _meshFlagsEntry; | ||
151 | |||
152 | public bool MeshFlagEntry | ||
153 | { | ||
154 | get { return _meshFlagsEntry;} | ||
155 | } | ||
147 | public byte ProfileCurve | 156 | public byte ProfileCurve |
148 | { | 157 | { |
149 | get { return (byte)((byte)HollowShape | (byte)ProfileShape); } | 158 | get { return (byte)((byte)HollowShape | (byte)ProfileShape); } |
@@ -1026,117 +1035,131 @@ namespace OpenSim.Framework | |||
1026 | { | 1035 | { |
1027 | // m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()"); | 1036 | // m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()"); |
1028 | 1037 | ||
1029 | ushort FlexiEP = 0x10; | 1038 | const byte FlexiEP = 0x10; |
1030 | ushort LightEP = 0x20; | 1039 | const byte LightEP = 0x20; |
1031 | ushort SculptEP = 0x30; | 1040 | const byte SculptEP = 0x30; |
1032 | ushort ProjectionEP = 0x40; | 1041 | const byte ProjectionEP = 0x40; |
1042 | //const byte MeshEP = 0x60; | ||
1043 | const byte MeshFlagsEP = 0x70; | ||
1033 | 1044 | ||
1034 | int i = 0; | 1045 | int TotalBytesLength = 1; // ExtraParamsNum |
1035 | uint TotalBytesLength = 1; // ExtraParamsNum | ||
1036 | 1046 | ||
1037 | uint ExtraParamsNum = 0; | 1047 | uint ExtraParamsNum = 0; |
1038 | if (_flexiEntry) | 1048 | if (_flexiEntry) |
1039 | { | 1049 | { |
1040 | ExtraParamsNum++; | 1050 | ExtraParamsNum++; |
1041 | TotalBytesLength += 16;// data | 1051 | TotalBytesLength += 16 + 2 + 4;// data |
1042 | TotalBytesLength += 2 + 4; // type | ||
1043 | } | 1052 | } |
1044 | 1053 | ||
1045 | if (_lightEntry) | 1054 | if (_lightEntry) |
1046 | { | 1055 | { |
1047 | ExtraParamsNum++; | 1056 | ExtraParamsNum++; |
1048 | TotalBytesLength += 16;// data | 1057 | TotalBytesLength += 16 + 2 + 4; // data |
1049 | TotalBytesLength += 2 + 4; // type | ||
1050 | } | 1058 | } |
1051 | 1059 | ||
1052 | if (_sculptEntry) | 1060 | if (_sculptEntry) |
1053 | { | 1061 | { |
1054 | ExtraParamsNum++; | 1062 | ExtraParamsNum++; |
1055 | TotalBytesLength += 17;// data | 1063 | TotalBytesLength += 17 + 2 + 4;// data |
1056 | TotalBytesLength += 2 + 4; // type | ||
1057 | } | 1064 | } |
1058 | 1065 | ||
1059 | if (_projectionEntry) | 1066 | if (_projectionEntry) |
1060 | { | 1067 | { |
1061 | ExtraParamsNum++; | 1068 | ExtraParamsNum++; |
1062 | TotalBytesLength += 28;// data | 1069 | TotalBytesLength += 28 + 2 + 4; // data |
1063 | TotalBytesLength += 2 + 4;// type | 1070 | } |
1071 | |||
1072 | if (_meshFlagsEntry) | ||
1073 | { | ||
1074 | ExtraParamsNum++; | ||
1075 | TotalBytesLength += 4 + 2 + 4; // data | ||
1064 | } | 1076 | } |
1077 | byte[] returnBytes = new byte[TotalBytesLength]; | ||
1065 | 1078 | ||
1066 | byte[] returnbytes = new byte[TotalBytesLength]; | 1079 | returnBytes[0] = (byte)ExtraParamsNum; |
1067 | 1080 | ||
1068 | // uint paramlength = ExtraParamsNum; | 1081 | if(ExtraParamsNum == 0) |
1082 | return returnBytes; | ||
1069 | 1083 | ||
1070 | // Stick in the number of parameters | 1084 | int i = 1; |
1071 | returnbytes[i++] = (byte)ExtraParamsNum; | ||
1072 | 1085 | ||
1073 | if (_flexiEntry) | 1086 | if (_flexiEntry) |
1074 | { | 1087 | { |
1075 | byte[] FlexiData = GetFlexiBytes(); | 1088 | returnBytes[i] = FlexiEP; // 2 bytes id code |
1089 | i += 2; | ||
1090 | returnBytes[i] = 16; // 4 bytes size | ||
1091 | i += 4; | ||
1076 | 1092 | ||
1077 | returnbytes[i++] = (byte)(FlexiEP % 256); | 1093 | // Softness is packed in the upper bits of tension and drag |
1078 | returnbytes[i++] = (byte)((FlexiEP >> 8) % 256); | 1094 | returnBytes[i] = (byte)((_flexiSoftness & 2) << 6); |
1095 | returnBytes[i + 1] = (byte)((_flexiSoftness & 1) << 7); | ||
1079 | 1096 | ||
1080 | returnbytes[i++] = (byte)(FlexiData.Length % 256); | 1097 | returnBytes[i++] |= (byte)((byte)(_flexiTension * 10.01f) & 0x7F); |
1081 | returnbytes[i++] = (byte)((FlexiData.Length >> 8) % 256); | 1098 | returnBytes[i++] |= (byte)((byte)(_flexiDrag * 10.01f) & 0x7F); |
1082 | returnbytes[i++] = (byte)((FlexiData.Length >> 16) % 256); | 1099 | returnBytes[i++] = (byte)((_flexiGravity + 10.0f) * 10.01f); |
1083 | returnbytes[i++] = (byte)((FlexiData.Length >> 24) % 256); | 1100 | returnBytes[i++] = (byte)(_flexiWind * 10.01f); |
1084 | Array.Copy(FlexiData, 0, returnbytes, i, FlexiData.Length); | 1101 | Utils.FloatToBytes(_flexiForceX, returnBytes, i); |
1085 | i += FlexiData.Length; | 1102 | Utils.FloatToBytes(_flexiForceY, returnBytes, i + 4); |
1103 | Utils.FloatToBytes(_flexiForceZ, returnBytes, i + 8); | ||
1104 | i += 12; | ||
1086 | } | 1105 | } |
1087 | 1106 | ||
1088 | if (_lightEntry) | 1107 | if (_lightEntry) |
1089 | { | 1108 | { |
1090 | byte[] LightData = GetLightBytes(); | 1109 | returnBytes[i] = LightEP; |
1091 | 1110 | i += 2; | |
1092 | returnbytes[i++] = (byte)(LightEP % 256); | 1111 | returnBytes[i] = 16; |
1093 | returnbytes[i++] = (byte)((LightEP >> 8) % 256); | 1112 | i += 4; |
1094 | 1113 | ||
1095 | returnbytes[i++] = (byte)(LightData.Length % 256); | 1114 | // Alpha channel in color is intensity |
1096 | returnbytes[i++] = (byte)((LightData.Length >> 8) % 256); | 1115 | Color4 tmpColor = new Color4(_lightColorR, _lightColorG, _lightColorB, _lightIntensity); |
1097 | returnbytes[i++] = (byte)((LightData.Length >> 16) % 256); | 1116 | tmpColor.GetBytes().CopyTo(returnBytes, i); |
1098 | returnbytes[i++] = (byte)((LightData.Length >> 24) % 256); | 1117 | Utils.FloatToBytes(_lightRadius, returnBytes, i + 4); |
1099 | Array.Copy(LightData, 0, returnbytes, i, LightData.Length); | 1118 | Utils.FloatToBytes(_lightCutoff, returnBytes, i + 8); |
1100 | i += LightData.Length; | 1119 | Utils.FloatToBytes(_lightFalloff, returnBytes, i + 12); |
1120 | i += 16; | ||
1101 | } | 1121 | } |
1102 | 1122 | ||
1103 | if (_sculptEntry) | 1123 | if (_sculptEntry) |
1104 | { | 1124 | { |
1105 | byte[] SculptData = GetSculptBytes(); | 1125 | //if(_sculptType == 5) |
1106 | 1126 | // returnBytes[i] = MeshEP; | |
1107 | returnbytes[i++] = (byte)(SculptEP % 256); | 1127 | //else |
1108 | returnbytes[i++] = (byte)((SculptEP >> 8) % 256); | 1128 | returnBytes[i] = SculptEP; |
1129 | i += 2; | ||
1130 | returnBytes[i] = 17; | ||
1131 | i += 4; | ||
1109 | 1132 | ||
1110 | returnbytes[i++] = (byte)(SculptData.Length % 256); | 1133 | _sculptTexture.GetBytes().CopyTo(returnBytes, i); |
1111 | returnbytes[i++] = (byte)((SculptData.Length >> 8) % 256); | 1134 | i += 16; |
1112 | returnbytes[i++] = (byte)((SculptData.Length >> 16) % 256); | 1135 | returnBytes[i++] = _sculptType; |
1113 | returnbytes[i++] = (byte)((SculptData.Length >> 24) % 256); | ||
1114 | Array.Copy(SculptData, 0, returnbytes, i, SculptData.Length); | ||
1115 | i += SculptData.Length; | ||
1116 | } | 1136 | } |
1117 | 1137 | ||
1118 | if (_projectionEntry) | 1138 | if (_projectionEntry) |
1119 | { | 1139 | { |
1120 | byte[] ProjectionData = GetProjectionBytes(); | 1140 | returnBytes[i] = ProjectionEP; |
1141 | i += 2; | ||
1142 | returnBytes[i] = 28; | ||
1143 | i += 4; | ||
1121 | 1144 | ||
1122 | returnbytes[i++] = (byte)(ProjectionEP % 256); | 1145 | _projectionTextureID.GetBytes().CopyTo(returnBytes, i); |
1123 | returnbytes[i++] = (byte)((ProjectionEP >> 8) % 256); | 1146 | Utils.FloatToBytes(_projectionFOV, returnBytes, i + 16); |
1124 | returnbytes[i++] = (byte)((ProjectionData.Length) % 256); | 1147 | Utils.FloatToBytes(_projectionFocus, returnBytes, i + 20); |
1125 | returnbytes[i++] = (byte)((ProjectionData.Length >> 16) % 256); | 1148 | Utils.FloatToBytes(_projectionAmb, returnBytes, i + 24); |
1126 | returnbytes[i++] = (byte)((ProjectionData.Length >> 20) % 256); | 1149 | i += 28; |
1127 | returnbytes[i++] = (byte)((ProjectionData.Length >> 24) % 256); | ||
1128 | Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length); | ||
1129 | i += ProjectionData.Length; | ||
1130 | } | 1150 | } |
1131 | 1151 | ||
1132 | if (!_flexiEntry && !_lightEntry && !_sculptEntry && !_projectionEntry) | 1152 | if (_meshFlagsEntry) |
1133 | { | 1153 | { |
1134 | byte[] returnbyte = new byte[1]; | 1154 | returnBytes[i] = MeshFlagsEP; |
1135 | returnbyte[0] = 0; | 1155 | i += 2; |
1136 | return returnbyte; | 1156 | returnBytes[i] = 4; |
1157 | i += 4; | ||
1158 | Utils.UIntToBytes(_meshFlags, returnBytes, i); | ||
1137 | } | 1159 | } |
1138 | 1160 | ||
1139 | return returnbytes; | 1161 | return returnBytes; |
1162 | |||
1140 | } | 1163 | } |
1141 | 1164 | ||
1142 | public void ReadInUpdateExtraParam(ushort type, bool inUse, byte[] data) | 1165 | public void ReadInUpdateExtraParam(ushort type, bool inUse, byte[] data) |
@@ -1145,6 +1168,8 @@ namespace OpenSim.Framework | |||
1145 | const ushort LightEP = 0x20; | 1168 | const ushort LightEP = 0x20; |
1146 | const ushort SculptEP = 0x30; | 1169 | const ushort SculptEP = 0x30; |
1147 | const ushort ProjectionEP = 0x40; | 1170 | const ushort ProjectionEP = 0x40; |
1171 | const ushort MeshEP = 0x60; | ||
1172 | const ushort MeshFlagsEP = 0x70; | ||
1148 | 1173 | ||
1149 | switch (type) | 1174 | switch (type) |
1150 | { | 1175 | { |
@@ -1166,6 +1191,7 @@ namespace OpenSim.Framework | |||
1166 | ReadLightData(data, 0); | 1191 | ReadLightData(data, 0); |
1167 | break; | 1192 | break; |
1168 | 1193 | ||
1194 | case MeshEP: | ||
1169 | case SculptEP: | 1195 | case SculptEP: |
1170 | if (!inUse) | 1196 | if (!inUse) |
1171 | { | 1197 | { |
@@ -1182,115 +1208,90 @@ namespace OpenSim.Framework | |||
1182 | } | 1208 | } |
1183 | ReadProjectionData(data, 0); | 1209 | ReadProjectionData(data, 0); |
1184 | break; | 1210 | break; |
1211 | case MeshFlagsEP: | ||
1212 | if (!inUse) | ||
1213 | { | ||
1214 | _meshFlagsEntry = false; | ||
1215 | return; | ||
1216 | } | ||
1217 | ReadMeshFlagsData(data, 0); | ||
1218 | break; | ||
1185 | } | 1219 | } |
1186 | } | 1220 | } |
1187 | 1221 | ||
1188 | public void ReadInExtraParamsBytes(byte[] data) | 1222 | public void ReadInExtraParamsBytes(byte[] data) |
1189 | { | 1223 | { |
1190 | if (data == null || data.Length == 1) | 1224 | if (data == null) |
1191 | return; | 1225 | return; |
1192 | 1226 | ||
1193 | const ushort FlexiEP = 0x10; | 1227 | _flexiEntry = false; |
1194 | const ushort LightEP = 0x20; | 1228 | _lightEntry = false; |
1195 | const ushort SculptEP = 0x30; | 1229 | _sculptEntry = false; |
1196 | const ushort ProjectionEP = 0x40; | 1230 | _projectionEntry = false; |
1231 | _meshFlagsEntry = false; | ||
1197 | 1232 | ||
1198 | bool lGotFlexi = false; | 1233 | if (data.Length == 1) |
1199 | bool lGotLight = false; | 1234 | return; |
1200 | bool lGotSculpt = false; | ||
1201 | bool lGotFilter = false; | ||
1202 | 1235 | ||
1203 | int i = 0; | 1236 | const byte FlexiEP = 0x10; |
1204 | byte extraParamCount = 0; | 1237 | const byte LightEP = 0x20; |
1205 | if (data.Length > 0) | 1238 | const byte SculptEP = 0x30; |
1206 | { | 1239 | const byte ProjectionEP = 0x40; |
1207 | extraParamCount = data[i++]; | 1240 | const byte MeshEP = 0x60; |
1208 | } | 1241 | const byte MeshFlagsEP = 0x70; |
1209 | 1242 | ||
1243 | byte extraParamCount = data[0]; | ||
1244 | int i = 1; | ||
1210 | for (int k = 0; k < extraParamCount; k++) | 1245 | for (int k = 0; k < extraParamCount; k++) |
1211 | { | 1246 | { |
1212 | ushort epType = Utils.BytesToUInt16(data, i); | 1247 | byte epType = data[i]; |
1213 | 1248 | i += 6; | |
1214 | i += 2; | ||
1215 | // uint paramLength = Helpers.BytesToUIntBig(data, i); | ||
1216 | 1249 | ||
1217 | i += 4; | ||
1218 | switch (epType) | 1250 | switch (epType) |
1219 | { | 1251 | { |
1220 | case FlexiEP: | 1252 | case FlexiEP: |
1221 | ReadFlexiData(data, i); | 1253 | ReadFlexiData(data, i); |
1222 | i += 16; | 1254 | i += 16; |
1223 | lGotFlexi = true; | ||
1224 | break; | 1255 | break; |
1225 | 1256 | ||
1226 | case LightEP: | 1257 | case LightEP: |
1227 | ReadLightData(data, i); | 1258 | ReadLightData(data, i); |
1228 | i += 16; | 1259 | i += 16; |
1229 | lGotLight = true; | ||
1230 | break; | 1260 | break; |
1231 | 1261 | ||
1262 | case MeshEP: | ||
1232 | case SculptEP: | 1263 | case SculptEP: |
1233 | ReadSculptData(data, i); | 1264 | ReadSculptData(data, i); |
1234 | i += 17; | 1265 | i += 17; |
1235 | lGotSculpt = true; | ||
1236 | break; | 1266 | break; |
1267 | |||
1237 | case ProjectionEP: | 1268 | case ProjectionEP: |
1238 | ReadProjectionData(data, i); | 1269 | ReadProjectionData(data, i); |
1239 | i += 28; | 1270 | i += 28; |
1240 | lGotFilter = true; | 1271 | break; |
1272 | |||
1273 | case MeshFlagsEP: | ||
1274 | ReadMeshFlagsData(data, i); | ||
1275 | i += 4; | ||
1241 | break; | 1276 | break; |
1242 | } | 1277 | } |
1243 | } | 1278 | } |
1244 | |||
1245 | if (!lGotFlexi) | ||
1246 | _flexiEntry = false; | ||
1247 | if (!lGotLight) | ||
1248 | _lightEntry = false; | ||
1249 | if (!lGotSculpt) | ||
1250 | _sculptEntry = false; | ||
1251 | if (!lGotFilter) | ||
1252 | _projectionEntry = false; | ||
1253 | } | 1279 | } |
1254 | 1280 | ||
1255 | public void ReadSculptData(byte[] data, int pos) | 1281 | public void ReadSculptData(byte[] data, int pos) |
1256 | { | 1282 | { |
1257 | UUID SculptUUID; | ||
1258 | byte SculptTypel; | ||
1259 | |||
1260 | if (data.Length-pos >= 17) | 1283 | if (data.Length-pos >= 17) |
1261 | { | 1284 | { |
1285 | _sculptTexture = new UUID(data, pos); | ||
1286 | _sculptType = data[pos + 16]; | ||
1262 | _sculptEntry = true; | 1287 | _sculptEntry = true; |
1263 | byte[] SculptTextureUUID = new byte[16]; | ||
1264 | SculptTypel = data[16 + pos]; | ||
1265 | Array.Copy(data, pos, SculptTextureUUID,0, 16); | ||
1266 | SculptUUID = new UUID(SculptTextureUUID, 0); | ||
1267 | } | 1288 | } |
1268 | else | 1289 | else |
1269 | { | 1290 | { |
1270 | _sculptEntry = false; | 1291 | _sculptEntry = false; |
1271 | SculptUUID = UUID.Zero; | 1292 | _sculptTexture = UUID.Zero; |
1272 | SculptTypel = 0x00; | 1293 | _sculptType = 0x00; |
1273 | } | ||
1274 | |||
1275 | if (_sculptEntry) | ||
1276 | { | ||
1277 | if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4) | ||
1278 | _sculptType = 4; | ||
1279 | } | 1294 | } |
1280 | |||
1281 | _sculptTexture = SculptUUID; | ||
1282 | _sculptType = SculptTypel; | ||
1283 | //m_log.Info("[SCULPT]:" + SculptUUID.ToString()); | ||
1284 | } | ||
1285 | |||
1286 | public byte[] GetSculptBytes() | ||
1287 | { | ||
1288 | byte[] data = new byte[17]; | ||
1289 | |||
1290 | _sculptTexture.GetBytes().CopyTo(data, 0); | ||
1291 | data[16] = (byte)_sculptType; | ||
1292 | |||
1293 | return data; | ||
1294 | } | 1295 | } |
1295 | 1296 | ||
1296 | public void ReadFlexiData(byte[] data, int pos) | 1297 | public void ReadFlexiData(byte[] data, int pos) |
@@ -1304,10 +1305,9 @@ namespace OpenSim.Framework | |||
1304 | _flexiDrag = (float)(data[pos++] & 0x7F) / 10.0f; | 1305 | _flexiDrag = (float)(data[pos++] & 0x7F) / 10.0f; |
1305 | _flexiGravity = (float)(data[pos++] / 10.0f) - 10.0f; | 1306 | _flexiGravity = (float)(data[pos++] / 10.0f) - 10.0f; |
1306 | _flexiWind = (float)data[pos++] / 10.0f; | 1307 | _flexiWind = (float)data[pos++] / 10.0f; |
1307 | Vector3 lForce = new Vector3(data, pos); | 1308 | _flexiForceX = Utils.BytesToFloat(data, pos); |
1308 | _flexiForceX = lForce.X; | 1309 | _flexiForceY = Utils.BytesToFloat(data, pos + 4); |
1309 | _flexiForceY = lForce.Y; | 1310 | _flexiForceZ = Utils.BytesToFloat(data, pos + 8); |
1310 | _flexiForceZ = lForce.Z; | ||
1311 | } | 1311 | } |
1312 | else | 1312 | else |
1313 | { | 1313 | { |
@@ -1324,25 +1324,6 @@ namespace OpenSim.Framework | |||
1324 | } | 1324 | } |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | public byte[] GetFlexiBytes() | ||
1328 | { | ||
1329 | byte[] data = new byte[16]; | ||
1330 | int i = 0; | ||
1331 | |||
1332 | // Softness is packed in the upper bits of tension and drag | ||
1333 | data[i] = (byte)((_flexiSoftness & 2) << 6); | ||
1334 | data[i + 1] = (byte)((_flexiSoftness & 1) << 7); | ||
1335 | |||
1336 | data[i++] |= (byte)((byte)(_flexiTension * 10.01f) & 0x7F); | ||
1337 | data[i++] |= (byte)((byte)(_flexiDrag * 10.01f) & 0x7F); | ||
1338 | data[i++] = (byte)((_flexiGravity + 10.0f) * 10.01f); | ||
1339 | data[i++] = (byte)(_flexiWind * 10.01f); | ||
1340 | Vector3 lForce = new Vector3(_flexiForceX, _flexiForceY, _flexiForceZ); | ||
1341 | lForce.GetBytes().CopyTo(data, i); | ||
1342 | |||
1343 | return data; | ||
1344 | } | ||
1345 | |||
1346 | public void ReadLightData(byte[] data, int pos) | 1327 | public void ReadLightData(byte[] data, int pos) |
1347 | { | 1328 | { |
1348 | if (data.Length - pos >= 16) | 1329 | if (data.Length - pos >= 16) |
@@ -1373,31 +1354,12 @@ namespace OpenSim.Framework | |||
1373 | } | 1354 | } |
1374 | } | 1355 | } |
1375 | 1356 | ||
1376 | public byte[] GetLightBytes() | ||
1377 | { | ||
1378 | byte[] data = new byte[16]; | ||
1379 | |||
1380 | // Alpha channel in color is intensity | ||
1381 | Color4 tmpColor = new Color4(_lightColorR,_lightColorG,_lightColorB,_lightIntensity); | ||
1382 | |||
1383 | tmpColor.GetBytes().CopyTo(data, 0); | ||
1384 | Utils.FloatToBytes(_lightRadius).CopyTo(data, 4); | ||
1385 | Utils.FloatToBytes(_lightCutoff).CopyTo(data, 8); | ||
1386 | Utils.FloatToBytes(_lightFalloff).CopyTo(data, 12); | ||
1387 | |||
1388 | return data; | ||
1389 | } | ||
1390 | |||
1391 | public void ReadProjectionData(byte[] data, int pos) | 1357 | public void ReadProjectionData(byte[] data, int pos) |
1392 | { | 1358 | { |
1393 | byte[] ProjectionTextureUUID = new byte[16]; | ||
1394 | |||
1395 | if (data.Length - pos >= 28) | 1359 | if (data.Length - pos >= 28) |
1396 | { | 1360 | { |
1397 | _projectionEntry = true; | 1361 | _projectionEntry = true; |
1398 | Array.Copy(data, pos, ProjectionTextureUUID,0, 16); | 1362 | _projectionTextureID = new UUID(data, pos); |
1399 | _projectionTextureID = new UUID(ProjectionTextureUUID, 0); | ||
1400 | |||
1401 | _projectionFOV = Utils.BytesToFloat(data, pos + 16); | 1363 | _projectionFOV = Utils.BytesToFloat(data, pos + 16); |
1402 | _projectionFocus = Utils.BytesToFloat(data, pos + 20); | 1364 | _projectionFocus = Utils.BytesToFloat(data, pos + 20); |
1403 | _projectionAmb = Utils.BytesToFloat(data, pos + 24); | 1365 | _projectionAmb = Utils.BytesToFloat(data, pos + 24); |
@@ -1412,19 +1374,20 @@ namespace OpenSim.Framework | |||
1412 | } | 1374 | } |
1413 | } | 1375 | } |
1414 | 1376 | ||
1415 | public byte[] GetProjectionBytes() | 1377 | public void ReadMeshFlagsData(byte[] data, int pos) |
1416 | { | 1378 | { |
1417 | byte[] data = new byte[28]; | 1379 | if (data.Length - pos >= 4) |
1418 | 1380 | { | |
1419 | _projectionTextureID.GetBytes().CopyTo(data, 0); | 1381 | _meshFlagsEntry = true; |
1420 | Utils.FloatToBytes(_projectionFOV).CopyTo(data, 16); | 1382 | _meshFlags = Utils.BytesToUInt(data, pos); |
1421 | Utils.FloatToBytes(_projectionFocus).CopyTo(data, 20); | 1383 | } |
1422 | Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24); | 1384 | else |
1423 | 1385 | { | |
1424 | return data; | 1386 | _meshFlagsEntry = true; |
1387 | _meshFlags = 0; | ||
1388 | } | ||
1425 | } | 1389 | } |
1426 | 1390 | ||
1427 | |||
1428 | /// <summary> | 1391 | /// <summary> |
1429 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values | 1392 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values |
1430 | /// </summary> | 1393 | /// </summary> |
@@ -1436,7 +1399,6 @@ namespace OpenSim.Framework | |||
1436 | new Quaternion(0.0f, 0.0f, 0.0f, 1.0f)); | 1399 | new Quaternion(0.0f, 0.0f, 0.0f, 1.0f)); |
1437 | } | 1400 | } |
1438 | 1401 | ||
1439 | |||
1440 | /// <summary> | 1402 | /// <summary> |
1441 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values | 1403 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values |
1442 | /// </summary> | 1404 | /// </summary> |
@@ -1595,8 +1557,6 @@ namespace OpenSim.Framework | |||
1595 | { | 1557 | { |
1596 | using (XmlTextReader xtr = new XmlTextReader(sr)) | 1558 | using (XmlTextReader xtr = new XmlTextReader(sr)) |
1597 | { | 1559 | { |
1598 | xtr.ProhibitDtd = true; | ||
1599 | |||
1600 | xtr.MoveToContent(); | 1560 | xtr.MoveToContent(); |
1601 | 1561 | ||
1602 | string type = xtr.GetAttribute("type"); | 1562 | string type = xtr.GetAttribute("type"); |