aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
diff options
context:
space:
mode:
authorlbsa712007-07-14 16:01:10 +0000
committerlbsa712007-07-14 16:01:10 +0000
commiteee1eb2f42cd848845dea56c0bf52abbb37d33b5 (patch)
tree2fcd9cd4a5ab75cc5cf6e7cd86f4ba68e7e70802 /OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
parent*Added support for simwide area and simwide prim count for parcels (diff)
downloadopensim-SC_OLD-eee1eb2f42cd848845dea56c0bf52abbb37d33b5.zip
opensim-SC_OLD-eee1eb2f42cd848845dea56c0bf52abbb37d33b5.tar.gz
opensim-SC_OLD-eee1eb2f42cd848845dea56c0bf52abbb37d33b5.tar.bz2
opensim-SC_OLD-eee1eb2f42cd848845dea56c0bf52abbb37d33b5.tar.xz
* SimpleApp finally doing something fun. :)
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MySceneObject.cs24
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
index 8508dac..1218dac 100644
--- a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
@@ -5,35 +5,35 @@ using OpenSim.Region.Environment.Scenes;
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Framework.Types; 6using OpenSim.Framework.Types;
7using System.Timers; 7using System.Timers;
8using System.Diagnostics;
8 9
9namespace SimpleApp 10namespace SimpleApp
10{ 11{
11 public class MySceneObject : SceneObject 12 public class MySceneObject : SceneObject
12 { 13 {
13 LLVector3 delta = new LLVector3(0.1f, 0.1f, 0.1f); 14 private PerformanceCounter m_counter;
14 15
15 public MySceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 16 public MySceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
16 : base(world, ownerID, localID, pos, shape ) 17 : base(world, ownerID, localID, pos, shape )
17 { 18 {
19 String objectName = "Processor";
20 String counterName = "% Processor Time";
21 String instanceName = "_Total";
22
23 m_counter = new PerformanceCounter(objectName, counterName, instanceName);
24
18 Timer timer = new Timer(); 25 Timer timer = new Timer();
19 timer.Enabled = true; 26 timer.Enabled = true;
20 timer.Interval = 100; 27 timer.Interval = 100;
21 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); 28 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
29
22 } 30 }
23 31
24 public void Heartbeat(object sender, EventArgs e) 32 public void Heartbeat(object sender, EventArgs e)
25 { 33 {
26 if (rootPrimitive.Scale.X > 1) 34 float cpu = m_counter.NextValue() / 40f;
27 { 35 LLVector3 size = new LLVector3(cpu, cpu, cpu);
28 delta = new LLVector3(-0.1f, -0.1f, -0.1f); 36 rootPrimitive.ResizeGoup( size );
29 }
30
31 if (rootPrimitive.Scale.X < 0.2f)
32 {
33 delta = new LLVector3(0.1f, 0.1f, 0.1f);
34 }
35
36 rootPrimitive.ResizeGoup(rootPrimitive.Scale + delta);
37 update(); 37 update();
38 } 38 }
39 } 39 }