aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/EntityBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/EntityBase.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs193
1 files changed, 97 insertions, 96 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 7e43718..11bafb7 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -36,83 +36,23 @@ namespace OpenSim.Region.Environment.Scenes
36 [Serializable] 36 [Serializable]
37 public abstract class EntityBase : ISerializable 37 public abstract class EntityBase : ISerializable
38 { 38 {
39 protected uint m_localId;
40 protected string m_name;
41 protected LLVector3 m_pos;
42 protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
43 protected LLVector3 m_rotationalvelocity;
44 protected Scene m_scene; 39 protected Scene m_scene;
45 40
46 protected LLUUID m_uuid;
47 protected LLVector3 m_velocity;
48
49 /// <summary>
50 /// Creates a new Entity (should not occur on it's own)
51 /// </summary>
52 public EntityBase()
53 {
54 m_uuid = LLUUID.Zero;
55
56 m_pos = new LLVector3();
57 m_velocity = new LLVector3();
58 Rotation = new Quaternion();
59 m_name = "(basic entity)";
60 m_rotationalvelocity = new LLVector3(0, 0, 0);
61 }
62
63 protected EntityBase(SerializationInfo info, StreamingContext context)
64 {
65 //System.Console.WriteLine("EntityBase Deserialize BGN");
66
67 if (info == null)
68 {
69 throw new ArgumentNullException("info");
70 }
71
72 m_uuid = new LLUUID((Guid) info.GetValue("m_uuid", typeof (Guid)));
73 m_name = (string) info.GetValue("m_name", typeof (string));
74
75 m_pos
76 = new LLVector3(
77 (float) info.GetValue("m_pos.X", typeof (float)),
78 (float) info.GetValue("m_pos.Y", typeof (float)),
79 (float) info.GetValue("m_pos.Z", typeof (float)));
80
81 m_velocity
82 = new LLVector3(
83 (float) info.GetValue("m_velocity.X", typeof (float)),
84 (float) info.GetValue("m_velocity.Y", typeof (float)),
85 (float) info.GetValue("m_velocity.Z", typeof (float)));
86
87 m_rotationalvelocity
88 = new LLVector3(
89 (float) info.GetValue("m_rotationalvelocity.X", typeof (float)),
90 (float) info.GetValue("m_rotationalvelocity.Y", typeof (float)),
91 (float) info.GetValue("m_rotationalvelocity.Z", typeof (float)));
92
93 m_rotation
94 = new Quaternion(
95 (float) info.GetValue("m_rotation.w", typeof (float)),
96 (float) info.GetValue("m_rotation.x", typeof (float)),
97 (float) info.GetValue("m_rotation.y", typeof (float)),
98 (float) info.GetValue("m_rotation.z", typeof (float)));
99
100 m_localId = (uint) info.GetValue("m_localId", typeof (uint));
101
102 //System.Console.WriteLine("EntityBase Deserialize END");
103 }
104
105 public Scene Scene 41 public Scene Scene
106 { 42 {
107 get { return m_scene; } 43 get { return m_scene; }
108 } 44 }
109 45
46 protected LLUUID m_uuid;
47
110 public virtual LLUUID UUID 48 public virtual LLUUID UUID
111 { 49 {
112 get { return m_uuid; } 50 get { return m_uuid; }
113 set { m_uuid = value; } 51 set { m_uuid = value; }
114 } 52 }
115 53
54 protected string m_name;
55
116 /// <summary> 56 /// <summary>
117 /// 57 ///
118 /// </summary> 58 /// </summary>
@@ -122,6 +62,8 @@ namespace OpenSim.Region.Environment.Scenes
122 set { m_name = value; } 62 set { m_name = value; }
123 } 63 }
124 64
65 protected LLVector3 m_pos;
66
125 /// <summary> 67 /// <summary>
126 /// 68 ///
127 /// </summary> 69 /// </summary>
@@ -131,6 +73,9 @@ namespace OpenSim.Region.Environment.Scenes
131 set { m_pos = value; } 73 set { m_pos = value; }
132 } 74 }
133 75
76 protected LLVector3 m_velocity;
77 protected LLVector3 m_rotationalvelocity;
78
134 /// <summary> 79 /// <summary>
135 /// 80 ///
136 /// </summary> 81 /// </summary>
@@ -140,24 +85,104 @@ namespace OpenSim.Region.Environment.Scenes
140 set { m_velocity = value; } 85 set { m_velocity = value; }
141 } 86 }
142 87
88 protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
89
143 public virtual Quaternion Rotation 90 public virtual Quaternion Rotation
144 { 91 {
145 get { return m_rotation; } 92 get { return m_rotation; }
146 set { m_rotation = value; } 93 set { m_rotation = value; }
147 } 94 }
148 95
96 protected uint m_localId;
97
149 public virtual uint LocalId 98 public virtual uint LocalId
150 { 99 {
151 get { return m_localId; } 100 get { return m_localId; }
152 set { m_localId = value; } 101 set { m_localId = value; }
153 } 102 }
154 103
155 #region ISerializable Members 104 /// <summary>
105 /// Creates a new Entity (should not occur on it's own)
106 /// </summary>
107 public EntityBase()
108 {
109 m_uuid = LLUUID.Zero;
110
111 m_pos = new LLVector3();
112 m_velocity = new LLVector3();
113 Rotation = new Quaternion();
114 m_name = "(basic entity)";
115 m_rotationalvelocity = new LLVector3(0, 0, 0);
116 }
117
118 /// <summary>
119 ///
120 /// </summary>
121 public abstract void UpdateMovement();
122
123 /// <summary>
124 /// Performs any updates that need to be done at each frame.
125 /// </summary>
126 public abstract void Update();
127
128 /// <summary>
129 /// Copies the entity
130 /// </summary>
131 /// <returns></returns>
132 public virtual EntityBase Copy()
133 {
134 return (EntityBase) MemberwiseClone();
135 }
136
137
138 public abstract void SetText(string text, Vector3 color, double alpha);
139
140 protected EntityBase(SerializationInfo info, StreamingContext context)
141 {
142 //System.Console.WriteLine("EntityBase Deserialize BGN");
143
144 if (info == null)
145 {
146 throw new ArgumentNullException("info");
147 }
148
149 m_uuid = new LLUUID((Guid)info.GetValue("m_uuid", typeof(Guid)));
150 m_name = (string)info.GetValue("m_name", typeof(string));
151
152 m_pos
153 = new LLVector3(
154 (float)info.GetValue("m_pos.X", typeof(float)),
155 (float)info.GetValue("m_pos.Y", typeof(float)),
156 (float)info.GetValue("m_pos.Z", typeof(float)));
157
158 m_velocity
159 = new LLVector3(
160 (float)info.GetValue("m_velocity.X", typeof(float)),
161 (float)info.GetValue("m_velocity.Y", typeof(float)),
162 (float)info.GetValue("m_velocity.Z", typeof(float)));
163
164 m_rotationalvelocity
165 = new LLVector3(
166 (float)info.GetValue("m_rotationalvelocity.X", typeof(float)),
167 (float)info.GetValue("m_rotationalvelocity.Y", typeof(float)),
168 (float)info.GetValue("m_rotationalvelocity.Z", typeof(float)));
169
170 m_rotation
171 = new Quaternion(
172 (float)info.GetValue("m_rotation.w", typeof(float)),
173 (float)info.GetValue("m_rotation.x", typeof(float)),
174 (float)info.GetValue("m_rotation.y", typeof(float)),
175 (float)info.GetValue("m_rotation.z", typeof(float)));
176
177 m_localId = (uint)info.GetValue("m_localId", typeof(uint));
178
179 //System.Console.WriteLine("EntityBase Deserialize END");
180 }
156 181
157 [SecurityPermission(SecurityAction.LinkDemand, 182 [SecurityPermission(SecurityAction.LinkDemand,
158 Flags = SecurityPermissionFlag.SerializationFormatter)] 183 Flags = SecurityPermissionFlag.SerializationFormatter)]
159 public virtual void GetObjectData( 184 public virtual void GetObjectData(
160 SerializationInfo info, StreamingContext context) 185 SerializationInfo info, StreamingContext context)
161 { 186 {
162 if (info == null) 187 if (info == null)
163 { 188 {
@@ -190,42 +215,18 @@ namespace OpenSim.Region.Environment.Scenes
190 215
191 info.AddValue("m_localId", m_localId); 216 info.AddValue("m_localId", m_localId);
192 } 217 }
193
194 #endregion
195
196 /// <summary>
197 ///
198 /// </summary>
199 public abstract void UpdateMovement();
200
201 /// <summary>
202 /// Performs any updates that need to be done at each frame.
203 /// </summary>
204 public abstract void Update();
205
206 /// <summary>
207 /// Copies the entity
208 /// </summary>
209 /// <returns></returns>
210 public virtual EntityBase Copy()
211 {
212 return (EntityBase) MemberwiseClone();
213 }
214
215
216 public abstract void SetText(string text, Vector3 color, double alpha);
217 } 218 }
218 219
219 //Nested Classes 220 //Nested Classes
220 public class EntityIntersection 221 public class EntityIntersection
221 { 222 {
222 public Vector3 AAfaceNormal = new Vector3(0, 0, 0);
223 public float distance;
224 public int face = -1;
225 public bool HitTF;
226 public Vector3 ipoint = new Vector3(0, 0, 0); 223 public Vector3 ipoint = new Vector3(0, 0, 0);
227 public Vector3 normal = new Vector3(0, 0, 0); 224 public Vector3 normal = new Vector3(0, 0, 0);
225 public Vector3 AAfaceNormal = new Vector3(0, 0, 0);
226 public int face = -1;
227 public bool HitTF = false;
228 public SceneObjectPart obj; 228 public SceneObjectPart obj;
229 public float distance = 0;
229 230
230 public EntityIntersection() 231 public EntityIntersection()
231 { 232 {
@@ -238,4 +239,4 @@ namespace OpenSim.Region.Environment.Scenes
238 HitTF = _HitTF; 239 HitTF = _HitTF;
239 } 240 }
240 } 241 }
241} \ No newline at end of file 242}