diff options
author | Melanie | 2012-03-19 14:25:11 +0100 |
---|---|---|
committer | Melanie | 2012-03-19 14:25:11 +0100 |
commit | 808995fb68980968cb61f1ca81fef5328ca29a12 (patch) | |
tree | 438b68871953c68596b7bb42368bfbfce3e5132f /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | added a new UbitMeshing module so i can mess it... (diff) | |
download | opensim-SC-808995fb68980968cb61f1ca81fef5328ca29a12.zip opensim-SC-808995fb68980968cb61f1ca81fef5328ca29a12.tar.gz opensim-SC-808995fb68980968cb61f1ca81fef5328ca29a12.tar.bz2 opensim-SC-808995fb68980968cb61f1ca81fef5328ca29a12.tar.xz |
Merge branch 'ubitwork'
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0d1adcb..90ad098 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1229,6 +1229,102 @@ namespace OpenSim.Region.Framework.Scenes | |||
1229 | 1229 | ||
1230 | #endregion | 1230 | #endregion |
1231 | 1231 | ||
1232 | public void GetResourcesCosts(SceneObjectPart apart, | ||
1233 | out float linksetResCost, out float linksetPhysCost, out float partCost, out float partPhysCost) | ||
1234 | { | ||
1235 | // this information may need to be cached | ||
1236 | |||
1237 | float cost; | ||
1238 | float tmpcost; | ||
1239 | |||
1240 | bool ComplexCost = false; | ||
1241 | |||
1242 | SceneObjectPart p; | ||
1243 | SceneObjectPart[] parts; | ||
1244 | |||
1245 | lock (m_parts) | ||
1246 | { | ||
1247 | parts = m_parts.GetArray(); | ||
1248 | } | ||
1249 | |||
1250 | int nparts = parts.Length; | ||
1251 | |||
1252 | |||
1253 | for (int i = 0; i < nparts; i++) | ||
1254 | { | ||
1255 | p = parts[i]; | ||
1256 | |||
1257 | if (p.UsesComplexCost) | ||
1258 | { | ||
1259 | ComplexCost = true; | ||
1260 | break; | ||
1261 | } | ||
1262 | } | ||
1263 | |||
1264 | if (ComplexCost) | ||
1265 | { | ||
1266 | linksetResCost = 0; | ||
1267 | linksetPhysCost = 0; | ||
1268 | partCost = 0; | ||
1269 | partPhysCost = 0; | ||
1270 | |||
1271 | for (int i = 0; i < nparts; i++) | ||
1272 | { | ||
1273 | p = parts[i]; | ||
1274 | |||
1275 | cost = p.StreamingCost; | ||
1276 | tmpcost = p.SimulationCost; | ||
1277 | if (tmpcost > cost) | ||
1278 | cost = tmpcost; | ||
1279 | tmpcost = p.PhysicsCost; | ||
1280 | if (tmpcost > cost) | ||
1281 | cost = tmpcost; | ||
1282 | |||
1283 | linksetPhysCost += tmpcost; | ||
1284 | linksetResCost += cost; | ||
1285 | |||
1286 | if (p == apart) | ||
1287 | { | ||
1288 | partCost = cost; | ||
1289 | partPhysCost = tmpcost; | ||
1290 | } | ||
1291 | } | ||
1292 | } | ||
1293 | else | ||
1294 | { | ||
1295 | partPhysCost = 1.0f; | ||
1296 | partCost = 1.0f; | ||
1297 | linksetResCost = (float)nparts; | ||
1298 | linksetPhysCost = linksetResCost; | ||
1299 | } | ||
1300 | } | ||
1301 | |||
1302 | public void GetSelectedCosts(out float PhysCost, out float StreamCost, out float SimulCost) | ||
1303 | { | ||
1304 | SceneObjectPart p; | ||
1305 | SceneObjectPart[] parts; | ||
1306 | |||
1307 | lock (m_parts) | ||
1308 | { | ||
1309 | parts = m_parts.GetArray(); | ||
1310 | } | ||
1311 | |||
1312 | int nparts = parts.Length; | ||
1313 | |||
1314 | PhysCost = 0; | ||
1315 | StreamCost = 0; | ||
1316 | SimulCost = 0; | ||
1317 | |||
1318 | for (int i = 0; i < nparts; i++) | ||
1319 | { | ||
1320 | p = parts[i]; | ||
1321 | |||
1322 | StreamCost += p.StreamingCost; | ||
1323 | SimulCost += p.SimulationCost; | ||
1324 | PhysCost += p.PhysicsCost; | ||
1325 | } | ||
1326 | } | ||
1327 | |||
1232 | public void SaveScriptedState(XmlTextWriter writer) | 1328 | public void SaveScriptedState(XmlTextWriter writer) |
1233 | { | 1329 | { |
1234 | SaveScriptedState(writer, false); | 1330 | SaveScriptedState(writer, false); |