aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs
diff options
context:
space:
mode:
authorMW2007-08-09 17:54:22 +0000
committerMW2007-08-09 17:54:22 +0000
commitd451dddcd0e061cd5aa326cb08d6e24e08817dcc (patch)
tree72284c21869a14db90f0fbaba25ba69b4abd0ab8 /OpenSim/Region/Environment/Scenes/SceneObject(Old).cs
parentNew linux libopenjpeg compiled for i386 instead of i686. Hopefully this one w... (diff)
downloadopensim-SC_OLD-d451dddcd0e061cd5aa326cb08d6e24e08817dcc.zip
opensim-SC_OLD-d451dddcd0e061cd5aa326cb08d6e24e08817dcc.tar.gz
opensim-SC_OLD-d451dddcd0e061cd5aa326cb08d6e24e08817dcc.tar.bz2
opensim-SC_OLD-d451dddcd0e061cd5aa326cb08d6e24e08817dcc.tar.xz
Start of replacing the old SceneObject/Primitive classes with the new versions.
PLEASE NOTE: that with this revision some prim related features may be broke for a while. (things like linking prims and the parcel prim count.) Also this revision may not work on mono, but that will be fixed soon.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObject(Old).cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject(Old).cs315
1 files changed, 315 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs
new file mode 100644
index 0000000..882b72e
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs
@@ -0,0 +1,315 @@
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*/
28using System.Collections.Generic;
29using System.Text;
30using System.IO;
31using System.Xml;
32using System.Xml.Serialization;
33using libsecondlife;
34using libsecondlife.Packets;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types;
37using OpenSim.Physics.Manager;
38
39namespace OpenSim.Region.Environment.Scenes
40{
41 public class SceneObjectOLD : EntityBase
42 {
43 private Encoding enc = Encoding.ASCII;
44 private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
45 public Primitive rootPrimitive;
46 protected ulong m_regionHandle;
47
48 private EventManager m_eventManager;
49
50 public bool isSelected = false;
51
52 public LLUUID rootUUID
53 {
54 get
55 {
56 this.m_uuid = this.rootPrimitive.m_uuid;
57 return this.m_uuid;
58 }
59 }
60
61 public uint rootLocalID
62 {
63 get
64 {
65 this.m_localId = this.rootPrimitive.LocalId;
66 return this.LocalId;
67 }
68 }
69
70 public int primCount
71 {
72 get
73 {
74 return this.ChildPrimitives.Count;
75 }
76 }
77
78 public Dictionary<LLUUID, Primitive> Children
79 {
80 get
81 {
82 return this.ChildPrimitives;
83 }
84 }
85
86 /// <summary>
87 ///
88 /// </summary>
89 public SceneObjectOLD(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
90 {
91 m_regionHandle = world.RegionInfo.RegionHandle;
92 m_scene = world;
93 m_eventManager = eventManager;
94
95 this.Pos = pos;
96 this.CreateRootFromShape(ownerID, localID, shape, pos);
97
98 registerEvents();
99 }
100
101 /// <summary>
102 ///
103 /// </summary>
104 /// <remarks>Need a null constructor for duplication</remarks>
105 public SceneObjectOLD()
106 {
107
108 }
109
110 public void registerEvents()
111 {
112 m_eventManager.OnBackup += new EventManager.OnBackupDelegate(ProcessBackup);
113 m_eventManager.OnParcelPrimCountUpdate += new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
114 }
115
116 public void unregisterEvents()
117 {
118 m_eventManager.OnBackup -= new EventManager.OnBackupDelegate(ProcessBackup);
119 m_eventManager.OnParcelPrimCountUpdate -= new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
120 }
121
122 /// <summary>
123 /// Processes backup
124 /// </summary>
125 /// <param name="datastore"></param>
126 public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore)
127 {
128 // datastore.StoreObject(this);
129 }
130
131 /// <summary>
132 /// Sends my primitive info to the land manager for it to keep tally of all of the prims!
133 /// </summary>
134 private void ProcessParcelPrimCountUpdate()
135 {
136
137 // m_eventManager.TriggerParcelPrimCountAdd(this);
138 }
139
140 /// <summary>
141 ///
142 /// </summary>
143 /// <param name="addPacket"></param>
144 /// <param name="agentID"></param>
145 /// <param name="localID"></param>
146 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
147 {
148
149 // this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_scene, agentID, localID, true, this, this, shape, pos);
150 this.m_children.Add(rootPrimitive);
151
152 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
153 }
154
155 /// <summary>
156 ///
157 /// </summary>
158 /// <param name="data"></param>
159 public void CreateFromBytes(byte[] data)
160 {
161
162 }
163
164 /// <summary>
165 /// Makes a copy of this SceneObject (and child primitives)
166 /// </summary>
167 /// <returns>A complete copy of the object</returns>
168 public new SceneObjectOLD Copy()
169 {
170 SceneObjectOLD dupe = new SceneObjectOLD();
171
172 dupe.m_scene = this.m_scene;
173 dupe.m_eventManager = this.m_eventManager;
174 dupe.m_regionHandle = this.m_regionHandle;
175 Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
176 dupe.rootPrimitive = newRoot;
177
178 dupe.m_children.Add(dupe.rootPrimitive);
179 dupe.rootPrimitive.Pos = this.Pos;
180 dupe.Rotation = this.Rotation;
181 dupe.LocalId = m_scene.PrimIDAllocate();
182
183 dupe.registerEvents();
184 return dupe;
185 }
186
187 /// <summary>
188 ///
189 /// </summary>
190 public void Serialise()
191 {
192
193 }
194
195 /// <summary>
196 ///
197 /// </summary>
198 public void DeleteAllChildren()
199 {
200 this.m_children.Clear();
201 this.ChildPrimitives.Clear();
202 this.rootPrimitive = null;
203 unregisterEvents();
204 }
205
206 /// <summary>
207 ///
208 /// </summary>
209 /// <param name="primObject"></param>
210 public void AddNewChildPrims(SceneObjectOLD primObject)
211 {
212 this.rootPrimitive.AddNewChildren(primObject);
213 }
214
215 public void AddChildToList(Primitive prim)
216 {
217 if (!this.ChildPrimitives.ContainsKey(prim.m_uuid))
218 {
219 this.ChildPrimitives.Add(prim.m_uuid, prim);
220 }
221 }
222 /// <summary>
223 ///
224 /// </summary>
225 /// <param name="primID"></param>
226 /// <returns></returns>
227 public Primitive HasChildPrim(LLUUID primID)
228 {
229 if (this.ChildPrimitives.ContainsKey(primID))
230 {
231 return this.ChildPrimitives[primID];
232 }
233
234 return null;
235 }
236
237 /// <summary>
238 ///
239 /// </summary>
240 /// <param name="localID"></param>
241 /// <returns></returns>
242 public Primitive HasChildPrim(uint localID)
243 {
244 Primitive returnPrim = null;
245 foreach (Primitive prim in this.ChildPrimitives.Values)
246 {
247 if (prim.LocalId == localID)
248 {
249 returnPrim = prim;
250 break;
251 }
252 }
253 return returnPrim;
254 }
255
256 public void SendAllChildPrimsToClient(IClientAPI client)
257 {
258 this.rootPrimitive.SendFullUpdateForAllChildren(client);
259 }
260
261 /// <summary>
262 ///
263 /// </summary>
264 public override void BackUp()
265 {
266
267 }
268
269 /// <summary>
270 ///
271 /// </summary>
272 /// <param name="offset"></param>
273 /// <param name="pos"></param>
274 /// <param name="remoteClient"></param>
275 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
276 {
277 this.rootPrimitive.Pos = pos;
278 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
279 }
280
281 /// <summary>
282 ///
283 /// </summary>
284 /// <param name="client"></param>
285 public void GetProperites(IClientAPI client)
286 {
287 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
288 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
289 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
290 proper.ObjectData[0].ItemID = LLUUID.Zero;
291 proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate;
292 proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID;
293 proper.ObjectData[0].FolderID = LLUUID.Zero;
294 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
295 proper.ObjectData[0].GroupID = LLUUID.Zero;
296 proper.ObjectData[0].InventorySerial = 0;
297 proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID;
298 proper.ObjectData[0].ObjectID = this.rootUUID;
299 proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID;
300 proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0");
301 proper.ObjectData[0].TextureID = new byte[0];
302 proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName + "\0");
303 proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name + "\0");
304 proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description + "\0");
305 proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask;
306 proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask;
307 proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask;
308 proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask;
309 proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask;
310
311 client.OutPacket(proper);
312 }
313
314 }
315}