diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityBase.cs | 193 |
1 files changed, 96 insertions, 97 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 11bafb7..7e43718 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -36,23 +36,83 @@ 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; | ||
39 | protected Scene m_scene; | 44 | protected Scene m_scene; |
40 | 45 | ||
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 | |||
41 | public Scene Scene | 105 | public Scene Scene |
42 | { | 106 | { |
43 | get { return m_scene; } | 107 | get { return m_scene; } |
44 | } | 108 | } |
45 | 109 | ||
46 | protected LLUUID m_uuid; | ||
47 | |||
48 | public virtual LLUUID UUID | 110 | public virtual LLUUID UUID |
49 | { | 111 | { |
50 | get { return m_uuid; } | 112 | get { return m_uuid; } |
51 | set { m_uuid = value; } | 113 | set { m_uuid = value; } |
52 | } | 114 | } |
53 | 115 | ||
54 | protected string m_name; | ||
55 | |||
56 | /// <summary> | 116 | /// <summary> |
57 | /// | 117 | /// |
58 | /// </summary> | 118 | /// </summary> |
@@ -62,8 +122,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
62 | set { m_name = value; } | 122 | set { m_name = value; } |
63 | } | 123 | } |
64 | 124 | ||
65 | protected LLVector3 m_pos; | ||
66 | |||
67 | /// <summary> | 125 | /// <summary> |
68 | /// | 126 | /// |
69 | /// </summary> | 127 | /// </summary> |
@@ -73,9 +131,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
73 | set { m_pos = value; } | 131 | set { m_pos = value; } |
74 | } | 132 | } |
75 | 133 | ||
76 | protected LLVector3 m_velocity; | ||
77 | protected LLVector3 m_rotationalvelocity; | ||
78 | |||
79 | /// <summary> | 134 | /// <summary> |
80 | /// | 135 | /// |
81 | /// </summary> | 136 | /// </summary> |
@@ -85,104 +140,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
85 | set { m_velocity = value; } | 140 | set { m_velocity = value; } |
86 | } | 141 | } |
87 | 142 | ||
88 | protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0); | ||
89 | |||
90 | public virtual Quaternion Rotation | 143 | public virtual Quaternion Rotation |
91 | { | 144 | { |
92 | get { return m_rotation; } | 145 | get { return m_rotation; } |
93 | set { m_rotation = value; } | 146 | set { m_rotation = value; } |
94 | } | 147 | } |
95 | 148 | ||
96 | protected uint m_localId; | ||
97 | |||
98 | public virtual uint LocalId | 149 | public virtual uint LocalId |
99 | { | 150 | { |
100 | get { return m_localId; } | 151 | get { return m_localId; } |
101 | set { m_localId = value; } | 152 | set { m_localId = value; } |
102 | } | 153 | } |
103 | 154 | ||
104 | /// <summary> | 155 | #region ISerializable Members |
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 | } | ||
181 | 156 | ||
182 | [SecurityPermission(SecurityAction.LinkDemand, | 157 | [SecurityPermission(SecurityAction.LinkDemand, |
183 | Flags = SecurityPermissionFlag.SerializationFormatter)] | 158 | Flags = SecurityPermissionFlag.SerializationFormatter)] |
184 | public virtual void GetObjectData( | 159 | public virtual void GetObjectData( |
185 | SerializationInfo info, StreamingContext context) | 160 | SerializationInfo info, StreamingContext context) |
186 | { | 161 | { |
187 | if (info == null) | 162 | if (info == null) |
188 | { | 163 | { |
@@ -215,18 +190,42 @@ namespace OpenSim.Region.Environment.Scenes | |||
215 | 190 | ||
216 | info.AddValue("m_localId", m_localId); | 191 | info.AddValue("m_localId", m_localId); |
217 | } | 192 | } |
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); | ||
218 | } | 217 | } |
219 | 218 | ||
220 | //Nested Classes | 219 | //Nested Classes |
221 | public class EntityIntersection | 220 | public class EntityIntersection |
222 | { | 221 | { |
223 | public Vector3 ipoint = new Vector3(0, 0, 0); | ||
224 | public Vector3 normal = new Vector3(0, 0, 0); | ||
225 | public Vector3 AAfaceNormal = new Vector3(0, 0, 0); | 222 | public Vector3 AAfaceNormal = new Vector3(0, 0, 0); |
223 | public float distance; | ||
226 | public int face = -1; | 224 | public int face = -1; |
227 | public bool HitTF = false; | 225 | public bool HitTF; |
226 | public Vector3 ipoint = new Vector3(0, 0, 0); | ||
227 | public Vector3 normal = new Vector3(0, 0, 0); | ||
228 | public SceneObjectPart obj; | 228 | public SceneObjectPart obj; |
229 | public float distance = 0; | ||
230 | 229 | ||
231 | public EntityIntersection() | 230 | public EntityIntersection() |
232 | { | 231 | { |
@@ -239,4 +238,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
239 | HitTF = _HitTF; | 238 | HitTF = _HitTF; |
240 | } | 239 | } |
241 | } | 240 | } |
242 | } | 241 | } \ No newline at end of file |