VeRegion.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. public class VeRegion : VeBase {
  30. public VeRegion() {
  31. }
  32. /// <summary>
  33. /// Special constructor used when deserializing the instance of the class.
  34. /// </summary>
  35. /// <param name="reader">Reader used to read the instance data.</param>
  36. protected VeRegion(Util.Eq2Reader reader, Util.StreamingContext context)
  37. : base(reader, context) {
  38. byte classVersion = context.ClassVersions[typeof(VeRegion)];
  39. if (classVersion == 0) unk0 = reader.ReadSingle();
  40. ushort count = reader.ReadUInt16();
  41. vert_count = count;
  42. m_normals = new float[count, 3];
  43. m_distance = new float[count];
  44. m_childindex = new short[count, 2];
  45. for (ushort i = 0; i < count; ++i) {
  46. m_normals[i, 0] = reader.ReadSingle();
  47. m_normals[i, 1] = reader.ReadSingle();
  48. m_normals[i, 2] = reader.ReadSingle();
  49. m_distance[i] = reader.ReadSingle();
  50. m_childindex[i, 0] = reader.ReadInt16();
  51. m_childindex[i, 1] = reader.ReadInt16();
  52. }
  53. if (classVersion >= 2) {
  54. uint unkcount = reader.ReadUInt32();
  55. m_center = new float[unkcount, 4];
  56. for (int i = 0; i < unkcount; i++) {
  57. m_center[i, 0] = reader.ReadSingle();
  58. m_center[i, 1] = reader.ReadSingle();
  59. m_center[i, 2] = reader.ReadSingle();
  60. m_center[i, 3] = reader.ReadSingle();
  61. }
  62. }
  63. unk4[0] = reader.ReadSingle();
  64. unk4[1] = reader.ReadSingle();
  65. unk4[2] = reader.ReadSingle();
  66. unk5 = reader.ReadSingle();
  67. }
  68. public int vert_count;
  69. public float unk0;
  70. public float[,] m_normals;
  71. public float[] m_distance;
  72. public short[,] m_childindex;
  73. public float[] unk4 = new float[3];
  74. public float unk5;
  75. public VeEnvironmentNode parentNode;
  76. float[,] m_center; // 1-3 is vector center, 4th is radius
  77. public int region_type;
  78. }
  79. }