diff options
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 5507aa0..3e4d552 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1231,6 +1231,102 @@ namespace OpenSim.Region.Framework.Scenes | |||
1231 | 1231 | ||
1232 | #endregion | 1232 | #endregion |
1233 | 1233 | ||
1234 | public void GetResourcesCosts(SceneObjectPart apart, | ||
1235 | out float linksetResCost, out float linksetPhysCost, out float partCost, out float partPhysCost) | ||
1236 | { | ||
1237 | // this information may need to be cached | ||
1238 | |||
1239 | float cost; | ||
1240 | float tmpcost; | ||
1241 | |||
1242 | bool ComplexCost = false; | ||
1243 | |||
1244 | SceneObjectPart p; | ||
1245 | SceneObjectPart[] parts; | ||
1246 | |||
1247 | lock (m_parts) | ||
1248 | { | ||
1249 | parts = m_parts.GetArray(); | ||
1250 | } | ||
1251 | |||
1252 | int nparts = parts.Length; | ||
1253 | |||
1254 | |||
1255 | for (int i = 0; i < nparts; i++) | ||
1256 | { | ||
1257 | p = parts[i]; | ||
1258 | |||
1259 | if (p.UsesComplexCost) | ||
1260 | { | ||
1261 | ComplexCost = true; | ||
1262 | break; | ||
1263 | } | ||
1264 | } | ||
1265 | |||
1266 | if (ComplexCost) | ||
1267 | { | ||
1268 | linksetResCost = 0; | ||
1269 | linksetPhysCost = 0; | ||
1270 | partCost = 0; | ||
1271 | partPhysCost = 0; | ||
1272 | |||
1273 | for (int i = 0; i < nparts; i++) | ||
1274 | { | ||
1275 | p = parts[i]; | ||
1276 | |||
1277 | cost = p.StreamingCost; | ||
1278 | tmpcost = p.SimulationCost; | ||
1279 | if (tmpcost > cost) | ||
1280 | cost = tmpcost; | ||
1281 | tmpcost = p.PhysicsCost; | ||
1282 | if (tmpcost > cost) | ||
1283 | cost = tmpcost; | ||
1284 | |||
1285 | linksetPhysCost += tmpcost; | ||
1286 | linksetResCost += cost; | ||
1287 | |||
1288 | if (p == apart) | ||
1289 | { | ||
1290 | partCost = cost; | ||
1291 | partPhysCost = tmpcost; | ||
1292 | } | ||
1293 | } | ||
1294 | } | ||
1295 | else | ||
1296 | { | ||
1297 | partPhysCost = 1.0f; | ||
1298 | partCost = 1.0f; | ||
1299 | linksetResCost = (float)nparts; | ||
1300 | linksetPhysCost = linksetResCost; | ||
1301 | } | ||
1302 | } | ||
1303 | |||
1304 | public void GetSelectedCosts(out float PhysCost, out float StreamCost, out float SimulCost) | ||
1305 | { | ||
1306 | SceneObjectPart p; | ||
1307 | SceneObjectPart[] parts; | ||
1308 | |||
1309 | lock (m_parts) | ||
1310 | { | ||
1311 | parts = m_parts.GetArray(); | ||
1312 | } | ||
1313 | |||
1314 | int nparts = parts.Length; | ||
1315 | |||
1316 | PhysCost = 0; | ||
1317 | StreamCost = 0; | ||
1318 | SimulCost = 0; | ||
1319 | |||
1320 | for (int i = 0; i < nparts; i++) | ||
1321 | { | ||
1322 | p = parts[i]; | ||
1323 | |||
1324 | StreamCost += p.StreamingCost; | ||
1325 | SimulCost += p.SimulationCost; | ||
1326 | PhysCost += p.PhysicsCost; | ||
1327 | } | ||
1328 | } | ||
1329 | |||
1234 | public void SaveScriptedState(XmlTextWriter writer) | 1330 | public void SaveScriptedState(XmlTextWriter writer) |
1235 | { | 1331 | { |
1236 | SaveScriptedState(writer, false); | 1332 | SaveScriptedState(writer, false); |