diff options
Start of replacing the old SceneObject/Primitive classes with the new versions.
PLEASE NOTE: that with this revision some prim related features may be broke for a while. (things like linking prims and the parcel prim count.)
Also this revision may not work on mono, but that will be fixed soon.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs | 520 |
1 files changed, 0 insertions, 520 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs deleted file mode 100644 index c91701a..0000000 --- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs +++ /dev/null | |||
@@ -1,520 +0,0 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using System.Text; | ||
3 | using System; | ||
4 | using Axiom.Math; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | using OpenSim.Framework.Interfaces; | ||
8 | using OpenSim.Framework.Types; | ||
9 | |||
10 | namespace OpenSim.Region.Environment.Scenes | ||
11 | { | ||
12 | |||
13 | public class AllNewSceneObjectPart2 | ||
14 | { | ||
15 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
16 | |||
17 | public LLUUID CreatorID; | ||
18 | public LLUUID OwnerID; | ||
19 | public LLUUID GroupID; | ||
20 | public LLUUID LastOwnerID; | ||
21 | public Int32 CreationDate; | ||
22 | public uint ParentID = 0; | ||
23 | |||
24 | public uint OwnerMask = FULL_MASK_PERMISSIONS; | ||
25 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
26 | public uint GroupMask = FULL_MASK_PERMISSIONS; | ||
27 | public uint EveryoneMask = FULL_MASK_PERMISSIONS; | ||
28 | public uint BaseMask = FULL_MASK_PERMISSIONS; | ||
29 | |||
30 | protected byte[] m_particleSystem = new byte[0]; | ||
31 | |||
32 | protected AllNewSceneObjectGroup2 m_parentGroup; | ||
33 | |||
34 | /// <summary> | ||
35 | /// Only used internally to schedule client updates | ||
36 | /// </summary> | ||
37 | private byte m_updateFlag; | ||
38 | |||
39 | #region Properties | ||
40 | |||
41 | protected LLUUID m_uuid; | ||
42 | public LLUUID UUID | ||
43 | { | ||
44 | get { return m_uuid; } | ||
45 | set { value = m_uuid; } | ||
46 | } | ||
47 | |||
48 | protected uint m_localID; | ||
49 | public uint LocalID | ||
50 | { | ||
51 | get { return m_localID; } | ||
52 | set { m_localID = value; } | ||
53 | } | ||
54 | |||
55 | protected string m_partName; | ||
56 | public virtual string PartName | ||
57 | { | ||
58 | get { return m_partName; } | ||
59 | set { m_partName = value; } | ||
60 | } | ||
61 | |||
62 | protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; | ||
63 | public uint ObjectFlags | ||
64 | { | ||
65 | get { return (uint)m_flags; } | ||
66 | set { m_flags = (LLObject.ObjectFlags)value; } | ||
67 | } | ||
68 | |||
69 | protected LLObject.MaterialType m_material; | ||
70 | public byte Material | ||
71 | { | ||
72 | get { return (byte)m_material; } | ||
73 | set { m_material = (LLObject.MaterialType)value; } | ||
74 | } | ||
75 | |||
76 | protected ulong m_regionHandle; | ||
77 | public ulong RegionHandle | ||
78 | { | ||
79 | get { return m_regionHandle; } | ||
80 | set { m_regionHandle = value; } | ||
81 | } | ||
82 | |||
83 | //unkown if this will be kept, added as a way of removing the group position from the group class | ||
84 | protected LLVector3 m_groupPosition; | ||
85 | public LLVector3 GroupPosition | ||
86 | { | ||
87 | get { return m_groupPosition; } | ||
88 | set { m_groupPosition = value; } | ||
89 | } | ||
90 | |||
91 | protected LLVector3 m_offset; | ||
92 | public LLVector3 OffsetPosition | ||
93 | { | ||
94 | get { return m_offset; } | ||
95 | set { m_offset = value; } | ||
96 | } | ||
97 | |||
98 | protected LLQuaternion m_rotationOffset; | ||
99 | public LLQuaternion RotationOffset | ||
100 | { | ||
101 | get { return m_rotationOffset; } | ||
102 | set { m_rotationOffset = value; } | ||
103 | } | ||
104 | |||
105 | protected LLVector3 m_velocity; | ||
106 | /// <summary></summary> | ||
107 | public LLVector3 Velocity | ||
108 | { | ||
109 | get { return m_velocity; } | ||
110 | set { m_velocity = value; } | ||
111 | } | ||
112 | |||
113 | protected LLVector3 m_angularVelocity; | ||
114 | /// <summary></summary> | ||
115 | public LLVector3 AngularVelocity | ||
116 | { | ||
117 | get { return m_angularVelocity; } | ||
118 | set { m_angularVelocity = value; } | ||
119 | } | ||
120 | |||
121 | protected LLVector3 m_acceleration; | ||
122 | /// <summary></summary> | ||
123 | public LLVector3 Acceleration | ||
124 | { | ||
125 | get { return m_acceleration; } | ||
126 | set { m_acceleration = value; } | ||
127 | } | ||
128 | |||
129 | private string m_description = ""; | ||
130 | public string Description | ||
131 | { | ||
132 | get { return this.m_description; } | ||
133 | set { this.m_description = value; } | ||
134 | } | ||
135 | |||
136 | private string m_text = ""; | ||
137 | public string Text | ||
138 | { | ||
139 | get { return m_text; } | ||
140 | set | ||
141 | { | ||
142 | m_text = value; | ||
143 | ScheduleFullUpdate(); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | private string m_sitName = ""; | ||
148 | public string SitName | ||
149 | { | ||
150 | get { return m_sitName; } | ||
151 | set { m_sitName = value; } | ||
152 | } | ||
153 | |||
154 | private string m_touchName = ""; | ||
155 | public string TouchName | ||
156 | { | ||
157 | get { return m_touchName; } | ||
158 | set { m_touchName = value; } | ||
159 | } | ||
160 | |||
161 | protected PrimitiveBaseShape m_shape; | ||
162 | public PrimitiveBaseShape Shape | ||
163 | { | ||
164 | get { return this.m_shape; } | ||
165 | set { m_shape = value; } | ||
166 | } | ||
167 | |||
168 | public LLVector3 Scale | ||
169 | { | ||
170 | set { this.m_shape.Scale = value; } | ||
171 | get { return this.m_shape.Scale; } | ||
172 | } | ||
173 | #endregion | ||
174 | |||
175 | #region Constructors | ||
176 | /// <summary> | ||
177 | /// | ||
178 | /// </summary> | ||
179 | public AllNewSceneObjectPart2() | ||
180 | { | ||
181 | |||
182 | } | ||
183 | |||
184 | /// <summary> | ||
185 | /// Create a completely new SceneObjectPart (prim) | ||
186 | /// </summary> | ||
187 | /// <param name="regionHandle"></param> | ||
188 | /// <param name="parent"></param> | ||
189 | /// <param name="ownerID"></param> | ||
190 | /// <param name="localID"></param> | ||
191 | /// <param name="shape"></param> | ||
192 | /// <param name="position"></param> | ||
193 | public AllNewSceneObjectPart2(ulong regionHandle, AllNewSceneObjectGroup2 parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) | ||
194 | { | ||
195 | this.m_regionHandle = regionHandle; | ||
196 | this.m_parentGroup = parent; | ||
197 | |||
198 | this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
199 | this.OwnerID = ownerID; | ||
200 | this.CreatorID = this.OwnerID; | ||
201 | this.LastOwnerID = LLUUID.Zero; | ||
202 | this.UUID = LLUUID.Random(); | ||
203 | this.LocalID = (uint)(localID); | ||
204 | this.Shape = shape; | ||
205 | |||
206 | this.GroupPosition = groupPosition; | ||
207 | this.OffsetPosition = offsetPosition; | ||
208 | this.RotationOffset = LLQuaternion.Identity; | ||
209 | this.Velocity = new LLVector3(0, 0, 0); | ||
210 | this.AngularVelocity = new LLVector3(0, 0, 0); | ||
211 | this.Acceleration = new LLVector3(0, 0, 0); | ||
212 | |||
213 | //temporary code just so the m_flags field doesn't give a compiler warning | ||
214 | if (m_flags == LLObject.ObjectFlags.AllowInventoryDrop) | ||
215 | { | ||
216 | |||
217 | } | ||
218 | } | ||
219 | |||
220 | /// <summary> | ||
221 | /// Re/create a SceneObjectPart (prim) | ||
222 | /// </summary> | ||
223 | /// <param name="regionHandle"></param> | ||
224 | /// <param name="parent"></param> | ||
225 | /// <param name="ownerID"></param> | ||
226 | /// <param name="localID"></param> | ||
227 | /// <param name="shape"></param> | ||
228 | /// <param name="position"></param> | ||
229 | public AllNewSceneObjectPart2(ulong regionHandle, AllNewSceneObjectGroup2 parent, int creationDate, LLUUID ownerID, LLUUID creatorID, LLUUID lastOwnerID, uint localID, PrimitiveBaseShape shape, LLVector3 position, LLQuaternion rotation, uint flags) | ||
230 | { | ||
231 | this.m_regionHandle = regionHandle; | ||
232 | this.m_parentGroup = parent; | ||
233 | |||
234 | this.CreationDate = creationDate; | ||
235 | this.OwnerID = ownerID; | ||
236 | this.CreatorID = creatorID; | ||
237 | this.LastOwnerID = lastOwnerID; | ||
238 | this.UUID = LLUUID.Random(); | ||
239 | this.LocalID = (uint)(localID); | ||
240 | this.Shape = shape; | ||
241 | |||
242 | this.OffsetPosition = position; | ||
243 | this.RotationOffset = rotation; | ||
244 | this.ObjectFlags = flags; | ||
245 | } | ||
246 | #endregion | ||
247 | |||
248 | #region Copying | ||
249 | /// <summary> | ||
250 | /// | ||
251 | /// </summary> | ||
252 | /// <returns></returns> | ||
253 | public AllNewSceneObjectPart2 Copy(uint localID) | ||
254 | { | ||
255 | AllNewSceneObjectPart2 dupe = (AllNewSceneObjectPart2)this.MemberwiseClone(); | ||
256 | dupe.m_shape = m_shape.Copy(); | ||
257 | dupe.m_regionHandle = m_regionHandle; | ||
258 | dupe.UUID = LLUUID.Random(); | ||
259 | dupe.LocalID = localID; | ||
260 | dupe.GroupPosition = new LLVector3(GroupPosition.X, GroupPosition.Y, GroupPosition.Z); | ||
261 | dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); | ||
262 | dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); | ||
263 | dupe.Velocity = new LLVector3(0, 0, 0); | ||
264 | dupe.Acceleration = new LLVector3(0, 0, 0); | ||
265 | dupe.AngularVelocity = new LLVector3(0, 0, 0); | ||
266 | dupe.ObjectFlags = this.ObjectFlags; | ||
267 | //TODO copy extraparams data and anything else not currently copied | ||
268 | return dupe; | ||
269 | } | ||
270 | #endregion | ||
271 | |||
272 | #region Update Scheduling | ||
273 | /// <summary> | ||
274 | /// | ||
275 | /// </summary> | ||
276 | private void ClearUpdateSchedule() | ||
277 | { | ||
278 | m_updateFlag = 0; | ||
279 | } | ||
280 | |||
281 | /// <summary> | ||
282 | /// | ||
283 | /// </summary> | ||
284 | public void ScheduleFullUpdate() | ||
285 | { | ||
286 | m_updateFlag = 2; | ||
287 | } | ||
288 | |||
289 | /// <summary> | ||
290 | /// | ||
291 | /// </summary> | ||
292 | public void ScheduleTerseUpdate() | ||
293 | { | ||
294 | if (m_updateFlag < 1) | ||
295 | { | ||
296 | m_updateFlag = 1; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | /// <summary> | ||
301 | /// | ||
302 | /// </summary> | ||
303 | public void SendScheduledUpdates() | ||
304 | { | ||
305 | if (m_updateFlag == 1) //some change has been made so update the clients | ||
306 | { | ||
307 | SendTerseUpdateToAllClients(); | ||
308 | ClearUpdateSchedule(); | ||
309 | } | ||
310 | else | ||
311 | { | ||
312 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | ||
313 | { | ||
314 | SendFullUpdateToAllClients(); | ||
315 | ClearUpdateSchedule(); | ||
316 | } | ||
317 | } | ||
318 | } | ||
319 | #endregion | ||
320 | |||
321 | #region Shape | ||
322 | /// <summary> | ||
323 | /// | ||
324 | /// </summary> | ||
325 | /// <param name="shapeBlock"></param> | ||
326 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) | ||
327 | { | ||
328 | this.m_shape.PathBegin = shapeBlock.PathBegin; | ||
329 | this.m_shape.PathEnd = shapeBlock.PathEnd; | ||
330 | this.m_shape.PathScaleX = shapeBlock.PathScaleX; | ||
331 | this.m_shape.PathScaleY = shapeBlock.PathScaleY; | ||
332 | this.m_shape.PathShearX = shapeBlock.PathShearX; | ||
333 | this.m_shape.PathShearY = shapeBlock.PathShearY; | ||
334 | this.m_shape.PathSkew = shapeBlock.PathSkew; | ||
335 | this.m_shape.ProfileBegin = shapeBlock.ProfileBegin; | ||
336 | this.m_shape.ProfileEnd = shapeBlock.ProfileEnd; | ||
337 | this.m_shape.PathCurve = shapeBlock.PathCurve; | ||
338 | this.m_shape.ProfileCurve = shapeBlock.ProfileCurve; | ||
339 | this.m_shape.ProfileHollow = shapeBlock.ProfileHollow; | ||
340 | this.m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; | ||
341 | this.m_shape.PathRevolutions = shapeBlock.PathRevolutions; | ||
342 | this.m_shape.PathTaperX = shapeBlock.PathTaperX; | ||
343 | this.m_shape.PathTaperY = shapeBlock.PathTaperY; | ||
344 | this.m_shape.PathTwist = shapeBlock.PathTwist; | ||
345 | this.m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; | ||
346 | } | ||
347 | #endregion | ||
348 | |||
349 | #region Inventory | ||
350 | public void GetInventory(IClientAPI client, uint localID) | ||
351 | { | ||
352 | if (localID == this.m_localID) | ||
353 | { | ||
354 | client.SendTaskInventory(this.m_uuid, 0, new byte[0]); | ||
355 | } | ||
356 | } | ||
357 | #endregion | ||
358 | |||
359 | #region ExtraParams | ||
360 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) | ||
361 | { | ||
362 | this.m_shape.ExtraParams = new byte[data.Length + 7]; | ||
363 | int i = 0; | ||
364 | uint length = (uint)data.Length; | ||
365 | this.m_shape.ExtraParams[i++] = 1; | ||
366 | this.m_shape.ExtraParams[i++] = (byte)(type % 256); | ||
367 | this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256); | ||
368 | |||
369 | this.m_shape.ExtraParams[i++] = (byte)(length % 256); | ||
370 | this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256); | ||
371 | this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256); | ||
372 | this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256); | ||
373 | Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length); | ||
374 | |||
375 | this.ScheduleFullUpdate(); | ||
376 | } | ||
377 | #endregion | ||
378 | |||
379 | #region Texture | ||
380 | /// <summary> | ||
381 | /// | ||
382 | /// </summary> | ||
383 | /// <param name="textureEntry"></param> | ||
384 | public void UpdateTextureEntry(byte[] textureEntry) | ||
385 | { | ||
386 | this.m_shape.TextureEntry = textureEntry; | ||
387 | } | ||
388 | #endregion | ||
389 | |||
390 | #region ParticleSystem | ||
391 | public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem) | ||
392 | { | ||
393 | this.m_particleSystem = pSystem.GetBytes(); | ||
394 | } | ||
395 | #endregion | ||
396 | |||
397 | #region Position | ||
398 | /// <summary> | ||
399 | /// | ||
400 | /// </summary> | ||
401 | /// <param name="pos"></param> | ||
402 | public void UpdateOffSet(LLVector3 pos) | ||
403 | { | ||
404 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | ||
405 | this.OffsetPosition = newPos; | ||
406 | } | ||
407 | #endregion | ||
408 | |||
409 | #region rotation | ||
410 | public void UpdateRotation(LLQuaternion rot) | ||
411 | { | ||
412 | this.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); | ||
413 | } | ||
414 | #endregion | ||
415 | |||
416 | #region Resizing/Scale | ||
417 | /// <summary> | ||
418 | /// | ||
419 | /// </summary> | ||
420 | /// <param name="scale"></param> | ||
421 | public void Resize(LLVector3 scale) | ||
422 | { | ||
423 | this.m_shape.Scale = scale; | ||
424 | } | ||
425 | #endregion | ||
426 | |||
427 | #region Client Update Methods | ||
428 | /// <summary> | ||
429 | /// | ||
430 | /// </summary> | ||
431 | public void SendFullUpdateToAllClients() | ||
432 | { | ||
433 | List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); | ||
434 | for (int i = 0; i < avatars.Count; i++) | ||
435 | { | ||
436 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this); | ||
437 | } | ||
438 | } | ||
439 | |||
440 | /// <summary> | ||
441 | /// | ||
442 | /// </summary> | ||
443 | /// <param name="remoteClient"></param> | ||
444 | public void SendFullUpdate(IClientAPI remoteClient) | ||
445 | { | ||
446 | m_parentGroup.SendPartFullUpdate( remoteClient, this ); | ||
447 | } | ||
448 | |||
449 | /// <summary> | ||
450 | /// | ||
451 | /// </summary> | ||
452 | /// <param name="remoteClient"></param> | ||
453 | public void SendFullUpdateToClient(IClientAPI remoteClient) | ||
454 | { | ||
455 | LLVector3 lPos; | ||
456 | lPos = OffsetPosition; | ||
457 | SendFullUpdateToClient(remoteClient, lPos); | ||
458 | } | ||
459 | |||
460 | /// <summary> | ||
461 | /// | ||
462 | /// </summary> | ||
463 | /// <param name="remoteClient"></param> | ||
464 | /// <param name="lPos"></param> | ||
465 | public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) | ||
466 | { | ||
467 | LLQuaternion lRot; | ||
468 | lRot = RotationOffset; | ||
469 | |||
470 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, this.ObjectFlags, m_uuid, OwnerID, | ||
471 | m_text, ParentID, this.m_particleSystem, lRot); | ||
472 | } | ||
473 | |||
474 | /// <summary> | ||
475 | /// | ||
476 | /// </summary> | ||
477 | public void SendTerseUpdateToAllClients() | ||
478 | { | ||
479 | List<ScenePresence> avatars = this.m_parentGroup.RequestSceneAvatars(); | ||
480 | for (int i = 0; i < avatars.Count; i++) | ||
481 | { | ||
482 | m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); | ||
483 | } | ||
484 | } | ||
485 | |||
486 | /// <summary> | ||
487 | /// | ||
488 | /// </summary> | ||
489 | /// <param name="remoteClient"></param> | ||
490 | public void SendTerseUpdate(IClientAPI remoteClient) | ||
491 | { | ||
492 | m_parentGroup.SendPartTerseUpdate(remoteClient, this); | ||
493 | } | ||
494 | |||
495 | /// <summary> | ||
496 | /// | ||
497 | /// </summary> | ||
498 | /// <param name="RemoteClient"></param> | ||
499 | public void SendTerseUpdateToClient(IClientAPI remoteClient) | ||
500 | { | ||
501 | LLVector3 lPos; | ||
502 | lPos = this.OffsetPosition; | ||
503 | LLQuaternion mRot = this.RotationOffset; | ||
504 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | ||
505 | } | ||
506 | |||
507 | /// <summary> | ||
508 | /// | ||
509 | /// </summary> | ||
510 | /// <param name="remoteClient"></param> | ||
511 | /// <param name="lPos"></param> | ||
512 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) | ||
513 | { | ||
514 | LLQuaternion mRot = this.RotationOffset; | ||
515 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); | ||
516 | } | ||
517 | #endregion | ||
518 | } | ||
519 | } | ||
520 | |||