diff options
author | UbitUmarov | 2012-09-17 15:37:05 +0100 |
---|---|---|
committer | UbitUmarov | 2012-09-17 15:37:05 +0100 |
commit | 5915dfc26f0fe02411588ddea2791d69cb67d1ed (patch) | |
tree | 155df84fb23cf8c4d7d66bbd57bd6aea63ac3701 /OpenSim/Region | |
parent | fix build (diff) | |
download | opensim-SC-5915dfc26f0fe02411588ddea2791d69cb67d1ed.zip opensim-SC-5915dfc26f0fe02411588ddea2791d69cb67d1ed.tar.gz opensim-SC-5915dfc26f0fe02411588ddea2791d69cb67d1ed.tar.bz2 opensim-SC-5915dfc26f0fe02411588ddea2791d69cb67d1ed.tar.xz |
Make use of mesh cost functions
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 29 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | 8 |
2 files changed, 13 insertions, 24 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 580c005..ce3ca8b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -429,6 +429,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
429 | //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); | 429 | //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); |
430 | 430 | ||
431 | uint cost = 0; | 431 | uint cost = 0; |
432 | LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); | ||
432 | 433 | ||
433 | if (llsdRequest.asset_type == "texture" || | 434 | if (llsdRequest.asset_type == "texture" || |
434 | llsdRequest.asset_type == "animation" || | 435 | llsdRequest.asset_type == "animation" || |
@@ -467,11 +468,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
467 | 468 | ||
468 | if (llsdRequest.asset_type == "mesh") | 469 | if (llsdRequest.asset_type == "mesh") |
469 | { | 470 | { |
470 | cost += 20; // Constant for now to test showing a price | 471 | string error; |
472 | int modelcost; | ||
473 | ModelCost mc = new ModelCost(); | ||
471 | 474 | ||
472 | if (llsdRequest.asset_resources == null) | 475 | if (!mc.MeshModelCost(llsdRequest.asset_resources, mm.UploadCharge, out modelcost, |
476 | meshcostdata, out error)) | ||
473 | { | 477 | { |
474 | client.SendAgentAlertMessage("Unable to upload asset. missing information.", false); | 478 | |
479 | client.SendAgentAlertMessage(error, false); | ||
475 | 480 | ||
476 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | 481 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
477 | errorResponse.uploader = ""; | 482 | errorResponse.uploader = ""; |
@@ -479,10 +484,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
479 | return errorResponse; | 484 | return errorResponse; |
480 | } | 485 | } |
481 | 486 | ||
482 | uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count; | 487 | cost = (uint)modelcost; |
483 | textures_cost *= (uint)mm.UploadCharge; | ||
484 | |||
485 | cost += textures_cost; | ||
486 | } | 488 | } |
487 | else | 489 | else |
488 | { | 490 | { |
@@ -536,20 +538,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
536 | uploadResponse.state = "upload"; | 538 | uploadResponse.state = "upload"; |
537 | uploadResponse.upload_price = (int)cost; | 539 | uploadResponse.upload_price = (int)cost; |
538 | 540 | ||
539 | // use fake values for now | ||
540 | if (llsdRequest.asset_type == "mesh") | 541 | if (llsdRequest.asset_type == "mesh") |
541 | { | 542 | { |
542 | uploadResponse.data = new LLSDAssetUploadResponseData(); | 543 | uploadResponse.data = meshcostdata; |
543 | uploadResponse.data.model_streaming_cost = 1.0; | ||
544 | uploadResponse.data.simulation_cost = 1.5; | ||
545 | |||
546 | uploadResponse.data.physics_cost = 2.0; | ||
547 | uploadResponse.data.resource_cost = 3.0; | ||
548 | uploadResponse.data.upload_price_breakdown.mesh_instance = 1; | ||
549 | uploadResponse.data.upload_price_breakdown.mesh_physics = 2; | ||
550 | uploadResponse.data.upload_price_breakdown.mesh_streaming = 3; | ||
551 | uploadResponse.data.upload_price_breakdown.texture = 5; | ||
552 | uploadResponse.data.upload_price_breakdown.model = 4; | ||
553 | } | 544 | } |
554 | 545 | ||
555 | uploader.OnUpLoad += UploadCompleteHandler; | 546 | uploader.OnUpLoad += UploadCompleteHandler; |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 8adacab..0b5d3fa 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | |||
@@ -27,9 +27,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
27 | { | 27 | { |
28 | float ModelMinCost = 5.0f; // try to favor small meshs versus sculpts | 28 | float ModelMinCost = 5.0f; // try to favor small meshs versus sculpts |
29 | 29 | ||
30 | // scale prices relative to basic cost | ||
31 | const float ModelCostScale = 1.0f; | ||
32 | |||
33 | const float primCreationCost = 0.01f; // 256 prims cost extra 2.56 | 30 | const float primCreationCost = 0.01f; // 256 prims cost extra 2.56 |
34 | 31 | ||
35 | // weigthed size to money convertion | 32 | // weigthed size to money convertion |
@@ -70,7 +67,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
70 | { | 67 | { |
71 | totalcost = 0; | 68 | totalcost = 0; |
72 | error = string.Empty; | 69 | error = string.Empty; |
73 | 70 | ||
74 | if (resources == null || | 71 | if (resources == null || |
75 | resources.instance_list == null || | 72 | resources.instance_list == null || |
76 | resources.instance_list.Array.Count == 0) | 73 | resources.instance_list.Array.Count == 0) |
@@ -184,7 +181,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
184 | if (meshsfee < ModelMinCost) | 181 | if (meshsfee < ModelMinCost) |
185 | meshsfee = ModelMinCost; | 182 | meshsfee = ModelMinCost; |
186 | 183 | ||
187 | meshsfee *= ModelCostScale; | 184 | // scale cost with basic cost changes relative to 10 |
185 | meshsfee *= (float)basicCost / 10.0f; | ||
188 | meshsfee += 0.5f; // rounding | 186 | meshsfee += 0.5f; // rounding |
189 | 187 | ||
190 | totalcost += (int)meshsfee; | 188 | totalcost += (int)meshsfee; |