aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2012-09-19 01:33:16 +0100
committerUbitUmarov2012-09-19 01:33:16 +0100
commitfb32604b413052ddedccba36247e676427c48824 (patch)
tree60533b21ae0b669041288a37482e906e3ac9f80a /OpenSim
parent coment out mesh model upload code to add textures and individual meshs (diff)
downloadopensim-SC_OLD-fb32604b413052ddedccba36247e676427c48824.zip
opensim-SC_OLD-fb32604b413052ddedccba36247e676427c48824.tar.gz
opensim-SC_OLD-fb32604b413052ddedccba36247e676427c48824.tar.bz2
opensim-SC_OLD-fb32604b413052ddedccba36247e676427c48824.tar.xz
create a single ModelCost provider for the caps instance. Let it know and
check scene prim size limits.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs14
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs56
2 files changed, 56 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 073f175..0fb6c99 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -87,6 +87,7 @@ namespace OpenSim.Region.ClientStack.Linden
87 87
88 private Scene m_Scene; 88 private Scene m_Scene;
89 private Caps m_HostCapsObj; 89 private Caps m_HostCapsObj;
90 private ModelCost m_ModelCost;
90 91
91 private static readonly string m_requestPath = "0000/"; 92 private static readonly string m_requestPath = "0000/";
92 // private static readonly string m_mapLayerPath = "0001/"; 93 // private static readonly string m_mapLayerPath = "0001/";
@@ -123,6 +124,15 @@ namespace OpenSim.Region.ClientStack.Linden
123 { 124 {
124 m_Scene = scene; 125 m_Scene = scene;
125 m_HostCapsObj = caps; 126 m_HostCapsObj = caps;
127
128 // create a model upload cost provider
129 m_ModelCost = new ModelCost();
130 // tell it about scene object limits
131 m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys;
132 m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys;
133// m_ModelCost.PrimScaleMin = ??
134// m_ModelCost.ObjectLinkedPartsMax = ??
135
126 IConfigSource config = m_Scene.Config; 136 IConfigSource config = m_Scene.Config;
127 if (config != null) 137 if (config != null)
128 { 138 {
@@ -193,7 +203,6 @@ namespace OpenSim.Region.ClientStack.Linden
193 { 203 {
194 try 204 try
195 { 205 {
196 // I don't think this one works...
197 m_HostCapsObj.RegisterHandler( 206 m_HostCapsObj.RegisterHandler(
198 "NewFileAgentInventory", 207 "NewFileAgentInventory",
199 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>( 208 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>(
@@ -472,9 +481,8 @@ namespace OpenSim.Region.ClientStack.Linden
472 { 481 {
473 string error; 482 string error;
474 int modelcost; 483 int modelcost;
475 ModelCost mc = new ModelCost();
476 484
477 if (!mc.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, 485 if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost,
478 meshcostdata, out error)) 486 meshcostdata, out error))
479 { 487 {
480 client.SendAgentAlertMessage(error, false); 488 client.SendAgentAlertMessage(error, false);
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