aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs51
1 files changed, 31 insertions, 20 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
index da701ba..66bb429 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
@@ -31,7 +31,7 @@ namespace OpenSim.Region.ClientStack.Linden
31 public class ModelCost 31 public class ModelCost
32 { 32 {
33 33
34 // upload fee tunning paramenters 34 // upload fee defaults
35 // fees are normalized to 1.0 35 // fees are normalized to 1.0
36 // this parameters scale them to basic cost ( so 1.0 translates to 10 ) 36 // this parameters scale them to basic cost ( so 1.0 translates to 10 )
37 37
@@ -42,7 +42,6 @@ namespace OpenSim.Region.ClientStack.Linden
42 42
43 public float ModelTextureCostFactor = 1.00f; // keep full price because texture price 43 public float ModelTextureCostFactor = 1.00f; // keep full price because texture price
44 // is based on it's storage needs not on usability 44 // is based on it's storage needs not on usability
45
46 // itens costs in normalized values 45 // itens costs in normalized values
47 // ie will be multiplied by basicCost and factors above 46 // ie will be multiplied by basicCost and factors above
48 const float primCreationCost = 0.002f; // extra cost for each prim creation overhead 47 const float primCreationCost = 0.002f; // extra cost for each prim creation overhead
@@ -100,7 +99,8 @@ namespace OpenSim.Region.ClientStack.Linden
100 // basicCost input region assets upload cost 99 // basicCost input region assets upload cost
101 // totalcost returns model total upload fee 100 // totalcost returns model total upload fee
102 // meshcostdata returns detailed costs for viewer 101 // meshcostdata returns detailed costs for viewer
103 public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, LLSDAssetUploadResponseData meshcostdata, out string error) 102 public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost,
103 LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning)
104 { 104 {
105 totalcost = 0; 105 totalcost = 0;
106 error = string.Empty; 106 error = string.Empty;
@@ -109,7 +109,7 @@ namespace OpenSim.Region.ClientStack.Linden
109 resources.instance_list == null || 109 resources.instance_list == null ||
110 resources.instance_list.Array.Count == 0) 110 resources.instance_list.Array.Count == 0)
111 { 111 {
112 error = "Unable to upload mesh model. missing information."; 112 error = "missing model information.";
113 return false; 113 return false;
114 } 114 }
115 115
@@ -117,7 +117,7 @@ namespace OpenSim.Region.ClientStack.Linden
117 117
118 if( numberInstances > ObjectLinkedPartsMax ) 118 if( numberInstances > ObjectLinkedPartsMax )
119 { 119 {
120 error = "upload failed: Model whould have two many linked prims"; 120 error = "Model whould have more than " + ObjectLinkedPartsMax.ToString() + " linked prims";
121 return false; 121 return false;
122 } 122 }
123 123
@@ -190,15 +190,13 @@ namespace OpenSim.Region.ClientStack.Linden
190 190
191 if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin) 191 if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin)
192 { 192 {
193// error = " upload fail: Model contains parts with a dimension lower than 0.001. Please adjust scaling";
194// return false;
195 skipedSmall++; 193 skipedSmall++;
196 continue; 194 continue;
197 } 195 }
198 196
199 if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax) 197 if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax)
200 { 198 {
201 error = "upload fail: Model contains parts larger than maximum allowed. Please adjust scaling"; 199 error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale";
202 return false; 200 return false;
203 } 201 }
204 202
@@ -208,7 +206,7 @@ namespace OpenSim.Region.ClientStack.Linden
208 206
209 if (mesh >= numberMeshs) 207 if (mesh >= numberMeshs)
210 { 208 {
211 error = "Unable to upload mesh model. incoerent information."; 209 error = "Incoerent model information.";
212 return false; 210 return false;
213 } 211 }
214 212
@@ -235,10 +233,18 @@ namespace OpenSim.Region.ClientStack.Linden
235 meshsfee += primCreationCost; 233 meshsfee += primCreationCost;
236 } 234 }
237 235
238 if (skipedSmall >0 && skipedSmall > numberInstances / 2) 236 if (skipedSmall > 0)
239 { 237 {
240 error = "Upload failed: Model contains too much prims smaller than minimum size to ignore"; 238 if (skipedSmall > numberInstances / 2)
241 return false; 239 {
240 error = "Model contains too many prims smaller than " + PrimScaleMin.ToString() +
241 "m minimum allowed size. Please check scalling";
242 return false;
243 }
244 else
245 warning += skipedSmall.ToString() + " of the requested " +numberInstances.ToString() +
246 " model prims will not upload because they are smaller than " + PrimScaleMin.ToString() +
247 "m minimum allowed size. Please check scalling ";
242 } 248 }
243 249
244 if (meshcostdata.physics_cost <= meshcostdata.model_streaming_cost) 250 if (meshcostdata.physics_cost <= meshcostdata.model_streaming_cost)
@@ -283,14 +289,14 @@ namespace OpenSim.Region.ClientStack.Linden
283 289
284 if (data == null || data.Length == 0) 290 if (data == null || data.Length == 0)
285 { 291 {
286 error = "Unable to upload mesh model. missing information."; 292 error = "Missing model information.";
287 return false; 293 return false;
288 } 294 }
289 295
290 OSD meshOsd = null; 296 OSD meshOsd = null;
291 int start = 0; 297 int start = 0;
292 298
293 error = "Unable to upload mesh model. Invalid data"; 299 error = "Invalid model data";
294 300
295 using (MemoryStream ms = new MemoryStream(data)) 301 using (MemoryStream ms = new MemoryStream(data))
296 { 302 {
@@ -338,13 +344,13 @@ namespace OpenSim.Region.ClientStack.Linden
338 344
339 if (submesh_offset < 0 || hulls_size == 0) 345 if (submesh_offset < 0 || hulls_size == 0)
340 { 346 {
341 error = "Unable to upload mesh model. missing physics_convex block"; 347 error = "Missing physics_convex block";
342 return false; 348 return false;
343 } 349 }
344 350
345 if (!hulls(data, submesh_offset, hulls_size, out phys_hullsvertices, out phys_nhulls)) 351 if (!hulls(data, submesh_offset, hulls_size, out phys_hullsvertices, out phys_nhulls))
346 { 352 {
347 error = "Unable to upload mesh model. bad physics_convex block"; 353 error = "Bad physics_convex block";
348 return false; 354 return false;
349 } 355 }
350 356
@@ -364,7 +370,7 @@ namespace OpenSim.Region.ClientStack.Linden
364 370
365 if (submesh_offset < 0 || highlod_size <= 0) 371 if (submesh_offset < 0 || highlod_size <= 0)
366 { 372 {
367 error = "Unable to upload mesh model. missing high_lod"; 373 error = "Missing high_lod block";
368 return false; 374 return false;
369 } 375 }
370 376
@@ -409,9 +415,14 @@ namespace OpenSim.Region.ClientStack.Linden
409 415
410 submesh_offset = -1; 416 submesh_offset = -1;
411 417
412 if (map.ContainsKey("physics_mesh")) 418 tmpmap = null;
413 { 419 if(map.ContainsKey("physics_mesh"))
414 tmpmap = (OSDMap)map["physics_mesh"]; 420 tmpmap = (OSDMap)map["physics_mesh"];
421 else if (map.ContainsKey("physics_shape")) // old naming
422 tmpmap = (OSDMap)map["physics_shape"];
423
424 if(tmpmap != null)
425 {
415 if (tmpmap.ContainsKey("offset")) 426 if (tmpmap.ContainsKey("offset"))
416 submesh_offset = tmpmap["offset"].AsInteger() + start; 427 submesh_offset = tmpmap["offset"].AsInteger() + start;
417 if (tmpmap.ContainsKey("size")) 428 if (tmpmap.ContainsKey("size"))
@@ -422,7 +433,7 @@ namespace OpenSim.Region.ClientStack.Linden
422 433
423 if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles)) 434 if (!submesh(data, submesh_offset, physmesh_size, out phys_ntriangles))
424 { 435 {
425 error = "Unable to upload mesh model. parsing error"; 436 error = "Model data parsing error";
426 return false; 437 return false;
427 } 438 }
428 } 439 }