aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/EntityBase.cs
diff options
context:
space:
mode:
authorJohan Berntsson2008-03-04 05:31:54 +0000
committerJohan Berntsson2008-03-04 05:31:54 +0000
commit279e0061c515ee0a03036bef68eea9738273d785 (patch)
tree4502228eb7b87a760e0b0e67aded9d1d870d0bed /OpenSim/Region/Environment/Scenes/EntityBase.cs
parentAdded copyright heaaders. Minor cleanup. (diff)
downloadopensim-SC-279e0061c515ee0a03036bef68eea9738273d785.zip
opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.tar.gz
opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.tar.bz2
opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.tar.xz
Merged 3Di code that provides scene and avatar serialization, and plugin support for region move/split/merge. See ThirdParty/3Di/README.txt. Unless the new modules are used there should be no noticeable changes when running OpenSim.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/EntityBase.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs91
1 files changed, 90 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 91dda74..2a8c1e9 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -30,9 +30,14 @@ using System.Collections.Generic;
30using Axiom.Math; 30using Axiom.Math;
31using libsecondlife; 31using libsecondlife;
32 32
33using System;
34using System.Runtime.Serialization;
35using System.Security.Permissions;
36
33namespace OpenSim.Region.Environment.Scenes 37namespace OpenSim.Region.Environment.Scenes
34{ 38{
35 public abstract class EntityBase 39 [Serializable]
40 public abstract class EntityBase : ISerializable
36 { 41 {
37 protected Scene m_scene; 42 protected Scene m_scene;
38 43
@@ -134,6 +139,90 @@ namespace OpenSim.Region.Environment.Scenes
134 139
135 140
136 public abstract void SetText(string text, Vector3 color, double alpha); 141 public abstract void SetText(string text, Vector3 color, double alpha);
142
143 protected EntityBase(SerializationInfo info, StreamingContext context)
144 {
145 //System.Console.WriteLine("EntityBase Deserialize BGN");
146
147 if (info == null)
148 {
149 throw new System.ArgumentNullException("info");
150 }
151
152 //JB m_children = (List<EntityBase>)info.GetValue("m_children", typeof(List<EntityBase>));
153// m_scene = (Scene)info.GetValue("m_scene", typeof(Scene));
154 m_uuid = new LLUUID((Guid)info.GetValue("m_uuid", typeof(Guid)));
155 m_name = (string)info.GetValue("m_name", typeof(string));
156
157 m_pos
158 = new LLVector3(
159 (float)info.GetValue("m_pos.X", typeof(float)),
160 (float)info.GetValue("m_pos.Y", typeof(float)),
161 (float)info.GetValue("m_pos.Z", typeof(float)));
162
163 m_velocity
164 = new LLVector3(
165 (float)info.GetValue("m_velocity.X", typeof(float)),
166 (float)info.GetValue("m_velocity.Y", typeof(float)),
167 (float)info.GetValue("m_velocity.Z", typeof(float)));
168
169 m_rotationalvelocity
170 = new LLVector3(
171 (float)info.GetValue("m_rotationalvelocity.X", typeof(float)),
172 (float)info.GetValue("m_rotationalvelocity.Y", typeof(float)),
173 (float)info.GetValue("m_rotationalvelocity.Z", typeof(float)));
174
175 m_rotation
176 = new Quaternion(
177 (float)info.GetValue("m_rotation.w", typeof(float)),
178 (float)info.GetValue("m_rotation.x", typeof(float)),
179 (float)info.GetValue("m_rotation.y", typeof(float)),
180 (float)info.GetValue("m_rotation.z", typeof(float)));
181
182 m_localId = (uint)info.GetValue("m_localId", typeof(uint));
183
184 //System.Console.WriteLine("EntityBase Deserialize END");
185 }
186
187 [SecurityPermission(SecurityAction.LinkDemand,
188 Flags = SecurityPermissionFlag.SerializationFormatter)]
189 public virtual void GetObjectData(
190 SerializationInfo info, StreamingContext context)
191 {
192 if (info == null)
193 {
194 throw new System.ArgumentNullException("info");
195 }
196
197 //JB info.AddValue("m_children", m_children);
198
199// info.AddValue("m_scene", m_scene);
200 info.AddValue("m_uuid", m_uuid.UUID);
201 info.AddValue("m_name", m_name);
202
203 // LLVector3
204 info.AddValue("m_pos.X", m_pos.X);
205 info.AddValue("m_pos.Y", m_pos.Y);
206 info.AddValue("m_pos.Z", m_pos.Z);
207
208 // LLVector3
209 info.AddValue("m_velocity.X", m_velocity.X);
210 info.AddValue("m_velocity.Y", m_velocity.Y);
211 info.AddValue("m_velocity.Z", m_velocity.Z);
212
213 // LLVector3
214 info.AddValue("m_rotationalvelocity.X", m_rotationalvelocity.X);
215 info.AddValue("m_rotationalvelocity.Y", m_rotationalvelocity.Y);
216 info.AddValue("m_rotationalvelocity.Z", m_rotationalvelocity.Z);
217
218 // Quaternion
219 info.AddValue("m_rotation.w", m_rotation.w);
220 info.AddValue("m_rotation.x", m_rotation.x);
221 info.AddValue("m_rotation.y", m_rotation.y);
222 info.AddValue("m_rotation.z", m_rotation.z);
223
224 info.AddValue("m_localId", m_localId);
225 }
137 } 226 }
138 227
139 //Nested Classes 228 //Nested Classes