* Exploring Group/Part from an app perspective.
parent
226339cd40
commit
c47bca94d2
|
@ -110,10 +110,11 @@ namespace OpenSim.Framework.Types
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BoxShape : PrimitiveBaseShape
|
public class BoxShape : PrimitiveBaseShape
|
||||||
{
|
{
|
||||||
public BoxShape() : base()
|
public BoxShape()
|
||||||
|
: base()
|
||||||
{
|
{
|
||||||
PathCurve = 16;
|
PathCurve = 16;
|
||||||
ProfileShape = ProfileShape.Square;
|
ProfileShape = ProfileShape.Square;
|
||||||
|
@ -121,10 +122,16 @@ namespace OpenSim.Framework.Types
|
||||||
PathScaleX = 100;
|
PathScaleX = 100;
|
||||||
PathScaleY = 100;
|
PathScaleY = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSide( float side )
|
public BoxShape(float side)
|
||||||
|
: base()
|
||||||
{
|
{
|
||||||
Scale = new LLVector3( side, side, side );
|
SetSide(side);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSide(float side)
|
||||||
|
{
|
||||||
|
Scale = new LLVector3(side, side, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BoxShape Default
|
public static BoxShape Default
|
||||||
|
@ -139,4 +146,33 @@ namespace OpenSim.Framework.Types
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class CylinderShape : PrimitiveBaseShape
|
||||||
|
{
|
||||||
|
public CylinderShape()
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
PathCurve = 16;
|
||||||
|
ProfileShape = ProfileShape.Circle;
|
||||||
|
PCode = 9;
|
||||||
|
PathScaleX = 100;
|
||||||
|
PathScaleY = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CylinderShape(float radius, float heigth)
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
SetRadius(radius);
|
||||||
|
SetHeigth(heigth);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetHeigth(float heigth)
|
||||||
|
{
|
||||||
|
Scale.Y = heigth;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetRadius(float radius)
|
||||||
|
{
|
||||||
|
Scale.X = Scale.Y = radius*2f;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
get { return 1; }
|
get { return 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LLQuaternion Rotation
|
||||||
|
{
|
||||||
|
get { return m_rootPart.RotationOffset; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -471,6 +477,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get { return m_rootPart.Text; }
|
||||||
|
set { m_rootPart.Text = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetPartText(string text, uint localID)
|
public void SetPartText(string text, uint localID)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = this.GetChildPrim(localID);
|
SceneObjectPart part = this.GetChildPrim(localID);
|
||||||
|
@ -626,7 +639,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Roation
|
#region Rotation
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -791,6 +804,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public override void UpdateMovement()
|
||||||
|
{
|
||||||
|
foreach( SceneObjectPart part in m_parts.Values )
|
||||||
|
{
|
||||||
|
part.UpdateMovement();
|
||||||
|
}
|
||||||
|
|
||||||
|
base.UpdateMovement();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Added as a way for the storage provider to reset the scene,
|
/// Added as a way for the storage provider to reset the scene,
|
||||||
/// most likely a better way to do this sort of thing but for now...
|
/// most likely a better way to do this sort of thing but for now...
|
||||||
|
|
|
@ -561,6 +561,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
|
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public virtual void UpdateMovement()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using Axiom.Math;
|
||||||
|
using libsecondlife;
|
||||||
|
using OpenSim.Framework.Types;
|
||||||
|
|
||||||
|
namespace SimpleApp
|
||||||
|
{
|
||||||
|
public class ComplexObject : SceneObjectGroup
|
||||||
|
{
|
||||||
|
private LLQuaternion m_rotationDirection;
|
||||||
|
|
||||||
|
private class RotatingWheel : SceneObjectPart
|
||||||
|
{
|
||||||
|
private static LLQuaternion m_rotationDirection = new LLQuaternion(0.05f, 0, 0);
|
||||||
|
|
||||||
|
public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition)
|
||||||
|
: base(regionHandle, parent, ownerID, localID, BoxShape.Default, groupPosition, offsetPosition )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateMovement()
|
||||||
|
{
|
||||||
|
UpdateRotation(RotationOffset * m_rotationDirection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateMovement()
|
||||||
|
{
|
||||||
|
UpdateGroupRotation(Rotation * m_rotationDirection);
|
||||||
|
|
||||||
|
base.UpdateMovement();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos )
|
||||||
|
: base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default )
|
||||||
|
{
|
||||||
|
m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f);
|
||||||
|
|
||||||
|
AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 1f)));
|
||||||
|
AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -1f)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,8 +13,8 @@ namespace SimpleApp
|
||||||
{
|
{
|
||||||
private PerformanceCounter m_counter;
|
private PerformanceCounter m_counter;
|
||||||
|
|
||||||
public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
|
public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos )
|
||||||
: base(world, regionHandle, ownerID, localID, pos, shape )
|
: base(world, regionHandle, ownerID, localID, pos, BoxShape.Default )
|
||||||
{
|
{
|
||||||
String objectName = "Processor";
|
String objectName = "Processor";
|
||||||
String counterName = "% Processor Time";
|
String counterName = "% Processor Time";
|
||||||
|
|
|
@ -65,14 +65,15 @@ namespace SimpleApp
|
||||||
|
|
||||||
udpServer.ServerListener();
|
udpServer.ServerListener();
|
||||||
|
|
||||||
PrimitiveBaseShape shape = BoxShape.Default;
|
LLVector3 pos = new LLVector3(110, 129, 27);
|
||||||
shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
|
|
||||||
LLVector3 pos = new LLVector3(138, 129, 27);
|
|
||||||
|
|
||||||
SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape);
|
SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 1f, 1f, 1f ));
|
||||||
scene.AddEntity(sceneObject);
|
scene.AddEntity(sceneObject);
|
||||||
|
|
||||||
MyNpcCharacter m_character = new MyNpcCharacter( scene.EventManager );
|
ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 2f, 2f, 2f ));
|
||||||
|
scene.AddEntity(complexObject);
|
||||||
|
|
||||||
|
MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager);
|
||||||
scene.AddNewClient(m_character, false);
|
scene.AddNewClient(m_character, false);
|
||||||
|
|
||||||
DirectoryInfo dirInfo = new DirectoryInfo( "." );
|
DirectoryInfo dirInfo = new DirectoryInfo( "." );
|
||||||
|
|
|
@ -722,6 +722,7 @@
|
||||||
<ReferencePath>../../../../bin/Physics/</ReferencePath>
|
<ReferencePath>../../../../bin/Physics/</ReferencePath>
|
||||||
|
|
||||||
<Reference name="libsecondlife.dll"/>
|
<Reference name="libsecondlife.dll"/>
|
||||||
|
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
||||||
<Reference name="System" localCopy="false"/>
|
<Reference name="System" localCopy="false"/>
|
||||||
<Reference name="System.Data.dll"/>
|
<Reference name="System.Data.dll"/>
|
||||||
<Reference name="System.Xml"/>
|
<Reference name="System.Xml"/>
|
||||||
|
|
Loading…
Reference in New Issue