aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Framework/PrimData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.Framework/PrimData.cs')
-rw-r--r--OpenSim.Framework/PrimData.cs168
1 files changed, 0 insertions, 168 deletions
diff --git a/OpenSim.Framework/PrimData.cs b/OpenSim.Framework/PrimData.cs
deleted file mode 100644
index ee4188d..0000000
--- a/OpenSim.Framework/PrimData.cs
+++ /dev/null
@@ -1,168 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Assets
7{
8 public class PrimData
9 {
10 private const uint FULL_MASK_PERMISSIONS = 2147483647;
11
12 public LLUUID OwnerID;
13 public byte PCode;
14 public byte PathBegin;
15 public byte PathEnd;
16 public byte PathScaleX;
17 public byte PathScaleY;
18 public byte PathShearX;
19 public byte PathShearY;
20 public sbyte PathSkew;
21 public byte ProfileBegin;
22 public byte ProfileEnd;
23 public LLVector3 Scale;
24 public byte PathCurve;
25 public byte ProfileCurve;
26 public uint ParentID = 0;
27 public byte ProfileHollow;
28 public sbyte PathRadiusOffset;
29 public byte PathRevolutions;
30 public sbyte PathTaperX;
31 public sbyte PathTaperY;
32 public sbyte PathTwist;
33 public sbyte PathTwistBegin;
34 public byte[] Texture;
35
36
37 public Int32 CreationDate;
38 public uint OwnerMask = FULL_MASK_PERMISSIONS;
39 public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
40 public uint GroupMask = FULL_MASK_PERMISSIONS;
41 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
42 public uint BaseMask = FULL_MASK_PERMISSIONS;
43
44 //following only used during prim storage
45 public LLVector3 Position;
46 public LLQuaternion Rotation = new LLQuaternion(0,1,0,0);
47 public uint LocalID;
48 public LLUUID FullID;
49
50 public PrimData()
51 {
52
53 }
54
55 public PrimData(byte[] data)
56 {
57 int i =0;
58
59 this.OwnerID = new LLUUID(data, i); i += 16;
60 this.PCode = data[i++];
61 this.PathBegin = data[i++];
62 this.PathEnd = data[i++];
63 this.PathScaleX = data[i++];
64 this.PathScaleY = data[i++];
65 this.PathShearX = data[i++];
66 this.PathShearY = data[i++];
67 this.PathSkew = (sbyte)data[i++];
68 this.ProfileBegin = data[i++];
69 this.ProfileEnd = data[i++];
70 this.Scale = new LLVector3(data, i); i += 12;
71 this.PathCurve = data[i++];
72 this.ProfileCurve = data[i++];
73 this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
74 this.ProfileHollow = data[i++];
75 this.PathRadiusOffset = (sbyte)data[i++];
76 this.PathRevolutions = data[i++];
77 this.PathTaperX = (sbyte)data[i++];
78 this.PathTaperY =(sbyte) data[i++];
79 this.PathTwist = (sbyte) data[i++];
80 this.PathTwistBegin = (sbyte) data[i++];
81 ushort length = (ushort)(data[i++] + (data[i++] << 8));
82 this.Texture = new byte[length];
83 Array.Copy(data, i, Texture, 0, length); i += length;
84 this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
85 this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
86 this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
87 this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
88 this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
89 this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
90 this.Position = new LLVector3(data, i); i += 12;
91 this.Rotation = new LLQuaternion(data,i, true); i += 12;
92 this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
93 this.FullID = new LLUUID(data, i); i += 16;
94
95 }
96
97 public byte[] ToBytes()
98 {
99 int i = 0;
100 byte[] bytes = new byte[121 + Texture.Length];
101 Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
102 bytes[i++] = this.PCode;
103 bytes[i++] = this.PathBegin;
104 bytes[i++] = this.PathEnd;
105 bytes[i++] = this.PathScaleX;
106 bytes[i++] = this.PathScaleY;
107 bytes[i++] = this.PathShearX;
108 bytes[i++] = this.PathShearY;
109 bytes[i++] = (byte)this.PathSkew;
110 bytes[i++] = this.ProfileBegin;
111 bytes[i++] = this.ProfileEnd;
112 Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
113 bytes[i++] = this.PathCurve;
114 bytes[i++] = this.ProfileCurve;
115 bytes[i++] = (byte)(ParentID % 256);
116 bytes[i++] = (byte)((ParentID >> 8) % 256);
117 bytes[i++] = (byte)((ParentID >> 16) % 256);
118 bytes[i++] = (byte)((ParentID >> 24) % 256);
119 bytes[i++] = this.ProfileHollow;
120 bytes[i++] = ((byte)this.PathRadiusOffset);
121 bytes[i++] = this.PathRevolutions;
122 bytes[i++] = ((byte) this.PathTaperX);
123 bytes[i++] = ((byte) this.PathTaperY);
124 bytes[i++] = ((byte) this.PathTwist);
125 bytes[i++] = ((byte) this.PathTwistBegin);
126 bytes[i++] = (byte)(Texture.Length % 256);
127 bytes[i++] = (byte)((Texture.Length >> 8) % 256);
128 Array.Copy(Texture, 0, bytes, i, Texture.Length); i += Texture.Length;
129 bytes[i++] = (byte)(this.CreationDate % 256);
130 bytes[i++] = (byte)((this.CreationDate >> 8) % 256);
131 bytes[i++] = (byte)((this.CreationDate >> 16) % 256);
132 bytes[i++] = (byte)((this.CreationDate >> 24) % 256);
133 bytes[i++] = (byte)(this.OwnerMask % 256);
134 bytes[i++] = (byte)((this.OwnerMask >> 8) % 256);
135 bytes[i++] = (byte)((this.OwnerMask >> 16) % 256);
136 bytes[i++] = (byte)((this.OwnerMask >> 24) % 256);
137 bytes[i++] = (byte)(this.NextOwnerMask % 256);
138 bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256);
139 bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256);
140 bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256);
141 bytes[i++] = (byte)(this.GroupMask % 256);
142 bytes[i++] = (byte)((this.GroupMask >> 8) % 256);
143 bytes[i++] = (byte)((this.GroupMask >> 16) % 256);
144 bytes[i++] = (byte)((this.GroupMask >> 24) % 256);
145 bytes[i++] = (byte)(this.EveryoneMask % 256);
146 bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256);
147 bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256);
148 bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256);
149 bytes[i++] = (byte)(this.BaseMask % 256);
150 bytes[i++] = (byte)((this.BaseMask >> 8) % 256);
151 bytes[i++] = (byte)((this.BaseMask >> 16) % 256);
152 bytes[i++] = (byte)((this.BaseMask >> 24) % 256);
153 Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12;
154 if (this.Rotation == new LLQuaternion(0,0,0,0))
155 {
156 this.Rotation = new LLQuaternion(0, 1, 0, 0);
157 }
158 Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
159 bytes[i++] = (byte)(this.LocalID % 256);
160 bytes[i++] = (byte)((this.LocalID >> 8) % 256);
161 bytes[i++] = (byte)((this.LocalID >> 16) % 256);
162 bytes[i++] = (byte)((this.LocalID >> 24) % 256);
163 Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
164
165 return bytes;
166 }
167 }
168}