diff options
author | MW | 2007-04-04 19:55:31 +0000 |
---|---|---|
committer | MW | 2007-04-04 19:55:31 +0000 |
commit | 0a377238f8e645f708b67bca1d6bb7ce879bd4a4 (patch) | |
tree | 01c70b1ce5c6f34e6716bec9c7878b8dbc5b9133 | |
parent | no SimUUID in OpenSimMain (diff) | |
download | opensim-SC-0a377238f8e645f708b67bca1d6bb7ce879bd4a4.zip opensim-SC-0a377238f8e645f708b67bca1d6bb7ce879bd4a4.tar.gz opensim-SC-0a377238f8e645f708b67bca1d6bb7ce879bd4a4.tar.bz2 opensim-SC-0a377238f8e645f708b67bca1d6bb7ce879bd4a4.tar.xz |
more work on Primitive2
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 7 | ||||
-rw-r--r-- | OpenSim.RegionServer/RegionInfo.cs | 33 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/Primitive2.cs | 155 |
3 files changed, 152 insertions, 43 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index e609b6c..7b0bd4b 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim | |||
54 | 54 | ||
55 | public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback | 55 | public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback |
56 | { | 56 | { |
57 | //private SimConfig Cfg; | 57 | //private SimConfig Cfg; |
58 | private IGenericConfig localConfig; | 58 | private IGenericConfig localConfig; |
59 | //private IGenericConfig remoteConfig; | 59 | //private IGenericConfig remoteConfig; |
60 | private PhysicsManager physManager; | 60 | private PhysicsManager physManager; |
@@ -110,8 +110,9 @@ namespace OpenSim | |||
110 | } | 110 | } |
111 | m_console.WriteLine("Main.cs:Startup() - Loading configuration"); | 111 | m_console.WriteLine("Main.cs:Startup() - Loading configuration"); |
112 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); | 112 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); |
113 | regionData.SimUUID = new LLUUID(localConfig.GetAttribute("SimUUID")); | 113 | //regionData.SimUUID = new LLUUID(localConfig.GetAttribute("SimUUID")); //don't need as regionData.SimUUID is already set through the above line |
114 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change | 114 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change |
115 | |||
115 | 116 | ||
116 | GridServers = new Grid(); | 117 | GridServers = new Grid(); |
117 | if (m_sandbox) | 118 | if (m_sandbox) |
diff --git a/OpenSim.RegionServer/RegionInfo.cs b/OpenSim.RegionServer/RegionInfo.cs index 15998cf..cf0c075 100644 --- a/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim.RegionServer/RegionInfo.cs | |||
@@ -9,9 +9,8 @@ namespace OpenSim | |||
9 | { | 9 | { |
10 | public class RegionInfo // could inherit from SimProfileBase | 10 | public class RegionInfo // could inherit from SimProfileBase |
11 | { | 11 | { |
12 | public LLUUID SimUUID; | ||
12 | public string RegionName; | 13 | public string RegionName; |
13 | public LLUUID SimUUID; | ||
14 | |||
15 | public uint RegionLocX; | 14 | public uint RegionLocX; |
16 | public uint RegionLocY; | 15 | public uint RegionLocY; |
17 | public ulong RegionHandle; | 16 | public ulong RegionHandle; |
@@ -42,21 +41,21 @@ namespace OpenSim | |||
42 | this.isSandbox = sandboxMode; | 41 | this.isSandbox = sandboxMode; |
43 | try | 42 | try |
44 | { | 43 | { |
45 | // Sim UUID | 44 | // Sim UUID |
46 | string attri =""; | 45 | string attri = ""; |
47 | attri = configData.GetAttribute("SimUUID"); | 46 | attri = configData.GetAttribute("SimUUID"); |
48 | if (attri == "") | 47 | if (attri == "") |
49 | { | 48 | { |
50 | this.SimUUID = LLUUID.Random(); | 49 | this.SimUUID = LLUUID.Random(); |
51 | configData.SetAttribute("SimUUID", this.SimUUID.ToString()); | 50 | configData.SetAttribute("SimUUID", this.SimUUID.ToString()); |
52 | } | 51 | } |
53 | else | 52 | else |
54 | { | 53 | { |
55 | this.SimUUID = new LLUUID(attri); | 54 | this.SimUUID = new LLUUID(attri); |
56 | } | 55 | } |
57 | 56 | ||
58 | // Sim name | 57 | // Sim name |
59 | attri =""; | 58 | attri = ""; |
60 | attri = configData.GetAttribute("SimName"); | 59 | attri = configData.GetAttribute("SimName"); |
61 | if (attri == "") | 60 | if (attri == "") |
62 | { | 61 | { |
@@ -116,7 +115,7 @@ namespace OpenSim | |||
116 | } | 115 | } |
117 | else | 116 | else |
118 | { | 117 | { |
119 | this.IPListenAddr = attri; | 118 | this.IPListenAddr = attri; |
120 | } | 119 | } |
121 | 120 | ||
122 | if (!isSandbox) | 121 | if (!isSandbox) |
@@ -231,7 +230,7 @@ namespace OpenSim | |||
231 | 230 | ||
232 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sim settings loaded:"); | 231 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sim settings loaded:"); |
233 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("UUID: " + this.SimUUID.ToStringHyphenated()); | 232 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("UUID: " + this.SimUUID.ToStringHyphenated()); |
234 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Name: " + this.RegionName); | 233 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Name: " + this.RegionName); |
235 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); | 234 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); |
236 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString()); | 235 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString()); |
237 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); | 236 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); |
diff --git a/OpenSim.RegionServer/world/Primitive2.cs b/OpenSim.RegionServer/world/Primitive2.cs index 4a19040..2ab1470 100644 --- a/OpenSim.RegionServer/world/Primitive2.cs +++ b/OpenSim.RegionServer/world/Primitive2.cs | |||
@@ -24,6 +24,8 @@ namespace OpenSim.world | |||
24 | private Dictionary<LLUUID, InventoryItem> inventoryItems; | 24 | private Dictionary<LLUUID, InventoryItem> inventoryItems; |
25 | private string inventoryFileName = ""; | 25 | private string inventoryFileName = ""; |
26 | 26 | ||
27 | #region Properties | ||
28 | |||
27 | public LLVector3 Scale | 29 | public LLVector3 Scale |
28 | { | 30 | { |
29 | set | 31 | set |
@@ -45,6 +47,7 @@ namespace OpenSim.world | |||
45 | } | 47 | } |
46 | } | 48 | } |
47 | 49 | ||
50 | #endregion | ||
48 | 51 | ||
49 | public Primitive2(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world) | 52 | public Primitive2(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world) |
50 | { | 53 | { |
@@ -88,16 +91,44 @@ namespace OpenSim.world | |||
88 | return result; | 91 | return result; |
89 | } | 92 | } |
90 | 93 | ||
94 | #region Overridden Methods | ||
95 | |||
91 | public override void update() | 96 | public override void update() |
92 | { | 97 | { |
93 | LLVector3 pos2 = new LLVector3(0, 0, 0); | 98 | LLVector3 pos2 = new LLVector3(0, 0, 0); |
94 | } | 99 | } |
95 | 100 | ||
96 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | 101 | public override void BackUp() |
97 | { | 102 | { |
98 | 103 | ||
99 | } | 104 | } |
100 | 105 | ||
106 | #endregion | ||
107 | |||
108 | #region Packet handlers | ||
109 | |||
110 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | ||
111 | { | ||
112 | this.primData.PathBegin = addPacket.PathBegin; | ||
113 | this.primData.PathEnd = addPacket.PathEnd; | ||
114 | this.primData.PathScaleX = addPacket.PathScaleX; | ||
115 | this.primData.PathScaleY = addPacket.PathScaleY; | ||
116 | this.primData.PathShearX = addPacket.PathShearX; | ||
117 | this.primData.PathShearY = addPacket.PathShearY; | ||
118 | this.primData.PathSkew = addPacket.PathSkew; | ||
119 | this.primData.ProfileBegin = addPacket.ProfileBegin; | ||
120 | this.primData.ProfileEnd = addPacket.ProfileEnd; | ||
121 | this.primData.PathCurve = addPacket.PathCurve; | ||
122 | this.primData.ProfileCurve = addPacket.ProfileCurve; | ||
123 | this.primData.ProfileHollow = addPacket.ProfileHollow; | ||
124 | this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; | ||
125 | this.primData.PathRevolutions = addPacket.PathRevolutions; | ||
126 | this.primData.PathTaperX = addPacket.PathTaperX; | ||
127 | this.primData.PathTaperY = addPacket.PathTaperY; | ||
128 | this.primData.PathTwist = addPacket.PathTwist; | ||
129 | this.primData.PathTwistBegin = addPacket.PathTwistBegin; | ||
130 | } | ||
131 | |||
101 | public void UpdateTexture(byte[] tex) | 132 | public void UpdateTexture(byte[] tex) |
102 | { | 133 | { |
103 | this.OurPacket.ObjectData[0].TextureEntry = tex; | 134 | this.OurPacket.ObjectData[0].TextureEntry = tex; |
@@ -115,6 +146,10 @@ namespace OpenSim.world | |||
115 | 146 | ||
116 | } | 147 | } |
117 | 148 | ||
149 | #endregion | ||
150 | |||
151 | # region Inventory Methods | ||
152 | |||
118 | public bool AddToInventory(InventoryItem item) | 153 | public bool AddToInventory(InventoryItem item) |
119 | { | 154 | { |
120 | return false; | 155 | return false; |
@@ -164,39 +199,57 @@ namespace OpenSim.world | |||
164 | 199 | ||
165 | } | 200 | } |
166 | 201 | ||
167 | public override void BackUp() | 202 | #endregion |
203 | |||
204 | #region Update viewers methods | ||
205 | |||
206 | public void SendFullUpdateToClient(SimClient remoteClient) | ||
168 | { | 207 | { |
208 | LLVector3 lPos; | ||
209 | if (this._physActor != null && this.physicsEnabled) | ||
210 | { | ||
211 | PhysicsVector pPos = this._physActor.Position; | ||
212 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
213 | } | ||
214 | else | ||
215 | { | ||
216 | lPos = this.Pos; | ||
217 | } | ||
218 | byte[] pb = lPos.GetBytes(); | ||
219 | Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
169 | 220 | ||
221 | this.UpdatePacketShapeData(); | ||
222 | remoteClient.OutPacket(OurPacket); | ||
170 | } | 223 | } |
171 | 224 | ||
225 | public void SendTerseUpdateToClient(SimClient RemoteClient) | ||
226 | { | ||
227 | |||
228 | } | ||
229 | |||
230 | public void SendTerseUpdateToALLClients() | ||
231 | { | ||
232 | |||
233 | } | ||
234 | |||
235 | #endregion | ||
236 | |||
237 | #region Create Methods | ||
238 | |||
172 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) | 239 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) |
173 | { | 240 | { |
174 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 241 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
175 | objupdate.RegionData.RegionHandle = m_regionHandle; | 242 | objupdate.RegionData.RegionHandle = m_regionHandle; |
176 | objupdate.RegionData.TimeDilation = 64096; | 243 | objupdate.RegionData.TimeDilation = 64096; |
177 | |||
178 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | 244 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; |
179 | PrimData PData = new PrimData(); | 245 | PrimData PData = new PrimData(); |
180 | this.primData = PData; | 246 | this.primData = PData; |
181 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 247 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
182 | 248 | ||
183 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | 249 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); |
184 | objupdate.ObjectData[0].PSBlock = new byte[0]; | 250 | this.SetDefaultPacketValues(objupdate.ObjectData[0]); |
185 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | 251 | |
186 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
187 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
188 | objupdate.ObjectData[0].Text = new byte[0]; | ||
189 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
190 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
191 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); | ||
192 | objupdate.ObjectData[0].Material = 3; | ||
193 | objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | 252 | objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; |
194 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
195 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
196 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
197 | this.primData.Texture = objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
198 | objupdate.ObjectData[0].State = 0; | ||
199 | objupdate.ObjectData[0].Data = new byte[0]; | ||
200 | PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID; | 253 | PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID; |
201 | PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; | 254 | PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; |
202 | PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; | 255 | PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; |
@@ -221,9 +274,6 @@ namespace OpenSim.world | |||
221 | PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | 274 | PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; |
222 | objupdate.ObjectData[0].ID = (uint)(localID); | 275 | objupdate.ObjectData[0].ID = (uint)(localID); |
223 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000")); | 276 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000")); |
224 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
225 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
226 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
227 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; | 277 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; |
228 | //update position | 278 | //update position |
229 | byte[] pb = pos1.GetBytes(); | 279 | byte[] pb = pos1.GetBytes(); |
@@ -235,12 +285,71 @@ namespace OpenSim.world | |||
235 | this.OurPacket = objupdate; | 285 | this.OurPacket = objupdate; |
236 | } | 286 | } |
237 | 287 | ||
238 | public void SendFullUpdateToClient(SimClient RemoteClient) | 288 | public void CreateFromBytes(byte[] data) |
289 | { | ||
290 | |||
291 | } | ||
292 | |||
293 | public void CreateFromPrimData(PrimData primData) | ||
239 | { | 294 | { |
240 | 295 | ||
241 | } | 296 | } |
242 | 297 | ||
243 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | 298 | #endregion |
299 | |||
300 | #region Packet Update Methods | ||
301 | protected void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) | ||
302 | { | ||
303 | objdata.PSBlock = new byte[0]; | ||
304 | objdata.ExtraParams = new byte[1]; | ||
305 | objdata.MediaURL = new byte[0]; | ||
306 | objdata.NameValue = new byte[0]; | ||
307 | objdata.Text = new byte[0]; | ||
308 | objdata.TextColor = new byte[4]; | ||
309 | objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); | ||
310 | objdata.JointPivot = new LLVector3(0, 0, 0); | ||
311 | objdata.Material = 3; | ||
312 | objdata.TextureAnim = new byte[0]; | ||
313 | objdata.Sound = LLUUID.Zero; | ||
314 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
315 | this.primData.Texture = objdata.TextureEntry = ntex.ToBytes(); | ||
316 | objdata.State = 0; | ||
317 | objdata.Data = new byte[0]; | ||
318 | |||
319 | objdata.ObjectData = new byte[60]; | ||
320 | objdata.ObjectData[46] = 128; | ||
321 | objdata.ObjectData[47] = 63; | ||
322 | } | ||
323 | |||
324 | protected void UpdatePacketShapeData() | ||
325 | { | ||
326 | OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
327 | OurPacket.ObjectData[0].PCode = this.primData.PCode; | ||
328 | OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
329 | OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
330 | OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
331 | OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
332 | OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
333 | OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
334 | OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
335 | OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
336 | OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
337 | OurPacket.ObjectData[0].Scale = this.primData.Scale; | ||
338 | OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
339 | OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
340 | OurPacket.ObjectData[0].ParentID = this.primData.ParentID; | ||
341 | OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
342 | OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | ||
343 | OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | ||
344 | OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX; | ||
345 | OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY; | ||
346 | OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist; | ||
347 | OurPacket.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin; | ||
348 | } | ||
349 | |||
350 | #endregion | ||
351 | |||
352 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | ||
244 | { | 353 | { |
245 | uint ID = this.localid; | 354 | uint ID = this.localid; |
246 | byte[] bytes = new byte[60]; | 355 | byte[] bytes = new byte[60]; |