diff options
author | lbsa71 | 2007-08-15 16:57:47 +0000 |
---|---|---|
committer | lbsa71 | 2007-08-15 16:57:47 +0000 |
commit | c47bca94d23420b164e5f32aa5c781009496e0d3 (patch) | |
tree | 1334b22e0580c1584a7ef7dfb537339992f2b0ef | |
parent | * Applying ckrinke's LSL baseclass changes (Thanks!) (diff) | |
download | opensim-SC_OLD-c47bca94d23420b164e5f32aa5c781009496e0d3.zip opensim-SC_OLD-c47bca94d23420b164e5f32aa5c781009496e0d3.tar.gz opensim-SC_OLD-c47bca94d23420b164e5f32aa5c781009496e0d3.tar.bz2 opensim-SC_OLD-c47bca94d23420b164e5f32aa5c781009496e0d3.tar.xz |
* Exploring Group/Part from an app perspective.
-rw-r--r-- | OpenSim/Framework/General/Types/PrimitiveBaseShape.cs | 46 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | 46 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/Program.cs | 13 | ||||
-rw-r--r-- | prebuild.xml | 1 |
7 files changed, 125 insertions, 14 deletions
diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs index 045569b..577c8a2 100644 --- a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs | |||
@@ -110,10 +110,11 @@ namespace OpenSim.Framework.Types | |||
110 | 110 | ||
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | public class BoxShape : PrimitiveBaseShape | 114 | public class BoxShape : PrimitiveBaseShape |
115 | { | 115 | { |
116 | public BoxShape() : base() | 116 | public BoxShape() |
117 | : base() | ||
117 | { | 118 | { |
118 | PathCurve = 16; | 119 | PathCurve = 16; |
119 | ProfileShape = ProfileShape.Square; | 120 | ProfileShape = ProfileShape.Square; |
@@ -121,10 +122,16 @@ namespace OpenSim.Framework.Types | |||
121 | PathScaleX = 100; | 122 | PathScaleX = 100; |
122 | PathScaleY = 100; | 123 | PathScaleY = 100; |
123 | } | 124 | } |
124 | 125 | ||
125 | public void SetSide( float side ) | 126 | public BoxShape(float side) |
127 | : base() | ||
128 | { | ||
129 | SetSide(side); | ||
130 | } | ||
131 | |||
132 | public void SetSide(float side) | ||
126 | { | 133 | { |
127 | Scale = new LLVector3( side, side, side ); | 134 | Scale = new LLVector3(side, side, side); |
128 | } | 135 | } |
129 | 136 | ||
130 | public static BoxShape Default | 137 | public static BoxShape Default |
@@ -139,4 +146,33 @@ namespace OpenSim.Framework.Types | |||
139 | } | 146 | } |
140 | } | 147 | } |
141 | } | 148 | } |
149 | public class CylinderShape : PrimitiveBaseShape | ||
150 | { | ||
151 | public CylinderShape() | ||
152 | : base() | ||
153 | { | ||
154 | PathCurve = 16; | ||
155 | ProfileShape = ProfileShape.Circle; | ||
156 | PCode = 9; | ||
157 | PathScaleX = 100; | ||
158 | PathScaleY = 100; | ||
159 | } | ||
160 | |||
161 | public CylinderShape(float radius, float heigth) | ||
162 | : base() | ||
163 | { | ||
164 | SetRadius(radius); | ||
165 | SetHeigth(heigth); | ||
166 | } | ||
167 | |||
168 | private void SetHeigth(float heigth) | ||
169 | { | ||
170 | Scale.Y = heigth; | ||
171 | } | ||
172 | |||
173 | private void SetRadius(float radius) | ||
174 | { | ||
175 | Scale.X = Scale.Y = radius*2f; | ||
176 | } | ||
177 | } | ||
142 | } | 178 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 4f98199..2f4d707 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -35,6 +35,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
35 | get { return 1; } | 35 | get { return 1; } |
36 | } | 36 | } |
37 | 37 | ||
38 | public LLQuaternion Rotation | ||
39 | { | ||
40 | get { return m_rootPart.RotationOffset; } | ||
41 | } | ||
42 | |||
43 | |||
38 | /// <summary> | 44 | /// <summary> |
39 | /// | 45 | /// |
40 | /// </summary> | 46 | /// </summary> |
@@ -471,6 +477,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
471 | } | 477 | } |
472 | } | 478 | } |
473 | 479 | ||
480 | public string Text | ||
481 | { | ||
482 | get { return m_rootPart.Text; } | ||
483 | set { m_rootPart.Text = value; } | ||
484 | } | ||
485 | |||
486 | |||
474 | public void SetPartText(string text, uint localID) | 487 | public void SetPartText(string text, uint localID) |
475 | { | 488 | { |
476 | SceneObjectPart part = this.GetChildPrim(localID); | 489 | SceneObjectPart part = this.GetChildPrim(localID); |
@@ -626,7 +639,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
626 | } | 639 | } |
627 | #endregion | 640 | #endregion |
628 | 641 | ||
629 | #region Roation | 642 | #region Rotation |
630 | /// <summary> | 643 | /// <summary> |
631 | /// | 644 | /// |
632 | /// </summary> | 645 | /// </summary> |
@@ -791,6 +804,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
791 | } | 804 | } |
792 | #endregion | 805 | #endregion |
793 | 806 | ||
807 | public override void UpdateMovement() | ||
808 | { | ||
809 | foreach( SceneObjectPart part in m_parts.Values ) | ||
810 | { | ||
811 | part.UpdateMovement(); | ||
812 | } | ||
813 | |||
814 | base.UpdateMovement(); | ||
815 | } | ||
816 | |||
794 | /// <summary> | 817 | /// <summary> |
795 | /// Added as a way for the storage provider to reset the scene, | 818 | /// Added as a way for the storage provider to reset the scene, |
796 | /// most likely a better way to do this sort of thing but for now... | 819 | /// most likely a better way to do this sort of thing but for now... |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 09a864e..81b2fe4 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -561,6 +561,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
561 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | 561 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); |
562 | } | 562 | } |
563 | #endregion | 563 | #endregion |
564 | |||
565 | public virtual void UpdateMovement() | ||
566 | { | ||
567 | } | ||
564 | } | 568 | } |
565 | } | 569 | } |
566 | 570 | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs new file mode 100644 index 0000000..25960b7 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | |||
@@ -0,0 +1,46 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Environment.Scenes; | ||
5 | using Axiom.Math; | ||
6 | using libsecondlife; | ||
7 | using OpenSim.Framework.Types; | ||
8 | |||
9 | namespace SimpleApp | ||
10 | { | ||
11 | public class ComplexObject : SceneObjectGroup | ||
12 | { | ||
13 | private LLQuaternion m_rotationDirection; | ||
14 | |||
15 | private class RotatingWheel : SceneObjectPart | ||
16 | { | ||
17 | private static LLQuaternion m_rotationDirection = new LLQuaternion(0.05f, 0, 0); | ||
18 | |||
19 | public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition) | ||
20 | : base(regionHandle, parent, ownerID, localID, BoxShape.Default, groupPosition, offsetPosition ) | ||
21 | { | ||
22 | } | ||
23 | |||
24 | public override void UpdateMovement() | ||
25 | { | ||
26 | UpdateRotation(RotationOffset * m_rotationDirection); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | public override void UpdateMovement() | ||
31 | { | ||
32 | UpdateGroupRotation(Rotation * m_rotationDirection); | ||
33 | |||
34 | base.UpdateMovement(); | ||
35 | } | ||
36 | |||
37 | public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) | ||
38 | : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default ) | ||
39 | { | ||
40 | m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); | ||
41 | |||
42 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 1f))); | ||
43 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -1f))); | ||
44 | } | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs index 108fa98..4ce59cb 100644 --- a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs | |||
@@ -13,8 +13,8 @@ namespace SimpleApp | |||
13 | { | 13 | { |
14 | private PerformanceCounter m_counter; | 14 | private PerformanceCounter m_counter; |
15 | 15 | ||
16 | public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) | 16 | public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) |
17 | : base(world, regionHandle, ownerID, localID, pos, shape ) | 17 | : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default ) |
18 | { | 18 | { |
19 | String objectName = "Processor"; | 19 | String objectName = "Processor"; |
20 | String counterName = "% Processor Time"; | 20 | String counterName = "% Processor Time"; |
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 0763b83..59d73ba 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -65,14 +65,15 @@ namespace SimpleApp | |||
65 | 65 | ||
66 | udpServer.ServerListener(); | 66 | udpServer.ServerListener(); |
67 | 67 | ||
68 | PrimitiveBaseShape shape = BoxShape.Default; | 68 | LLVector3 pos = new LLVector3(110, 129, 27); |
69 | shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); | ||
70 | LLVector3 pos = new LLVector3(138, 129, 27); | ||
71 | 69 | ||
72 | SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); | 70 | SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 1f, 1f, 1f )); |
73 | scene.AddEntity(sceneObject); | 71 | scene.AddEntity(sceneObject); |
74 | 72 | ||
75 | MyNpcCharacter m_character = new MyNpcCharacter( scene.EventManager ); | 73 | ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 2f, 2f, 2f )); |
74 | scene.AddEntity(complexObject); | ||
75 | |||
76 | MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager); | ||
76 | scene.AddNewClient(m_character, false); | 77 | scene.AddNewClient(m_character, false); |
77 | 78 | ||
78 | DirectoryInfo dirInfo = new DirectoryInfo( "." ); | 79 | DirectoryInfo dirInfo = new DirectoryInfo( "." ); |
diff --git a/prebuild.xml b/prebuild.xml index 53fbad9..d1bb30f 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -722,6 +722,7 @@ | |||
722 | <ReferencePath>../../../../bin/Physics/</ReferencePath> | 722 | <ReferencePath>../../../../bin/Physics/</ReferencePath> |
723 | 723 | ||
724 | <Reference name="libsecondlife.dll"/> | 724 | <Reference name="libsecondlife.dll"/> |
725 | <Reference name="Axiom.MathLib.dll" localCopy="false"/> | ||
725 | <Reference name="System" localCopy="false"/> | 726 | <Reference name="System" localCopy="false"/> |
726 | <Reference name="System.Data.dll"/> | 727 | <Reference name="System.Data.dll"/> |
727 | <Reference name="System.Xml"/> | 728 | <Reference name="System.Xml"/> |