2007-03-02 18:37:38 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text;
|
|
|
|
using Axiom.MathLib;
|
|
|
|
using OpenSim.types;
|
2007-03-04 12:40:55 +00:00
|
|
|
using libsecondlife;
|
2007-03-02 18:37:38 +00:00
|
|
|
|
|
|
|
namespace OpenSim.world
|
|
|
|
{
|
|
|
|
public class Entity
|
|
|
|
{
|
|
|
|
protected libsecondlife.LLUUID uuid;
|
2007-03-04 12:40:55 +00:00
|
|
|
protected uint localid;
|
|
|
|
public LLVector3 position;
|
|
|
|
public LLVector3 velocity;
|
2007-03-02 18:37:38 +00:00
|
|
|
public Quaternion rotation;
|
|
|
|
protected string name;
|
|
|
|
protected List<Entity> children;
|
|
|
|
|
|
|
|
public Entity()
|
|
|
|
{
|
|
|
|
uuid = new libsecondlife.LLUUID();
|
2007-03-04 12:40:55 +00:00
|
|
|
localid = 8880000 + (OpenSim_Main.local_world._localNumber++); // FIXME - race condition!
|
|
|
|
position = new LLVector3();
|
|
|
|
velocity = new LLVector3();
|
2007-03-02 18:37:38 +00:00
|
|
|
rotation = new Quaternion();
|
|
|
|
name = "(basic entity)";
|
|
|
|
children = new List<Entity>();
|
|
|
|
}
|
|
|
|
public virtual void addFroces()
|
|
|
|
{
|
|
|
|
foreach (Entity child in children)
|
|
|
|
{
|
|
|
|
child.addFroces();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public virtual void update() {
|
|
|
|
// Do any per-frame updates needed that are applicable to every type of entity
|
|
|
|
foreach (Entity child in children)
|
|
|
|
{
|
|
|
|
child.update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual string getName()
|
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual Mesh getMesh()
|
|
|
|
{
|
|
|
|
Mesh mesh = new Mesh();
|
|
|
|
|
|
|
|
foreach (Entity child in children)
|
|
|
|
{
|
|
|
|
mesh += child.getMesh();
|
|
|
|
}
|
|
|
|
|
|
|
|
return mesh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|