diff options
author | ubit | 2012-09-17 16:38:14 +0200 |
---|---|---|
committer | ubit | 2012-09-17 16:38:14 +0200 |
commit | f3f955b19b1acd44b08cdf6f30f086eaf58e3815 (patch) | |
tree | 0b8bf6180c232737543d444f319027924ac8a1f3 /OpenSim/Region/ClientStack/Linden | |
parent | Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff) | |
parent | Make use of mesh cost functions (diff) | |
download | opensim-SC-f3f955b19b1acd44b08cdf6f30f086eaf58e3815.zip opensim-SC-f3f955b19b1acd44b08cdf6f30f086eaf58e3815.tar.gz opensim-SC-f3f955b19b1acd44b08cdf6f30f086eaf58e3815.tar.bz2 opensim-SC-f3f955b19b1acd44b08cdf6f30f086eaf58e3815.tar.xz |
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-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; |