1
0

EntityBase.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.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. */
  28. using System.Collections.Generic;
  29. using Axiom.Math;
  30. using libsecondlife;
  31. namespace OpenSim.Region.Environment.Scenes
  32. {
  33. public abstract class EntityBase
  34. {
  35. protected Scene m_scene;
  36. public Scene Scene
  37. {
  38. get { return m_scene; }
  39. }
  40. public LLUUID m_uuid;
  41. public virtual LLUUID UUID
  42. {
  43. get { return m_uuid; }
  44. set { m_uuid = value; }
  45. }
  46. protected string m_name;
  47. /// <summary>
  48. ///
  49. /// </summary>
  50. public virtual string Name
  51. {
  52. get { return m_name; }
  53. set { m_name = value; }
  54. }
  55. protected LLVector3 m_pos;
  56. /// <summary>
  57. ///
  58. /// </summary>
  59. public virtual LLVector3 AbsolutePosition
  60. {
  61. get { return m_pos; }
  62. set { m_pos = value; }
  63. }
  64. protected LLVector3 m_velocity;
  65. protected LLVector3 m_rotationalvelocity;
  66. /// <summary>
  67. ///
  68. /// </summary>
  69. public virtual LLVector3 Velocity
  70. {
  71. get { return m_velocity; }
  72. set { m_velocity = value; }
  73. }
  74. protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
  75. public virtual Quaternion Rotation
  76. {
  77. get { return m_rotation; }
  78. set { m_rotation = value; }
  79. }
  80. protected uint m_localId;
  81. public virtual uint LocalId
  82. {
  83. get { return m_localId; }
  84. set { m_localId = value; }
  85. }
  86. /// <summary>
  87. /// Creates a new Entity (should not occur on it's own)
  88. /// </summary>
  89. public EntityBase()
  90. {
  91. m_uuid = LLUUID.Zero;
  92. m_pos = new LLVector3();
  93. m_velocity = new LLVector3();
  94. Rotation = new Quaternion();
  95. m_name = "(basic entity)";
  96. m_rotationalvelocity = new LLVector3(0, 0, 0);
  97. }
  98. /// <summary>
  99. ///
  100. /// </summary>
  101. public abstract void UpdateMovement();
  102. /// <summary>
  103. /// Performs any updates that need to be done at each frame.
  104. /// </summary>
  105. public abstract void Update();
  106. /// <summary>
  107. /// Copies the entity
  108. /// </summary>
  109. /// <returns></returns>
  110. public virtual EntityBase Copy()
  111. {
  112. return (EntityBase) MemberwiseClone();
  113. }
  114. public abstract void SetText(string text, Vector3 color, double alpha);
  115. }
  116. //Nested Classes
  117. public class EntityIntersection
  118. {
  119. public Vector3 ipoint = new Vector3(0, 0, 0);
  120. public float normal = 0;
  121. public bool HitTF = false;
  122. public SceneObjectPart obj;
  123. public float distance = 0;
  124. public EntityIntersection()
  125. {
  126. }
  127. public EntityIntersection(Vector3 _ipoint, float _normal, bool _HitTF)
  128. {
  129. ipoint = _ipoint;
  130. normal = _normal;
  131. HitTF = _HitTF;
  132. }
  133. }
  134. }