aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorUbitUmarov2019-03-23 23:32:39 +0000
committerUbitUmarov2019-03-23 23:32:39 +0000
commit33986aea5e2ced1be33ef3b8d5c361742b17c427 (patch)
tree47f74bce71671cda0bf50dd30f9ccc5de2b5ec2f /OpenSim/Region/ClientStack
parentfix particles encoding on compressedupdate (diff)
downloadopensim-SC-33986aea5e2ced1be33ef3b8d5c361742b17c427.zip
opensim-SC-33986aea5e2ced1be33ef3b8d5c361742b17c427.tar.gz
opensim-SC-33986aea5e2ced1be33ef3b8d5c361742b17c427.tar.bz2
opensim-SC-33986aea5e2ced1be33ef3b8d5c361742b17c427.tar.xz
mantis 8506: parse highlod mesh and compare its number of prim faces to the number of faces provided and warn mismatch
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs35
1 files changed, 29 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
index eb1ab45..e293463 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
@@ -129,6 +129,7 @@ namespace OpenSim.Region.ClientStack.Linden
129 public int medLODSize; 129 public int medLODSize;
130 public int lowLODSize; 130 public int lowLODSize;
131 public int lowestLODSize; 131 public int lowestLODSize;
132 public int highLODsides;
132 // normalized fee based on compressed data sizes 133 // normalized fee based on compressed data sizes
133 public float costFee; 134 public float costFee;
134 // physics cost 135 // physics cost
@@ -209,7 +210,7 @@ namespace OpenSim.Region.ClientStack.Linden
209 ameshCostParam curCost = new ameshCostParam(); 210 ameshCostParam curCost = new ameshCostParam();
210 byte[] data = (byte[])resources.mesh_list.Array[i]; 211 byte[] data = (byte[])resources.mesh_list.Array[i];
211 212
212 if (!MeshCost(data, curCost,out curskeleton, out curAvatarPhys, out error)) 213 if (!MeshCost(data, curCost, out curskeleton, out curAvatarPhys, out error))
213 { 214 {
214 return false; 215 return false;
215 } 216 }
@@ -259,6 +260,11 @@ namespace OpenSim.Region.ClientStack.Linden
259 error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale"; 260 error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale";
260 return false; 261 return false;
261 } 262 }
263 int nfaces = 0;
264 if(inst.Contains("face_list"))
265 {
266 nfaces = ((ArrayList)inst["face_list"]).Count;
267 }
262 268
263 if (haveMeshs && inst.ContainsKey("mesh")) 269 if (haveMeshs && inst.ContainsKey("mesh"))
264 { 270 {
@@ -275,6 +281,9 @@ namespace OpenSim.Region.ClientStack.Linden
275 float sqdiam = scale.LengthSquared(); 281 float sqdiam = scale.LengthSquared();
276 282
277 ameshCostParam curCost = meshsCosts[mesh]; 283 ameshCostParam curCost = meshsCosts[mesh];
284 if(nfaces != curCost.highLODsides)
285 warning +="Warning: Uploaded number of faces ( "+ nfaces.ToString() +" ) does not match highlod number of faces ( "+ curCost.highLODsides.ToString() +" )\n";
286
278 float mesh_streaming = streamingCost(curCost, sqdiam); 287 float mesh_streaming = streamingCost(curCost, sqdiam);
279 288
280 meshcostdata.model_streaming_cost += mesh_streaming; 289 meshcostdata.model_streaming_cost += mesh_streaming;
@@ -339,6 +348,7 @@ namespace OpenSim.Region.ClientStack.Linden
339 private bool MeshCost(byte[] data, ameshCostParam cost,out bool skeleton, out bool avatarPhys, out string error) 348 private bool MeshCost(byte[] data, ameshCostParam cost,out bool skeleton, out bool avatarPhys, out string error)
340 { 349 {
341 cost.highLODSize = 0; 350 cost.highLODSize = 0;
351 cost.highLODsides = 0;
342 cost.medLODSize = 0; 352 cost.medLODSize = 0;
343 cost.lowLODSize = 0; 353 cost.lowLODSize = 0;
344 cost.lowestLODSize = 0; 354 cost.lowestLODSize = 0;
@@ -430,7 +440,8 @@ namespace OpenSim.Region.ClientStack.Linden
430 440
431 submesh_offset = -1; 441 submesh_offset = -1;
432 442
433 // only look for LOD meshs sizes 443 int nsides = 0;
444 int lod_ntriangles = 0;
434 445
435 if (map.ContainsKey("high_lod")) 446 if (map.ContainsKey("high_lod"))
436 { 447 {
@@ -440,6 +451,15 @@ namespace OpenSim.Region.ClientStack.Linden
440 submesh_offset = tmpmap["offset"].AsInteger() + start; 451 submesh_offset = tmpmap["offset"].AsInteger() + start;
441 if (tmpmap.ContainsKey("size")) 452 if (tmpmap.ContainsKey("size"))
442 highlod_size = tmpmap["size"].AsInteger(); 453 highlod_size = tmpmap["size"].AsInteger();
454
455 if (submesh_offset >= 0 && highlod_size > 0)
456 {
457 if (!submesh(data, submesh_offset, highlod_size, out lod_ntriangles, out nsides))
458 {
459 error = "Model data parsing error";
460 return false;
461 }
462 }
443 } 463 }
444 464
445 if (submesh_offset < 0 || highlod_size <= 0) 465 if (submesh_offset < 0 || highlod_size <= 0)
@@ -483,6 +503,7 @@ namespace OpenSim.Region.ClientStack.Linden
483 } 503 }
484 504
485 cost.highLODSize = highlod_size; 505 cost.highLODSize = highlod_size;
506 cost.highLODsides = nsides;
486 cost.medLODSize = medlod_size; 507 cost.medLODSize = medlod_size;
487 cost.lowLODSize = lowlod_size; 508 cost.lowLODSize = lowlod_size;
488 cost.lowestLODSize = lowestlod_size; 509 cost.lowestLODSize = lowestlod_size;
@@ -495,6 +516,7 @@ namespace OpenSim.Region.ClientStack.Linden
495 else if (map.ContainsKey("physics_shape")) // old naming 516 else if (map.ContainsKey("physics_shape")) // old naming
496 tmpmap = (OSDMap)map["physics_shape"]; 517 tmpmap = (OSDMap)map["physics_shape"];
497 518
519 int phys_nsides = 0;
498 if(tmpmap != null) 520 if(tmpmap != null)
499 { 521 {
500 if (tmpmap.ContainsKey("offset")) 522 if (tmpmap.ContainsKey("offset"))
@@ -502,10 +524,9 @@ namespace OpenSim.Region.ClientStack.Linden
502 if (tmpmap.ContainsKey("size")) 524 if (tmpmap.ContainsKey("size"))
503 physmesh_size = tmpmap["size"].AsInteger(); 525 physmesh_size = tmpmap["size"].AsInteger();
504 526
505 if (submesh_offset >= 0 || physmesh_size > 0) 527 if (submesh_offset >= 0 && physmesh_size > 0)
506 { 528 {
507 529 if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles, out phys_nsides))
508 if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles))
509 { 530 {
510 error = "Model data parsing error"; 531 error = "Model data parsing error";
511 return false; 532 return false;
@@ -541,9 +562,10 @@ namespace OpenSim.Region.ClientStack.Linden
541 } 562 }
542 563
543 // parses a LOD or physics mesh component 564 // parses a LOD or physics mesh component
544 private bool submesh(byte[] data, int offset, int size, out int ntriangles) 565 private bool submesh(byte[] data, int offset, int size, out int ntriangles, out int nsides)
545 { 566 {
546 ntriangles = 0; 567 ntriangles = 0;
568 nsides = 0;
547 569
548 OSD decodedMeshOsd = new OSD(); 570 OSD decodedMeshOsd = new OSD();
549 byte[] meshBytes = new byte[size]; 571 byte[] meshBytes = new byte[size];
@@ -599,6 +621,7 @@ namespace OpenSim.Region.ClientStack.Linden
599 } 621 }
600 else 622 else
601 return false; 623 return false;
624 nsides++;
602 } 625 }
603 } 626 }
604 627