* Completed a partial port of OpenSim's LSL API. Thank you to everyone on the OpenSim team for their hard work on this incredibly large feature
* Added Agent.GetSimulatorPosition()
* Corrected default PrimFlags for agents and prims
* Stubs for encoding/decoding prim linkset assets
* Route chat through the scene
* Stub for grid messaging (IM and email)
* Add GetTerrainHeightAt(), removed duplicate heightmap storage in Movement.cs
* Added a permissions manager stub
* Store wind speeds, added functions to get wind speed
* Make sure all of the important prim properties are set before creating an object
* Lots of new object manipulation functions in scene
* Properly clean up event queues on agent exit
* Stubbed out a space for a scripting engine
* Stubbed out task inventory
* Added ScriptingConsole, which allows you to run LSL functions from the chat console
* Added new PacketCategory, Messaging, for chat-related packets
* Fixed InventoryObject overrides
* Added a NotecardCache, useful for the scripting engine and may become generally useful later
* Added several helper functions and new members to SimulationObject

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2462 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2009-03-02 23:00:28 +00:00
parent 12375d40e9
commit abf0c15384
30 changed files with 10378 additions and 255 deletions

View File

@@ -8,6 +8,8 @@ namespace Simian
{
public class SimulationObject
{
// TODO: Frozen and RotationAxis might want to become properties that access the parent values
/// <summary>Reference to the primitive object this class wraps</summary>
public Primitive Prim;
/// <summary>Link number, if this object is part of a linkset</summary>
@@ -19,6 +21,10 @@ namespace Simian
public CircularQueue<Primitive> UndoSteps = new CircularQueue<Primitive>(10);
/// <summary>Holds the state of the object after each undo to enable redo</summary>
public CircularQueue<Primitive> RedoSteps = new CircularQueue<Primitive>(10);
/// <summary>Axis of rotation for the object in the physics engine</summary>
public Vector3 RotationAxis = Vector3.UnitY;
/// <summary>A continual rotational impulse</summary>
public Vector3 Torque;
protected Simian Server;
protected SimpleMesh[] Meshes;
@@ -39,6 +45,88 @@ namespace Simian
Server = server;
}
public SimulationObject GetLinksetParent()
{
// This is the root object
if (Prim.ParentID == 0)
return this;
SimulationObject parent;
if (Server.Scene.TryGetObject(Prim.ParentID, out parent))
{
// Check if this is the root object, but is attached to an avatar
if (parent.Prim is Avatar)
return this;
else
return parent;
}
else
{
Logger.Log(String.Format("Prim {0} has an unknown ParentID {1}", Prim.LocalID, Prim.ParentID),
Helpers.LogLevel.Warning);
return this;
}
}
public SimulationObject GetLinksetPrim(int linkNum)
{
Logger.DebugLog("Running expensive SimulationObject.GetLinksetPrim() function");
return Server.Scene.FindObject(delegate(SimulationObject obj)
{ return obj.Prim.ParentID == this.Prim.ParentID && obj.LinkNumber == linkNum; });
}
public List<SimulationObject> GetChildren()
{
Logger.DebugLog("Running expensive SimulationObject.GetChildren() function");
List<SimulationObject> children = new List<SimulationObject>();
Server.Scene.ForEachObject(delegate(SimulationObject obj)
{ if (obj.Prim.ParentID == this.Prim.LocalID) children.Add(obj); });
return children;
}
public float GetMass()
{
// FIXME:
return 0f;
}
public float GetLinksetMass()
{
Logger.DebugLog("Running expensive SimulationObject.GetLinksetMass() function");
// FIXME:
return 0f;
}
public Vector3 GetSimulatorPosition()
{
SimulationObject parent;
Vector3 position = Prim.Position;
if (Prim.ParentID != 0 && Server.Scene.TryGetObject(Prim.ParentID, out parent))
position += Vector3.Transform(parent.Prim.Position, Matrix4.CreateFromQuaternion(parent.Prim.Rotation));
return position;
}
public Quaternion GetSimulatorRotation(ISceneProvider scene)
{
SimulationObject parent;
Quaternion rotation = Prim.Rotation;
if (Prim.ParentID != 0 && scene.TryGetObject(Prim.ParentID, out parent))
rotation *= parent.Prim.Rotation;
return rotation;
}
public void AddScriptLPS(int count)
{
// TODO: Do something with this
}
/// <summary>
/// Copy the current state of the object into the next undo step
/// </summary>