VeRegion.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #region License information
  2. // ----------------------------------------------------------------------------
  3. //
  4. // libeq2 - A library for analyzing the Everquest II File Format
  5. // Blaz (blaz@blazlabs.com)
  6. //
  7. // This program is free software; you can redistribute it and/or
  8. // modify it under the terms of the GNU General Public License
  9. // as published by the Free Software Foundation; either version 2
  10. // of the License, or (at your option) any later version.
  11. //
  12. // This program is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. // GNU General Public License for more details.
  16. //
  17. // You should have received a copy of the GNU General Public License
  18. // along with this program; if not, write to the Free Software
  19. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  20. //
  21. // ( The full text of the license can be found in the License.txt file )
  22. //
  23. // ----------------------------------------------------------------------------
  24. #endregion
  25. #region Using directives
  26. using System;
  27. #endregion
  28. namespace Everquest2.Visualization
  29. {
  30. public class VeRegion : VeBase
  31. {
  32. public VeRegion()
  33. {
  34. }
  35. /// <summary>
  36. /// Special constructor used when deserializing the instance of the class.
  37. /// </summary>
  38. /// <param name="reader">Reader used to read the instance data.</param>
  39. protected VeRegion(Util.Eq2Reader reader, Util.StreamingContext context)
  40. : base(reader, context)
  41. {
  42. byte classVersion = context.ClassVersions[typeof(VeRegion)];
  43. if (classVersion == 0) unk0 = reader.ReadSingle();
  44. ushort count = reader.ReadUInt16();
  45. vert_count = count;
  46. m_normals = new float[count, 3];
  47. m_distance = new float[count];
  48. m_childindex = new short[count, 2];
  49. for (ushort i = 0; i < count; ++i)
  50. {
  51. m_normals[i, 0] = reader.ReadSingle();
  52. m_normals[i, 1] = reader.ReadSingle();
  53. m_normals[i, 2] = reader.ReadSingle();
  54. m_distance[i] = reader.ReadSingle();
  55. m_childindex[i, 0] = reader.ReadInt16();
  56. m_childindex[i, 1] = reader.ReadInt16();
  57. }
  58. if (classVersion >= 2)
  59. {
  60. unkcount = reader.ReadUInt32();
  61. m_center = new float[unkcount, 4];
  62. for (int i = 0; i < unkcount; i++)
  63. {
  64. m_center[i, 0] = reader.ReadSingle();
  65. m_center[i, 1] = reader.ReadSingle();
  66. m_center[i, 2] = reader.ReadSingle();
  67. m_center[i, 3] = reader.ReadSingle();
  68. }
  69. }
  70. position[0] = reader.ReadSingle();
  71. position[1] = reader.ReadSingle();
  72. position[2] = reader.ReadSingle();
  73. splitdistance = reader.ReadSingle();
  74. }
  75. public int vert_count;
  76. public float unk0;
  77. public uint unkcount;
  78. public float[,] m_normals;
  79. public float[] m_distance;
  80. public short[,] m_childindex;
  81. public float[] position = new float[3];
  82. public float splitdistance;
  83. public VeEnvironmentNode parentNode;
  84. float[,] m_center; // 1-3 is vector center, 4th is radius
  85. public int region_type;
  86. public int special = 0;
  87. public string envFileChosen = "";
  88. public uint GridID = 0;
  89. }
  90. }