diff options
author | gareth | 2007-03-22 10:11:15 +0000 |
---|---|---|
committer | gareth | 2007-03-22 10:11:15 +0000 |
commit | 7daa3955bc3a1918e40962851f9e8d38597a245e (patch) | |
tree | bee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /src/world/Primitive.cs | |
parent | Load XML for neighbourinfo from grid (diff) | |
download | opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.zip opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.gz opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.bz2 opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.xz |
brought zircon branch into trunk
Diffstat (limited to 'src/world/Primitive.cs')
-rw-r--r-- | src/world/Primitive.cs | 429 |
1 files changed, 0 insertions, 429 deletions
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs deleted file mode 100644 index 6be33ef..0000000 --- a/src/world/Primitive.cs +++ /dev/null | |||
@@ -1,429 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.types; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | using GridInterfaces; | ||
8 | using PhysicsSystem; | ||
9 | |||
10 | namespace OpenSim.world | ||
11 | { | ||
12 | public class Primitive : Entity | ||
13 | { | ||
14 | protected float mesh_cutbegin; | ||
15 | protected float mesh_cutend; | ||
16 | protected PrimData primData; | ||
17 | protected bool newPrimFlag; | ||
18 | protected bool updateFlag; | ||
19 | protected bool dirtyFlag; | ||
20 | private ObjectUpdatePacket OurPacket; | ||
21 | private PhysicsActor _physActor; | ||
22 | private bool physicsEnabled; | ||
23 | |||
24 | public bool PhysicsEnabled | ||
25 | { | ||
26 | get | ||
27 | { | ||
28 | return physicsEnabled; | ||
29 | } | ||
30 | set | ||
31 | { | ||
32 | physicsEnabled = value; | ||
33 | } | ||
34 | } | ||
35 | public bool UpdateFlag | ||
36 | { | ||
37 | get | ||
38 | { | ||
39 | return updateFlag; | ||
40 | } | ||
41 | set | ||
42 | { | ||
43 | updateFlag = value; | ||
44 | } | ||
45 | } | ||
46 | public LLVector3 Scale | ||
47 | { | ||
48 | set | ||
49 | { | ||
50 | this.primData.Scale = value; | ||
51 | this.dirtyFlag = true; | ||
52 | } | ||
53 | get | ||
54 | { | ||
55 | return this.primData.Scale; | ||
56 | } | ||
57 | } | ||
58 | public PhysicsActor PhysActor | ||
59 | { | ||
60 | set | ||
61 | { | ||
62 | this._physActor = value; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | public Primitive() | ||
67 | { | ||
68 | mesh_cutbegin = 0.0f; | ||
69 | mesh_cutend = 1.0f; | ||
70 | } | ||
71 | |||
72 | public override Mesh getMesh() | ||
73 | { | ||
74 | Mesh mesh = new Mesh(); | ||
75 | Triangle tri = new Triangle( | ||
76 | new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f), | ||
77 | new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f), | ||
78 | new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f)); | ||
79 | |||
80 | mesh.AddTri(tri); | ||
81 | mesh += base.getMesh(); | ||
82 | |||
83 | return mesh; | ||
84 | } | ||
85 | |||
86 | public void UpdatePosition( LLVector3 pos) | ||
87 | { | ||
88 | this.position = pos; | ||
89 | if(this._physActor != null && this.physicsEnabled) | ||
90 | { | ||
91 | this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z); | ||
92 | } | ||
93 | this.updateFlag = true; | ||
94 | } | ||
95 | |||
96 | public override void update() | ||
97 | { | ||
98 | if(this.newPrimFlag) | ||
99 | { | ||
100 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
101 | client.OutPacket(OurPacket); | ||
102 | } | ||
103 | this.newPrimFlag = false; | ||
104 | } | ||
105 | else if(this.updateFlag) | ||
106 | { | ||
107 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
108 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME | ||
109 | terse.RegionData.TimeDilation = 64096; | ||
110 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
111 | terse.ObjectData[0] = this.CreateImprovedBlock(); | ||
112 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
113 | client.OutPacket(terse); | ||
114 | } | ||
115 | this.updateFlag = false; | ||
116 | } | ||
117 | else if(this.dirtyFlag) | ||
118 | { | ||
119 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
120 | UpdateClient(client); | ||
121 | } | ||
122 | this.dirtyFlag = false; | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | if(this._physActor != null && this.physicsEnabled) | ||
127 | { | ||
128 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
129 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME | ||
130 | terse.RegionData.TimeDilation = 64096; | ||
131 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
132 | terse.ObjectData[0] = this.CreateImprovedBlock(); | ||
133 | foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { | ||
134 | client.OutPacket(terse); | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | |||
140 | public void UpdateClient(OpenSimClient RemoteClient) | ||
141 | { | ||
142 | |||
143 | LLVector3 lPos; | ||
144 | if( this._physActor != null && this.physicsEnabled) | ||
145 | { | ||
146 | PhysicsVector pPos = this._physActor.Position; | ||
147 | lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z); | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | lPos = this.position; | ||
152 | } | ||
153 | byte[] pb = lPos.GetBytes(); | ||
154 | Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
155 | |||
156 | // OurPacket should be update with the follwing in updateShape() rather than having to do it here | ||
157 | OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
158 | OurPacket.ObjectData[0].PCode = this.primData.PCode; | ||
159 | OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
160 | OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
161 | OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
162 | OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
163 | OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
164 | OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
165 | OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
166 | OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
167 | OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
168 | OurPacket.ObjectData[0].Scale = this.primData.Scale; | ||
169 | OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
170 | OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
171 | OurPacket.ObjectData[0].ParentID = 0; | ||
172 | OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
173 | //finish off copying rest of shape data | ||
174 | OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | ||
175 | OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | ||
176 | OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX; | ||
177 | OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY; | ||
178 | OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist; | ||
179 | OurPacket.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin; | ||
180 | |||
181 | RemoteClient.OutPacket(OurPacket); | ||
182 | } | ||
183 | |||
184 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | ||
185 | { | ||
186 | this.primData.PathBegin = addPacket.PathBegin; | ||
187 | this.primData.PathEnd = addPacket.PathEnd; | ||
188 | this.primData.PathScaleX = addPacket.PathScaleX; | ||
189 | this.primData.PathScaleY = addPacket.PathScaleY; | ||
190 | this.primData.PathShearX = addPacket.PathShearX; | ||
191 | this.primData.PathShearY = addPacket.PathShearY; | ||
192 | this.primData.PathSkew = addPacket.PathSkew; | ||
193 | this.primData.ProfileBegin = addPacket.ProfileBegin; | ||
194 | this.primData.ProfileEnd = addPacket.ProfileEnd; | ||
195 | this.primData.PathCurve = addPacket.PathCurve; | ||
196 | this.primData.ProfileCurve = addPacket.ProfileCurve; | ||
197 | this.primData.ProfileHollow = addPacket.ProfileHollow; | ||
198 | this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; | ||
199 | this.primData.PathRevolutions = addPacket.PathRevolutions; | ||
200 | this.primData.PathTaperX = addPacket.PathTaperX; | ||
201 | this.primData.PathTaperY = addPacket.PathTaperY; | ||
202 | this.primData.PathTwist = addPacket.PathTwist; | ||
203 | this.primData.PathTwistBegin =addPacket.PathTwistBegin; | ||
204 | this.dirtyFlag = true; | ||
205 | } | ||
206 | |||
207 | public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID) | ||
208 | { | ||
209 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
210 | objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
211 | objupdate.RegionData.TimeDilation = 64096; | ||
212 | |||
213 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
214 | PrimData PData = new PrimData(); | ||
215 | this.primData = PData; | ||
216 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
217 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
218 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
219 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
220 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
221 | objupdate.ObjectData[0].Text = new byte[0]; | ||
222 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
223 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0); | ||
224 | objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0); | ||
225 | objupdate.ObjectData[0].Material = 3; | ||
226 | objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456; | ||
227 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
228 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
229 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
230 | objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
231 | objupdate.ObjectData[0].State = 0; | ||
232 | objupdate.ObjectData[0].Data = new byte[0]; | ||
233 | PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID; | ||
234 | PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; | ||
235 | PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; | ||
236 | PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd; | ||
237 | PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX; | ||
238 | PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY; | ||
239 | PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX; | ||
240 | PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY; | ||
241 | PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew; | ||
242 | PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin; | ||
243 | PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd; | ||
244 | PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale; | ||
245 | PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve; | ||
246 | PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve; | ||
247 | PData.ParentID = objupdate.ObjectData[0].ParentID = 0; | ||
248 | PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow; | ||
249 | |||
250 | PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | ||
251 | PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions; | ||
252 | PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX; | ||
253 | PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY; | ||
254 | PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist; | ||
255 | PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | ||
256 | |||
257 | //finish off copying rest of shape data | ||
258 | |||
259 | objupdate.ObjectData[0].ID = (uint)(localID); | ||
260 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID- 702000).ToString("00000")); | ||
261 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
262 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
263 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
264 | LLVector3 pos1= addPacket.ObjectData.RayEnd; | ||
265 | //update position | ||
266 | byte[] pb = pos1.GetBytes(); | ||
267 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
268 | |||
269 | this.newPrimFlag = true; | ||
270 | this.uuid = objupdate.ObjectData[0].FullID; | ||
271 | this.localid = objupdate.ObjectData[0].ID; | ||
272 | this.position = pos1; | ||
273 | this.OurPacket = objupdate; | ||
274 | } | ||
275 | |||
276 | public void CreateFromStorage(PrimData store) | ||
277 | { | ||
278 | //need to clean this up as it shares a lot of code with CreateFromPacket() | ||
279 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
280 | objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
281 | objupdate.RegionData.TimeDilation = 64096; | ||
282 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
283 | |||
284 | this.primData = store; | ||
285 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
286 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
287 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
288 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
289 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
290 | objupdate.ObjectData[0].Text = new byte[0]; | ||
291 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
292 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0); | ||
293 | objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0); | ||
294 | objupdate.ObjectData[0].Material = 3; | ||
295 | objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456; | ||
296 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
297 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
298 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
299 | objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
300 | objupdate.ObjectData[0].State = 0; | ||
301 | objupdate.ObjectData[0].Data = new byte[0]; | ||
302 | objupdate.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
303 | objupdate.ObjectData[0].PCode = this.primData.PCode; | ||
304 | objupdate.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
305 | objupdate.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
306 | objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
307 | objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
308 | objupdate.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
309 | objupdate.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
310 | objupdate.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
311 | objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
312 | objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
313 | objupdate.ObjectData[0].Scale = this.primData.Scale; | ||
314 | objupdate.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
315 | objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
316 | objupdate.ObjectData[0].ParentID = 0; | ||
317 | objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
318 | //finish off copying rest of shape data | ||
319 | objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; | ||
320 | objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; | ||
321 | objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX; | ||
322 | objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY; | ||
323 | objupdate.ObjectData[0].PathTwist = this.primData.PathTwist; | ||
324 | objupdate.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin; | ||
325 | |||
326 | objupdate.ObjectData[0].ID = (uint)store.LocalID; | ||
327 | objupdate.ObjectData[0].FullID = store.FullID; | ||
328 | |||
329 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
330 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
331 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
332 | LLVector3 pos1= store.Position; | ||
333 | //update position | ||
334 | byte[] pb = pos1.GetBytes(); | ||
335 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
336 | |||
337 | this.uuid = objupdate.ObjectData[0].FullID; | ||
338 | this.localid = objupdate.ObjectData[0].ID; | ||
339 | this.position = pos1; | ||
340 | this.OurPacket = objupdate; | ||
341 | |||
342 | } | ||
343 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | ||
344 | { | ||
345 | uint ID = this.localid; | ||
346 | byte[] bytes = new byte[60]; | ||
347 | |||
348 | int i = 0; | ||
349 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
350 | dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry; | ||
351 | |||
352 | bytes[i++] = (byte)(ID % 256); | ||
353 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
354 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
355 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
356 | bytes[i++]= 0; | ||
357 | bytes[i++]= 0; | ||
358 | |||
359 | LLVector3 lPos; | ||
360 | if( this._physActor != null && this.physicsEnabled) | ||
361 | { | ||
362 | PhysicsVector pPos = this._physActor.Position; | ||
363 | lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z); | ||
364 | } | ||
365 | else | ||
366 | { | ||
367 | lPos = this.position; | ||
368 | } | ||
369 | byte[] pb = lPos.GetBytes(); | ||
370 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
371 | i += 12; | ||
372 | ushort ac = 32767; | ||
373 | |||
374 | //vel | ||
375 | bytes[i++] = (byte)(ac % 256); | ||
376 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
377 | bytes[i++] = (byte)(ac % 256); | ||
378 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
379 | bytes[i++] = (byte)(ac % 256); | ||
380 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
381 | |||
382 | //accel | ||
383 | bytes[i++] = (byte)(ac % 256); | ||
384 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
385 | bytes[i++] = (byte)(ac % 256); | ||
386 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
387 | bytes[i++] = (byte)(ac % 256); | ||
388 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
389 | |||
390 | ushort rw, rx,ry,rz; | ||
391 | rw = (ushort)(32768 * (this.rotation.w+1)); | ||
392 | rx = (ushort)(32768 * (this.rotation.x+1)); | ||
393 | ry = (ushort)(32768 * (this.rotation.y+1)); | ||
394 | rz = (ushort)(32768 * (this.rotation.z+1)); | ||
395 | |||
396 | //rot | ||
397 | bytes[i++] = (byte)(rx % 256); | ||
398 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
399 | bytes[i++] = (byte)(ry % 256); | ||
400 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
401 | bytes[i++] = (byte)(rz % 256); | ||
402 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
403 | bytes[i++] = (byte)(rw % 256); | ||
404 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
405 | |||
406 | //rotation vel | ||
407 | bytes[i++] = (byte)(ac % 256); | ||
408 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
409 | bytes[i++] = (byte)(ac % 256); | ||
410 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
411 | bytes[i++] = (byte)(ac % 256); | ||
412 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
413 | |||
414 | dat.Data=bytes; | ||
415 | return dat; | ||
416 | } | ||
417 | |||
418 | public override void BackUp() | ||
419 | { | ||
420 | |||
421 | this.primData.FullID = this.uuid; | ||
422 | this.primData.LocalID = this.localid; | ||
423 | this.primData.Position = this.position; | ||
424 | this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z , this.rotation.w); | ||
425 | OpenSim_Main.local_world.localStorage.StorePrim(this.primData); | ||
426 | } | ||
427 | } | ||
428 | |||
429 | } | ||