aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2012-09-17 19:09:51 +0100
committerUbitUmarov2012-09-17 19:09:51 +0100
commit7f5b1182efab9e7a80293622fa658d8d1a7b1fc8 (patch)
treeaba999e67de145070ac621fe41d22e7ec202d71c
parentremoved broken fee compression (diff)
downloadopensim-SC-7f5b1182efab9e7a80293622fa658d8d1a7b1fc8.zip
opensim-SC-7f5b1182efab9e7a80293622fa658d8d1a7b1fc8.tar.gz
opensim-SC-7f5b1182efab9e7a80293622fa658d8d1a7b1fc8.tar.bz2
opensim-SC-7f5b1182efab9e7a80293622fa658d8d1a7b1fc8.tar.xz
same cleanup
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs79
1 files changed, 41 insertions, 38 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
index 622a2d9..ba73a25 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.ClientStack.Linden
42 const float physMeshSizeWth = 6f; // counts 7x 42 const float physMeshSizeWth = 6f; // counts 7x
43 const float physHullSizeWth = 8f; // counts 9x 43 const float physHullSizeWth = 8f; // counts 9x
44 44
45 // stream cost size factors 45 // stream cost area factors
46 const float highLodFactor = 17.36f; 46 const float highLodFactor = 17.36f;
47 const float midLodFactor = 277.78f; 47 const float midLodFactor = 277.78f;
48 const float lowLodFactor = 1111.11f; 48 const float lowLodFactor = 1111.11f;
@@ -94,13 +94,12 @@ namespace OpenSim.Region.ClientStack.Linden
94 totalcost += textures_cost; 94 totalcost += textures_cost;
95 } 95 }
96 96
97 float meshsfee = 0;
98
99 // meshs assets cost 97 // meshs assets cost
100 98 float meshsfee = 0;
101 int numberMeshs = 0; 99 int numberMeshs = 0;
100 bool haveMeshs = false;
102 List<ameshCostParam> meshsCosts = new List<ameshCostParam>(); 101 List<ameshCostParam> meshsCosts = new List<ameshCostParam>();
103 // a model could have no mesh actually 102
104 if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0) 103 if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0)
105 { 104 {
106 numberMeshs = resources.mesh_list.Array.Count; 105 numberMeshs = resources.mesh_list.Array.Count;
@@ -117,6 +116,7 @@ namespace OpenSim.Region.ClientStack.Linden
117 meshsCosts.Add(curCost); 116 meshsCosts.Add(curCost);
118 meshsfee += curCost.costFee; 117 meshsfee += curCost.costFee;
119 } 118 }
119 haveMeshs = true;
120 } 120 }
121 121
122 // instances (prims) cost 122 // instances (prims) cost
@@ -126,44 +126,43 @@ namespace OpenSim.Region.ClientStack.Linden
126 { 126 {
127 Hashtable inst = (Hashtable)resources.instance_list.Array[i]; 127 Hashtable inst = (Hashtable)resources.instance_list.Array[i];
128 128
129 // streamming cost 129 if (haveMeshs && inst.ContainsKey("mesh"))
130 // assume all instances have a mesh
131 // but in general they can have normal prims
132 // but for now that seems not suported
133 // when they do, we will need to inspect pbs information
134 // and have cost funtions for all prims types
135 // don't check for shape type none, since
136 // that could be used to upload meshs with low cost
137 // changing later inworld
138
139 ArrayList ascale = (ArrayList)inst["scale"];
140 Vector3 scale;
141 double tmp;
142 tmp = (double)ascale[0];
143 scale.X = (float)tmp;
144 tmp = (double)ascale[1];
145 scale.Y = (float)tmp;
146 tmp = (double)ascale[2];
147 scale.Z = (float)tmp;
148
149 float sqdiam = scale.LengthSquared();
150
151 mesh = (int)inst["mesh"];
152
153 if(mesh >= numberMeshs)
154 { 130 {
155 error = "Unable to upload mesh model. incoerent information."; 131 mesh = (int)inst["mesh"];
156 return false;
157 }
158 132
159 ameshCostParam curCost = meshsCosts[mesh]; 133 if (mesh >= numberMeshs)
160 float mesh_streaming = streamingCost(curCost, sqdiam); 134 {
135 error = "Unable to upload mesh model. incoerent information.";
136 return false;
137 }
138
139 // streamming cost
140 ArrayList ascale = (ArrayList)inst["scale"];
141 Vector3 scale;
142 double tmp;
143 tmp = (double)ascale[0];
144 scale.X = (float)tmp;
145 tmp = (double)ascale[1];
146 scale.Y = (float)tmp;
147 tmp = (double)ascale[2];
148 scale.Z = (float)tmp;
161 149
162 meshcostdata.model_streaming_cost += mesh_streaming; 150 float sqdiam = scale.LengthSquared();
163 151
164 meshcostdata.physics_cost += curCost.physicsCost; 152 ameshCostParam curCost = meshsCosts[mesh];
153 float mesh_streaming = streamingCost(curCost, sqdiam);
154
155 meshcostdata.model_streaming_cost += mesh_streaming;
156 meshcostdata.physics_cost += curCost.physicsCost;
157 }
158 else // instance as no mesh ??
159 {
160 // to do later if needed
161 meshcostdata.model_streaming_cost += 0.5f;
162 meshcostdata.physics_cost += 1.0f;
163 }
165 164
166 // unscripted and static prim server cost 165 // assume unscripted and static prim server cost
167 meshcostdata.simulation_cost += 0.5f; 166 meshcostdata.simulation_cost += 0.5f;
168 // charge for prims creation 167 // charge for prims creation
169 meshsfee += primCreationCost; 168 meshsfee += primCreationCost;
@@ -174,6 +173,10 @@ namespace OpenSim.Region.ClientStack.Linden
174 else 173 else
175 meshcostdata.resource_cost = meshcostdata.physics_cost; 174 meshcostdata.resource_cost = meshcostdata.physics_cost;
176 175
176 if (meshcostdata.resource_cost < meshcostdata.simulation_cost)
177 meshcostdata.resource_cost = meshcostdata.simulation_cost;
178
179
177 if (meshsfee < ModelMinCost) 180 if (meshsfee < ModelMinCost)
178 meshsfee = ModelMinCost; 181 meshsfee = ModelMinCost;
179 182