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.cs56
1 files changed, 45 insertions, 11 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
index 5096a91..62f1d06 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
@@ -23,8 +23,14 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap;
23 23
24namespace OpenSim.Region.ClientStack.Linden 24namespace OpenSim.Region.ClientStack.Linden
25{ 25{
26 public struct ModelPrimLimits
27 {
28
29 }
30
26 public class ModelCost 31 public class ModelCost
27 { 32 {
33
28 // upload fee tunning paramenters 34 // upload fee tunning paramenters
29 // fees are normalized to 1.0 35 // fees are normalized to 1.0
30 // 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 )
@@ -66,6 +72,12 @@ namespace OpenSim.Region.ClientStack.Linden
66 // internal 72 // internal
67 const int bytesPerCoord = 6; // 3 coords, 2 bytes per each 73 const int bytesPerCoord = 6; // 3 coords, 2 bytes per each
68 74
75 // control prims dimensions
76 public float PrimScaleMin = 0.01f;
77 public float NonPhysicalPrimScaleMax = 256f;
78 public float PhysicalPrimScaleMax = 10f;
79 public int ObjectLinkedPartsMax = 512;
80
69 // storage for a single mesh asset cost parameters 81 // storage for a single mesh asset cost parameters
70 private class ameshCostParam 82 private class ameshCostParam
71 { 83 {
@@ -98,7 +110,15 @@ namespace OpenSim.Region.ClientStack.Linden
98 error = "Unable to upload mesh model. missing information."; 110 error = "Unable to upload mesh model. missing information.";
99 return false; 111 return false;
100 } 112 }
101 113
114 int numberInstances = resources.instance_list.Array.Count;
115
116 if( numberInstances > ObjectLinkedPartsMax )
117 {
118 error = "upload failed: Model whould have two many linked prims";
119 return false;
120 }
121
102 meshcostdata.model_streaming_cost = 0.0; 122 meshcostdata.model_streaming_cost = 0.0;
103 meshcostdata.simulation_cost = 0.0; 123 meshcostdata.simulation_cost = 0.0;
104 meshcostdata.physics_cost = 0.0; 124 meshcostdata.physics_cost = 0.0;
@@ -148,12 +168,35 @@ namespace OpenSim.Region.ClientStack.Linden
148 } 168 }
149 169
150 // instances (prims) cost 170 // instances (prims) cost
151 int numberInstances = resources.instance_list.Array.Count; 171
172
152 int mesh; 173 int mesh;
153 for (int i = 0; i < numberInstances; i++) 174 for (int i = 0; i < numberInstances; i++)
154 { 175 {
155 Hashtable inst = (Hashtable)resources.instance_list.Array[i]; 176 Hashtable inst = (Hashtable)resources.instance_list.Array[i];
156 177
178 ArrayList ascale = (ArrayList)inst["scale"];
179 Vector3 scale;
180 double tmp;
181 tmp = (double)ascale[0];
182 scale.X = (float)tmp;
183 tmp = (double)ascale[1];
184 scale.Y = (float)tmp;
185 tmp = (double)ascale[2];
186 scale.Z = (float)tmp;
187
188 if (scale.X < PrimScaleMin || scale.Y < PrimScaleMin || scale.Z < PrimScaleMin)
189 {
190 error = " upload fail: Model contains parts with a dimension lower than 0.01. Please adjust scaling";
191 return false;
192 }
193
194 if (scale.X > NonPhysicalPrimScaleMax || scale.Y > NonPhysicalPrimScaleMax || scale.Z > NonPhysicalPrimScaleMax)
195 {
196 error = "upload fail: Model contains parts larger than maximum allowed. Please adjust scaling";
197 return false;
198 }
199
157 if (haveMeshs && inst.ContainsKey("mesh")) 200 if (haveMeshs && inst.ContainsKey("mesh"))
158 { 201 {
159 mesh = (int)inst["mesh"]; 202 mesh = (int)inst["mesh"];
@@ -165,15 +208,6 @@ namespace OpenSim.Region.ClientStack.Linden
165 } 208 }
166 209
167 // streamming cost 210 // streamming cost
168 ArrayList ascale = (ArrayList)inst["scale"];
169 Vector3 scale;
170 double tmp;
171 tmp = (double)ascale[0];
172 scale.X = (float)tmp;
173 tmp = (double)ascale[1];
174 scale.Y = (float)tmp;
175 tmp = (double)ascale[2];
176 scale.Z = (float)tmp;
177 211
178 float sqdiam = scale.LengthSquared(); 212 float sqdiam = scale.LengthSquared();
179 213