diff options
author | lbsa71 | 2009-03-08 19:33:19 +0000 |
---|---|---|
committer | lbsa71 | 2009-03-08 19:33:19 +0000 |
commit | 4f23718102c4d1730a68f0ee85c5604a4dc3d527 (patch) | |
tree | 9abb7918cfaf37f4972fcad0fb9a5bbff331e274 /OpenSim/Client/MXP/ClientStack | |
parent | Moving Windows Installer to forge. (diff) | |
download | opensim-SC-4f23718102c4d1730a68f0ee85c5604a4dc3d527.zip opensim-SC-4f23718102c4d1730a68f0ee85c5604a4dc3d527.tar.gz opensim-SC-4f23718102c4d1730a68f0ee85c5604a4dc3d527.tar.bz2 opensim-SC-4f23718102c4d1730a68f0ee85c5604a4dc3d527.tar.xz |
Thank you tlaukkan for a patch that: Upgraded to MXP 0.4 version and cleaned up field naming.
* Updated code to compile against MXP 0.4 version.
* Cleaned up field naming conventions.
* Added support for logging in with region name.
* Filled in new fields of JoinResponseMEssage.
* Added support for SynchronizationBeginEvent and SynchronizationEndEvent.
* Commented out periodic debug log.
* Added networking startup log messages.
This closes mantis #3277
Diffstat (limited to 'OpenSim/Client/MXP/ClientStack')
-rw-r--r-- | OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 139 |
1 files changed, 88 insertions, 51 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 383ae07..5d08eb0 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs | |||
@@ -41,6 +41,7 @@ using Packet=OpenMetaverse.Packets.Packet; | |||
41 | using MXP.Extentions.OpenMetaverseFragments.Proto; | 41 | using MXP.Extentions.OpenMetaverseFragments.Proto; |
42 | using MXP.Util; | 42 | using MXP.Util; |
43 | using MXP.Fragments; | 43 | using MXP.Fragments; |
44 | using MXP.Common.Proto; | ||
44 | 45 | ||
45 | namespace OpenSim.Client.MXP.ClientStack | 46 | namespace OpenSim.Client.MXP.ClientStack |
46 | { | 47 | { |
@@ -64,9 +65,10 @@ namespace OpenSim.Client.MXP.ClientStack | |||
64 | private readonly IScene m_scene; | 65 | private readonly IScene m_scene; |
65 | private readonly string m_firstName; | 66 | private readonly string m_firstName; |
66 | private readonly string m_lastName; | 67 | private readonly string m_lastName; |
68 | private int m_objectsToSynchronize = 0; | ||
69 | private int m_objectsSynchronized = -1; | ||
67 | 70 | ||
68 | private Vector3 m_startPosition=new Vector3(128f, 128f, 128f); | 71 | private Vector3 m_startPosition=new Vector3(128f, 128f, 128f); |
69 | //private int m_debugLevel; | ||
70 | #endregion | 72 | #endregion |
71 | 73 | ||
72 | #region Properties | 74 | #region Properties |
@@ -181,7 +183,7 @@ namespace OpenSim.Client.MXP.ClientStack | |||
181 | } | 183 | } |
182 | else | 184 | else |
183 | { | 185 | { |
184 | m_log.Warn("[MXP] Received messaged unhandled: " + message); | 186 | m_log.Warn("[MXP ClientStack] Received messaged unhandled: " + message); |
185 | } | 187 | } |
186 | } | 188 | } |
187 | 189 | ||
@@ -249,7 +251,13 @@ namespace OpenSim.Client.MXP.ClientStack | |||
249 | 251 | ||
250 | if (avatarExt.Body != null) | 252 | if (avatarExt.Body != null) |
251 | { | 253 | { |
252 | agentUpdate.HeadRotation = FromOmQuaternion(avatarExt.Body.HeadOrientation); | 254 | foreach(OmBipedBoneOrientation boneOrientation in avatarExt.Body.BipedBoneOrientations) |
255 | { | ||
256 | if (boneOrientation.Bone == OmBipedBones.Head) | ||
257 | { | ||
258 | agentUpdate.HeadRotation = FromOmQuaternion(boneOrientation.Orientation); | ||
259 | } | ||
260 | } | ||
253 | } | 261 | } |
254 | else | 262 | else |
255 | { | 263 | { |
@@ -295,7 +303,7 @@ namespace OpenSim.Client.MXP.ClientStack | |||
295 | private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) | 303 | private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) |
296 | { | 304 | { |
297 | String typeName = ToOmType(primShape.PCode); | 305 | String typeName = ToOmType(primShape.PCode); |
298 | m_log.Info("[MXP] Transmitting Primitive" + typeName); | 306 | m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName); |
299 | 307 | ||
300 | PerceptionEventMessage pe = new PerceptionEventMessage(); | 308 | PerceptionEventMessage pe = new PerceptionEventMessage(); |
301 | 309 | ||
@@ -307,16 +315,16 @@ namespace OpenSim.Client.MXP.ClientStack | |||
307 | pe.ObjectFragment.OwnerId = ownerID.Guid; | 315 | pe.ObjectFragment.OwnerId = ownerID.Guid; |
308 | pe.ObjectFragment.TypeId = Guid.Empty; | 316 | pe.ObjectFragment.TypeId = Guid.Empty; |
309 | pe.ObjectFragment.TypeName = typeName; | 317 | pe.ObjectFragment.TypeName = typeName; |
310 | pe.ObjectFragment.Acceleration = new float[] { acc.X, acc.Y, acc.Z }; | 318 | pe.ObjectFragment.Acceleration = ToOmVector(acc); |
311 | pe.ObjectFragment.AngularAcceleration = new float[4]; | 319 | pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f(); |
312 | pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f }; | 320 | pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel); |
313 | pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); | 321 | pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); |
314 | 322 | ||
315 | pe.ObjectFragment.Location = new float[] { pos.X, pos.Y, pos.Z }; | 323 | pe.ObjectFragment.Location = ToOmVector(pos); |
316 | 324 | ||
317 | pe.ObjectFragment.Mass = 1.0f; | 325 | pe.ObjectFragment.Mass = 1.0f; |
318 | pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W }; | 326 | pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); |
319 | pe.ObjectFragment.Velocity = new float[] { vel.X, vel.Y, vel.Z }; | 327 | pe.ObjectFragment.Velocity =ToOmVector(vel); |
320 | 328 | ||
321 | OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); | 329 | OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); |
322 | 330 | ||
@@ -360,11 +368,23 @@ namespace OpenSim.Client.MXP.ClientStack | |||
360 | pe.SetExtension<OmSlPrimitiveExt>(ext); | 368 | pe.SetExtension<OmSlPrimitiveExt>(ext); |
361 | 369 | ||
362 | Session.Send(pe); | 370 | Session.Send(pe); |
371 | |||
372 | if (m_objectsSynchronized != -1) | ||
373 | { | ||
374 | m_objectsSynchronized++; | ||
375 | |||
376 | if (m_objectsToSynchronize >= m_objectsSynchronized) | ||
377 | { | ||
378 | SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage(); | ||
379 | Session.Send(synchronizationEndEventMessage); | ||
380 | m_objectsSynchronized = -1; | ||
381 | } | ||
382 | } | ||
363 | } | 383 | } |
364 | 384 | ||
365 | public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation) | 385 | public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation) |
366 | { | 386 | { |
367 | m_log.Info("[MXP] Transmitting Avatar Data " + participantName); | 387 | m_log.Info("[MXP ClientStack] Transmitting Avatar Data " + participantName); |
368 | 388 | ||
369 | PerceptionEventMessage pe = new PerceptionEventMessage(); | 389 | PerceptionEventMessage pe = new PerceptionEventMessage(); |
370 | 390 | ||
@@ -376,23 +396,23 @@ namespace OpenSim.Client.MXP.ClientStack | |||
376 | pe.ObjectFragment.OwnerId = ownerID.Guid; | 396 | pe.ObjectFragment.OwnerId = ownerID.Guid; |
377 | pe.ObjectFragment.TypeId = Guid.Empty; | 397 | pe.ObjectFragment.TypeId = Guid.Empty; |
378 | pe.ObjectFragment.TypeName = "Avatar"; | 398 | pe.ObjectFragment.TypeName = "Avatar"; |
379 | pe.ObjectFragment.Acceleration = new float[3]; | 399 | pe.ObjectFragment.Acceleration = new MsdVector3f(); |
380 | pe.ObjectFragment.AngularAcceleration = new float[4]; | 400 | pe.ObjectFragment.AngularAcceleration = new MsdQuaternion4f(); |
381 | pe.ObjectFragment.AngularVelocity = new float[4]; | 401 | pe.ObjectFragment.AngularVelocity = new MsdQuaternion4f(); |
382 | pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value | 402 | pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value |
383 | 403 | ||
384 | pe.ObjectFragment.Location = new float[] { position.X, position.Y, position.Z }; | 404 | pe.ObjectFragment.Location = ToOmVector(position); |
385 | 405 | ||
386 | pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value | 406 | pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value |
387 | pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W }; | 407 | pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); |
388 | pe.ObjectFragment.Velocity = new float[3]; | 408 | pe.ObjectFragment.Velocity = new MsdVector3f(); |
389 | 409 | ||
390 | Session.Send(pe); | 410 | Session.Send(pe); |
391 | } | 411 | } |
392 | 412 | ||
393 | public void MXPSendTerrain(float[] map) | 413 | public void MXPSendTerrain(float[] map) |
394 | { | 414 | { |
395 | m_log.Info("[MXP] Transmitting terrain for " + m_scene.RegionInfo.RegionName); | 415 | m_log.Info("[MXP ClientStack] Transmitting terrain for " + m_scene.RegionInfo.RegionName); |
396 | 416 | ||
397 | PerceptionEventMessage pe = new PerceptionEventMessage(); | 417 | PerceptionEventMessage pe = new PerceptionEventMessage(); |
398 | 418 | ||
@@ -404,16 +424,16 @@ namespace OpenSim.Client.MXP.ClientStack | |||
404 | pe.ObjectFragment.OwnerId = m_scene.RegionInfo.MasterAvatarAssignedUUID.Guid; | 424 | pe.ObjectFragment.OwnerId = m_scene.RegionInfo.MasterAvatarAssignedUUID.Guid; |
405 | pe.ObjectFragment.TypeId = Guid.Empty; | 425 | pe.ObjectFragment.TypeId = Guid.Empty; |
406 | pe.ObjectFragment.TypeName = "Terrain"; | 426 | pe.ObjectFragment.TypeName = "Terrain"; |
407 | pe.ObjectFragment.Acceleration = new float[3]; | 427 | pe.ObjectFragment.Acceleration = new MsdVector3f(); |
408 | pe.ObjectFragment.AngularAcceleration = new float[4]; | 428 | pe.ObjectFragment.AngularAcceleration = new MsdQuaternion4f(); |
409 | pe.ObjectFragment.AngularVelocity = new float[4]; | 429 | pe.ObjectFragment.AngularVelocity = new MsdQuaternion4f(); |
410 | pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value | 430 | pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value |
411 | 431 | ||
412 | pe.ObjectFragment.Location = new float[] { 0, 0, 0 }; | 432 | pe.ObjectFragment.Location = new MsdVector3f(); |
413 | 433 | ||
414 | pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value | 434 | pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value |
415 | pe.ObjectFragment.Orientation = new float[] { 0, 0, 0, 0 }; | 435 | pe.ObjectFragment.Orientation = new MsdQuaternion4f(); |
416 | pe.ObjectFragment.Velocity = new float[3]; | 436 | pe.ObjectFragment.Velocity = new MsdVector3f(); |
417 | 437 | ||
418 | OmBitmapTerrainExt terrainExt = new OmBitmapTerrainExt(); | 438 | OmBitmapTerrainExt terrainExt = new OmBitmapTerrainExt(); |
419 | terrainExt.Width = 256; | 439 | terrainExt.Width = 256; |
@@ -421,37 +441,68 @@ namespace OpenSim.Client.MXP.ClientStack | |||
421 | terrainExt.WaterLevel = (float) m_scene.RegionInfo.RegionSettings.WaterHeight; | 441 | terrainExt.WaterLevel = (float) m_scene.RegionInfo.RegionSettings.WaterHeight; |
422 | terrainExt.Offset = 0; | 442 | terrainExt.Offset = 0; |
423 | terrainExt.Scale = 10; | 443 | terrainExt.Scale = 10; |
424 | terrainExt.HeightMap = CompressionUtil.CompressHeightMap(map, 0, 10); | 444 | terrainExt.HeightMap = CompressUtil.CompressHeightMap(map, 0, 10); |
425 | 445 | ||
426 | pe.SetExtension<OmBitmapTerrainExt>(terrainExt); | 446 | pe.SetExtension<OmBitmapTerrainExt>(terrainExt); |
427 | 447 | ||
428 | Session.Send(pe); | 448 | Session.Send(pe); |
429 | } | 449 | } |
430 | 450 | ||
451 | public void MXPSentSynchronizationBegin(int objectCount) | ||
452 | { | ||
453 | m_objectsToSynchronize = objectCount; | ||
454 | m_objectsSynchronized = 0; | ||
455 | SynchronizationBeginEventMessage synchronizationBeginEventMessage = new SynchronizationBeginEventMessage(); | ||
456 | synchronizationBeginEventMessage.ObjectCount = (uint)objectCount; | ||
457 | Session.Send(synchronizationBeginEventMessage); | ||
458 | } | ||
459 | |||
431 | #endregion | 460 | #endregion |
432 | 461 | ||
433 | #region MXP Conversions | 462 | #region MXP Conversions |
434 | 463 | ||
435 | private OmVector3f ToOmVector(Vector3 value) | 464 | private MsdVector3f ToOmVector(Vector3 value) |
465 | { | ||
466 | MsdVector3f encodedValue = new MsdVector3f(); | ||
467 | encodedValue.X = value.X; | ||
468 | encodedValue.Y = value.Y; | ||
469 | encodedValue.Z = value.Z; | ||
470 | return encodedValue; | ||
471 | } | ||
472 | |||
473 | private MsdQuaternion4f ToOmQuaternion(Vector3 value) | ||
474 | { | ||
475 | Quaternion quaternion=Quaternion.CreateFromEulers(value); | ||
476 | MsdQuaternion4f encodedValue = new MsdQuaternion4f(); | ||
477 | encodedValue.X = quaternion.X; | ||
478 | encodedValue.Y = quaternion.Y; | ||
479 | encodedValue.Z = quaternion.Z; | ||
480 | encodedValue.W = quaternion.W; | ||
481 | return encodedValue; | ||
482 | } | ||
483 | |||
484 | private MsdQuaternion4f ToOmQuaternion(Quaternion value) | ||
436 | { | 485 | { |
437 | OmVector3f encodedValue = new OmVector3f(); | 486 | MsdQuaternion4f encodedValue = new MsdQuaternion4f(); |
438 | encodedValue.X = value.X; | 487 | encodedValue.X = value.X; |
439 | encodedValue.Y = value.Y; | 488 | encodedValue.Y = value.Y; |
440 | encodedValue.Z = value.Z; | 489 | encodedValue.Z = value.Z; |
490 | encodedValue.W = value.W; | ||
441 | return encodedValue; | 491 | return encodedValue; |
442 | } | 492 | } |
443 | 493 | ||
444 | private Vector3 FromOmVector(OmVector3f vector) | 494 | private Vector3 FromOmVector(MsdVector3f vector) |
445 | { | 495 | { |
446 | return new Vector3(vector.X, vector.Y, vector.Z); | 496 | return new Vector3(vector.X, vector.Y, vector.Z); |
447 | } | 497 | } |
448 | 498 | ||
499 | |||
449 | private Vector3 FromOmVector(float[] vector) | 500 | private Vector3 FromOmVector(float[] vector) |
450 | { | 501 | { |
451 | return new Vector3(vector[0], vector[1], vector[2]); | 502 | return new Vector3(vector[0], vector[1], vector[2]); |
452 | } | 503 | } |
453 | 504 | ||
454 | private Quaternion FromOmQuaternion(OmQuaternion4f quaternion) | 505 | private Quaternion FromOmQuaternion(MsdQuaternion4f quaternion) |
455 | { | 506 | { |
456 | return new Quaternion(quaternion.X, quaternion.Y, quaternion.Z, quaternion.W); | 507 | return new Quaternion(quaternion.X, quaternion.Y, quaternion.Z, quaternion.W); |
457 | } | 508 | } |
@@ -461,9 +512,9 @@ namespace OpenSim.Client.MXP.ClientStack | |||
461 | return new Quaternion(quaternion[0], quaternion[1], quaternion[2], quaternion[3]); | 512 | return new Quaternion(quaternion[0], quaternion[1], quaternion[2], quaternion[3]); |
462 | } | 513 | } |
463 | 514 | ||
464 | private OmColor4f ToOmColor(byte[] value) | 515 | private MsdColor4f ToOmColor(byte[] value) |
465 | { | 516 | { |
466 | OmColor4f encodedValue = new OmColor4f(); | 517 | MsdColor4f encodedValue = new MsdColor4f(); |
467 | encodedValue.R = value[0]; | 518 | encodedValue.R = value[0]; |
468 | encodedValue.G = value[1]; | 519 | encodedValue.G = value[1]; |
469 | encodedValue.B = value[2]; | 520 | encodedValue.B = value[2]; |
@@ -750,18 +801,6 @@ namespace OpenSim.Client.MXP.ClientStack | |||
750 | public void Start() | 801 | public void Start() |
751 | { | 802 | { |
752 | Scene.AddNewClient(this); | 803 | Scene.AddNewClient(this); |
753 | /*foreach (ScenePresence presence in ((Scene)Scene).GetScenePresences()) | ||
754 | { | ||
755 | if (presence.Appearance!=null) | ||
756 | { | ||
757 | AvatarAppearance avatar = presence.Appearance; | ||
758 | if (presence.Appearance.Owner == m_userID) | ||
759 | { | ||
760 | MXPSendAvatarData(m_firstName + " " + m_lastName, presence.Appearance.Owner, UUID.Zero, presence.UUID, presence.LocalId, presence.AbsolutePosition, presence.Rotation); | ||
761 | } | ||
762 | } | ||
763 | }*/ | ||
764 | |||
765 | } | 804 | } |
766 | 805 | ||
767 | public void Stop() | 806 | public void Stop() |
@@ -799,7 +838,7 @@ namespace OpenSim.Client.MXP.ClientStack | |||
799 | 838 | ||
800 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) | 839 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) |
801 | { | 840 | { |
802 | m_log.Info("[MXP] Completing Handshake to Region"); | 841 | m_log.Info("[MXP ClientStack] Completing Handshake to Region"); |
803 | 842 | ||
804 | if (OnRegionHandShakeReply != null) | 843 | if (OnRegionHandShakeReply != null) |
805 | { | 844 | { |
@@ -820,9 +859,8 @@ namespace OpenSim.Client.MXP.ClientStack | |||
820 | chatActionEvent.ActionFragment.ActionName = "Chat"; | 859 | chatActionEvent.ActionFragment.ActionName = "Chat"; |
821 | chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid; | 860 | chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid; |
822 | chatActionEvent.ActionFragment.ObservationRadius = 180.0f; | 861 | chatActionEvent.ActionFragment.ObservationRadius = 180.0f; |
823 | chatActionEvent.ActionFragment.ActionPayloadDialect = "TEXT"; | 862 | chatActionEvent.ActionFragment.ExtensionDialect = "TEXT"; |
824 | chatActionEvent.SetPayloadData(Encoding.UTF8.GetBytes(message)); | 863 | chatActionEvent.SetPayloadData(Encoding.UTF8.GetBytes(message)); |
825 | chatActionEvent.ActionFragment.ActionPayloadLength = (uint)chatActionEvent.GetPayloadData().Length; | ||
826 | 864 | ||
827 | Session.Send(chatActionEvent); | 865 | Session.Send(chatActionEvent); |
828 | } | 866 | } |
@@ -938,8 +976,8 @@ namespace OpenSim.Client.MXP.ClientStack | |||
938 | { | 976 | { |
939 | MovementEventMessage me = new MovementEventMessage(); | 977 | MovementEventMessage me = new MovementEventMessage(); |
940 | me.ObjectIndex = localID; | 978 | me.ObjectIndex = localID; |
941 | me.Location = new float[] { position.X, position.Y, position.Z }; | 979 | me.Location =ToOmVector(position); |
942 | me.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W }; | 980 | me.Orientation = ToOmQuaternion(rotation); |
943 | 981 | ||
944 | Session.Send(me); | 982 | Session.Send(me); |
945 | } | 983 | } |
@@ -973,9 +1011,8 @@ namespace OpenSim.Client.MXP.ClientStack | |||
973 | { | 1011 | { |
974 | MovementEventMessage me = new MovementEventMessage(); | 1012 | MovementEventMessage me = new MovementEventMessage(); |
975 | me.ObjectIndex = localID; | 1013 | me.ObjectIndex = localID; |
976 | me.Location = new float[] {position.X, position.Y, position.Z}; | 1014 | me.Location = ToOmVector(position); |
977 | me.Orientation = new float[] {rotation.X, rotation.Y, rotation.Z, rotation.W}; | 1015 | me.Orientation = ToOmQuaternion(rotation); |
978 | |||
979 | Session.Send(me); | 1016 | Session.Send(me); |
980 | } | 1017 | } |
981 | 1018 | ||