* SimpleApp finally doing something fun. :)
parent
a3f2c1276a
commit
eee1eb2f42
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue