diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Primitive.cs | 532 |
1 files changed, 94 insertions, 438 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 0f649b2..497196d 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs | |||
@@ -1,31 +1,3 @@ | |||
1 | |||
2 | /* | ||
3 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
4 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions are met: | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * * Neither the name of the OpenSim Project nor the | ||
14 | * names of its contributors may be used to endorse or promote products | ||
15 | * derived from this software without specific prior written permission. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
20 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | */ | ||
29 | using System; | 1 | using System; |
30 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
31 | using System.Text; | 3 | using System.Text; |
@@ -38,175 +10,66 @@ using OpenSim.Framework.Inventory; | |||
38 | 10 | ||
39 | namespace OpenSim.Region.Environment.Scenes | 11 | namespace OpenSim.Region.Environment.Scenes |
40 | { | 12 | { |
41 | public class Primitive : Entity | 13 | public class Primitive : EntityBase |
42 | { | 14 | { |
43 | internal PrimData primData; | 15 | private const uint FULL_MASK_PERMISSIONS = 2147483647; |
16 | |||
44 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); | 17 | private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); |
45 | // private Dictionary<uint, IClientAPI> m_clientThreads; | ||
46 | private ulong m_regionHandle; | 18 | private ulong m_regionHandle; |
47 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
48 | private bool physicsEnabled = false; | ||
49 | private byte updateFlag = 0; | 19 | private byte updateFlag = 0; |
50 | private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; | 20 | private uint flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; |
51 | 21 | ||
52 | private Dictionary<LLUUID, InventoryItem> inventoryItems; | 22 | private Dictionary<LLUUID, InventoryItem> inventoryItems; |
53 | 23 | ||
54 | #region Properties | 24 | public LLUUID OwnerID; |
25 | public Int32 CreationDate; | ||
26 | public uint OwnerMask = FULL_MASK_PERMISSIONS; | ||
27 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
28 | public uint GroupMask = FULL_MASK_PERMISSIONS; | ||
29 | public uint EveryoneMask = FULL_MASK_PERMISSIONS; | ||
30 | public uint BaseMask = FULL_MASK_PERMISSIONS; | ||
55 | 31 | ||
56 | public LLVector3 Scale | 32 | private PrimitiveBaseShape m_Shape; |
57 | { | ||
58 | set | ||
59 | { | ||
60 | this.primData.Scale = value; | ||
61 | //this.dirtyFlag = true; | ||
62 | } | ||
63 | get | ||
64 | { | ||
65 | return this.primData.Scale; | ||
66 | } | ||
67 | } | ||
68 | 33 | ||
69 | public PhysicsActor PhysActor | 34 | private SceneObject m_RootParent; |
70 | { | 35 | private bool isRootPrim; |
71 | set | 36 | private EntityBase m_Parent; |
72 | { | ||
73 | this._physActor = value; | ||
74 | } | ||
75 | } | ||
76 | 37 | ||
77 | public override LLVector3 Pos | 38 | public override LLVector3 Pos |
78 | { | 39 | { |
79 | get | 40 | get |
80 | { | 41 | { |
81 | return base.Pos; | 42 | if (isRootPrim) |
43 | { | ||
44 | return this.m_pos + m_Parent.Pos; | ||
45 | } | ||
46 | else | ||
47 | { | ||
48 | return this.m_pos; | ||
49 | } | ||
82 | } | 50 | } |
83 | set | 51 | set |
84 | { | 52 | { |
85 | base.Pos = value; | 53 | this.m_pos = value - m_Parent.Pos; //should we being subtracting the parent position |
86 | } | 54 | } |
87 | } | ||
88 | #endregion | ||
89 | 55 | ||
90 | /// <summary> | ||
91 | /// | ||
92 | /// </summary> | ||
93 | /// <param name="clientThreads"></param> | ||
94 | /// <param name="regionHandle"></param> | ||
95 | /// <param name="world"></param> | ||
96 | public Primitive( ulong regionHandle, Scene world) | ||
97 | { | ||
98 | // m_clientThreads = clientThreads; | ||
99 | m_regionHandle = regionHandle; | ||
100 | m_world = world; | ||
101 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | ||
102 | } | 56 | } |
103 | 57 | ||
104 | /// <summary> | 58 | public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent , SceneObject rootObject) |
105 | /// | ||
106 | /// </summary> | ||
107 | /// <param name="regionHandle"></param> | ||
108 | /// <param name="world"></param> | ||
109 | /// <param name="addPacket"></param> | ||
110 | /// <param name="ownerID"></param> | ||
111 | /// <param name="localID"></param> | ||
112 | public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID) | ||
113 | { | 59 | { |
114 | // m_clientThreads = clientThreads; | ||
115 | m_regionHandle = regionHandle; | 60 | m_regionHandle = regionHandle; |
116 | m_world = world; | 61 | m_world = world; |
117 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | 62 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); |
63 | this.m_Parent = parent; | ||
64 | this.isRootPrim = isRoot; | ||
65 | this.m_RootParent = rootObject; | ||
118 | this.CreateFromPacket(addPacket, ownerID, localID); | 66 | this.CreateFromPacket(addPacket, ownerID, localID); |
119 | } | 67 | } |
120 | 68 | ||
121 | /// <summary> | 69 | /// <summary> |
122 | /// | 70 | /// |
123 | /// </summary> | 71 | /// </summary> |
124 | /// <param name="clientThreads"></param> | 72 | public override void update() |
125 | /// <param name="regionHandle"></param> | ||
126 | /// <param name="world"></param> | ||
127 | /// <param name="owner"></param> | ||
128 | /// <param name="fullID"></param> | ||
129 | /// <param name="localID"></param> | ||
130 | public Primitive( ulong regionHandle, Scene world, LLUUID owner, LLUUID fullID, uint localID) | ||
131 | { | ||
132 | // m_clientThreads = clientThreads; | ||
133 | m_regionHandle = regionHandle; | ||
134 | m_world = world; | ||
135 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | ||
136 | this.primData = new PrimData(); | ||
137 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
138 | this.primData.OwnerID = owner; | ||
139 | this.primData.FullID = this.uuid = fullID; | ||
140 | this.primData.LocalID = m_localId = localID; | ||
141 | } | ||
142 | |||
143 | /// <summary> | ||
144 | /// Constructor to create a default cube | ||
145 | /// </summary> | ||
146 | /// <param name="clientThreads"></param> | ||
147 | /// <param name="regionHandle"></param> | ||
148 | /// <param name="world"></param> | ||
149 | /// <param name="owner"></param> | ||
150 | /// <param name="localID"></param> | ||
151 | /// <param name="position"></param> | ||
152 | public Primitive( ulong regionHandle, Scene world, LLUUID owner, uint localID, LLVector3 position) | ||
153 | { | ||
154 | //m_clientThreads = clientThreads; | ||
155 | m_regionHandle = regionHandle; | ||
156 | m_world = world; | ||
157 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | ||
158 | this.primData = PrimData.DefaultCube(); | ||
159 | this.primData.OwnerID = owner; | ||
160 | this.primData.LocalID = m_localId = localID; | ||
161 | this.Pos = this.primData.Position = position; | ||
162 | |||
163 | this.updateFlag = 1; | ||
164 | } | ||
165 | |||
166 | /// <summary> | ||
167 | /// | ||
168 | /// </summary> | ||
169 | /// <returns></returns> | ||
170 | public byte[] GetByteArray() | ||
171 | { | ||
172 | byte[] result = null; | ||
173 | List<byte[]> dataArrays = new List<byte[]>(); | ||
174 | dataArrays.Add(primData.ToBytes()); | ||
175 | foreach (Entity child in children) | ||
176 | { | ||
177 | if (child is OpenSim.Region.Environment.Scenes.Primitive) | ||
178 | { | ||
179 | dataArrays.Add(((OpenSim.Region.Environment.Scenes.Primitive)child).GetByteArray()); | ||
180 | } | ||
181 | } | ||
182 | byte[] primstart = Helpers.StringToField("<Prim>"); | ||
183 | byte[] primend = Helpers.StringToField("</Prim>"); | ||
184 | int totalLength = primstart.Length + primend.Length; | ||
185 | for (int i = 0; i < dataArrays.Count; i++) | ||
186 | { | ||
187 | totalLength += dataArrays[i].Length; | ||
188 | } | ||
189 | |||
190 | result = new byte[totalLength]; | ||
191 | int arraypos = 0; | ||
192 | Array.Copy(primstart, 0, result, 0, primstart.Length); | ||
193 | arraypos += primstart.Length; | ||
194 | for (int i = 0; i < dataArrays.Count; i++) | ||
195 | { | ||
196 | Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); | ||
197 | arraypos += dataArrays[i].Length; | ||
198 | } | ||
199 | Array.Copy(primend, 0, result, arraypos, primend.Length); | ||
200 | |||
201 | return result; | ||
202 | } | ||
203 | |||
204 | #region Overridden Methods | ||
205 | |||
206 | /// <summary> | ||
207 | /// | ||
208 | /// </summary> | ||
209 | public override void update() | ||
210 | { | 73 | { |
211 | if (this.updateFlag == 1) // is a new prim just been created/reloaded | 74 | if (this.updateFlag == 1) // is a new prim just been created/reloaded |
212 | { | 75 | { |
@@ -218,112 +81,53 @@ namespace OpenSim.Region.Environment.Scenes | |||
218 | this.SendTerseUpdateToALLClients(); | 81 | this.SendTerseUpdateToALLClients(); |
219 | this.updateFlag = 0; | 82 | this.updateFlag = 0; |
220 | } | 83 | } |
221 | } | ||
222 | |||
223 | /// <summary> | ||
224 | /// | ||
225 | /// </summary> | ||
226 | public override void BackUp() | ||
227 | { | ||
228 | 84 | ||
229 | } | 85 | base.update(); |
230 | |||
231 | #endregion | ||
232 | |||
233 | #region Packet handlers | ||
234 | |||
235 | /// <summary> | ||
236 | /// | ||
237 | /// </summary> | ||
238 | /// <param name="pos"></param> | ||
239 | public void UpdatePosition(LLVector3 pos) | ||
240 | { | ||
241 | this.Pos = new LLVector3(pos.X, pos.Y, pos.Z); | ||
242 | this.updateFlag = 2; | ||
243 | } | 86 | } |
244 | 87 | ||
245 | /// <summary> | 88 | /// <summary> |
246 | /// | 89 | /// |
247 | /// </summary> | 90 | /// </summary> |
248 | /// <param name="addPacket"></param> | 91 | /// <param name="addPacket"></param> |
249 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock updatePacket) | 92 | /// <param name="ownerID"></param> |
250 | { | 93 | /// <param name="localID"></param> |
251 | this.primData.PathBegin = updatePacket.PathBegin; | 94 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) |
252 | this.primData.PathEnd = updatePacket.PathEnd; | ||
253 | this.primData.PathScaleX = updatePacket.PathScaleX; | ||
254 | this.primData.PathScaleY = updatePacket.PathScaleY; | ||
255 | this.primData.PathShearX = updatePacket.PathShearX; | ||
256 | this.primData.PathShearY = updatePacket.PathShearY; | ||
257 | this.primData.PathSkew = updatePacket.PathSkew; | ||
258 | this.primData.ProfileBegin = updatePacket.ProfileBegin; | ||
259 | this.primData.ProfileEnd = updatePacket.ProfileEnd; | ||
260 | this.primData.PathCurve = updatePacket.PathCurve; | ||
261 | this.primData.ProfileCurve = updatePacket.ProfileCurve; | ||
262 | this.primData.ProfileHollow = updatePacket.ProfileHollow; | ||
263 | this.primData.PathRadiusOffset = updatePacket.PathRadiusOffset; | ||
264 | this.primData.PathRevolutions = updatePacket.PathRevolutions; | ||
265 | this.primData.PathTaperX = updatePacket.PathTaperX; | ||
266 | this.primData.PathTaperY = updatePacket.PathTaperY; | ||
267 | this.primData.PathTwist = updatePacket.PathTwist; | ||
268 | this.primData.PathTwistBegin = updatePacket.PathTwistBegin; | ||
269 | } | ||
270 | |||
271 | /// <summary> | ||
272 | /// | ||
273 | /// </summary> | ||
274 | /// <param name="tex"></param> | ||
275 | public void UpdateTexture(byte[] tex) | ||
276 | { | ||
277 | this.primData.TextureEntry = tex; | ||
278 | } | ||
279 | |||
280 | /// <summary> | ||
281 | /// | ||
282 | /// </summary> | ||
283 | /// <param name="pack"></param> | ||
284 | public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) | ||
285 | { | ||
286 | |||
287 | } | ||
288 | |||
289 | /// <summary> | ||
290 | /// | ||
291 | /// </summary> | ||
292 | /// <param name="prim"></param> | ||
293 | public void AssignToParent(Primitive prim) | ||
294 | { | ||
295 | |||
296 | } | ||
297 | |||
298 | #endregion | ||
299 | |||
300 | # region Inventory Methods | ||
301 | /// <summary> | ||
302 | /// | ||
303 | /// </summary> | ||
304 | /// <param name="item"></param> | ||
305 | /// <returns></returns> | ||
306 | public bool AddToInventory(InventoryItem item) | ||
307 | { | 95 | { |
308 | return false; | 96 | this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
309 | } | 97 | this.OwnerID = ownerID; |
98 | this.Pos = addPacket.ObjectData.RayEnd; | ||
99 | this.uuid = LLUUID.Random(); | ||
100 | this.m_localId = (uint)(localID); | ||
101 | |||
102 | PrimitiveBaseShape pShape = new PrimitiveBaseShape(); | ||
103 | this.m_Shape = pShape; | ||
104 | |||
105 | pShape.PCode = addPacket.ObjectData.PCode; | ||
106 | pShape.PathBegin = addPacket.ObjectData.PathBegin; | ||
107 | pShape.PathEnd = addPacket.ObjectData.PathEnd; | ||
108 | pShape.PathScaleX = addPacket.ObjectData.PathScaleX; | ||
109 | pShape.PathScaleY = addPacket.ObjectData.PathScaleY; | ||
110 | pShape.PathShearX = addPacket.ObjectData.PathShearX; | ||
111 | pShape.PathShearY = addPacket.ObjectData.PathShearY; | ||
112 | pShape.PathSkew = addPacket.ObjectData.PathSkew; | ||
113 | pShape.ProfileBegin = addPacket.ObjectData.ProfileBegin; | ||
114 | pShape.ProfileEnd = addPacket.ObjectData.ProfileEnd; | ||
115 | pShape.Scale = addPacket.ObjectData.Scale; | ||
116 | pShape.PathCurve = addPacket.ObjectData.PathCurve; | ||
117 | pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve; | ||
118 | pShape.ParentID = 0; | ||
119 | pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow; | ||
120 | pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | ||
121 | pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions; | ||
122 | pShape.PathTaperX = addPacket.ObjectData.PathTaperX; | ||
123 | pShape.PathTaperY = addPacket.ObjectData.PathTaperY; | ||
124 | pShape.PathTwist = addPacket.ObjectData.PathTwist; | ||
125 | pShape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | ||
310 | 126 | ||
311 | /// <summary> | 127 | this.updateFlag = 1; |
312 | /// | ||
313 | /// </summary> | ||
314 | /// <param name="itemID"></param> | ||
315 | /// <returns></returns> | ||
316 | public InventoryItem RemoveFromInventory(LLUUID itemID) | ||
317 | { | ||
318 | return null; | ||
319 | } | 128 | } |
320 | 129 | ||
321 | /// <summary> | 130 | public void AddToChildren(SceneObject linkObject) |
322 | /// | ||
323 | /// </summary> | ||
324 | /// <param name="simClient"></param> | ||
325 | /// <param name="packet"></param> | ||
326 | public void RequestInventoryInfo(IClientAPI simClient, RequestTaskInventoryPacket packet) | ||
327 | { | 131 | { |
328 | 132 | ||
329 | } | 133 | } |
@@ -331,53 +135,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
331 | /// <summary> | 135 | /// <summary> |
332 | /// | 136 | /// |
333 | /// </summary> | 137 | /// </summary> |
334 | /// <param name="simClient"></param> | 138 | /// <param name="pos"></param> |
335 | /// <param name="xferID"></param> | 139 | public void UpdatePosition(LLVector3 pos) |
336 | public void RequestXferInventory(IClientAPI simClient, ulong xferID) | ||
337 | { | ||
338 | //will only currently work if the total size of the inventory data array is under about 1000 bytes | ||
339 | SendXferPacketPacket send = new SendXferPacketPacket(); | ||
340 | |||
341 | send.XferID.ID = xferID; | ||
342 | send.XferID.Packet = 1 + 2147483648; | ||
343 | send.DataPacket.Data = this.ConvertInventoryToBytes(); | ||
344 | |||
345 | simClient.OutPacket(send); | ||
346 | } | ||
347 | |||
348 | /// <summary> | ||
349 | /// | ||
350 | /// </summary> | ||
351 | /// <returns></returns> | ||
352 | public byte[] ConvertInventoryToBytes() | ||
353 | { | 140 | { |
354 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | 141 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); |
355 | byte[] result = new byte[0]; | 142 | if (this.isRootPrim) |
356 | List<byte[]> inventoryData = new List<byte[]>(); | ||
357 | int totallength = 0; | ||
358 | foreach (InventoryItem invItem in inventoryItems.Values) | ||
359 | { | 143 | { |
360 | byte[] data = enc.GetBytes(invItem.ExportString()); | 144 | this.m_Parent.Pos = newPos; |
361 | inventoryData.Add(data); | ||
362 | totallength += data.Length; | ||
363 | } | 145 | } |
364 | //TODO: copy arrays into the single result array | 146 | this.Pos = newPos; |
365 | 147 | this.updateFlag = 2; | |
366 | return result; | ||
367 | } | ||
368 | |||
369 | /// <summary> | ||
370 | /// | ||
371 | /// </summary> | ||
372 | /// <param name="data"></param> | ||
373 | public void CreateInventoryFromBytes(byte[] data) | ||
374 | { | ||
375 | |||
376 | } | 148 | } |
377 | 149 | ||
378 | #endregion | 150 | #region Client Update Methods |
379 | |||
380 | #region Update viewers Methods | ||
381 | 151 | ||
382 | /// <summary> | 152 | /// <summary> |
383 | /// | 153 | /// |
@@ -402,17 +172,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
402 | public void SendFullUpdateToClient(IClientAPI remoteClient) | 172 | public void SendFullUpdateToClient(IClientAPI remoteClient) |
403 | { | 173 | { |
404 | LLVector3 lPos; | 174 | LLVector3 lPos; |
405 | if (this._physActor != null && this.physicsEnabled) | 175 | lPos = this.Pos; |
406 | { | ||
407 | PhysicsVector pPos = this._physActor.Position; | ||
408 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | lPos = this.Pos; | ||
413 | } | ||
414 | 176 | ||
415 | remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.primData, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags); | 177 | remoteClient.SendPrimitiveToClient2(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID); |
416 | } | 178 | } |
417 | 179 | ||
418 | /// <summary> | 180 | /// <summary> |
@@ -430,22 +192,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
430 | /// <summary> | 192 | /// <summary> |
431 | /// | 193 | /// |
432 | /// </summary> | 194 | /// </summary> |
195 | /// <param name="remoteClient"></param> | ||
196 | public void SendTerseUpdateForAllChildren(IClientAPI remoteClient) | ||
197 | { | ||
198 | this.SendTerseUpdateToClient(remoteClient); | ||
199 | for (int i = 0; i < this.children.Count; i++) | ||
200 | { | ||
201 | if (this.children[i] is Primitive) | ||
202 | { | ||
203 | ((Primitive)this.children[i]).SendTerseUpdateForAllChildren(remoteClient); | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | |||
208 | /// <summary> | ||
209 | /// | ||
210 | /// </summary> | ||
433 | /// <param name="RemoteClient"></param> | 211 | /// <param name="RemoteClient"></param> |
434 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) | 212 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) |
435 | { | 213 | { |
436 | LLVector3 lPos; | 214 | LLVector3 lPos; |
437 | Axiom.MathLib.Quaternion lRot; | 215 | Axiom.MathLib.Quaternion lRot; |
438 | if (this._physActor != null && this.physicsEnabled) //is this needed ? doesn't the property fields do this for us? | 216 | |
439 | { | 217 | lPos = this.Pos; |
440 | PhysicsVector pPos = this._physActor.Position; | 218 | lRot = this.rotation; |
441 | lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); | 219 | |
442 | lRot = this._physActor.Orientation; | ||
443 | } | ||
444 | else | ||
445 | { | ||
446 | lPos = this.Pos; | ||
447 | lRot = this.rotation; | ||
448 | } | ||
449 | LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); | 220 | LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); |
450 | RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); | 221 | RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); |
451 | } | 222 | } |
@@ -463,120 +234,5 @@ namespace OpenSim.Region.Environment.Scenes | |||
463 | } | 234 | } |
464 | 235 | ||
465 | #endregion | 236 | #endregion |
466 | |||
467 | #region Create Methods | ||
468 | |||
469 | /// <summary> | ||
470 | /// | ||
471 | /// </summary> | ||
472 | /// <param name="addPacket"></param> | ||
473 | /// <param name="ownerID"></param> | ||
474 | /// <param name="localID"></param> | ||
475 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) | ||
476 | { | ||
477 | PrimData PData = new PrimData(); | ||
478 | this.primData = PData; | ||
479 | this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
480 | |||
481 | PData.OwnerID = ownerID; | ||
482 | PData.PCode = addPacket.ObjectData.PCode; | ||
483 | PData.PathBegin = addPacket.ObjectData.PathBegin; | ||
484 | PData.PathEnd = addPacket.ObjectData.PathEnd; | ||
485 | PData.PathScaleX = addPacket.ObjectData.PathScaleX; | ||
486 | PData.PathScaleY = addPacket.ObjectData.PathScaleY; | ||
487 | PData.PathShearX = addPacket.ObjectData.PathShearX; | ||
488 | PData.PathShearY = addPacket.ObjectData.PathShearY; | ||
489 | PData.PathSkew = addPacket.ObjectData.PathSkew; | ||
490 | PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; | ||
491 | PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; | ||
492 | PData.Scale = addPacket.ObjectData.Scale; | ||
493 | PData.PathCurve = addPacket.ObjectData.PathCurve; | ||
494 | PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; | ||
495 | PData.ParentID = 0; | ||
496 | PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; | ||
497 | PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | ||
498 | PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; | ||
499 | PData.PathTaperX = addPacket.ObjectData.PathTaperX; | ||
500 | PData.PathTaperY = addPacket.ObjectData.PathTaperY; | ||
501 | PData.PathTwist = addPacket.ObjectData.PathTwist; | ||
502 | PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | ||
503 | LLVector3 pos1 = addPacket.ObjectData.RayEnd; | ||
504 | this.primData.FullID = this.uuid = LLUUID.Random(); | ||
505 | this.primData.LocalID = m_localId = (uint)(localID); | ||
506 | this.primData.Position = this.Pos = pos1; | ||
507 | |||
508 | this.updateFlag = 1; | ||
509 | } | ||
510 | |||
511 | /// <summary> | ||
512 | /// | ||
513 | /// </summary> | ||
514 | /// <param name="data"></param> | ||
515 | public void CreateFromBytes(byte[] data) | ||
516 | { | ||
517 | |||
518 | } | ||
519 | |||
520 | /// <summary> | ||
521 | /// | ||
522 | /// </summary> | ||
523 | /// <param name="primData"></param> | ||
524 | public void CreateFromPrimData(PrimData primData) | ||
525 | { | ||
526 | this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); | ||
527 | } | ||
528 | |||
529 | /// <summary> | ||
530 | /// | ||
531 | /// </summary> | ||
532 | /// <param name="primData"></param> | ||
533 | /// <param name="posi"></param> | ||
534 | /// <param name="localID"></param> | ||
535 | /// <param name="newprim"></param> | ||
536 | public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) | ||
537 | { | ||
538 | |||
539 | } | ||
540 | |||
541 | public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) | ||
542 | { | ||
543 | // Console.WriteLine("moving prim to new location " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
544 | this.Pos = pos; | ||
545 | this.SendTerseUpdateToALLClients(); | ||
546 | } | ||
547 | |||
548 | public void GetProperites(IClientAPI client) | ||
549 | { | ||
550 | //needs changing | ||
551 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | ||
552 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | ||
553 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | ||
554 | proper.ObjectData[0].ItemID = LLUUID.Zero; | ||
555 | proper.ObjectData[0].CreationDate = (ulong)primData.CreationDate; | ||
556 | proper.ObjectData[0].CreatorID = primData.OwnerID; | ||
557 | proper.ObjectData[0].FolderID = LLUUID.Zero; | ||
558 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | ||
559 | proper.ObjectData[0].GroupID = LLUUID.Zero; | ||
560 | proper.ObjectData[0].InventorySerial = 0; | ||
561 | proper.ObjectData[0].LastOwnerID = LLUUID.Zero; | ||
562 | proper.ObjectData[0].ObjectID = this.uuid; | ||
563 | proper.ObjectData[0].OwnerID = primData.OwnerID; | ||
564 | proper.ObjectData[0].TouchName = new byte[0]; | ||
565 | proper.ObjectData[0].TextureID = new byte[0]; | ||
566 | proper.ObjectData[0].SitName = new byte[0]; | ||
567 | proper.ObjectData[0].Name = new byte[0]; | ||
568 | proper.ObjectData[0].Description = new byte[0]; | ||
569 | proper.ObjectData[0].OwnerMask = primData.OwnerMask; | ||
570 | proper.ObjectData[0].NextOwnerMask = primData.NextOwnerMask; | ||
571 | proper.ObjectData[0].GroupMask = primData.GroupMask; | ||
572 | proper.ObjectData[0].EveryoneMask = primData.EveryoneMask; | ||
573 | proper.ObjectData[0].BaseMask = primData.BaseMask; | ||
574 | |||
575 | client.OutPacket(proper); | ||
576 | |||
577 | } | ||
578 | |||
579 | #endregion | ||
580 | |||
581 | } | 237 | } |
582 | } | 238 | } |