aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs97
1 files changed, 30 insertions, 67 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 49745bc..664208e 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -1082,8 +1082,9 @@ namespace OpenSim.Framework
1082 returnBytes[i++] |= (byte)((byte)(_flexiDrag * 10.01f) & 0x7F); 1082 returnBytes[i++] |= (byte)((byte)(_flexiDrag * 10.01f) & 0x7F);
1083 returnBytes[i++] = (byte)((_flexiGravity + 10.0f) * 10.01f); 1083 returnBytes[i++] = (byte)((_flexiGravity + 10.0f) * 10.01f);
1084 returnBytes[i++] = (byte)(_flexiWind * 10.01f); 1084 returnBytes[i++] = (byte)(_flexiWind * 10.01f);
1085 Vector3 lForce = new Vector3(_flexiForceX, _flexiForceY, _flexiForceZ); 1085 Utils.FloatToBytes(_flexiForceX, returnBytes, i);
1086 lForce.GetBytes().CopyTo(returnBytes, i); 1086 Utils.FloatToBytes(_flexiForceY, returnBytes, i + 4);
1087 Utils.FloatToBytes(_flexiForceZ, returnBytes, i + 8);
1087 i += 12; 1088 i += 12;
1088 } 1089 }
1089 1090
@@ -1097,9 +1098,9 @@ namespace OpenSim.Framework
1097 // Alpha channel in color is intensity 1098 // Alpha channel in color is intensity
1098 Color4 tmpColor = new Color4(_lightColorR, _lightColorG, _lightColorB, _lightIntensity); 1099 Color4 tmpColor = new Color4(_lightColorR, _lightColorG, _lightColorB, _lightIntensity);
1099 tmpColor.GetBytes().CopyTo(returnBytes, i); 1100 tmpColor.GetBytes().CopyTo(returnBytes, i);
1100 Utils.FloatToBytes(_lightRadius).CopyTo(returnBytes, i + 4); 1101 Utils.FloatToBytes(_lightRadius, returnBytes, i + 4);
1101 Utils.FloatToBytes(_lightCutoff).CopyTo(returnBytes, i + 8); 1102 Utils.FloatToBytes(_lightCutoff, returnBytes, i + 8);
1102 Utils.FloatToBytes(_lightFalloff).CopyTo(returnBytes, i + 12); 1103 Utils.FloatToBytes(_lightFalloff, returnBytes, i + 12);
1103 i += 16; 1104 i += 16;
1104 } 1105 }
1105 1106
@@ -1179,100 +1180,67 @@ namespace OpenSim.Framework
1179 1180
1180 public void ReadInExtraParamsBytes(byte[] data) 1181 public void ReadInExtraParamsBytes(byte[] data)
1181 { 1182 {
1182 if (data == null || data.Length == 1) 1183 if (data == null)
1183 return; 1184 return;
1184 1185
1185 const ushort FlexiEP = 0x10; 1186 _flexiEntry = false;
1186 const ushort LightEP = 0x20; 1187 _lightEntry = false;
1187 const ushort SculptEP = 0x30; 1188 _sculptEntry = false;
1188 const ushort ProjectionEP = 0x40; 1189 _projectionEntry = false;
1189 1190
1190 bool lGotFlexi = false; 1191 if (data.Length == 1)
1191 bool lGotLight = false; 1192 return;
1192 bool lGotSculpt = false;
1193 bool lGotFilter = false;
1194 1193
1195 int i = 0; 1194 const byte FlexiEP = 0x10;
1196 byte extraParamCount = 0; 1195 const byte LightEP = 0x20;
1197 if (data.Length > 0) 1196 const byte SculptEP = 0x30;
1198 { 1197 const byte ProjectionEP = 0x40;
1199 extraParamCount = data[i++];
1200 }
1201 1198
1199 byte extraParamCount = data[0];
1200 int i = 1;
1202 for (int k = 0; k < extraParamCount; k++) 1201 for (int k = 0; k < extraParamCount; k++)
1203 { 1202 {
1204 ushort epType = Utils.BytesToUInt16(data, i); 1203 byte epType = data[i];
1205 1204 i += 6;
1206 i += 2;
1207 // uint paramLength = Helpers.BytesToUIntBig(data, i);
1208 1205
1209 i += 4;
1210 switch (epType) 1206 switch (epType)
1211 { 1207 {
1212 case FlexiEP: 1208 case FlexiEP:
1213 ReadFlexiData(data, i); 1209 ReadFlexiData(data, i);
1214 i += 16; 1210 i += 16;
1215 lGotFlexi = true;
1216 break; 1211 break;
1217 1212
1218 case LightEP: 1213 case LightEP:
1219 ReadLightData(data, i); 1214 ReadLightData(data, i);
1220 i += 16; 1215 i += 16;
1221 lGotLight = true;
1222 break; 1216 break;
1223 1217
1224 case SculptEP: 1218 case SculptEP:
1225 ReadSculptData(data, i); 1219 ReadSculptData(data, i);
1226 i += 17; 1220 i += 17;
1227 lGotSculpt = true;
1228 break; 1221 break;
1229 case ProjectionEP: 1222 case ProjectionEP:
1230 ReadProjectionData(data, i); 1223 ReadProjectionData(data, i);
1231 i += 28; 1224 i += 28;
1232 lGotFilter = true;
1233 break; 1225 break;
1234 } 1226 }
1235 } 1227 }
1236
1237 if (!lGotFlexi)
1238 _flexiEntry = false;
1239 if (!lGotLight)
1240 _lightEntry = false;
1241 if (!lGotSculpt)
1242 _sculptEntry = false;
1243 if (!lGotFilter)
1244 _projectionEntry = false;
1245 } 1228 }
1246 1229
1247 public void ReadSculptData(byte[] data, int pos) 1230 public void ReadSculptData(byte[] data, int pos)
1248 { 1231 {
1249 UUID SculptUUID;
1250 byte SculptTypel;
1251
1252 if (data.Length-pos >= 17) 1232 if (data.Length-pos >= 17)
1253 { 1233 {
1254 _sculptEntry = true; 1234 _sculptTexture = new UUID(data, pos);
1255 byte[] SculptTextureUUID = new byte[16]; 1235 _sculptType = data[pos + 16];
1256 SculptTypel = data[16 + pos]; 1236 _sculptEntry = (_sculptType != 0);
1257 Array.Copy(data, pos, SculptTextureUUID,0, 16);
1258 SculptUUID = new UUID(SculptTextureUUID, 0);
1259 } 1237 }
1260 else 1238 else
1261 { 1239 {
1262 _sculptEntry = false; 1240 _sculptEntry = false;
1263 SculptUUID = UUID.Zero; 1241 _sculptTexture = UUID.Zero;
1264 SculptTypel = 0x00; 1242 _sculptType = 0x00;
1265 } 1243 }
1266
1267 if (_sculptEntry)
1268 {
1269 if (_sculptType != (byte)1 && _sculptType != (byte)2 && _sculptType != (byte)3 && _sculptType != (byte)4)
1270 _sculptType = 4;
1271 }
1272
1273 _sculptTexture = SculptUUID;
1274 _sculptType = SculptTypel;
1275 //m_log.Info("[SCULPT]:" + SculptUUID.ToString());
1276 } 1244 }
1277 1245
1278 public void ReadFlexiData(byte[] data, int pos) 1246 public void ReadFlexiData(byte[] data, int pos)
@@ -1286,10 +1254,9 @@ namespace OpenSim.Framework
1286 _flexiDrag = (float)(data[pos++] & 0x7F) / 10.0f; 1254 _flexiDrag = (float)(data[pos++] & 0x7F) / 10.0f;
1287 _flexiGravity = (float)(data[pos++] / 10.0f) - 10.0f; 1255 _flexiGravity = (float)(data[pos++] / 10.0f) - 10.0f;
1288 _flexiWind = (float)data[pos++] / 10.0f; 1256 _flexiWind = (float)data[pos++] / 10.0f;
1289 Vector3 lForce = new Vector3(data, pos); 1257 _flexiForceX = Utils.BytesToFloat(data, pos);
1290 _flexiForceX = lForce.X; 1258 _flexiForceY = Utils.BytesToFloat(data, pos + 4);
1291 _flexiForceY = lForce.Y; 1259 _flexiForceZ = Utils.BytesToFloat(data, pos + 8);
1292 _flexiForceZ = lForce.Z;
1293 } 1260 }
1294 else 1261 else
1295 { 1262 {
@@ -1338,14 +1305,10 @@ namespace OpenSim.Framework
1338 1305
1339 public void ReadProjectionData(byte[] data, int pos) 1306 public void ReadProjectionData(byte[] data, int pos)
1340 { 1307 {
1341 byte[] ProjectionTextureUUID = new byte[16];
1342
1343 if (data.Length - pos >= 28) 1308 if (data.Length - pos >= 28)
1344 { 1309 {
1345 _projectionEntry = true; 1310 _projectionEntry = true;
1346 Array.Copy(data, pos, ProjectionTextureUUID,0, 16); 1311 _projectionTextureID = new UUID(data, pos);
1347 _projectionTextureID = new UUID(ProjectionTextureUUID, 0);
1348
1349 _projectionFOV = Utils.BytesToFloat(data, pos + 16); 1312 _projectionFOV = Utils.BytesToFloat(data, pos + 16);
1350 _projectionFocus = Utils.BytesToFloat(data, pos + 20); 1313 _projectionFocus = Utils.BytesToFloat(data, pos + 20);
1351 _projectionAmb = Utils.BytesToFloat(data, pos + 24); 1314 _projectionAmb = Utils.BytesToFloat(data, pos + 24);