diff options
Diffstat (limited to 'Common/OpenSim.Framework/Types/PrimData.cs')
-rw-r--r-- | Common/OpenSim.Framework/Types/PrimData.cs | 201 |
1 files changed, 0 insertions, 201 deletions
diff --git a/Common/OpenSim.Framework/Types/PrimData.cs b/Common/OpenSim.Framework/Types/PrimData.cs deleted file mode 100644 index a63be76..0000000 --- a/Common/OpenSim.Framework/Types/PrimData.cs +++ /dev/null | |||
@@ -1,201 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | ||
33 | |||
34 | namespace OpenSim.Framework.Types | ||
35 | { | ||
36 | public class PrimData | ||
37 | { | ||
38 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
39 | |||
40 | public LLUUID OwnerID; | ||
41 | public byte PCode; | ||
42 | public ushort PathBegin; | ||
43 | public ushort PathEnd; | ||
44 | public byte PathScaleX; | ||
45 | public byte PathScaleY; | ||
46 | public byte PathShearX; | ||
47 | public byte PathShearY; | ||
48 | public sbyte PathSkew; | ||
49 | public ushort ProfileBegin; | ||
50 | public ushort ProfileEnd; | ||
51 | public LLVector3 Scale; | ||
52 | public byte PathCurve; | ||
53 | public byte ProfileCurve; | ||
54 | public uint ParentID = 0; | ||
55 | public ushort ProfileHollow; | ||
56 | public sbyte PathRadiusOffset; | ||
57 | public byte PathRevolutions; | ||
58 | public sbyte PathTaperX; | ||
59 | public sbyte PathTaperY; | ||
60 | public sbyte PathTwist; | ||
61 | public sbyte PathTwistBegin; | ||
62 | public byte[] Texture; | ||
63 | |||
64 | |||
65 | public Int32 CreationDate; | ||
66 | public uint OwnerMask = FULL_MASK_PERMISSIONS; | ||
67 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
68 | public uint GroupMask = FULL_MASK_PERMISSIONS; | ||
69 | public uint EveryoneMask = FULL_MASK_PERMISSIONS; | ||
70 | public uint BaseMask = FULL_MASK_PERMISSIONS; | ||
71 | |||
72 | //following only used during prim storage | ||
73 | public LLVector3 Position; | ||
74 | public LLQuaternion Rotation = new LLQuaternion(0,1,0,0); | ||
75 | public uint LocalID; | ||
76 | public LLUUID FullID; | ||
77 | |||
78 | public PrimData() | ||
79 | { | ||
80 | |||
81 | } | ||
82 | |||
83 | public PrimData(byte[] data) | ||
84 | { | ||
85 | int i =0; | ||
86 | |||
87 | this.OwnerID = new LLUUID(data, i); i += 16; | ||
88 | this.PCode = data[i++]; | ||
89 | this.PathBegin = (ushort)(data[i++] + (data[i++] << 8)); | ||
90 | this.PathEnd = (ushort)(data[i++] + (data[i++] << 8)); | ||
91 | this.PathScaleX = data[i++]; | ||
92 | this.PathScaleY = data[i++]; | ||
93 | this.PathShearX = data[i++]; | ||
94 | this.PathShearY = data[i++]; | ||
95 | this.PathSkew = (sbyte)data[i++]; | ||
96 | this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8)); | ||
97 | this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8)); | ||
98 | this.Scale = new LLVector3(data, i); i += 12; | ||
99 | this.PathCurve = data[i++]; | ||
100 | this.ProfileCurve = data[i++]; | ||
101 | this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
102 | this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8)); | ||
103 | this.PathRadiusOffset = (sbyte)data[i++]; | ||
104 | this.PathRevolutions = data[i++]; | ||
105 | this.PathTaperX = (sbyte)data[i++]; | ||
106 | this.PathTaperY =(sbyte) data[i++]; | ||
107 | this.PathTwist = (sbyte) data[i++]; | ||
108 | this.PathTwistBegin = (sbyte) data[i++]; | ||
109 | ushort length = (ushort)(data[i++] + (data[i++] << 8)); | ||
110 | this.Texture = new byte[length]; | ||
111 | Array.Copy(data, i, Texture, 0, length); i += length; | ||
112 | this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
113 | this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
114 | this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
115 | this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
116 | this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
117 | this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
118 | this.Position = new LLVector3(data, i); i += 12; | ||
119 | this.Rotation = new LLQuaternion(data,i, true); i += 12; | ||
120 | this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
121 | this.FullID = new LLUUID(data, i); i += 16; | ||
122 | |||
123 | } | ||
124 | |||
125 | public byte[] ToBytes() | ||
126 | { | ||
127 | int i = 0; | ||
128 | byte[] bytes = new byte[126 + Texture.Length]; | ||
129 | Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; | ||
130 | bytes[i++] = this.PCode; | ||
131 | bytes[i++] = (byte)(this.PathBegin % 256); | ||
132 | bytes[i++] = (byte)((this.PathBegin >> 8) % 256); | ||
133 | bytes[i++] = (byte)(this.PathEnd % 256); | ||
134 | bytes[i++] = (byte)((this.PathEnd >> 8) % 256); | ||
135 | bytes[i++] = this.PathScaleX; | ||
136 | bytes[i++] = this.PathScaleY; | ||
137 | bytes[i++] = this.PathShearX; | ||
138 | bytes[i++] = this.PathShearY; | ||
139 | bytes[i++] = (byte)this.PathSkew; | ||
140 | bytes[i++] = (byte)(this.ProfileBegin % 256); | ||
141 | bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256); | ||
142 | bytes[i++] = (byte)(this.ProfileEnd % 256); | ||
143 | bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256); | ||
144 | Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12; | ||
145 | bytes[i++] = this.PathCurve; | ||
146 | bytes[i++] = this.ProfileCurve; | ||
147 | bytes[i++] = (byte)(ParentID % 256); | ||
148 | bytes[i++] = (byte)((ParentID >> 8) % 256); | ||
149 | bytes[i++] = (byte)((ParentID >> 16) % 256); | ||
150 | bytes[i++] = (byte)((ParentID >> 24) % 256); | ||
151 | bytes[i++] = (byte)(this.ProfileHollow %256); | ||
152 | bytes[i++] = (byte)((this.ProfileHollow >> 8)% 256); | ||
153 | bytes[i++] = ((byte)this.PathRadiusOffset); | ||
154 | bytes[i++] = this.PathRevolutions; | ||
155 | bytes[i++] = ((byte) this.PathTaperX); | ||
156 | bytes[i++] = ((byte) this.PathTaperY); | ||
157 | bytes[i++] = ((byte) this.PathTwist); | ||
158 | bytes[i++] = ((byte) this.PathTwistBegin); | ||
159 | bytes[i++] = (byte)(Texture.Length % 256); | ||
160 | bytes[i++] = (byte)((Texture.Length >> 8) % 256); | ||
161 | Array.Copy(Texture, 0, bytes, i, Texture.Length); i += Texture.Length; | ||
162 | bytes[i++] = (byte)(this.CreationDate % 256); | ||
163 | bytes[i++] = (byte)((this.CreationDate >> 8) % 256); | ||
164 | bytes[i++] = (byte)((this.CreationDate >> 16) % 256); | ||
165 | bytes[i++] = (byte)((this.CreationDate >> 24) % 256); | ||
166 | bytes[i++] = (byte)(this.OwnerMask % 256); | ||
167 | bytes[i++] = (byte)((this.OwnerMask >> 8) % 256); | ||
168 | bytes[i++] = (byte)((this.OwnerMask >> 16) % 256); | ||
169 | bytes[i++] = (byte)((this.OwnerMask >> 24) % 256); | ||
170 | bytes[i++] = (byte)(this.NextOwnerMask % 256); | ||
171 | bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256); | ||
172 | bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256); | ||
173 | bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256); | ||
174 | bytes[i++] = (byte)(this.GroupMask % 256); | ||
175 | bytes[i++] = (byte)((this.GroupMask >> 8) % 256); | ||
176 | bytes[i++] = (byte)((this.GroupMask >> 16) % 256); | ||
177 | bytes[i++] = (byte)((this.GroupMask >> 24) % 256); | ||
178 | bytes[i++] = (byte)(this.EveryoneMask % 256); | ||
179 | bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256); | ||
180 | bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256); | ||
181 | bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256); | ||
182 | bytes[i++] = (byte)(this.BaseMask % 256); | ||
183 | bytes[i++] = (byte)((this.BaseMask >> 8) % 256); | ||
184 | bytes[i++] = (byte)((this.BaseMask >> 16) % 256); | ||
185 | bytes[i++] = (byte)((this.BaseMask >> 24) % 256); | ||
186 | Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12; | ||
187 | if (this.Rotation == new LLQuaternion(0,0,0,0)) | ||
188 | { | ||
189 | this.Rotation = new LLQuaternion(0, 1, 0, 0); | ||
190 | } | ||
191 | Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12; | ||
192 | bytes[i++] = (byte)(this.LocalID % 256); | ||
193 | bytes[i++] = (byte)((this.LocalID >> 8) % 256); | ||
194 | bytes[i++] = (byte)((this.LocalID >> 16) % 256); | ||
195 | bytes[i++] = (byte)((this.LocalID >> 24) % 256); | ||
196 | Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16; | ||
197 | |||
198 | return bytes; | ||
199 | } | ||
200 | } | ||
201 | } | ||