aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/world/Primitive2.cs
diff options
context:
space:
mode:
authorMW2007-04-04 19:55:31 +0000
committerMW2007-04-04 19:55:31 +0000
commit0a377238f8e645f708b67bca1d6bb7ce879bd4a4 (patch)
tree01c70b1ce5c6f34e6716bec9c7878b8dbc5b9133 /OpenSim.RegionServer/world/Primitive2.cs
parentno SimUUID in OpenSimMain (diff)
downloadopensim-SC-0a377238f8e645f708b67bca1d6bb7ce879bd4a4.zip
opensim-SC-0a377238f8e645f708b67bca1d6bb7ce879bd4a4.tar.gz
opensim-SC-0a377238f8e645f708b67bca1d6bb7ce879bd4a4.tar.bz2
opensim-SC-0a377238f8e645f708b67bca1d6bb7ce879bd4a4.tar.xz
more work on Primitive2
Diffstat (limited to 'OpenSim.RegionServer/world/Primitive2.cs')
-rw-r--r--OpenSim.RegionServer/world/Primitive2.cs155
1 files changed, 132 insertions, 23 deletions
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];