From eee1eb2f42cd848845dea56c0bf52abbb37d33b5 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sat, 14 Jul 2007 16:01:10 +0000 Subject: * SimpleApp finally doing something fun. :) --- OpenSim/Region/Examples/SimpleApp/MySceneObject.cs | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region') 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; using libsecondlife; using OpenSim.Framework.Types; using System.Timers; +using System.Diagnostics; namespace SimpleApp { public class MySceneObject : SceneObject { - LLVector3 delta = new LLVector3(0.1f, 0.1f, 0.1f); + private PerformanceCounter m_counter; public MySceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) : base(world, ownerID, localID, pos, shape ) { + String objectName = "Processor"; + String counterName = "% Processor Time"; + String instanceName = "_Total"; + + m_counter = new PerformanceCounter(objectName, counterName, instanceName); + Timer timer = new Timer(); timer.Enabled = true; timer.Interval = 100; timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); + } public void Heartbeat(object sender, EventArgs e) { - if (rootPrimitive.Scale.X > 1) - { - delta = new LLVector3(-0.1f, -0.1f, -0.1f); - } - - if (rootPrimitive.Scale.X < 0.2f) - { - delta = new LLVector3(0.1f, 0.1f, 0.1f); - } - - rootPrimitive.ResizeGoup(rootPrimitive.Scale + delta); + float cpu = m_counter.NextValue() / 40f; + LLVector3 size = new LLVector3(cpu, cpu, cpu); + rootPrimitive.ResizeGoup( size ); update(); } } -- cgit v1.1