diff options
author | lbsa71 | 2007-07-18 09:36:47 +0000 |
---|---|---|
committer | lbsa71 | 2007-07-18 09:36:47 +0000 |
commit | f70ec1fa75ef526266ad359d2db0e25f2635c182 (patch) | |
tree | 0ce6f6df1702d849532d1818c76c2bd301fb4579 /OpenSim | |
parent | * One hopefully-final attempt at fixing this remoting issue. (diff) | |
download | opensim-SC-f70ec1fa75ef526266ad359d2db0e25f2635c182.zip opensim-SC-f70ec1fa75ef526266ad359d2db0e25f2635c182.tar.gz opensim-SC-f70ec1fa75ef526266ad359d2db0e25f2635c182.tar.bz2 opensim-SC-f70ec1fa75ef526266ad359d2db0e25f2635c182.tar.xz |
* Added a FileSystemObject to SimpleApp
* Added Some ShapeTypes (shapes doesn't work though!)
* Fixed some \0 issues
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/General/Types/PrimData.cs | 58 | ||||
-rw-r--r-- | OpenSim/Framework/General/Types/PrimitiveBaseShape.cs | 74 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs | 31 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/Program.cs | 26 |
5 files changed, 131 insertions, 62 deletions
diff --git a/OpenSim/Framework/General/Types/PrimData.cs b/OpenSim/Framework/General/Types/PrimData.cs index 6b8fa3a..9b24c0f 100644 --- a/OpenSim/Framework/General/Types/PrimData.cs +++ b/OpenSim/Framework/General/Types/PrimData.cs | |||
@@ -194,35 +194,35 @@ namespace OpenSim.Framework.Types | |||
194 | return bytes; | 194 | return bytes; |
195 | } | 195 | } |
196 | 196 | ||
197 | public static PrimData DefaultCube() | 197 | //public static PrimData DefaultCube() |
198 | { | 198 | //{ |
199 | PrimData primData = new PrimData(); | 199 | // PrimData primData = new PrimData(); |
200 | primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 200 | // primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
201 | primData.FullID = LLUUID.Random(); | 201 | // primData.FullID = LLUUID.Random(); |
202 | primData.Scale = new LLVector3(0.5f, 0.5f, 0.5f); | 202 | // primData.Scale = new LLVector3(0.5f, 0.5f, 0.5f); |
203 | primData.Rotation = new LLQuaternion(0, 0, 0, 1); | 203 | // primData.Rotation = new LLQuaternion(0, 0, 0, 1); |
204 | primData.PCode = 9; | 204 | // primData.PCode = 9; |
205 | primData.ParentID = 0; | 205 | // primData.ParentID = 0; |
206 | primData.PathBegin = 0; | 206 | // primData.PathBegin = 0; |
207 | primData.PathEnd = 0; | 207 | // primData.PathEnd = 0; |
208 | primData.PathScaleX = 0; | 208 | // primData.PathScaleX = 0; |
209 | primData.PathScaleY = 0; | 209 | // primData.PathScaleY = 0; |
210 | primData.PathShearX = 0; | 210 | // primData.PathShearX = 0; |
211 | primData.PathShearY = 0; | 211 | // primData.PathShearY = 0; |
212 | primData.PathSkew = 0; | 212 | // primData.PathSkew = 0; |
213 | primData.ProfileBegin = 0; | 213 | // primData.ProfileBegin = 0; |
214 | primData.ProfileEnd = 0; | 214 | // primData.ProfileEnd = 0; |
215 | primData.PathCurve = 16; | 215 | // primData.PathCurve = 16; |
216 | primData.ProfileCurve = 1; | 216 | // primData.ProfileCurve = 1; |
217 | primData.ProfileHollow = 0; | 217 | // primData.ProfileHollow = 0; |
218 | primData.PathRadiusOffset = 0; | 218 | // primData.PathRadiusOffset = 0; |
219 | primData.PathRevolutions = 0; | 219 | // primData.PathRevolutions = 0; |
220 | primData.PathTaperX = 0; | 220 | // primData.PathTaperX = 0; |
221 | primData.PathTaperY = 0; | 221 | // primData.PathTaperY = 0; |
222 | primData.PathTwist = 0; | 222 | // primData.PathTwist = 0; |
223 | primData.PathTwistBegin = 0; | 223 | // primData.PathTwistBegin = 0; |
224 | 224 | ||
225 | return primData; | 225 | // return primData; |
226 | } | 226 | //} |
227 | } | 227 | } |
228 | } | 228 | } |
diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs index e058c07..9ab6071 100644 --- a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs | |||
@@ -19,7 +19,7 @@ namespace OpenSim.Framework.Types | |||
19 | 19 | ||
20 | public class PrimitiveBaseShape | 20 | public class PrimitiveBaseShape |
21 | { | 21 | { |
22 | private ShapeType type = ShapeType.Unknown; | 22 | protected ShapeType type = ShapeType.Unknown; |
23 | 23 | ||
24 | public byte PCode; | 24 | public byte PCode; |
25 | public ushort PathBegin; | 25 | public ushort PathBegin; |
@@ -72,38 +72,56 @@ namespace OpenSim.Framework.Types | |||
72 | 72 | ||
73 | public PrimitiveBaseShape Copy() | 73 | public PrimitiveBaseShape Copy() |
74 | { | 74 | { |
75 | return (PrimitiveBaseShape) this.MemberwiseClone(); | 75 | return (PrimitiveBaseShape)this.MemberwiseClone(); |
76 | } | 76 | } |
77 | } | ||
77 | 78 | ||
78 | public static PrimitiveBaseShape DefaultBox() | 79 | public class BoxShape : PrimitiveBaseShape |
80 | { | ||
81 | public BoxShape() | ||
79 | { | 82 | { |
80 | PrimitiveBaseShape primShape = new PrimitiveBaseShape(); | 83 | type = ShapeType.Box; |
84 | } | ||
85 | |||
86 | public static BoxShape Default | ||
87 | { | ||
88 | get | ||
89 | { | ||
90 | BoxShape primShape = new BoxShape(); | ||
81 | 91 | ||
82 | primShape.type = ShapeType.Box; | 92 | primShape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); |
83 | primShape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); | 93 | primShape.PCode = 9; |
84 | primShape.PCode = 9; | 94 | primShape.PathBegin = 0; |
85 | primShape.PathBegin = 0; | 95 | primShape.PathEnd = 0; |
86 | primShape.PathEnd = 0; | 96 | primShape.PathScaleX = 0; |
87 | primShape.PathScaleX = 0; | 97 | primShape.PathScaleY = 0; |
88 | primShape.PathScaleY = 0; | 98 | primShape.PathShearX = 0; |
89 | primShape.PathShearX = 0; | 99 | primShape.PathShearY = 0; |
90 | primShape.PathShearY = 0; | 100 | primShape.PathSkew = 0; |
91 | primShape.PathSkew = 0; | 101 | primShape.ProfileBegin = 0; |
92 | primShape.ProfileBegin = 0; | 102 | primShape.ProfileEnd = 0; |
93 | primShape.ProfileEnd = 0; | 103 | primShape.PathCurve = 16; |
94 | primShape.PathCurve = 16; | 104 | primShape.ProfileCurve = 1; |
95 | primShape.ProfileCurve = 1; | 105 | primShape.ProfileHollow = 0; |
96 | primShape.ProfileHollow = 0; | 106 | primShape.PathRadiusOffset = 0; |
97 | primShape.PathRadiusOffset = 0; | 107 | primShape.PathRevolutions = 0; |
98 | primShape.PathRevolutions = 0; | 108 | primShape.PathTaperX = 0; |
99 | primShape.PathTaperX = 0; | 109 | primShape.PathTaperY = 0; |
100 | primShape.PathTaperY = 0; | 110 | primShape.PathTwist = 0; |
101 | primShape.PathTwist = 0; | 111 | primShape.PathTwistBegin = 0; |
102 | primShape.PathTwistBegin = 0; | 112 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")); |
103 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")); | 113 | primShape.TextureEntry = ntex.ToBytes(); |
104 | primShape.TextureEntry = ntex.ToBytes(); | ||
105 | 114 | ||
106 | return primShape; | 115 | return primShape; |
116 | } | ||
117 | } | ||
118 | } | ||
119 | |||
120 | public class SphereShape : PrimitiveBaseShape | ||
121 | { | ||
122 | public SphereShape() | ||
123 | { | ||
124 | type = ShapeType.Sphere; | ||
107 | } | 125 | } |
108 | } | 126 | } |
109 | } | 127 | } |
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 2ac1000..044ad68 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -779,7 +779,7 @@ namespace OpenSim.Region.ClientStack | |||
779 | outPacket.ObjectData[0].ID = localID; | 779 | outPacket.ObjectData[0].ID = localID; |
780 | outPacket.ObjectData[0].FullID = objectID; | 780 | outPacket.ObjectData[0].FullID = objectID; |
781 | outPacket.ObjectData[0].OwnerID = ownerID; | 781 | outPacket.ObjectData[0].OwnerID = ownerID; |
782 | outPacket.ObjectData[0].Text = enc.GetBytes(text); | 782 | outPacket.ObjectData[0].Text = Helpers.StringToField( text ); |
783 | outPacket.ObjectData[0].ParentID = parentID; | 783 | outPacket.ObjectData[0].ParentID = parentID; |
784 | byte[] pb = pos.GetBytes(); | 784 | byte[] pb = pos.GetBytes(); |
785 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); | 785 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); |
@@ -798,7 +798,7 @@ namespace OpenSim.Region.ClientStack | |||
798 | outPacket.ObjectData[0].ID = localID; | 798 | outPacket.ObjectData[0].ID = localID; |
799 | outPacket.ObjectData[0].FullID = objectID; | 799 | outPacket.ObjectData[0].FullID = objectID; |
800 | outPacket.ObjectData[0].OwnerID = ownerID; | 800 | outPacket.ObjectData[0].OwnerID = ownerID; |
801 | outPacket.ObjectData[0].Text = enc.GetBytes(text); | 801 | outPacket.ObjectData[0].Text = Helpers.StringToField( text ); |
802 | outPacket.ObjectData[0].ParentID = parentID; | 802 | outPacket.ObjectData[0].ParentID = parentID; |
803 | byte[] pb = pos.GetBytes(); | 803 | byte[] pb = pos.GetBytes(); |
804 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); | 804 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); |
diff --git a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs new file mode 100644 index 0000000..2e43fe6 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs | |||
@@ -0,0 +1,31 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Environment.Scenes; | ||
5 | using libsecondlife; | ||
6 | using OpenSim.Framework.Types; | ||
7 | using System.Timers; | ||
8 | using System.Diagnostics; | ||
9 | using System.IO; | ||
10 | using Primitive=OpenSim.Region.Environment.Scenes.Primitive; | ||
11 | |||
12 | namespace SimpleApp | ||
13 | { | ||
14 | public class FileSystemObject : SceneObject | ||
15 | { | ||
16 | public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos) | ||
17 | : base( world, world.EventManager, LLUUID.Zero, world.NextLocalId, pos, BoxShape.Default ) | ||
18 | { | ||
19 | |||
20 | |||
21 | float size = (float)Math.Pow((double)fileInfo.Length, (double) 1 / 3) / 5; | ||
22 | rootPrimitive.ResizeGoup(new LLVector3(size, size, size)); | ||
23 | rootPrimitive.Text = fileInfo.Name; | ||
24 | } | ||
25 | |||
26 | public override void Update() | ||
27 | { | ||
28 | base.Update(); | ||
29 | } | ||
30 | } | ||
31 | } | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 4dae461..82dba0e 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -17,6 +17,7 @@ using System.Timers; | |||
17 | using OpenSim.Region.Environment.Scenes; | 17 | using OpenSim.Region.Environment.Scenes; |
18 | using OpenSim.Framework.Data; | 18 | using OpenSim.Framework.Data; |
19 | using OpenSim.Region.Environment; | 19 | using OpenSim.Region.Environment; |
20 | using System.IO; | ||
20 | 21 | ||
21 | namespace SimpleApp | 22 | namespace SimpleApp |
22 | { | 23 | { |
@@ -58,16 +59,35 @@ namespace SimpleApp | |||
58 | 59 | ||
59 | udpServer.ServerListener(); | 60 | udpServer.ServerListener(); |
60 | 61 | ||
61 | PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); | 62 | PrimitiveBaseShape shape = BoxShape.Default; |
62 | shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); | 63 | shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); |
63 | LLVector3 pos = new LLVector3(138, 129, 27); | 64 | LLVector3 pos = new LLVector3(138, 129, 27); |
64 | 65 | ||
65 | SceneObject m_sceneObject = new CpuCounterObject(scene, scene.EventManager, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); | 66 | SceneObject sceneObject = new CpuCounterObject(scene, scene.EventManager, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); |
66 | scene.AddEntity(m_sceneObject); | 67 | scene.AddEntity(sceneObject); |
67 | 68 | ||
68 | MyNpcCharacter m_character = new MyNpcCharacter( scene.EventManager ); | 69 | MyNpcCharacter m_character = new MyNpcCharacter( scene.EventManager ); |
69 | scene.AddNewClient(m_character, false); | 70 | scene.AddNewClient(m_character, false); |
70 | 71 | ||
72 | DirectoryInfo dirInfo = new DirectoryInfo( "." ); | ||
73 | |||
74 | float x = 0; | ||
75 | float z = 0; | ||
76 | |||
77 | foreach( FileInfo fileInfo in dirInfo.GetFiles()) | ||
78 | { | ||
79 | LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z); | ||
80 | x = x + 2; | ||
81 | if( x > 50 ) | ||
82 | { | ||
83 | x = 0; | ||
84 | z = z + 2; | ||
85 | } | ||
86 | |||
87 | FileSystemObject fileObject = new FileSystemObject( scene, fileInfo, filePos ); | ||
88 | scene.AddEntity(fileObject); | ||
89 | } | ||
90 | |||
71 | m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); | 91 | m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); |
72 | m_log.ReadLine(); | 92 | m_log.ReadLine(); |
73 | } | 93 | } |