diff options
More testing some ideas, to find best method for SceneObject Primitive classes.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs new file mode 100644 index 0000000..b0df4af --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs | |||
@@ -0,0 +1,211 @@ | |||
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 | private ulong m_regionHandle; | ||
18 | private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; | ||
19 | //private Dictionary<LLUUID, InventoryItem> inventoryItems; | ||
20 | |||
21 | public string SitName = ""; | ||
22 | public string TouchName = ""; | ||
23 | public string Text = ""; | ||
24 | |||
25 | public LLUUID CreatorID; | ||
26 | public LLUUID OwnerID; | ||
27 | public LLUUID LastOwnerID; | ||
28 | public Int32 CreationDate; | ||
29 | |||
30 | public LLUUID uuid; | ||
31 | public uint m_localID; | ||
32 | |||
33 | public uint ParentID = 0; | ||
34 | |||
35 | public uint OwnerMask = FULL_MASK_PERMISSIONS; | ||
36 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
37 | public uint GroupMask = FULL_MASK_PERMISSIONS; | ||
38 | public uint EveryoneMask = FULL_MASK_PERMISSIONS; | ||
39 | public uint BaseMask = FULL_MASK_PERMISSIONS; | ||
40 | |||
41 | protected PrimitiveBaseShape m_Shape; | ||
42 | |||
43 | protected AllNewSceneObjectGroup2 m_parentGroup; | ||
44 | |||
45 | |||
46 | #region Properties | ||
47 | protected string m_name; | ||
48 | /// <summary> | ||
49 | /// | ||
50 | /// </summary> | ||
51 | public virtual string Name | ||
52 | { | ||
53 | get { return m_name; } | ||
54 | set { m_name = value; } | ||
55 | } | ||
56 | |||
57 | protected LLVector3 m_offset; | ||
58 | public LLVector3 OffsetPosition | ||
59 | { | ||
60 | get | ||
61 | { | ||
62 | return m_offset; | ||
63 | } | ||
64 | set | ||
65 | { | ||
66 | m_offset = value; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | protected LLQuaternion m_rotationOffset; | ||
71 | public LLQuaternion RotationOffset | ||
72 | { | ||
73 | get | ||
74 | { | ||
75 | return m_rotationOffset; | ||
76 | } | ||
77 | set | ||
78 | { | ||
79 | m_rotationOffset = value; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | private string m_description = ""; | ||
84 | public string Description | ||
85 | { | ||
86 | get | ||
87 | { | ||
88 | return this.m_description; | ||
89 | } | ||
90 | set | ||
91 | { | ||
92 | this.m_description = value; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public PrimitiveBaseShape Shape | ||
97 | { | ||
98 | get | ||
99 | { | ||
100 | return this.m_Shape; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public LLVector3 Scale | ||
105 | { | ||
106 | set | ||
107 | { | ||
108 | this.m_Shape.Scale = value; | ||
109 | } | ||
110 | get | ||
111 | { | ||
112 | return this.m_Shape.Scale; | ||
113 | } | ||
114 | } | ||
115 | #endregion | ||
116 | |||
117 | #region Constructors | ||
118 | public AllNewSceneObjectPart2(ulong regionHandle, AllNewSceneObjectGroup2 parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 position) | ||
119 | { | ||
120 | this.m_regionHandle = regionHandle; | ||
121 | this.m_parentGroup = parent; | ||
122 | |||
123 | this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
124 | this.OwnerID = ownerID; | ||
125 | this.CreatorID = this.OwnerID; | ||
126 | this.LastOwnerID = LLUUID.Zero; | ||
127 | this.uuid = LLUUID.Random(); | ||
128 | this.m_localID = (uint)(localID); | ||
129 | this.m_Shape = shape; | ||
130 | |||
131 | this.OffsetPosition = position; | ||
132 | } | ||
133 | #endregion | ||
134 | |||
135 | #region Shape | ||
136 | /// <summary> | ||
137 | /// | ||
138 | /// </summary> | ||
139 | /// <param name="shapeBlock"></param> | ||
140 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) | ||
141 | { | ||
142 | this.m_Shape.PathBegin = shapeBlock.PathBegin; | ||
143 | this.m_Shape.PathEnd = shapeBlock.PathEnd; | ||
144 | this.m_Shape.PathScaleX = shapeBlock.PathScaleX; | ||
145 | this.m_Shape.PathScaleY = shapeBlock.PathScaleY; | ||
146 | this.m_Shape.PathShearX = shapeBlock.PathShearX; | ||
147 | this.m_Shape.PathShearY = shapeBlock.PathShearY; | ||
148 | this.m_Shape.PathSkew = shapeBlock.PathSkew; | ||
149 | this.m_Shape.ProfileBegin = shapeBlock.ProfileBegin; | ||
150 | this.m_Shape.ProfileEnd = shapeBlock.ProfileEnd; | ||
151 | this.m_Shape.PathCurve = shapeBlock.PathCurve; | ||
152 | this.m_Shape.ProfileCurve = shapeBlock.ProfileCurve; | ||
153 | this.m_Shape.ProfileHollow = shapeBlock.ProfileHollow; | ||
154 | this.m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; | ||
155 | this.m_Shape.PathRevolutions = shapeBlock.PathRevolutions; | ||
156 | this.m_Shape.PathTaperX = shapeBlock.PathTaperX; | ||
157 | this.m_Shape.PathTaperY = shapeBlock.PathTaperY; | ||
158 | this.m_Shape.PathTwist = shapeBlock.PathTwist; | ||
159 | this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; | ||
160 | } | ||
161 | #endregion | ||
162 | |||
163 | #region Texture | ||
164 | /// <summary> | ||
165 | /// | ||
166 | /// </summary> | ||
167 | /// <param name="textureEntry"></param> | ||
168 | public void UpdateTextureEntry(byte[] textureEntry) | ||
169 | { | ||
170 | this.m_Shape.TextureEntry = textureEntry; | ||
171 | } | ||
172 | #endregion | ||
173 | |||
174 | #region Position | ||
175 | /// <summary> | ||
176 | /// | ||
177 | /// </summary> | ||
178 | /// <param name="pos"></param> | ||
179 | public void UpdateOffSet(LLVector3 pos) | ||
180 | { | ||
181 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | ||
182 | this.OffsetPosition = newPos; | ||
183 | } | ||
184 | #endregion | ||
185 | |||
186 | #region rotation | ||
187 | public void UpdateRotation(LLQuaternion rot) | ||
188 | { | ||
189 | this.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); | ||
190 | } | ||
191 | #endregion | ||
192 | |||
193 | #region Resizing/Scale | ||
194 | /// <summary> | ||
195 | /// | ||
196 | /// </summary> | ||
197 | /// <param name="scale"></param> | ||
198 | public void Resize(LLVector3 scale) | ||
199 | { | ||
200 | LLVector3 offset = (scale - this.m_Shape.Scale); | ||
201 | offset.X /= 2; | ||
202 | offset.Y /= 2; | ||
203 | offset.Z /= 2; | ||
204 | |||
205 | this.OffsetPosition += offset; | ||
206 | this.m_Shape.Scale = scale; | ||
207 | } | ||
208 | #endregion | ||
209 | } | ||
210 | } | ||
211 | |||